Skip to content

Initialize the transaction log in TransactionManager::start() at server startup, not in the constructor - #121005

Open
groeneai wants to merge 9 commits into
ClickHouse:masterfrom
groeneai:fix-transaction-manager-ctor-unwind-holders
Open

groeneai wants to merge 9 commits into
ClickHouse:masterfrom
groeneai:fix-transaction-manager-ctor-unwind-holders

Conversation

@groeneai

@groeneai groeneai commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #117822
Related: #120932

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Move TransactionManager's Keeper initialization out of its constructor into TransactionManager::start(), so an ordinary BEGIN TRANSACTION can no longer abort the server with Current component is empty.

Description

An ordinary BEGIN TRANSACTION can abort the server whenever enforce_keeper_component_tracking is on. It is off by default, but both test harnesses write it into every server they start.

The constructor took two ephemeral node holders that are members (TransactionSession::active_node_holder, TransactionManager::cleanup_lock_holder) while its Keeper component guard was a local of the body. C++ destroys a body's locals before the member subobjects, so an exception leaving the body destroyed the guard first, and the member ~EphemeralNodeHolder then called tryRemove with no component set. ZooKeeper::pushRequest rejects that with a LOGICAL_ERROR raised inside Exception's own constructor, so a debug build aborts before the unwinding exception is ever logged.

Initialization moves into TransactionManager::start(), and SingletonHelper::createInstanceOrThrow publishes the instance only after it succeeds. A successful constructor then leaves both holders on a live object, and a failed attempt discards its instance, whose ~TransactionManager() -> shutdown() releases both under its own guard.

The server initializes the log before loadMetadata, because resolving a part's transactional creation_tid while loading tables would otherwise build the singleton on a background loading thread. With transactions enabled, a log that cannot be initialized stops the server at startup. Only an unavailable Keeper is logged and left to the next use, so such a server still starts without Keeper, as test_startup_without_zk requires. The call is TransactionManager::instance(), not start(): start() holds mutex across Keeper RPCs, which is safe only while the instance is unpublished. Four DatabaseReplicated test configs enabled transactions without using them, on randomized Keeper feature flags, and drop the setting.


Workflow [PR]
Sync PR [sync-upstream/pr/121005]

…tor throws

An ordinary BEGIN TRANSACTION could abort the server.

TransactionManager::TransactionManager() installs its Keeper component guard as a
local of the constructor body, but the two ephemeral node holders it then takes,
TransactionSession::active_node_holder and TransactionManager::cleanup_lock_holder,
are members. C++ destroys a body's locals before the member subobjects, so any
exception leaving the body destroyed the guard first and the member
~EphemeralNodeHolder then called tryRemove with no Coordination component set.
ZooKeeper::pushRequest rejects that at ZooKeeperImpl.cpp:1718.

This is one level beyond the usual "a destructor cannot be covered by a
caller-side guard": the guard is in the right function, just in the wrong scope
relative to member lifetime.

Both faces are bad. In a debug or sanitizer build Exception::handleErrorCode
calls abortOnFailedAssertion for LOGICAL_ERROR inside Exception's own
constructor, so ~EphemeralNodeHolder's catch never sees it: the server aborts
with signal 6, and the exception that unwound the constructor is never logged,
which is why this fix is deliberately trigger-agnostic rather than aimed at one
throwing statement. In a release build the throw happens inside pushRequest's
own try, whose handler calls finalize(false, false, ...) before rethrowing, so
the process-wide Keeper session is force-closed and every other Keeper-backed
subsystem on the server loses its session at once.

The fix keeps the guard where it is and wraps the constructor body in
try / catch (...) that releases both holders while the guard is still alive, then
rethrows. TransactionManager::shutdown() already documents this exact invariant
and protects itself the same way with a nested guard scope around the same two
releases. The shape also follows b95ea45 ("Move keeper component guard
from EphemeralNodeHolder to DDLWorker::shutdown"), which removed a generic guard
from ~EphemeralNodeHolder as too generic in favour of owner-scoped cleanup plus
an explicit holder clear.

A function-try-block would not work: its handler runs after the member
subobjects are destroyed, so the holders would already be gone. Making the guard
a first-declared data member would work but leaves the component installed on the
pooled handler thread for the singleton's whole lifetime, and since pushRequest
only throws on an empty component that would silence genuinely unguarded call
sites elsewhere.

A body-scoped catch is complete: no holder can exist before the body is entered,
because the two member constructors that could hold one are pure
member-initializer work with no Keeper calls, and both holders are only assigned
from inside loadLogFromZooKeeper(). Both releases are no-ops on a null holder, so
one handler also covers the window where _active is held but the cleanup lease is
not yet.

The other invariant shutdown() documents, that the holders must not outlive the
ZooKeeper& they reference, needs no second fix here: on the unwind path reverse
declaration order destroys both holders before zookeeper, and unlike shutdown()
this path never calls zookeeper.reset() explicitly.

TransactionManager::TransactionManager() is the only constructor in the tree that
stores an ephemeral node holder into a member, so there is no structural sibling
to extend this to. Of the nine EphemeralNodeHolder member carriers in src/, the
other seven are all assigned in non-constructor functions, and of the twelve
constructors that install a component guard in their body, only StorageKafka2 and
StorageReplicatedMergeTree own a holder member at all, each assigned from a
background task that the constructor does not run.

The new integration test needs no product-code scaffolding: it writes one CSN log
entry claiming an unknown format version, which makes CSNEntryData::deserialize
throw from reloadCSNLogs, that is, after initOwnReplicaState has taken both
holders. It asserts the cleanup lease is acquired twice in the window, because a
second acquisition of an ephemeral znode is only possible if the failed
constructor actually removed the first, and that the LOGICAL_ERROR needle does
not appear. It runs first in the module: several part-loading paths build the
singleton at startup once a transactional part exists on disk, and the singleton
latches on success, so a later position could pass without covering anything.

Reproducing the abort requires enforce_keeper_component_tracking, which is off by
default but is written into every integration instance and is set for stateless
runs too.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-oranjeai PR origin: delegated from the OranjeAI sibling fleet labels Sep 19, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review in two independent passes: my own cold read of the resulting code (5 nits, no
blocker and no major), then a second model over the same tree (engine: codex; 1 finding, a nit).
No fix round was needed, so the tree published here is the tree both passes read.

# Sev Finding Verdict Evidence / action
1 💡 The regression test's comments restate too much of the narrative (tests/integration/test_transactions/test.py) DISAGREE, forwarded Not something I bounce a fix for: no oracle, trigger or assertion is affected. Forwarded to the comment pass that runs over the whole diff before publication.
2 💡 The catch (...) handler releases the two holders but does nothing about updating_thread, whose destructor calls abort() on a still-joinable thread DISAGREE Unreachable, so a guard would defend against a defect that does not exist: the updating_thread assignment is the last statement inside the try, and std::unique_ptr move-assignment cannot throw, so no exception can leave the body with a live thread. Worth knowing that the handler is holder-only by design if this constructor grows a statement after that assignment.
3 💡 The test's coverage depends on its position as the first test in the module DISAGREE Accepted design. pytest keeps within-file order under both integration schedules (--dist=loadfile normally, --dist=each on the flaky path), and if the singleton were already built the precondition assert fails loudly naming that cause, so a wrong position cannot turn into a silent pass.

Boundary of the "no structural sibling" claim, stated rather than left implicit. A different shape
exists elsewhere and is deliberately not covered: a non-constructor function that stores an ephemeral
holder into a member under a body-scoped guard and then throws. The holder survives that unwind inside
a live object and is destroyed later under whatever component is then in scope, so no destructor runs
during the unwind. TransactionManager::TransactionManager() is the only constructor in the tree that
stores an ephemeral holder into a member: of the 9 member carriers in src/, the other 7 are assigned
in non-constructor functions, and of the 12 constructors that install a component guard in their body
only StorageKafka2 and StorageReplicatedMergeTree own a holder member at all, each assigned from a
background task the constructor does not run. A holder that is a local of a constructor body is safe
by construction, since the guard is declared first and therefore destroyed last.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal
per finding.

Session id: cron:clickhouse-review-slot-8:20260919-094100

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. pytest test_transactions/test.py::test_ctor_unwind_releases_ephemeral_holders: 1/1 pre-fix, 20/20 post-fix. The trigger is a znode the test writes itself, so it is not probabilistic.
b Root cause explained? A constructor body's locals are destroyed before its member subobjects, so the body-scoped Keeper component guard dies before the member ~EphemeralNodeHolders run tryRemove, and ZooKeeper::pushRequest rejects an empty component (ZooKeeperImpl.cpp:1718).
c Fix matches root cause? Yes, at the owner scope. It releases the holders while the guard is alive, mirroring TransactionManager::shutdown(), and follows b95ea457e2cd71, which moved this class of guard out of ~EphemeralNodeHolder as too generic. No widened bound, no tag, no defensive check at the crash site.
d Test intent preserved / new tests added? New integration test; no existing test touched. git diff --ignore-all-space -- src/ is +11/-0 and the test file diff is +76/-0, so nothing was deleted or weakened.
e Both directions demonstrated? Yes, on Build-ID-verified binaries. Unfixed: abort, signal 6, Current component is empty x2, frame 19 = the constructor's closing brace. Fixed: pass, that needle 0, cleanup lease acquired twice.
f Fix is general across code paths? One catch (...) covers every exception that can leave the body, including the four other reachable throw sites after the first holder and the updating_thread creation after both. Both releases are no-ops on a null holder, so the partial-holder window is covered too. Structural siblings: none. TransactionManager::TransactionManager() is the only constructor in the tree that stores an ephemeral node holder into a member; the 7 other member carriers are all assigned in non-constructor functions.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A for value inputs: no user value reaches this path. The axis that exists is which exception unwinds the constructor and how many holders are held, which (f) covers exhaustively; the test drives the widest case, both holders held.
h Backward compatible? (maintainer-approved exception only) Yes. One .cpp, one function, no header, setting, default, format or ABI change, so no SettingsChangesHistory.cpp entry is owed. On success the try changes nothing; the handler runs only on an unwind that today aborts.
i Invariants and contracts preserved? The constructor still throws the original exception verbatim (throw; rethrows; the client now sees Code: 287), and SingletonHelper still does not latch on failure, which the second successful construction proves. The other invariant shutdown() documents, that holders must not outlive the ZooKeeper& they reference, holds for free here: reverse declaration order destroys both holders before zookeeper, and this path never calls zookeeper.reset(). No lock needed: clang TSA emitted no diagnostic under -Werror, and no other thread can reach a half-constructed singleton because updating_thread is the body's last statement.

Session id: cron:clickhouse-impl-slot-4:20260919-085600

@clickhouse-gh

clickhouse-gh Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e8869f6]

Summary: ✅


AI Review

Summary

This PR moves TransactionManager Keeper initialization out of the constructor into TransactionManager::start(), publishes the singleton only after start() succeeds, eagerly initializes it during server startup so metadata loading no longer constructs it on a background thread, and adds focused integration coverage for the startup failure and retry paths. I found no remaining correctness, lifecycle, or test-coverage issues in the current head.

Final Verdict

✅ No new findings in the current diff.

LLVM Coverage Report

Measured on commit e8869f6.

Metric Baseline Current Δ
Lines 87.90% 87.90% +0.00%
Functions 91.70% 91.70% +0.00%
Branches 79.30% 79.30% +0.00%

Changed lines: Changed C/C++ lines covered: 21/24 (87.50%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Sep 19, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing e8869f641 with master 001b6e36e (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 1ba41baf1; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

28 translation units recompiled, 255 s compile time in total, 28 of them have a recent master baseline.

Job report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 102931e

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Upgrade check (amd_release) / Error message in clickhouse-server.log Code 344 SUPPORT_IS_DISABLED. The upgraded-from server aborts ATTACH TABLE test_3.mt_txn_fuzz in AsyncLoader::worker because the randomized Keeper feature flags do not advertise LIST_WITH_STAT_AND_DATA, FILTERED_LIST, MULTI_READ and CHECK_STAT, which transactions require. Not caused by this PR: 30 unrelated PRs carry the identical message in the last 14 days, and this PR changes no Keeper feature-flag or loader code. #120932 (mine, open)
Performance Comparison (arm_release, master_head, 5/6) perf-harness error, not a query regression. The shard reports 10 errors, 4 too long, 1 unstable, and the 10 errors are all iceberg_suite_tpch failing to ATTACH its Iceberg tables: Code 481 PATH_ACCESS_DENIED, with the left/db segment doubled in the server's user_files root. #120964 (mine, merged 2026-09-19 10:45Z). This head predates that commit, so the next push to this branch picks the fix up.
Mergeable Check, PR praktika aggregators reflecting the two rows above #120932 (mine, open) and #120964 (mine, merged)

Measured on the perf row, so the shard verdict is not misread as a perf regression: of the 1308 per-query rows on this run, 1306 are success and 2 are the old/new pair of a single unstable query, with zero slower and zero FAIL/ERROR. Master reproduces the identical 10 errors signature two commits before e502343bccdf1 and is green at e502343bccdf1 itself, which is the merge commit of #120964.

Session id: cron:our-pr-ci-monitor:20260919-170416

@tuanpach tuanpach self-assigned this Sep 21, 2026

@tavplubix tavplubix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer aborts the server with Current component is empty

What does this error mean exactly?

TransactionManager::TransactionManager() installs its Keeper component guard as a local of the constructor body, but the two ephemeral node holders it then takes (TransactionSession::active_node_holder and TransactionManager::cleanup_lock_holder) are members.

So we still don't set the component for these requests, but bypass the enforce_component_tracking check, right? Why don't we make the guard a member too, or not initialize the node holders in the ctor body?

@tuanpach

Copy link
Copy Markdown
Member

What does this error mean exactly?

When using Keeper client, we must set a guard like auto component_guard = Coordination::setCurrentComponent("TransactionManager::runUpdatingThread");.

One of the purposes should be for troubleshooting (e.g, link).

When TransactionManager::TransactionManager throws an exception, the guard is destroyed, but EphemeralNodeHolder still might use the Keeper client without the guard, and it throws an exception.

We can fix it by adding the guard to EphemeralNodeHolder, but I think it is harder to track the original caller.

@tuanpach

Copy link
Copy Markdown
Member

Why don't we make the guard a member too

The current_component is a thread_local variable. We rely on the guard's destructor to clear it.

not initialize the node holders in the ctor body?

We must put the logic to clear EphemeralNodeHolder in an uninitializing function. In the function, we can create a new component guard.

@groeneai

Copy link
Copy Markdown
Collaborator Author

The first question is answered above, so from my side only the consequence:

What the error means. With enforce_component_tracking on, ZooKeeper::pushRequest throws LOGICAL_ERROR when the thread-local component is empty. In a debug or sanitizer build Exception::handleErrorCode aborts inside the exception constructor, so the catch in ~EphemeralNodeHolder never sees it: the server dies on signal 6, and the exception that was unwinding the constructor is never logged. In a release build the throw lands in pushRequest's own try, whose handler calls finalize(false, false, ...) before rethrowing, so the process-wide Keeper session is force-closed and every other Keeper-backed subsystem loses it too.

So we still don't set the component for these requests, but bypass the enforce_component_tracking check, right?

The opposite: the component is set for those two tryRemove requests, and they are attributed to TransactionManager::TransactionManager in the Keeper log like any other request. component_guard is the first statement of the constructor body, so it is still alive inside catch (...), which is where the holders are released now. Nothing bypasses the check, and it still fires for a genuinely unguarded call site. The bug was ordering only: the body's locals are destroyed before the member subobjects, so the guard was already gone when the member ~EphemeralNodeHolder ran.

Guard as a member would get the destruction order right, but current_component is static thread_local (ZooKeeperCommon.cpp:1962). A member guard is constructed on whichever pooled thread happens to run the first BEGIN TRANSACTION and then stays installed on that thread for the singleton's whole lifetime, so every later Keeper request from that thread is attributed to TransactionManager::TransactionManager, and its destructor restores a previous_component captured on that thread onto whichever thread destroys the singleton. Since pushRequest only throws on an empty component, an always-set component would also hide genuinely unguarded sites on that thread. Putting the guard into ~EphemeralNodeHolder was tried and removed for being too generic (b95ea45 moved it to DDLWorker::shutdown "where the actual issue occurs", clearing the holders explicitly); this change is the same shape for this owner, and it mirrors TransactionManager::shutdown(), which already wraps the same two releases in a nested guard scope.

Not taking the holders in the constructor body is the cleaner shape and I agree with it, but it is wider than this fix: both holders are taken inside loadLogFromZooKeeper() (initOwnReplicaState -> initReplicaNodes -> createActiveNode, plus the cleanup lease), so Keeper initialization has to move out of construction, and SingletonHelper latches the instance on a successful constructor today, so the latch and the failed-init path move with it. I did not take that decision on my own. If you want it in this PR, say so and I will do it.

@tuanpach

Copy link
Copy Markdown
Member

@groeneai can move the resetting logic to dtor of TransactionManager. Creating a new guard before resetting.

@groeneai

Copy link
Copy Markdown
Collaborator Author

~TransactionManager() already does that: it calls shutdown(), which creates its own guard and resets cleanup_lock_holder and the session's active node inside that scope. It has to reset them explicitly rather than leave them to member teardown, because member subobjects are destroyed after the destructor body finishes, so a guard created in the destructor body would already be gone by then.

The path this PR fixes never reaches the destructor at all: when a constructor exits by exception, the object's own destructor is not invoked, only the destructors of its fully constructed members. Nothing calls ~TransactionManager() or shutdown(), and the two member EphemeralNodeHolders are destroyed directly, after the constructor body's locals (the guard included) are gone. The constructor's handler is the only scope where the members are still alive and a guard is still installed.

The integration test here is the check for that: it throws from reloadCSNLogs after both holders are taken and asserts the cleanup lease can be acquired a second time, which is only possible if the failed constructor removed the first one. With the releases only in the destructor, that test fails.

What I can do instead, if this is the part that bothers you: put the two releases in one named private helper that installs the guard itself, called from both shutdown() and the constructor handler. It would take the component name as a parameter, since setCurrentComponent takes a StaticString, so the Keeper log still separates the two callers. Say the word and I will push it.

@tuanpach

Copy link
Copy Markdown
Member

@groeneai

Can we put the initialization logic into TransactionManager::start()? It can be called in Server::createServers when allow_experimental_transactions is enabled.

@groeneai

Copy link
Copy Markdown
Collaborator Author

Yes, and I would rather do it in this PR than leave the narrow fix standing. Two things I measured on the current head before answering, because both change how the call has to be wired.

Server::createServers alone does not cover every construction site. TransactionManager::getCSN calls instance() for any transactional TID, and MergeTreeData::PartLoadingTree::add calls getCSN while building the loading tree, so MergeTreeData::loadDataParts constructs the manager for any part whose transactional creation_tid has no resolved CSN. Table loading is scheduled at loadMetadata (Server.cpp:3490) while the createServers call that builds the main servers list is at :3547, and with async_load_databases = true (the default) those loading jobs run on background threads, so they race with it rather than follow it. The two earlier createServers calls are config gated (:3348 requires no prometheus.handlers, :3428 requires hasIntrospectionProtocols), createServers also runs from Server::updateServers and from the SYSTEM START LISTEN callback, and clickhouse-local never calls it at all.

So the shape I would implement: start() owns the Keeper work, the server calls it before loadMetadata when allow_experimental_transactions is set (fail fast, and ahead of any part loading), and instance() calls it idempotently so the paths the server call does not precede are still initialized. Say the word if you would rather have the call in createServers.

A throw out of start() does not have the constructor's problem, so this removes the abort instead of relocating it. After a successful constructor the two holders are members of a live object, so the unwind destroys only start()'s own locals, and ~TransactionManager() calls shutdown(), which installs its own guard before resetting them. shutdown() already tolerates a half initialized state: the stop_flag latch, the null check before joining updating_thread, and zookeeper.reset() last.

One thing the move does not give for free: with no handler in start(), the release waits for Context::shutdown() calling shutdownIfAny(), so a failed start() would hold cleanup_lock and this replica's _active node for the life of the process, and peers would keep seeing this replica as live. So start() keeps the release-on-failure handler this PR adds, minus the abort. That is also the answer to tavplubix's "not initialize the node holders in the ctor body".

groeneai and others added 2 commits September 22, 2026 06:50
… the constructor

Both reviewers asked for the same reshape: @ tavplubix, "Why don't we make the
guard a member too, or not initialize the node holders in the ctor body?", and
@ tuanpach, "Can we put the initialization logic into TransactionManager::start()?".
This does the second, which removes the abort structurally instead of handling it.

The constructor took two ephemeral node holders that are members
(TransactionSession::active_node_holder, TransactionManager::cleanup_lock_holder)
while its Keeper component guard was a local of the body. C++ destroys a body's
locals before the member subobjects, so an exception leaving the body destroyed
the guard first and the member ~EphemeralNodeHolder called tryRemove with no
Coordination component set; ZooKeeper::pushRequest rejects that. After the split,
a successful constructor leaves both holders as members of a live object, so an
unwind out of start() destroys only start()'s own locals and no holder destructor
runs at all. There is nothing left to handle.

start() and the constructor are both private, with
friend class SingletonHelper<TransactionManager>, and the server calls
TransactionManager::instance() rather than instance().start(). Two reasons, both
measured, neither visible in the diff. First, exclusion against shutdown:
shutdownIfAny() holds instance_mutex while calling shutdown(), and shutdown()
joins updating_thread before taking mutex, so a start() reachable outside
instance_mutex could create a thread that shutdown() has already passed and then
have zookeeper reset under it. Second, no new stall: start() holds mutex across
Keeper RPCs bounded only by the client watchdog (worst case about three session
timeouts, 90 s by default), which is invisible only while the instance is
unpublished, because other threads then block on instance_mutex exactly as they
do today across the equally long constructor, rather than on the mutex that
commitTransaction, rollbackTransaction and getCSNImpl need. Construction alone no
longer yields a usable object, so the constructor must not be reachable without
the initialization that follows it; that also forces new Derived() in place of
std::make_shared<Derived>(), since make_shared constructs inside the standard
library, which is not the friend.

A failed attempt discards its instance rather than retrying in place, and
createInstanceOrThrow publishes only after start() returns. Retrying on the same
object would not work: TransactionLog::initLogRoot asserts it begins empty
(chassert(tid_to_csn.empty()), chassert(last_loaded_csn == Tx::UnknownCSN)),
processCSNLogs fills exactly those two, and the statement after the log load,
ThreadFromGlobalPool's construction, can throw from scheduleOrThrow. So a second
start() on a reused instance would trip that assertion in a debug build.
Discarding also reproduces today's semantics exactly, since a throwing constructor
already destroys everything and the next instance() builds afresh, and it means
instance_holder is non-null if and only if the instance is started, so
shutdownIfAny() can never see a half-built object.

That is also why round 1's release-on-failure handler is deleted rather than moved:
the unwind now runs ~TransactionManager() -> shutdown(), which installs its own
component guard and performs the same two releases before zookeeper.reset(). On
that path stop_flag is false and updating_thread is null, so shutdown() reaches
the releases unconditionally and a handler in start() would be dead code. The
property still holds that _active and the cleanup lease are released immediately
rather than at Context::shutdown(); only the mechanism changed. ~EphemeralNodeHolder
has its own catch plus tryLogCurrentException, so there was never a std::terminate
exposure to move off the destructor either.

Three new lock edges, none of which closes a cycle: mutex -> running_list_mutex via
publishLoadedSnapshot (all 14 running_list_mutex critical sections in this file were
enumerated and none reaches mutex), mutex -> TransactionLog::mutex (TransactionLog
holds only paths, a const TransactionSession &, a const std::atomic_bool & and a
logger, and calls back into nothing), and mutex -> Context's zookeeper_mutex via
global_context->getZooKeeper() (Context::getZooKeeper and its callees contain zero
TransactionManager references). Nothing reachable from loadLogFromZooKeeper()
re-acquires mutex, and the launched updating thread's first getZooKeeper() blocks on
mutex for zero further statements.

The server calls the singleton eagerly before loadMetadata when
allow_experimental_transactions is set, because otherwise initialization lands on
whichever thread first touches it: measured, that is a background table-loading
thread, through MergeTreeData::PartLoadingTree::add -> getCSN,
VersionMetadata::loadAndUpdateMetadata -> tryGetCSN, and
StorageMergeTree::loadMutations -> getCSN, all of which run on async loading jobs
with async_load_databases enabled by default. The call is deliberately not fatal.
Today a Keeper problem surfaces at the first transaction and never at startup, so
throwing would add a new startup failure mode in which a transient Keeper outage
becomes a restart loop; tests/config/config.d/transactions.xml is installed into
every stateless test server; and the lazy path still retries, so nothing is lost.
Fail fast is honoured as reported at startup instead of at the first transaction.

Making the guard a member instead was rejected with reasoning already posted:
current_component is static thread_local, so a member guard would stay installed on
whichever pooled thread built the singleton and mis-attribute every later request
from that thread, hiding genuinely unguarded sites, since pushRequest only throws on
an empty component. A function-try-block does not work either, because its handler
runs after the member subobjects are destroyed. The guard itself still has to move
into start(): every Keeper request start() makes goes through pushRequest, which
requires a non-empty component, so deleting it would break the normal path.

Calling start() from Server::createServers, as literally proposed, does not cover
the construction sites: createServers runs after loadMetadata, two of its five call
sites are config-gated, it also runs from updateServers and the SYSTEM START LISTEN
callback so it is not one-shot, and clickhouse-local never calls it.

The integration test is reshaped rather than added. It is renamed
test_failed_start_releases_ephemeral_holders, and the injection now happens before
the restart, because the server initializes the log itself at startup and an entry
planted afterwards would never be seen by a failing initialization. Its assertions
are absolute rather than deltas because the harness config sets rotateOnOpen, so
count_in_log reads only the process started by the restart, which is the whole
window of interest. A new arm asserts the server still answers SELECT 1 after the
eager initialization fails; it is preceded by an assertion on that initialization's
own startup diagnostic, so the arm observes an attempt that ran and failed rather
than a server that never tried.

Co-Authored-By: Claude Opus 5 <[email protected]>
Drop the private-constructor block and the publication story in createInstanceOrThrow (both narrate the new design); compress start()'s block to the member-destruction-order property that pushRequest's component requirement depends on.
@groeneai groeneai changed the title Release the ephemeral node holders when TransactionManager's constructor throws Initialize the transaction log in TransactionManager::start(), not in the constructor Sep 22, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Done, see 8c026bc. The initialization now lives in
TransactionManager::start(), and SingletonHelper::createInstanceOrThrow publishes the instance only
after it succeeds.

Two corrections to what I said when I accepted the reshape, both in the PR description as well. Round
1's release-on-failure handler is gone rather than moved: a failed attempt discards its instance,
and that instance's ~TransactionManager() calls shutdown(), which already performs the same two
releases under its own Keeper component guard, so a handler inside start() would be dead code. The
promised property is unchanged, _active and the cleanup lease are still released immediately rather
than at Context::shutdown(). And the server calls instance() rather than instance().start()
because start() has to stay private. It takes mutex across its Keeper RPCs, which is harmless only
while the instance is still unpublished and no other thread can reach it; a public start() could be
called after publication, where those same waits would block commitTransaction,
rollbackTransaction and getCSNImpl. Keeping it private is also what keeps initialization and
shutdownIfAny() mutually exclusive through instance_mutex.

Internal second-model review: adjudication log (click to expand)

Pre-publication review of the reshape, in two independent passes per round: my own cold read of the
resulting code, then a second model over the same tree (engine: codex). Two fix rounds, seven findings.
This supersedes the adjudication log I posted on 2026-09-19, which covered the narrow constructor-handler
design that this reshape replaced.

# Sev Finding Verdict Evidence / action
1 ⚠️ The eager startup initialization had no oracle: the test stayed green with the Server.cpp block deleted, so the "server still starts" arm could not fail for the stated reason AGREE, fixed The test now asserts that initialization's own startup diagnostic between the restart and the lazy attempt. The mutation arm that removes the block was re-run and reddens on that assertion only, with every pre-existing assertion still holding, so the holder-release oracles stay independent of the startup path
2 ⚠️ The commit message attributed both review requests with live GitHub mentions, which notify the accounts and, on a squash merge, reach the default branch AGREE, fixed Written as spaced references instead. The push already notifies both reviewers and this reply is where attention is legitimately asked for, so the mentions were duplicate pings. Measured: of the last 500 commit messages on master exactly one carries a handle, and the commit already pushed to this branch carried none
3 💡 The test's opening comment described the previous round's mechanism, releases happening "while the component guard is still in scope" AGREE, fixed Rewritten to the mechanism that actually runs: the failed attempt's instance is discarded and its destructor releases both holders under shutdown()'s own guard
4 💡 The module-ordering comment claimed the first step creates the transaction log root, contradicting the comment below it AGREE, fixed The root is created by initLogRoot on the fixture's own startup initialization; both comments now say so, and the stated reason for running first is the load-bearing one
5 💡 Server.cpp's comment said "before any table is loaded", but the system database's load tasks are created earlier AGREE, fixed Reworded to what the call site actually precedes, the database loading below it
6 💡 A comment in test_part_loading_tree_rollback still attributes the Keeper initialization and the feature-flag check to the constructor DISAGREE (scope), disclosed here rather than changed The observation is correct and I am not disputing it. That file is not in this diff, and nothing a reader of it relies on is falsified: its operative claim is that ZooKeeper is required because classifying a transactional TID reaches TransactionManager::instance, and that entry point is still the trigger, the log load is still unconditional, and the flag refusal still happens, only raised from start(). Adding a fifth file to a diff asked to be a minimal single-commit reshape is not worth it, but say the word and I will
7 💡 Alternative offered for #1: assert an exact lease-acquisition count instead DISAGREE A count-exact bound would couple the test to the number of construction attempts, and it was measured to redden the very mutation arm that proves the holder-release oracles are independent of the startup path. >= 2 plus a separate assertion on the startup diagnostic keeps the two concerns apart

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per
finding.

Also checked and clean, for what it is worth to a reviewer. The three new lock edges (mutex to
running_list_mutex, to TransactionLog::mutex, and to the Context's ZooKeeper mutex) close no cycle,
verified by extracting all 14 running_list_mutex critical sections and confirming none reaches
mutex; holding mutex inside instance_mutex adds no inversion either, because the only window in
which instance_holder is null is before publication, when no other thread can reach the object. Nor
does start() deadlock on mutex itself, which a constructor could not have done and which clang's
thread-safety analysis does not check inside one: nothing on its call path calls the mutex-taking
getZooKeeper() accessor, every such call site being the updating thread or a transaction path.
~TransactionManager() now runs with an exception in flight, which a throwing constructor never did, so
every throw site on that path was enumerated: ~EphemeralNodeHolder wraps tryRemove in a catch (...)
with tryLogCurrentException, notifyUpdated is an event set plus a notify, the component guard only
stores a thread-local, and the thread join is unreachable there, so no std::terminate exposure is
added. Retrying from a fresh instance is sound on the Keeper side as well: createActiveNode removes a
stale _active before creating, initLogRoot accepts an existing log, and the session node and tail
pointer are idempotent. And after this change no class in the tree takes an ephemeral node holder into a
member during construction, which is what makes the defect class closed by construction rather than
handled.

Validation beyond the PR's own module: the nine integration modules that enable transactions and
therefore now initialize eagerly at startup were all run green, and on a server carrying the full
stateless overlay the new startup diagnostic appears zero times because the eager call succeeds there,
so it is not a routine log line.

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. pytest test_transactions/test.py::test_failed_start_releases_ephemeral_holders with a csn-0009999999 znode claiming version: 2; 1/1 and 10/10, no randomization dependence.
b Root cause explained? The Keeper component guard was a local of the constructor body while both ephemeral node holders are members. Locals die before member subobjects, so ~EphemeralNodeHolder ran tryRemove with an empty thread_local component; pushRequest raises LOGICAL_ERROR inside Exception's own constructor, so the abort precedes any log line.
c Fix matches root cause? Yes, structurally: initialization moves to TransactionManager::start(), so no holder is taken while the object is under construction and no handler is needed. No widened bound, no no-random-* tag, no defensive check.
d Test intent preserved / new tests added? The single behavioural case is reshaped, not weakened: it gains an arm (the server must still start after a failed eager initialization, asserted together with that initialization's own startup diagnostic, so the arm cannot pass on a server that never tried) and its two log assertions become absolute instead of deltas, because the harness sets rotateOnOpen. Whole test_transactions module green (10/10).
e Both directions demonstrated? Yes, same command. Without (build id 4b4c1035...): Logical error: 'Current component is empty...' -> abortOnFailedAssertion -> Received signal 6 (Aborted) on BEGIN TRANSACTION. With (6ef75d27...): 1 passed, Current component is empty count 0.
f Fix is general across code paths? Census re-run on this head: of the nine EphemeralNodeHolder member carriers in src/, every assignment site's enclosing function is a regular method. After this change no class takes a holder into a member during construction, so there is no sibling to extend to. Fixed where initialization happens, not at the crash site, and not inside ~EphemeralNodeHolder (which b95ea457e2cd71 removed as too generic).
g Fix generalizes across inputs (params/datatypes/wrappers)? Not a type/settings matrix: the trigger is any exception escaping initialization, and the fix is trigger-agnostic by construction. All three throw sites in start() (feature-flag check, everything under loadLogFromZooKeeper(), ThreadFromGlobalPool's construction) now unwind into ~TransactionManager() -> shutdown().
h Backward compatible? (maintainer-approved exception only) Yes. No setting, no SettingsChangesHistory.cpp entry, no serialized format, no config key, no ABI addition. The public API gets smaller (constructor and start() private); createInstanceOrThrow is the only construction site in the repo, and programs/, utils/, base/ and every gtest contain zero TransactionManager references.
i Invariants and contracts preserved? instance_holder is now non-null iff the instance is started, so shutdownIfAny() can never see a half-built object. Three new lock edges (mutex -> running_list_mutex, -> TransactionLog::mutex, -> Context's zookeeper_mutex), none closing a cycle; all 14 running_list_mutex sections and both reverse directions were enumerated. -Werror build clean, so clang thread-safety analysis accepts the TSA_REQUIRES(mutex) chain. On the failure path stop_flag is false and updating_thread null, so shutdown() reaches both releases unconditionally under its own guard before zookeeper.reset().

Mutation arms, all three as required: reverting the whole src/ + programs/ diff reddens with the
original signal-6 abort; publishing the instance before start() reddens (DID NOT RAISE - the
unstarted singleton served a transaction, and its lease leaked); removing the eager startup call reddens
on the startup-diagnostic assertion alone, and with only that assertion neutralized the same binary
passes with Acquired cleanup lease still 2 - so the eager call has its own oracle and the
holder-release assertions remain independent of it.

Validation beyond the module: all nine integration modules that enable
allow_experimental_transactions are green (test_replicated_database 46,
test_database_replicated_settings 390, test_drop_is_lock_free 20, test_drop_database_replica 5,
test_broken_tmp_txn_version_startup 5, test_part_loading_tree_rollback 4, two others 1 each), plus
03920_drop_db_hang_with_trx, 05045_keeper_access_in_clickhouse_local and the 26-test stateless
transaction family on a server carrying the full tests/config overlay. On that server the eager call
succeeds at startup, so it emits no error line in a routine run.

Session id: cron:clickhouse-impl-slot-4:20260922-052700

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 42d9798

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Upgrade check (amd_release) / Error message in clickhouse-server.log TCPHandler: Can't skip excessive input packets after the exception. Close connection. on Code: 101 ... UNEXPECTED_PACKET_FROM_CLIENT, leaking into the log scan. CIDB 14d: 8 unrelated PRs, 0 true-master, onset 2026-09-17 #119368 (external, open)
Performance Comparison (arm_release, master_head, 6/6) / bitmap_cardinality #1 and #4 shard red on a dashboard confirmed_regression (client_time 0.3355 -> 0.4374). On this same shard in 7d the fixture is called slower on 10 true-master runs across 50 PRs and unstable on 28 true-master runs across 148 PRs, so the verdict is a property of the fixture and the bar, not of this branch #121090 + #121189 (mine, open)
Performance Comparison (arm_release, master_head, 6/6) / number_formatting_formats #0 same shard, unstable: 6100 rows over 899 PRs and 502 true-master runs in 7d #121090 + #121189 (mine, open)
Mergeable Check, PR praktika aggregators reflecting the rows above #119368 (external, open), #121090 + #121189 (mine, open)
CH Inc sync - CH Inc sync (private, not actionable by me)

Neither failure is reachable from this diff, which touches src/Interpreters/TransactionManager.{h,cpp} and src/Server/Server.cpp only: the upgrade-check row is a client-protocol message emitted by the upgraded-from binary, and both merged fixes that owned the PREVIOUS head's two rows (#120932 and #120964) are ancestors of this head and their signatures are gone, so those rows did not recur.

Session id: cron:our-pr-ci-monitor:20260922-120136

@clickhouse-gh clickhouse-gh Bot added the comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. label Sep 22, 2026
…ders separately

test_failed_start_releases_ephemeral_holders asserted `Acquired cleanup lease >= 2` over the
whole post-restart process, but three start() attempts contribute to that count: the eager one
in Server.cpp, the lazy one from BEGIN TRANSACTION, and the final successful one. A single
release satisfied it, while the contract the test states is that both failing attempts release
what they took.

Measured with a mutation that leaks the cleanup lease from the second shutdown of the process
onwards, which is the shape of a leak confined to the lazy path: the count falls from 3 to 2 so
`>= 2` still holds, `Current component is empty` stays 0 because a holder whose need_remove is
clear never calls tryRemove, and the third attempt still succeeds because tryAcquireCleanupLock
returns silently on ZNODEEXISTS and createActiveNode removes a stale `_active` before taking its
own. The test passed.

The oracle is now per attempt: after the eager failure and again after the lazy failure, both
ephemeral znodes a start() attempt takes are read out of Keeper and must be absent, and the lease
count must have grown across each attempt, which is only possible if the previous attempt
released it. After the successful attempt both znodes must be present, so the two empty results
are an absence and not a path that never takes them.

Those reads sync() first. The test client is pinned to zoo1 while the server shuffles the three
configured endpoints, so an unsynced read of a follower could show a holder the server had
already removed and redden the test for no reason. test_drop_replica reads Keeper the same way.

The same mutation now fails at the lazy-failure arm with "the lazy start() failure left ephemeral
node holders behind: ['cleanup_lock']", every earlier assertion still passing. On the unmutated
binary the test passes 5 of 5 and the whole test_transactions module 10 of 10.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - ab4f807

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Integration tests (amd_asan_ubsan, db disk, 1/8) / test_max_bytes_ratio_before_external_order_group_by_for_server.py::test_max_bytes_ratio_before_external_distinct[user] flaky, not this diff: a client-side timeout at test.py:134. 86 rows across 76 distinct PRs in 30 days, one of them a documentation-only PR, which is about as clean a proof of PR-independence as this failure can offer a fix task is moved to pending (fixing-PR link to follow here)
Performance Comparison (arm_release, master_head, 4/6) CI harness, not this diff: the shard is red only on the confirmed regression(s) on the performance dashboard verdict, a gate that reds unrelated PRs with a regression which does not reproduce on a re-run of the same head (here: 4 too long, 1 unstable; 1 confirmed regression(s)) #121090 (mine, open), with #121189 (mine, open)
CH Inc sync - CH Inc sync (private, not actionable by me)

On the first row, one deliberate omission worth stating: the earlier merged trim of that test is
NOT linked as the owner, because the failure occurs with it already present, so naming it would
claim a fix that does not cover this sub-signature. 126 checks succeeded and 45 were skipped;
Mergeable Check and PR are the praktika aggregators, not separate failures.

Session id: cron:our-pr-ci-monitor:20260923-163416

@groeneai

Copy link
Copy Markdown
Collaborator Author

Owner for the test_max_bytes_ratio_before_external_distinct[user] red on this PR (Integration tests (amd_asan_ubsan, db disk, 1/8), subprocess.TimeoutExpired after 600 seconds at test.py:134, no Code: 241): in-flight #121772, which reduces the external DISTINCT spill and merge cost that this failure's runtime measures.

Not caused by this PR: over 30 days that parameter has 14 rows on 14 distinct carriers and 0 true-master rows, and one of the carriers is a docs-only change, so the signature cannot depend on any carrier's diff. Whether the test also needs its own timeout headroom restored, independently of #121772, is asked at #121096 (comment)

@groeneai

Copy link
Copy Markdown
Collaborator Author

Fixing PR for the test_max_bytes_ratio_before_external_distinct[user] red on this PR (Integration tests (amd_asan_ubsan, db disk, 1/8)): #122494, which sizes the [user] case to fit the 600 s client timeout. #121772, linked above, does not change this test.

/// otherwise build this singleton on a background table-loading thread.
try
{
TransactionManager::instance();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can call start() here, and we don't need to wrap in a try-catch.
If TransactionManager cannot start when config is enabled, we should raise an error early

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 956b548: the startup call no longer catches everything, so a transaction log that cannot be initialized (a Keeper without the feature flags transactions need, a log entry it cannot read) now stops the server.

  • The call is still TransactionManager::instance(): it runs start() on a fresh instance and publishes it only if start() succeeds. start() itself stays private because it holds mutex across the Keeper requests, which is only safe while no other thread can see the instance.
  • I kept one exception: a Keeper hardware error (Coordination::isHardwareError) is logged, and the first transaction retries. Without it a server with transactions enabled cannot start while Keeper is unreachable, and test_replicated_database::test_startup_without_zk fails (I ran it). If you want that to be fatal too, I will drop the catch and turn transactions off for that test's restart.
  • Four DatabaseReplicated test configs enabled transactions without running any, on Keeper feature flags the harness randomizes, so their servers would now fail to start. I removed the setting there.

With `allow_experimental_transactions` enabled, the eager `TransactionManager::instance()` call
before `loadMetadata` now rethrows everything except a Keeper hardware error, so a transaction log
that cannot be initialized (a Keeper that does not advertise the feature flags transactions need,
a CSN entry in an unknown format, no ZooKeeper configuration at all) stops the server at startup
instead of surfacing at the first transaction. An unavailable Keeper is still only logged:
`test_replicated_database::test_startup_without_zk` restarts a node that has transactions enabled
while its Keeper connections are rejected and requires it to come up, and the next use of the
manager retries the initialization.

`test_failed_start_releases_ephemeral_holders` now expects the start with the bad CSN entry to
fail and checks the log of the process that refused to start: the attempt took the cleanup lease,
the load error is logged, and `Current component is empty` is not. The per-attempt znode checks go
away together with the lazy attempt they covered, which a server with transactions enabled no
longer reaches after a failed initialization. That attempt was also what showed a failed instance
is never published, so `test_start_is_retried_after_keeper_was_unavailable` takes over: the server
starts with its Keeper connections rejected, and the first transaction afterwards must take the
cleanup lease, which an instance published by the failed attempt would never do. And
`test_startup_fails_on_other_keeper_errors` plants a persistent node with a child where the
ephemeral `_active` node goes, so `createActiveNode` fails with `ZNODEEXISTS`, a Keeper error that
is not a hardware one, and the server must still refuse to start.

Four DatabaseReplicated modules enabled transactions without running any, on a Keeper whose
feature flags the harness randomizes. With the error fatal they fail to start whenever the Keeper
node a server connects to lacks one of the four flags, so the setting is removed from their configs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai changed the title Initialize the transaction log in TransactionManager::start(), not in the constructor Initialize the transaction log in TransactionManager::start() at server startup, not in the constructor Sep 29, 2026
Comment thread programs/server/Server.cpp Resolved
… log at startup

The eager TransactionManager::instance() call before loadMetadata logged and skipped every Keeper
hardware error, and Coordination::isHardwareError also covers ZNOAUTH. So a server whose Keeper
credentials do not match the log's ACL still started, and every transaction then failed the same
way. Now only the codes of a Keeper that cannot serve the request right now (connection loss, an
expired session, an operation timeout, the memory soft limit) leave the initialization to the next
use; any other Keeper error, including ZNOAUTH and a marshalling error, stops the server.

test_startup_fails_when_keeper_denies_access restricts the log's ACL to an identity the server
does not have and requires the server to refuse to start. With the previous check the server logs
"Cannot initialize the transaction log at startup" and keeps running, so the test fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

🟢 AI verdict: improvement — 1 query(s) improved out of 31 analysed

This PR changes only server startup when allow_experimental_transactions is set in the config: the transaction manager is now created at startup and its Keeper setup moves out of the constructor into start(). It also adds integration tests. None of the benchmarked SELECT queries run this code, so the PR cannot plausibly cause any of the flagged shifts. ClickBench Q20 (-41.4%, CPU time roughly halved) is a large, clear shift that the hard trust rule locks as an improvement, but it most likely comes from a code difference between the PR build and the base build, not from this diff. The not_sure rows (Q18, Q28, Q30, Q33, Q34) are small slowdowns, mostly on noisy queries and inside master's normal range, and the envelope suppressions are consistent with a diff that never touches these queries.

clickbench

🟢 1 improved · ⚠️ 5 inconclusive

Flagged queries (6 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
🟢 20 improvement 220 129 -41.4% <0.0001 cpu: The hard trust rule locks this -41.4% verdict, and CPU time also fell by about half. The diff does not touch this query's path, so the gain likely comes from a code difference between the two builds outside this diff.
⚠️ 18 not_sure 848 945 +11.4% <0.0001 Borderline +11.4% on a noisy query, and the two tests disagree. This PR only changes how the transaction manager starts up, which this SELECT never runs.
⚠️ 28 not_sure 1058 1150 +8.6% 0.0018 The +8.6% stays inside master's normal range for this query. Nothing in the startup-only diff explains it.
⚠️ 30 not_sure 219 247 +12.8% <0.0001 The +12.8% (28 ms) stays inside master's normal range for this query. Nothing in the startup-only diff explains it.
⚠️ 33 not_sure 1049 1119 +6.7% 0.0018 The +6.7% is on a noisy query and stays inside master's normal range. Nothing in the startup-only diff explains it.
⚠️ 34 not_sure 1046 1164 +11.2% <0.0001 The +11.2% is on a noisy query and stays inside master's normal range. Nothing in the startup-only diff explains it.

Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on.

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: aadce65a-aa9c-4481-b88c-dcae94454c0e
  • MIRAI run: 9a50b182-335d-41fe-962c-104b1b3fcf0f
  • PR check IDs:
    • clickbench_93733_1791940779
    • clickbench_93863_1791940798
    • clickbench_93968_1791940801
    • tpch_adapted_1_official_94162_1791940815
    • tpch_adapted_1_official_94278_1791940827
    • tpch_adapted_1_official_94516_1791940938

@clickhouse-gh

clickhouse-gh Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Dear @tuanpach, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@clickhouse-gh clickhouse-gh Bot added comp-transactions MergeTree transactions (MVCC): BEGIN / COMMIT / ROLLBACK, the transaction log and manager, part v... and removed comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. labels Nov 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-transactions MergeTree transactions (MVCC): BEGIN / COMMIT / ROLLBACK, the transaction log and manager, part v... groeneai-origin-oranjeai PR origin: delegated from the OranjeAI sibling fleet pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants