mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
Added an option ‘force’ to clearOldTemporaryDirectories, which is currently used by dropAllData to remove blobs when zero copy replication is enabled.
This commit is contained in:
parent
0c58c75023
commit
d14cc1691c
@ -1960,7 +1960,7 @@ static bool isOldPartDirectory(const DiskPtr & disk, const String & directory_pa
|
||||
}
|
||||
|
||||
|
||||
size_t MergeTreeData::clearOldTemporaryDirectories(size_t custom_directories_lifetime_seconds, const NameSet & valid_prefixes)
|
||||
size_t MergeTreeData::clearOldTemporaryDirectories(size_t custom_directories_lifetime_seconds, const NameSet & valid_prefixes, const bool & force)
|
||||
{
|
||||
/// If the method is already called from another thread, then we don't need to do anything.
|
||||
std::unique_lock lock(clear_old_temporary_directories_mutex, std::defer_lock);
|
||||
@ -2018,7 +2018,7 @@ size_t MergeTreeData::clearOldTemporaryDirectories(size_t custom_directories_lif
|
||||
/// We don't control the amount of refs for temporary parts so we cannot decide can we remove blobs
|
||||
/// or not. So we are not doing it
|
||||
bool keep_shared = false;
|
||||
if (disk->supportZeroCopyReplication() && settings->allow_remote_fs_zero_copy_replication)
|
||||
if (disk->supportZeroCopyReplication() && settings->allow_remote_fs_zero_copy_replication && !force)
|
||||
{
|
||||
LOG_WARNING(log, "Since zero-copy replication is enabled we are not going to remove blobs from shared storage for {}", full_path);
|
||||
keep_shared = true;
|
||||
@ -2724,7 +2724,7 @@ void MergeTreeData::dropAllData()
|
||||
}
|
||||
|
||||
LOG_INFO(log, "dropAllData: clearing temporary directories");
|
||||
clearOldTemporaryDirectories(0, {"tmp_", "delete_tmp_", "tmp-fetch_"});
|
||||
clearOldTemporaryDirectories(0, {"tmp_", "delete_tmp_", "tmp-fetch_"}, /* force */ true);
|
||||
|
||||
column_sizes.clear();
|
||||
|
||||
|
@ -667,7 +667,8 @@ public:
|
||||
|
||||
/// Delete all directories which names begin with "tmp"
|
||||
/// Must be called with locked lockForShare() because it's using relative_data_path.
|
||||
size_t clearOldTemporaryDirectories(size_t custom_directories_lifetime_seconds, const NameSet & valid_prefixes = {"tmp_", "tmp-fetch_"});
|
||||
/// 'force' is used by dropAllData(), this will remove blobs even if zero copy replication is enabled
|
||||
size_t clearOldTemporaryDirectories(size_t custom_directories_lifetime_seconds, const NameSet & valid_prefixes = {"tmp_", "tmp-fetch_"}, const bool & force = false);
|
||||
|
||||
size_t clearEmptyParts();
|
||||
|
||||
|
@ -55,7 +55,7 @@ select sleep(3);
|
||||
select count(), sum(n), sum(m) from rmt;
|
||||
select count(), sum(n), sum(m) from rmt2;
|
||||
|
||||
-- So there will be at least 2 parts (just in case no parts are removed until drop)
|
||||
-- So there will be at least 2 parts (just in case no parts are removed until drop).
|
||||
insert into rmt(n) values (10);
|
||||
|
||||
drop table rmt;
|
||||
|
Loading…
Reference in New Issue
Block a user