Do not spam log in MergeJoinAlgorithm

This commit is contained in:
vdimir 2022-07-13 11:51:11 +00:00
parent bddf6c1b32
commit fa59133463
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862
2 changed files with 2 additions and 15 deletions

View File

@ -855,7 +855,7 @@ MergeJoinTransform::MergeJoinTransform(
void MergeJoinTransform::onFinish() void MergeJoinTransform::onFinish()
{ {
algorithm.logElapsed(total_stopwatch.elapsedSeconds(), true); algorithm.logElapsed(total_stopwatch.elapsedSeconds());
} }
} }

View File

@ -233,19 +233,14 @@ public:
virtual void consume(Input & input, size_t source_num) override; virtual void consume(Input & input, size_t source_num) override;
virtual Status merge() override; virtual Status merge() override;
void logElapsed(double seconds, bool force) void logElapsed(double seconds)
{ {
/// Do not log more frequently than once per ten seconds
if (seconds - stat.last_log_seconds < 10 && !force)
return;
LOG_TRACE(log, LOG_TRACE(log,
"Finished pocessing in {} seconds" "Finished pocessing in {} seconds"
", left: {} blocks, {} rows; right: {} blocks, {} rows" ", left: {} blocks, {} rows; right: {} blocks, {} rows"
", max blocks loaded to memory: {}", ", max blocks loaded to memory: {}",
seconds, stat.num_blocks[0], stat.num_rows[0], stat.num_blocks[1], stat.num_rows[1], seconds, stat.num_blocks[0], stat.num_rows[0], stat.num_blocks[1], stat.num_rows[1],
stat.max_blocks_loaded); stat.max_blocks_loaded);
stat.last_log_seconds = seconds;
} }
private: private:
@ -277,8 +272,6 @@ private:
size_t num_rows[2] = {0, 0}; size_t num_rows[2] = {0, 0};
size_t max_blocks_loaded = 0; size_t max_blocks_loaded = 0;
double last_log_seconds = 0;
}; };
Statistic stat; Statistic stat;
@ -303,12 +296,6 @@ public:
protected: protected:
void onFinish() override; void onFinish() override;
void work() override
{
algorithm.logElapsed(total_stopwatch.elapsedSeconds(), true);
Base::work();
}
Poco::Logger * log; Poco::Logger * log;
}; };