mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Merge pull request #21716 from azat/concurrent-OPTIMIZE-DROP-fix
[RFC] Fix concurrent OPTIMIZE and DROP for ReplicatedMergeTree
This commit is contained in:
commit
8d1bf002e9
@ -4151,6 +4151,10 @@ bool StorageReplicatedMergeTree::optimize(
|
||||
const Names & deduplicate_by_columns,
|
||||
const Context & query_context)
|
||||
{
|
||||
/// NOTE: exclusive lock cannot be used here, since this may lead to deadlock (see comments below),
|
||||
/// but it should be safe to use non-exclusive to avoid dropping parts that may be required for processing queue.
|
||||
auto table_lock = lockForShare(query_context.getCurrentQueryId(), query_context.getSettingsRef().lock_acquire_timeout);
|
||||
|
||||
assertNotReadonly();
|
||||
|
||||
if (!is_leader)
|
||||
|
Loading…
Reference in New Issue
Block a user