Merge pull request #26213 from ClickHouse/fix-bad-code-merge-tree

Fix bad code (default function argument)
This commit is contained in:
Maksim Kita 2021-07-11 12:30:38 +03:00 committed by GitHub
commit 5d818708d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 10 deletions

View File

@ -1179,7 +1179,7 @@ void AsynchronousMetrics::update(std::chrono::system_clock::time_point update_ti
total_number_of_parts += table_merge_tree->getPartsCount();
}
if (StorageReplicatedMergeTree * table_replicated_merge_tree = dynamic_cast<StorageReplicatedMergeTree *>(table.get()))
if (StorageReplicatedMergeTree * table_replicated_merge_tree = typeid_cast<StorageReplicatedMergeTree *>(table.get()))
{
StorageReplicatedMergeTree::Status status;
table_replicated_merge_tree->getStatus(status, false);

View File

@ -1088,7 +1088,7 @@ static bool isOldPartDirectory(const DiskPtr & disk, const String & directory_pa
}
void MergeTreeData::clearOldTemporaryDirectories(ssize_t custom_directories_lifetime_seconds)
void MergeTreeData::clearOldTemporaryDirectories(size_t custom_directories_lifetime_seconds)
{
/// 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);
@ -1097,9 +1097,7 @@ void MergeTreeData::clearOldTemporaryDirectories(ssize_t custom_directories_life
const auto settings = getSettings();
time_t current_time = time(nullptr);
ssize_t deadline = (custom_directories_lifetime_seconds >= 0)
? current_time - custom_directories_lifetime_seconds
: current_time - settings->temporary_directories_lifetime.totalSeconds();
ssize_t deadline = current_time - custom_directories_lifetime_seconds;
/// Delete temporary directories older than a day.
for (const auto & [path, disk] : getRelativeDataPathsWithDisks())

View File

@ -526,9 +526,8 @@ public:
void clearOldWriteAheadLogs();
/// Delete all directories which names begin with "tmp"
/// Set non-negative parameter value to override MergeTreeSettings temporary_directories_lifetime
/// Must be called with locked lockForShare() because use relative_data_path.
void clearOldTemporaryDirectories(ssize_t custom_directories_lifetime_seconds = -1);
/// Must be called with locked lockForShare() because it's using relative_data_path.
void clearOldTemporaryDirectories(size_t custom_directories_lifetime_seconds);
void clearEmptyParts();

View File

@ -62,7 +62,7 @@ void ReplicatedMergeTreeCleanupThread::iterate()
/// Both use relative_data_path which changes during rename, so we
/// do it under share lock
storage.clearOldWriteAheadLogs();
storage.clearOldTemporaryDirectories();
storage.clearOldTemporaryDirectories(storage.getSettings()->temporary_directories_lifetime.totalSeconds());
}
/// This is loose condition: no problem if we actually had lost leadership at this moment

View File

@ -1068,7 +1068,7 @@ bool StorageMergeTree::scheduleDataProcessingJob(IBackgroundJobExecutor & execut
/// All use relative_data_path which changes during rename
/// so execute under share lock.
clearOldPartsFromFilesystem();
clearOldTemporaryDirectories();
clearOldTemporaryDirectories(getSettings()->temporary_directories_lifetime.totalSeconds());
clearOldWriteAheadLogs();
clearOldMutations();
clearEmptyParts();