Little improvement for large number of small inserts [#METR-22327].

This commit is contained in:
Alexey Milovidov 2016-11-18 04:03:57 +03:00
parent cfcdb3f881
commit b19e61757e
2 changed files with 10 additions and 4 deletions

View File

@ -119,9 +119,12 @@ private:
MergeTreeDataWriter writer;
MergeTreeDataMerger merger;
/// Для нумерации блоков.
/// For block numbers.
SimpleIncrement increment;
/// For clearOldParts, clearOldTemporaryDirectories.
StopwatchWithLock time_after_previous_cleanup;
MergeTreeData::DataParts currently_merging;
std::mutex currently_merging_mutex;

View File

@ -296,9 +296,12 @@ bool StorageMergeTree::merge(
const String & partition,
bool final)
{
/// Удаляем старые куски.
data.clearOldParts();
data.clearOldTemporaryDirectories(); /// TODO Делать это реже.
/// Clear old parts. It does not matter to do it more frequently than each second.
if (time_after_previous_cleanup.lockTestAndRestart(1))
{
data.clearOldParts();
data.clearOldTemporaryDirectories();
}
auto structure_lock = lockStructure(true);