Expose disagg truncate path as WT_SESSION.truncate config option to replace process-global build flag

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • WT12.0.0, 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: Truncate
    • None
    • Storage Engines - Foundations
    • 118.405
    • None
    • None

      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:

      1. 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.
      1. 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).

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Jie Chen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: