提交 fa3d9226 编写于 作者: A Andrey Mironov

dbms: fix forced flush in StorageBuffer

上级 274e0a80
......@@ -114,6 +114,7 @@ private:
size_t num_shards_, const Thresholds & min_thresholds_, const Thresholds & max_thresholds_,
const String & destination_database_, const String & destination_table_);
void flushAllBuffers(bool check_thresholds = true);
/// Сбросить буфер. Если выставлено check_thresholds - сбрасывает только если превышены пороги.
void flushBuffer(Buffer & buffer, bool check_thresholds);
bool checkThresholds(Buffer & buffer, time_t current_time, size_t additional_rows = 0, size_t additional_bytes = 0);
......
......@@ -258,8 +258,7 @@ void StorageBuffer::shutdown()
bool StorageBuffer::optimize()
{
for (auto & buf : buffers)
flushBuffer(buf, false);
flushAllBuffers(false);
return true;
}
......@@ -285,6 +284,13 @@ bool StorageBuffer::checkThresholds(Buffer & buffer, time_t current_time, size_t
}
void StorageBuffer::flushAllBuffers(const bool check_thresholds)
{
for (auto & buf : buffers)
flushBuffer(buf, check_thresholds);
}
void StorageBuffer::flushBuffer(Buffer & buffer, bool check_thresholds)
{
Block block_to_write;
......@@ -408,7 +414,7 @@ void StorageBuffer::flushThread()
{
try
{
optimize();
flushAllBuffers(true);
}
catch (...)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册