Update comment

This commit is contained in:
Amos Bird 2021-06-11 23:06:25 +08:00
parent 7d9a1106b8
commit 49db4dbe6a
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
2 changed files with 6 additions and 5 deletions

View File

@ -35,10 +35,7 @@ void ClientInfo::write(WriteBuffer & out, const UInt64 server_protocol_revision)
writeBinary(initial_address.toString(), out);
if (server_protocol_revision >= DBMS_MIN_PROTOCOL_VERSION_WITH_INITIAL_QUERY_START_TIME)
{
writeBinary(initial_query_start_time, out);
writeBinary(initial_query_start_time_microseconds, out);
}
writeBinary(UInt8(interface), out);
@ -117,8 +114,8 @@ void ClientInfo::read(ReadBuffer & in, const UInt64 client_protocol_revision)
if (client_protocol_revision >= DBMS_MIN_PROTOCOL_VERSION_WITH_INITIAL_QUERY_START_TIME)
{
readBinary(initial_query_start_time, in);
readBinary(initial_query_start_time_microseconds, in);
initial_query_start_time = initial_query_start_time_microseconds / 1000000;
}
UInt8 read_interface = 0;

View File

@ -357,7 +357,11 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
auto & client_info = context->getClientInfo();
// If it's an initial query, set to current_time
// If it's not an internal query and we don't see an initial_query_start_time yet, initialize it
// to current time. Internal queries are those executed without an independent client context,
// thus should not set initial_query_start_time, because it might introduce data race. It's also
// possible to have unset initial_query_start_time for non-internal and non-initial queries. For
// example, the query is from an initiator that is running an old version of clickhouse.
if (!internal && client_info.initial_query_start_time == 0)
{
client_info.initial_query_start_time = time_in_seconds(current_time);