dbms: development [#CONV-2944].

This commit is contained in:
Alexey Milovidov 2012-07-31 20:30:13 +00:00
parent 19a3e788e9
commit 83337ec474
2 changed files with 8 additions and 4 deletions

View File

@ -94,7 +94,7 @@ public:
*/
bool optimize()
{
return merge();
return merge(false);
}
// void drop();
@ -225,7 +225,7 @@ private:
void getIndexRanges(ASTPtr & query, Range & date_range, Row & primary_prefix, Range & primary_range);
/// Определяет, какие куски нужно объединять, и запускает их слияние в отдельном потоке.
bool merge();
bool merge(bool async = true);
bool selectPartsToMerge(DataParts::iterator & left, DataParts::iterator & right);
void mergeImpl(DataParts::iterator left, DataParts::iterator right);

View File

@ -1049,7 +1049,7 @@ void StorageMergeTree::clearOldParts()
}
bool StorageMergeTree::merge()
bool StorageMergeTree::merge(bool async)
{
DataParts::iterator left;
DataParts::iterator right;
@ -1059,7 +1059,11 @@ bool StorageMergeTree::merge()
if (selectPartsToMerge(left, right))
{
if (async)
merge_thread = boost::thread(boost::bind(&StorageMergeTree::mergeImpl, this, left, right));
else
mergeImpl(left, right);
return true;
}