Fix race condition in clickhouse cache dictionary#12566
Fix race condition in clickhouse cache dictionary#12566alexey-milovidov merged 8 commits intomasterfrom
Conversation
|
Also, setting |
|
If we remove these two unlockers https://github.com/ClickHouse/ClickHouse/blob/master/src/Dictionaries/CacheDictionary.cpp#L882-L892 than it should work as expected, but the whole idea of non-blocking read will be broken. When I add more granular locks (both read for update and write for rest) my server hangs without any information from thread sanitizer :( |
|
Traces from gdb when server hangs https://gist.github.com/alesapin/46a52d33d89f100c67cff3c4cff4bea8 I don't understand why the server is not able to drop the view or underlying table. Nobody holds table's drop lock, new select queries also wait for table drop lock (because DROP already in lock's queue) or some locks inside CacheDictionary. The only idea is that the timed part of our fair RWLock has a bug. Two reasons:
|
3463f04 to
9ed4204
Compare
|
All tests passed, I have just renamed method. |
…naries Fix race condition in clickhouse cache dictionary (cherry picked from commit 16e8c61)
…naries Fix race condition in clickhouse cache dictionary (cherry picked from commit 16e8c61)
…naries Fix race condition in clickhouse cache dictionary (cherry picked from commit 16e8c61)
…naries Fix race condition in clickhouse cache dictionary (cherry picked from commit 16e8c61)
…ctionary (#12681) * Race condition test * remove comment * Ugly code without races * Comments for ugly fix * Better code * Better comment * Remove redundant new line * Better function name and comment Co-authored-by: alesapin <alesapin@gmail.com> Co-authored-by: alexey-milovidov <milovidov@yandex-team.ru>
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix race condition in external dictionaries with cache layout which can lead server crash.