You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
storage-postgres: no test fails when the 1 ms floor of set_lock_timeout is removed #1502
crates/storage-postgres/src/data/ddl.rs, set_lock_timeout, at #1166's head 5b7d9dfd9. On main at 80490c6ca the same floor is in two places: begin_read_committed (crates/storage-postgres/src/data/catalog_check.rs line 255) and set_lock_timeout_until (ddl.rs line 733). #1166 moves both into the one helper.
What happens
The helper sets a transaction's lock_timeout to at least 1 ms, because PostgreSQL reads 0 as no limit. No test fails without that floor. LJMart11 measured it on #1166: with .max(1) removed, the catalog_check suite passes (16 tests).
The catalog check can reach a 0 ms attempt in read_after_index_writers (catalog_check.rs lines 266 to 295). After a lock attempt times out, the check pauses for min(left, INDEX_LOCK_PAUSE). When less than 50 ms of the budget is left, the pause ends at the deadline, and the next attempt starts with 0 ms left. Without the floor, that attempt waits on the index lock with no bound.
an_index_write_open_past_the_budget_stops_the_check_and_the_drop (crates/storage-postgres/tests/catalog_check/fix.rs) gets to that attempt only when an attempt times out with less than 50 ms of its 2 s budget left. That depends on how long each attempt's round trips take, so the test doesn't catch a missing floor on every host.
A test that fails without the floor
Plant an orphan and hold LOCK TABLE indexes IN ROW EXCLUSIVE MODE in another session, as that test does. Build the store with PostgresCatalogStore::with_index_lock_budget(catalog, Duration::ZERO), and require the check to fail with the index lock error inside a short timeout. With a zero budget, the first attempt in read_after_index_writers starts with 0 ms left, so every run takes the floor.
Activity