last_ckpt_disaggregated_schema_epoch is written with plain stores but read lock-free — TSAN-reportable data race

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Checkpoints
    • None
    • Storage Engines - Foundations
    • 185.18
    • None
    • None

      txn_global.last_ckpt_disaggregated_schema_epoch is declared wt_shared, but all three stores are plain assignments:

      • checkpoint_txn.c:2083 and :2098 (checkpoint completion — runs on every checkpoint, disaggregated or not)
      • conn_layered_checkpoint_pick_up.c:1547 (checkpoint pickup adoption)

      while query_timestamp("get=last_disaggregated_schema_epoch") reads the field with a lock-free acquire load (txn_timestamp.c:210). The stores run under the checkpoint lock, the reader takes no lock, so the pair is a data race (UB per C11; ThreadSanitizer reports it — see the reproducer comment). All other readers are checkpoint-lock- or schema-lock-ordered with the stores; the query API is the only racy access.

      Practical impact is bounded — an aligned 8-byte store does not tear on our platforms, so the caller can only observe a stale epoch — but the race trips TSAN in any workload combining checkpoints with this timestamp query. One possible fix: use release stores at the three store sites, matching the adjacent fields.

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

              Created:
              Updated: