some refactoring

This commit is contained in:
Yakov Olkhovskiy 2022-08-03 16:36:52 -04:00
parent 2e34b384c1
commit 1680be19ca
3 changed files with 11 additions and 5 deletions

View File

@ -170,7 +170,7 @@ void Connection::connect(const ConnectionTimeouts & timeouts)
sendHello();
receiveHello();
if (server_revision >= DBMS_MIN_PROTOCOL_VERSION_WITH_QUOTA_KEY)
if (server_revision >= DBMS_MIN_PROTOCOL_VERSION_WITH_ADDENDUM)
sendAddendum();
LOG_TRACE(log_wrapper.get(), "Connected to {} server version {}.{}.{}.",
@ -271,7 +271,8 @@ void Connection::sendHello()
void Connection::sendAddendum()
{
writeStringBinary(quota_key, *out);
if (server_revision >= DBMS_MIN_PROTOCOL_VERSION_WITH_QUOTA_KEY)
writeStringBinary(quota_key, *out);
out->next();
}

View File

@ -60,4 +60,6 @@
#define DBMS_MIN_PROTOCOL_VERSION_WITH_VIEW_IF_PERMITTED 54457
#define DBMS_MIN_PROTOCOL_VERSION_WITH_ADDENDUM 54458
#define DBMS_MIN_PROTOCOL_VERSION_WITH_QUOTA_KEY 54458

View File

@ -134,7 +134,7 @@ void TCPHandler::runImpl()
{
receiveHello();
sendHello();
if (client_tcp_protocol_version >= DBMS_MIN_PROTOCOL_VERSION_WITH_QUOTA_KEY)
if (client_tcp_protocol_version >= DBMS_MIN_PROTOCOL_VERSION_WITH_ADDENDUM)
receiveAddendum();
if (!is_interserver_mode) /// In interserver mode queries are executed without a session context.
@ -1082,8 +1082,11 @@ void TCPHandler::receiveHello()
void TCPHandler::receiveAddendum()
{
readStringBinary(quota_key, *in);
session->getClientInfo().quota_key = quota_key;
if (client_tcp_protocol_version >= DBMS_MIN_PROTOCOL_VERSION_WITH_QUOTA_KEY)
{
readStringBinary(quota_key, *in);
session->getClientInfo().quota_key = quota_key;
}
}