fixed delay

This commit is contained in:
zvonand 2023-04-12 00:15:07 +02:00
parent 35f07df494
commit 5d18343fb8
2 changed files with 23 additions and 25 deletions

View File

@ -65,7 +65,7 @@
#include <Storages/ColumnsDescription.h>
#include <boost/algorithm/string/case_conv.hpp>
#include <Poco/Logger.h>
//#include <Poco/Logger.h>
#include <iostream>
#include <filesystem>
#include <map>
@ -74,7 +74,7 @@
#include "config_version.h"
#include "config.h"
#include <Common/logger_useful.h>
//#include <Common/logger_useful.h>
namespace fs = std::filesystem;
@ -97,18 +97,18 @@ const void* getContextPtrOrNull(ContetGetterFunc contextFunc)
return nullptr;
}
void LogContextes(const std::string_view scope, const ContextPtr global_context)
{
const auto * context = global_context.get();
std::cerr << scope << " contextes"
<< "\n\tglobal: " << reinterpret_cast<const void*>(context)
<< "\n\tsession: " << getContextPtrOrNull([&]() { return context ? context->getSessionContext() : nullptr; })
<< "\n\tquery: " << getContextPtrOrNull([&]() { return context ? context->getQueryContext() : nullptr; })
<< "\n\tcurrent T query: " << getContextPtrOrNull([&]() { return DB::CurrentThread::get().getQueryContext(); })
<< "\n\tcurrent T global: " << getContextPtrOrNull([&]() { return DB::CurrentThread::get().getGlobalContext(); })
// << "\n\tbuffer: " << getContextPtrOrNull(context, &Context::getBufferContext)
<< std::endl;
}
//void LogContextes(const std::string_view scope, const ContextPtr global_context)
//{
// const auto * context = global_context.get();
// std::cerr << scope << " contextes"
// << "\n\tglobal: " << reinterpret_cast<const void*>(context)
// << "\n\tsession: " << getContextPtrOrNull([&]() { return context ? context->getSessionContext() : nullptr; })
// << "\n\tquery: " << getContextPtrOrNull([&]() { return context ? context->getQueryContext() : nullptr; })
// << "\n\tcurrent T query: " << getContextPtrOrNull([&]() { return DB::CurrentThread::get().getQueryContext(); })
// << "\n\tcurrent T global: " << getContextPtrOrNull([&]() { return DB::CurrentThread::get().getGlobalContext(); })
//// << "\n\tbuffer: " << getContextPtrOrNull(context, &Context::getBufferContext)
// << std::endl;
//}
}
@ -473,11 +473,11 @@ void ClientBase::onData(Block & block, ASTPtr parsed_query)
/// Also do not output too much data if we're fuzzing.
if (block.rows() == 0 || (query_fuzzer_runs != 0 && processed_rows >= 100))
{
LogContextes("ClientBase::onData header", global_context);
// LogContextes("ClientBase::onData header", global_context);
return;
}
LogContextes("ClientBase::onData DATA block", global_context);
// LogContextes("ClientBase::onData DATA block", global_context);
/// If results are written INTO OUTFILE, we can avoid clearing progress to avoid flicker.
if (need_render_progress && tty_buf && (!select_into_file || select_into_file_and_stdout))
@ -1088,14 +1088,12 @@ void ClientBase::onProgress(const Progress & value)
void ClientBase::onTimezoneUpdate(const String & tz)
{
std::cerr << "ClientBase::onTimezoneUpdate received new TZ from server: " << tz << std::endl;
DateLUT::setDefaultTimezone(tz);
Settings settings;
settings.timezone = tz;
global_context->applySettingsChanges(settings.changes());
// DB::CurrentThread::get().getQueryContext()->applySettingsChanges(settings.changes());
LogContextes("ClientBase::onTimezoneUpdate", global_context);
// LogContextes("ClientBase::onTimezoneUpdate", global_context);
}

View File

@ -453,7 +453,7 @@ void TCPHandler::runImpl()
if (isQueryCancelled())
return true;
// sendTimezone();
sendTimezone();
sendProgress();
sendSelectProfileEvents();
sendLogs();
@ -495,7 +495,7 @@ void TCPHandler::runImpl()
{
std::lock_guard lock(task_callback_mutex);
// sendTimezone();
sendTimezone();
sendLogs();
sendEndOfStream();
}
@ -1069,14 +1069,14 @@ void TCPHandler::sendTimezone()
query_context->getSettingsRef().timezone.toString(),
(query_context->getSettingsRef().timezone.changed ? "changed" : "UNCHANGED"));
const String & tz = query_context->getSettingsRef().timezone.toString();
if (!tz.empty())
{
const String & tz = CurrentThread::get().getQueryContext()->getSettingsRef().timezone.toString();
// if (!tz.empty())
// {
LOG_DEBUG(log, "Sent timezone: {}", tz);
writeVarUInt(Protocol::Server::TimezoneUpdate, *out);
writeStringBinary(tz, *out);
out->next();
}
// }
}