Add new fields to InsertQuery::hash and operator ==

This commit is contained in:
Vitaly Baranov 2023-10-05 11:02:58 +02:00
parent 76766a200e
commit a54d3f31e4

View File

@ -87,6 +87,8 @@ AsynchronousInsertQueue::InsertQuery::operator=(const InsertQuery & other)
{
query = other.query->clone();
query_str = other.query_str;
user_id = other.user_id;
current_roles = other.current_roles;
settings = other.settings;
hash = other.hash;
}
@ -99,6 +101,13 @@ UInt128 AsynchronousInsertQueue::InsertQuery::calculateHash() const
SipHash siphash;
query->updateTreeHash(siphash);
if (user_id)
{
siphash.update(*user_id);
for (const auto & current_role : current_roles)
siphash.update(current_role);
}
for (const auto & setting : settings.allChanged())
{
/// We don't consider this setting because it is only for deduplication,
@ -114,7 +123,7 @@ UInt128 AsynchronousInsertQueue::InsertQuery::calculateHash() const
bool AsynchronousInsertQueue::InsertQuery::operator==(const InsertQuery & other) const
{
return query_str == other.query_str && settings == other.settings;
return query_str == other.query_str && user_id == other.user_id && current_roles == other.current_roles && settings == other.settings;
}
AsynchronousInsertQueue::InsertData::Entry::Entry(String && bytes_, String && query_id_, const String & async_dedup_token_, MemoryTracker * user_memory_tracker_)