Repository navigation
test(e2e): flush system.query_log before checking it - #2182
Merged
Merged
Conversation
jsc0218
marked this pull request as ready for review
December 1, 2026 22:49
Slach
approved these changes
Dec 2, 2026
Collaborator
There was a problem hiding this comment.
LGTM. This fix is needed. A query can't see entries that are still in the system log's in-memory buffer. Checked against the ClickHouse source:
- New log entries go into a private
std::vector<LogElement> queueinsideSystemLogQueue(SystemLogBase.h#L208). No storage reads that queue. - The saving thread (SystemLog.cpp#L885) calls
pop().pop()waits forflush_interval_millisecondsor for an explicit flush (SystemLogBase.cpp#L288-L298). flushImpl()runs a regularINSERTinto thesystem.query_logMergeTree table (SystemLog.cpp#L986-L1019).SELECTsees a row only after thatINSERTis done.SYSTEM FLUSH LOGSwaits until the queue has been flushed up to the current index (SystemLogBase.cpp#L231). The check readscluster('all-sharded', system.query_log), so the flush has to runON CLUSTER 'all-sharded'too, as this PR does.
Slach
approved these changes
Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2181
check_query_logreadssystem.query_logright away, but ClickHouse writes that table on a timer (7.5 s by default), so a statement the operator just ran can be missing. This madetest_010014_0fail once.Run
SYSTEM FLUSH LOGS ON CLUSTER 'all-sharded'first, since the check reads fromcluster('all-sharded', ...).