{{ message }}
Make query_log faster under MSAN#92716
Merged
Merged
Conversation
Contributor
fd2eb41 to
893b8ae
Compare
azat
reviewed
Dec 21, 2025
Member
|
Apparently the situation became worse right now, maybe upgrade to clang-21 makes MSan slower... |
Member
893b8ae to
ee9cbd9
Compare
Merged
via the queue into
ClickHouse:master
with commit Jan 7, 2026
7c9ecc9
124 of 131 checks passed
Algunenano
added a commit
to Algunenano/ClickHouse
that referenced
this pull request
May 14, 2026
Even at track-origins=1, the per-call origin maintenance dominates two hot helpers used by every QueryLog flush: - ProfileEvents::dumpToMapColumn (Interpreters/ProfileEventsExt.cpp) - SettingsImpl::dumpToMapColumn (Core/Settings.cpp, already covered) Each walks hundreds of keys and does tight LowCardinality::insertData calls in a loop, so the per-call __msan_set_alloca_origin overhead adds up to seconds per `SYSTEM FLUSH LOGS query_log` and the failing tests on the MSan WasmEdge 2/2 shard hit the 180 s flush-wait timeout. The CI logs show Block phase up to 14.7 s for a 5759-entry batch, dominated by these two functions. Extend the existing per-file override added in ClickHouse#92716 to also cover ProfileEventsExt.cpp and SystemLog.cpp. These files are leaf helpers where MSan checks don't carry uninit values into user code, so turning origin tracking off here is safe; the rest of the build keeps origin tracking.
Algunenano
added a commit
that referenced
this pull request
May 15, 2026
Even at track-origins=1, the per-call origin maintenance dominates two hot helpers used by every QueryLog flush: - ProfileEvents::dumpToMapColumn (Interpreters/ProfileEventsExt.cpp) - SettingsImpl::dumpToMapColumn (Core/Settings.cpp, already covered) Each walks hundreds of keys and does tight LowCardinality::insertData calls in a loop, so the per-call __msan_set_alloca_origin overhead adds up to seconds per `SYSTEM FLUSH LOGS query_log` and the failing tests on the MSan WasmEdge 2/2 shard hit the 180 s flush-wait timeout. The CI logs show Block phase up to 14.7 s for a 5759-entry batch, dominated by these two functions. Extend the existing per-file override added in #92716 to also cover ProfileEventsExt.cpp and SystemLog.cpp. These files are leaf helpers where MSan checks don't carry uninit values into user code, so turning origin tracking off here is safe; the rest of the build keeps origin tracking.
Algunenano
added a commit
that referenced
this pull request
May 15, 2026
The earlier override on Settings.cpp / ProfileEventsExt.cpp / SystemLog.cpp removed __msan_chain_origin / __msan_set_alloca_origin from the helpers (dumpToMapColumn, flushImpl). But the per-row LogElement::appendToBlock functions, which are called once per row inside flushImpl and dominate the Block phase, were still being compiled with origin tracking at level 1. With ~5000 rows per query_log flush, the per-call origin-tracking overhead in those functions added seconds to every SYSTEM FLUSH LOGS query_log. Cover QueryLog.cpp, QueryThreadLog.cpp, MetricLog.cpp, QueryMetricLog.cpp. Result on the rebuilt MSan binary: QueryLogElement::appendToBlock 57 KB -> 39 KB (-32%), 0 origin calls QueryThreadLogElement 9.5 KB -> 6 KB (-37%), 0 origin calls MetricLogElement / QueryMetricLog also 0 origin calls Compare with PartLogElement::appendToBlock (still origin-tracked): 55 __msan_set_alloca_origin calls in 22 KB. Also drop the `-fomit-frame-pointer -momit-leaf-frame-pointer` flags from the override: they were an artifact of exploratory commits in PR #92716 that didn't move the needle (azat/Algunenano review thread on Core/Settings.cpp). The single-line override on Common/ThreadFuzzer.cpp keeps them with a comment pointing at commit d5825ec, where they were measured to almost double ThreadFuzzer test throughput.
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.

Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Make query_log faster under MSAN by disabling it when building Settings.cpp
Closes #91410
Documentation entry for user-facing changes