-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Schema Management
-
Storage Engines - Foundations
-
1.852
-
SE Foundations - 2026-09-15
-
5
Follow-up to WT-18428 which renames the dropped file under the schema lock and applies the unlink, history store truncate and tiered object removal after the locks are released, still inside WT_SESSION::drop. This ticket moves that work to the sweep server so drop returns without paying for it.
- __drop_file inserts, in the same tracked metadata transaction as __wt_metadata_remove(uri), a system:drop.<btree_id> record: original, renamed, btree_id. It commits and unrolls with the drop and is covered by the same metadata checkpoint. system: keys are already skipped by backup, wt list, dhandle and checkpoint walks and __wt_meta_apply_all.
- Rename stays in __meta_track_apply under the lock (after the metadata is durable, so only a crash can interleave with a same-name create).
- __sweep_server drains the pending list at the top of every pass, before the WT_CONN_CKPT_GATHER skip and on the existing drop signal (did_drop). After each removal it deletes the system:drop.<id> record (untracked, durable at the next metadata checkpoint).
- __wt_connection_close drains synchronously after the sweep thread stops.
- Startup (__conn_startup_cleanup_and_verify, after recovery) scans system:drop. records: remove renamed if present; remove original only if present and file:<original> is absent from the metadata; truncate history store for btree_id; delete the record. Skipped on read-only connections. Not needed on WT_DISAGG_NO_LOCAL_DURABILITY nodes.
- Internal startup drops (hs_conn, chunk cache, partial backup, recovery) keep the synchronous drain from WT-18428.
- Tests checking file absence right after drop poll a statistic instead (pattern: test_drop_cache_discard01.py). Add a debug_mode option to force synchronous removal only if a test cannot poll.
Enables later: deferring disagg TRIM (WT-18386) and converting lock-conflict EBUSY on drop into a deferred drop, both reusing the system:drop. record and the sweep drain.