[Disagg] simulate_crash_restart does not take a consistent snapshot of the PALite store

XMLWordPrintableJSON

    • Storage Engines - Foundations
    • 152.971
    • None
    • None

      Motivation:

      Several disagg-leader hook tests that call simulate_crash_restart intermittently fail on wiredtiger_open after the restart with Illegal byte sequence (SQLITE_NOTADB) or Bad message (SQLITE_CORRUPT). Known instances:

      • WT-17770test_hs24.test_missing_commit on macos-14-arm64
      • WT-17884test_hs01.test_hs (precise_checkpoint) on ubuntu2004-asan

      The failure is cross-platform (macOS and Linux-asan), which rules out a platform-only cause and points at the test harness. Both auto-triages routed these to storage-engine domains (recovery/log-record, precise-checkpoint), but the underlying cause is test infrastructure.

      Root cause:

      simulate_crash_restart -> copy_wiredtiger_home (test/suite/helpers/helper.py) copies the home directory while the connection is still open, and it recurses into subdirectories (shutil.copytree), so it copies PALite's SQLite kv_home/*.db files. PALite runs SQLite in WAL mode with synchronous=NORMAL and mmap enabled (ext/page_log/palite/palite.cpp). SQLite auto-checkpoints the WAL back into the main .db file in the background. The per-file, unsynchronized copy can capture a torn image of a .db file mid-checkpoint, so reopening the copied store yields SQLITE_CORRUPT / SQLITE_NOTADB. It is timing-dependent, which is why it is rare and host-load-sensitive.

      Reproducer:

      A standalone SQLite-level reproducer (WAL + synchronous=NORMAL + mmap + a concurrent writer + PRAGMA wal_checkpoint, copied exactly the way copy_wiredtiger_home copies, then reopened and integrity-checked) reproduces reliably: 283/300 reopen attempts hit corruption. Script attached to this ticket.

      Expected outcome / approach:

      simulate_crash_restart / copy_wiredtiger_home should produce a consistent snapshot of the PALite kv_home store before/while copying — e.g. flush and quiesce the SQLite databases, use SQLite's backup API or VACUUM INTO, or copy under an appropriate lock — rather than a raw byte copy of live WAL-mode files.

      Definition of done:

      • copy_wiredtiger_home / simulate_crash_restart produces a consistent PALite snapshot under the disagg hook.
      • test_hs24 (re-enabled) and test_hs01 pass reliably under unit-test-hook-disagg-leader on macOS and ubuntu-asan.
      • WT-17770 and WT-17884 are resolved (fixed or duplicate).

      Tasks:

      • Identify root cause and build a standalone reproducer (done — attached).
      • ( ) Make the crash-restart copy PALite-consistent.
      • ( ) Re-enable test_hs24 in test/suite/fail_lists/hook_disagg.fail.
      • ( ) Verify under the disagg-leader hook on macOS + ubuntu2004-asan.

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: