Fix errors

This commit is contained in:
Alexey Milovidov 2024-06-23 03:58:11 +02:00
parent c21cce7a04
commit e064171a68
6 changed files with 3 additions and 18 deletions

View File

@ -19,7 +19,6 @@
#include <Common/Config/ConfigProcessor.h> #include <Common/Config/ConfigProcessor.h>
#include <Common/Config/getClientConfigPath.h> #include <Common/Config/getClientConfigPath.h>
#include <Common/CurrentThread.h>
#include <Common/Exception.h> #include <Common/Exception.h>
#include <Common/TerminalSize.h> #include <Common/TerminalSize.h>
#include <Common/config_version.h> #include <Common/config_version.h>
@ -311,7 +310,6 @@ int Client::main(const std::vector<std::string> & /*args*/)
try try
{ {
UseSSL use_ssl; UseSSL use_ssl;
auto & thread_status = MainThreadStatus::getInstance();
setupSignalHandler(); setupSignalHandler();
std::cout << std::fixed << std::setprecision(3); std::cout << std::fixed << std::setprecision(3);
@ -326,14 +324,6 @@ try
initTTYBuffer(toProgressOption(config().getString("progress", "default"))); initTTYBuffer(toProgressOption(config().getString("progress", "default")));
ASTAlterCommand::setFormatAlterCommandsWithParentheses(true); ASTAlterCommand::setFormatAlterCommandsWithParentheses(true);
{
// All that just to set DB::CurrentThread::get().getGlobalContext()
// which is required for client timezone (pushed from server) to work.
auto thread_group = std::make_shared<ThreadGroup>();
const_cast<ContextWeakPtr&>(thread_group->global_context) = global_context;
thread_status.attachToGroup(thread_group, false);
}
/// Includes delayed_interactive. /// Includes delayed_interactive.
if (is_interactive) if (is_interactive)
{ {

View File

@ -27,10 +27,8 @@
#include <Common/Exception.h> #include <Common/Exception.h>
#include <Common/Macros.h> #include <Common/Macros.h>
#include <Common/Config/ConfigProcessor.h> #include <Common/Config/ConfigProcessor.h>
#include <Common/ThreadStatus.h>
#include <Common/TLDListsHolder.h> #include <Common/TLDListsHolder.h>
#include <Common/quoteString.h> #include <Common/quoteString.h>
#include <Common/randomSeed.h>
#include <Common/ThreadPool.h> #include <Common/ThreadPool.h>
#include <Loggers/OwnFormattingChannel.h> #include <Loggers/OwnFormattingChannel.h>
#include <Loggers/OwnPatternFormatter.h> #include <Loggers/OwnPatternFormatter.h>
@ -48,7 +46,6 @@
#include <Dictionaries/registerDictionaries.h> #include <Dictionaries/registerDictionaries.h>
#include <Disks/registerDisks.h> #include <Disks/registerDisks.h>
#include <Formats/registerFormats.h> #include <Formats/registerFormats.h>
#include <boost/algorithm/string/replace.hpp>
#include <boost/program_options/options_description.hpp> #include <boost/program_options/options_description.hpp>
#include <base/argsToConfig.h> #include <base/argsToConfig.h>
#include <filesystem> #include <filesystem>

View File

@ -1872,7 +1872,7 @@ void ClientBase::processParsedSingleQuery(const String & full_query, const Strin
ASTPtr parsed_query, std::optional<bool> echo_query_, bool report_error) ASTPtr parsed_query, std::optional<bool> echo_query_, bool report_error)
{ {
query_context = Context::createCopy(global_context); query_context = Context::createCopy(global_context);
query_context->makeQueryContext(); CurrentThread::QueryScope query_scope(query_context);
resetOutput(); resetOutput();
have_error = false; have_error = false;
@ -2926,6 +2926,8 @@ void ClientBase::init(int argc, char ** argv)
/// Don't parse options with Poco library, we prefer neat boost::program_options. /// Don't parse options with Poco library, we prefer neat boost::program_options.
stopOptionsProcessing(); stopOptionsProcessing();
MainThreadStatus::getInstance();
stdin_is_a_tty = isatty(STDIN_FILENO); stdin_is_a_tty = isatty(STDIN_FILENO);
stdout_is_a_tty = isatty(STDOUT_FILENO); stdout_is_a_tty = isatty(STDOUT_FILENO);
stderr_is_a_tty = isatty(STDERR_FILENO); stderr_is_a_tty = isatty(STDERR_FILENO);

View File

@ -125,7 +125,6 @@ void LocalConnection::sendQuery(
state->query_id = query_id; state->query_id = query_id;
state->query = query; state->query = query;
state->query_scope_holder = std::make_unique<CurrentThread::QueryScope>(query_context);
state->stage = QueryProcessingStage::Enum(stage); state->stage = QueryProcessingStage::Enum(stage);
state->profile_queue = std::make_shared<InternalProfileEventsQueue>(std::numeric_limits<int>::max()); state->profile_queue = std::make_shared<InternalProfileEventsQueue>(std::numeric_limits<int>::max());
CurrentThread::attachInternalProfileEventsQueue(state->profile_queue); CurrentThread::attachInternalProfileEventsQueue(state->profile_queue);

View File

@ -61,8 +61,6 @@ struct LocalQueryState
/// Time after the last check to stop the request and send the progress. /// Time after the last check to stop the request and send the progress.
Stopwatch after_send_progress; Stopwatch after_send_progress;
Stopwatch after_send_profile_events; Stopwatch after_send_profile_events;
std::unique_ptr<CurrentThread::QueryScope> query_scope_holder;
}; };

View File

@ -1,4 +1,3 @@
DROP TABLE IF EXISTS local_table; DROP TABLE IF EXISTS local_table;
DROP TABLE IF EXISTS other_table; DROP TABLE IF EXISTS other_table;