[nexus] avoid loading torn sitreps #9627
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit fixes #9594 with regards to the sitrep load/delete operations.1
It makes the following changes:
fm_sitrep_readquery so that the sitrep metadata record is loaded last, and any loaded records are discarded should the metadata record no longer exist. This allows us to detect whether we have read a torn sitrep due to a concurrent delete (cda4f4d)fm_sitrep_delete_allquery to use a transaction. The query is still a batched delete of multiple sitrep IDs, but this should be fine as the query does notSELECTthe IDs to delete itself, and should therefore create a CRDB "write intent" only on the deleted rows. (1f0d6d9)fm_sitrep_delete_allquery, adding a guard against deleting the current sitrep and changing the log level to INFO to match the similar blueprint/inventory delete queries. This isn't strictly necessary to fix It's possible to load a torn blueprint / sitrep / inventory #9594, but seemed worthwhile to do while I was here (0251720)fm_sitrep_read_currentto correctly handle situations where it loads the current sitrep ID, and then, before it loads the sitrep records, a new sitrep is made current and the previous one is deleted (5f9b831)Footnotes
Which should be sufficient to close that issue, as Reorder blueprint read to the end of loading #9603 and Reorder inventory read to the end of loading #9604 already fixed the blueprint and inventory collection sides of the issue. ↩