Do not drop parts for static (ro/write-once) storages for Replicated engine

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2024-01-24 11:59:16 +01:00
parent e56728ae6c
commit 6751e01cc3
2 changed files with 9 additions and 3 deletions

View File

@ -2740,6 +2740,15 @@ void MergeTreeData::renameInMemory(const StorageID & new_table_id)
void MergeTreeData::dropAllData() void MergeTreeData::dropAllData()
{ {
/// In case there is read-only/write-once disk we cannot allow to call dropAllData(), but dropping tables is allowed.
///
/// Note, that one may think that drop on write-once disk should be
/// supported, since it is pretty trivial to implement
/// MetadataStorageFromPlainObjectStorageTransaction::removeDirectory(),
/// however removing part requires moveDirectory() as well.
if (isStaticStorage())
return;
LOG_TRACE(log, "dropAllData: waiting for locks."); LOG_TRACE(log, "dropAllData: waiting for locks.");
auto settings_ptr = getSettings(); auto settings_ptr = getSettings();

View File

@ -319,9 +319,6 @@ void StorageMergeTree::checkTableCanBeDropped(ContextPtr query_context) const
void StorageMergeTree::drop() void StorageMergeTree::drop()
{ {
shutdown(true); shutdown(true);
/// In case there is read-only disk we cannot allow to call dropAllData(), but dropping tables is allowed.
if (isStaticStorage())
return;
dropAllData(); dropAllData();
} }