-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache dictionaries lru cache #20595
Cache dictionaries lru cache #20595
Conversation
f49d8a2
to
afbcbae
Compare
aa56276
to
24070a3
Compare
449fecc
to
712e9f2
Compare
const char * ColumnString::skipSerializedInArena(const char * pos) const | ||
{ | ||
const size_t string_size = unalignedLoad<size_t>(pos); | ||
pos += sizeof(string_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sizeof(size_t) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no difference.
@@ -195,6 +202,8 @@ inline size_t DefaultHash64(std::enable_if_t<(sizeof(T) > sizeof(UInt64)), T> ke | |||
static_cast<UInt64>(key >> 128) ^ | |||
static_cast<UInt64>(key >> 256)); | |||
} | |||
|
|||
assert(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw Exception("Wrong specialization for type ...", ErrorCodes::..);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No exception is necessary here, we can't get here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it is better for future readers. At least a comment required here
@@ -341,6 +350,11 @@ struct IntHash32 | |||
} | |||
else if constexpr (sizeof(T) <= sizeof(UInt64)) | |||
return intHash32<salt>(key); | |||
|
|||
assert(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw Exception("Wrong specialization for type ...", ErrorCodes::..);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No exception is necessary here, we can't get here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it is better for future readers. At least a comment required here
} | ||
catch (...) | ||
{ | ||
/// TODO: Write log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dangerous, it will may lead to std::terminate, because we have ThreadPool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikitamikhaylov it was your comment.
} | ||
catch (...) | ||
{ | ||
std::unique_lock<std::mutex> lock(update_mutex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lock_guard
using KeyType = std::conditional_t<dictionary_key_type == DictionaryKeyType::simple, UInt64, StringRef>; | ||
|
||
/// Constructor for complex keys update request | ||
explicit CacheDictionaryUpdateUnit( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why explicit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no case when client will want to construct CacheDictionaryUpdateUnit without specifying it type.
|
||
auto type_call = [&](const auto &dictionary_attribute_type) | ||
/// TODO: Move this to DictionaryStructure | ||
for (const auto & attribute : dict_struct.attributes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is for next refactoring pull requests related to hierarchy handling.
7e0c0b2
to
4db7131
Compare
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Fixes #20252.
Fixes #20194.
Fixes #10863.
Fixes #19714.
Fixes #21517.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Added async update in
ComplexKeyCache
,SSDCache
,SSDComplexKeyCache
dictionaries.Added support for Nullable type in
Cache
,ComplexKeyCache
,SSDCache
,SSDComplexKeyCache
dictionaries.Added support for multiple attributes fetch with
dictGet
,dictGetOrDefault
functions. Fixes #21517.