Repository navigation
Conversation
…orward The direction check in `rewind` and `truncate` built an `internal_error!` but never returned it, so `graphman rewind` to a block above the current head moved the head forward and skipped the blocks in between. Return the error, and only reject targets above the current head. Rewinding to the current head stays allowed since it is used to clear a failed state. Fixes graphprotocol#6803
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.
DeploymentStore::rewindandtruncatecheck the direction of the move, but they build theinternal_error!without returning it.graphman rewindto a block above the current head therefore moves the head forward, and the blocks in between are never indexed.Changes:
<instead of<=, so only a target above the current head is rejected. Rewinding to the current head has always worked, and thefile_data_sourcesrunner test relies on it: it rewinds to the head to clear a failed state. With<=that test fails withrewind must go backwards, but would go from block 4 to block 4.rewind_and_truncate_refuse_to_move_forward. The deployment's head is at block 2. The test checks that rewind and truncate to block 4 both fail, that the head and the entity count stay the same, and that rewinding to block 2 still works.Testing, run locally against Postgres 17 with
THEGRAPH_STORE_POSTGRES_DIESEL_URL=postgresql://graph:graph@127.0.0.1:5432/graph-test:cargo test -p test-store --test postgres -- store::rewind_and_truncate_refuse_to_move_forward: fails on master ("rewind to a later block must fail") and passes with the fix.cargo test -p graph-store-postgres -p test-store: all pass (postgres suite: 113 passed).cargo test -p graph-tests --test runner_tests: 16 passed.just format,just lint(no warnings) andcargo check --release -p graph-store-postgresare clean.Fixes #6803