Today, the choice between slow and fast disagg truncate is controlled by __wt_process.disagg_slow_truncate_2026, set at process init from the build-time WT_DISAGG_SLOW_TRUNCATE_BUILD CMake option (src/support/global.c line 359, cmake/configs/base.cmake line 215). This causes two problems:
- CI / local mismatch. Several Evergreen stress tasks force WT_DISAGG_SLOW_TRUNCATE_BUILD=1 (e.g. test/evergreen.yml lines 1730, 1750, 1770, 4932, 5361; test/evergreen_disagg.yml lines 552, 567, including the format-stress-test-disagg-switch template). Local cmake -B build defaults to OFF, so a developer reproducing a CI failure exercises the opposite code path with no warning. The FIXME at test/evergreen_disagg.yml:549 acknowledges this as a known workaround pending WT-17564.
- Rigid coupling. Switching paths requires a full rebuild. Tests cannot exercise both paths in one binary, and there is no way to scope the choice to a single truncate call.
Proposal
Replace the process-global flag with a per-call config on WT_SESSION.truncate. The public API already accepts a config string — the schema at dist/api_data.py:1906 is just empty (Method([])). No public API or ABI change is needed; existing call sites that pass NULL continue to work.
Sketch
- Add a Config entry (e.g. Config('mode', 'fast', choices=['fast', 'slow'])) to WT_SESSION.truncate in dist/api_data.py; run dist/s_all to regenerate.
- In the truncate dispatch (src/schema/schema_truncate.c:256) and the layered-cursor truncate path (src/cursor/cur_layered.c:755), branch on the parsed config instead of __wt_process.disagg_slow_truncate_2026.
- Remove or relax the assertions that assume a process-static value: src/include/txn_inline.h:783; src/txn/txn_truncate.c lines 25, 194, 299, 420, 460, 479; src/cursor/cur_layered.c:1010.
- Keep the build flag temporarily as the default value of the new config, so existing CI tasks and call sites keep working unchanged. Plan its removal alongside or after WT-17564.
Benefits
- Local builds and CI exercise the same binary; the mode is data, not build configuration.
- A single test binary can cover both paths.
- Removes a class of "wrong-path" reproductions during stress-failure triage.
Risks and caveats
- The assertion sites assume process-wide constancy. Each one needs a real look to confirm the invariant survives a per-call choice (or to scope the assertion correctly).
- Default behavior must match today's default (fast) so no caller breaks silently. Tests that need the slow path must opt in via config.
Related: WT-17135 (default flip), WT-17564 (planned removal of slow-truncate code path).
- is related to
-
WT-17678 Slow truncate causes WT_ROLLBACK under cache pressure on layered tables
-
- Needs Scheduling
-
-
WT-17564 Remove WT_DISAGG_SLOW_TRUNCATE_BUILD feature flag and slow truncate code path
-
- Open
-
-
WT-17135 (Follower mode) Enable fast truncate on develop
-
- Closed
-
- related to
-
WT-17678 Slow truncate causes WT_ROLLBACK under cache pressure on layered tables
-
- Needs Scheduling
-
-
WT-17675 [Disagg] checkpoint-cleanup thread asserts "schema lock acquired during role transition" in switch mode
-
- Closed
-
-
WT-17686 failed: compatibility-test-for-newer-releases on compatibility-tests [wiredtiger @ 07d3f582]
-
- Needs Scheduling
-