Delete sitreps non-transactionally with improved pagination#10210
Delete sitreps non-transactionally with improved pagination#10210
Conversation
zoom zoom! |
| // Join all tasks — a panic in any task (from assert_sitreps_eq) | ||
| // means we detected a torn read. | ||
| for handle in handles { | ||
| handle.await.expect("task panicked"); | ||
| } |
There was a problem hiding this comment.
i believe this may not actually be necessary if the tests are being compiled with panic = "abort"? but probably good to do anyway
| /// *complete* sitrep (no torn reads). Errors (e.g. `NotFound`) are | ||
| /// expected and fine — partial data is not. | ||
| /// | ||
| /// Writers race with each other, causing `ParentNotCurrent` failures. |
There was a problem hiding this comment.
I think we expect that one of the racing writers will always win and the rest will fail with ParentNotCurrent or whatever, is that right? Is there any possibility that all writers will fail, such that the test wouldn't make progress?
There was a problem hiding this comment.
if exactly one racing writer doesn't always win, then we have much worse problems :)
There was a problem hiding this comment.
^ yeah, we are spinning waiting for a "minimum number of successful inserts", but there really is no reason why "all of them" would fail - one should reliably be getting through.
Follow-up to #10143
Adds pagination during sitrep garbage collection.
While I was there, I realized that we actually don't need transactions on the delete pathway anymore.
fm_sitreprows, which immediately orphans all other sub-tables within the sitrep.fm_sitrep_read_on_conn, which reads metadata fromfm_sitreplast. If this sitrep can be read: it has not been deleted yet. If this sitrep cannot be read: it has been deleted, and prior reads can be discarded.fm_sitreptable first, the child rows are "not orphaned" (won't be GC-ed). This protection lasts for the duration offm_sitrep_insert, OR until the parent sitrep is marked stale - at which point insert should fail anyway.All this is to say: the "read" and "insert" pathways function fine if a
fm_sitreprow is deleted non-atomically before subsequent child rows. Therefore: no transaction is necessary here.