Repository navigation
Conversation
`Batch::append_inner` moved `block_ptr`, `block_times` and `firehose_cursor` onto `self` before appending the row groups, and only `mods.append` can refuse the batch. A refused append therefore left the batch pointing at the block it had rejected while holding only the changes of the blocks before it. `append` then set `self.error`, and the write queue refuses to write a batch that carries one, so the valid blocks were dropped and the failure poisoned the queue. A failed deployment's head depended on the batching settings rather than on its data: with batching on it stayed at the start of the batch, with `GRAPH_STORE_WRITE_BATCH_DURATION=0` it reached the block before the failure. The row groups now go first, before any other field moves, so a refused append leaves the batch exactly as it was. With nothing half-applied there is no indeterminate state to guard against, so `append` no longer records the error and the batch stays writable: writing it afterwards records the blocks that were valid and the head stops where the failure did. The test appends an immutable insert across two blocks, which `append_row` refuses, and asserts the pointer stays on the first block and that the batch carries no error. Both assertions fail without the change. Signed-off-by: Liang Xu <24490353+lx3133584@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Batch::append_innermovedblock_ptr,block_timesandfirehose_cursorontoselfbefore appending the row groups, and onlymods.appendcan refuse the batch. A refused append therefore left the batch pointing at the block it had rejected while holding only the changes of the blocks before it.appendthen setself.error, and the write queue refuses to write a batch that carries one (store/postgres/src/writable.rs,Request::Write), so the valid blocks were dropped and the failure poisoned the queue.A failed deployment's head depended on the batching settings rather than on its data:
GRAPH_STORE_WRITE_BATCH_DURATION=0That is what #6793 reports, and it is why a graft whose base fails a few blocks after the graft block never reaches it when batching is on.
Fix
The row groups go first, before any other field moves:
With nothing half-applied, a refused append leaves the batch exactly as it was, so there is no indeterminate state for
self.errorto guard against.appendno longer records the error and the batch stays writable: writing it afterwards records the blocks that were valid, and the head stops where the failure did. The error still reaches the caller, which reports the failure as before.Batch::appendhas one caller (writable.rs,Queue::push_write), and after this changeBatch::erroris written only byrollup.rs, which is a different failure.Testing
failed_append_keeps_the_block_pointerbuilds two batches and appends an immutable insert across blocks 1 and 2, whichappend_rowrefuses. It asserts the pointer stays on block 1 and that the batch carries no error. Both assertions fail on the previous code: the pointer reads 2, and the batch carries the error that would have poisoned the queue.cargo test -p graph --lib store::write— 9 passedcargo test -p graph --lib— 538 passed, 3 failed. The three arecomponents::link_resolver::ipfs::*, which dial127.0.0.1:5001; there is no IPFS here, and they do not touchstore::write.cargo test --workspace --exclude graph-tests— the commandjust test-unitruns, so the whole workspace and every target. 4 crates pass;gnd'sgnd_testfails 6 of 7, all atpgtemp'srun_db.rswithFailed to start initdb. Is it installed and on your path?— the test harness starts a throwaway PostgreSQL and this machine has the client library but not the server binaries. It fails before reaching any code.cargo check -p graph-store-postgres— clean, so the crate that consumesBatchstill compilescargo fmt --all— no changecargo clippy --all-targets— no warnings, the same commandjust lintrunscargo check --release— clean, every crate in the workspace, the same commandjust check --releaserunsNot run: the integration tests, which need PostgreSQL on 5432, IPFS on 5001 and Anvil on 3021.
Fixes #6793