Fix corrupted Dynamic Contracts table on restart - #416
Merged
Conversation
Member
Author
|
@JasoonS Ignore the failing test. The logic is correct |
JasoonS
reviewed
Jan 14, 2025
| entity_history_block_number > ${restartBlockNumber} | ||
| OR entity_history_block_number = ${restartBlockNumber} | ||
| AND entity_history_log_index > ${restartLogIndex} | ||
| );`; |
Contributor
There was a problem hiding this comment.
I guess the other option is that instead of deleting them on restart, we upsert them, but agree that deleting makes things consistent between restart runs and runs without restarts and removes potential for strange behavior on edge cases. 👍
JasoonS
reviewed
Jan 14, 2025
| * This function allows a chain fetcher to be created from metadata, in particular this is useful for restarting an indexer and making sure it fetches blocks from the same place. | ||
| */ | ||
| let makeFromDbState = async (chainConfig: Config.chainConfig, ~maxAddrInPartition) => { | ||
| let makeFromDbState = async (chainConfig: Config.chainConfig, ~maxAddrInPartition, ~sql=Db.sql) => { |
Contributor
There was a problem hiding this comment.
Is there any significance in passing the sql as a parameter here?
Member
Author
There was a problem hiding this comment.
This is to pass a transaction context in tests, so I can rollback dynamic contracts after they are deleted
Contributor
There was a problem hiding this comment.
Ok, it is to make it easier to test I assume - nice 👍
JasoonS
approved these changes
Jan 14, 2025
DZakh
added a commit
that referenced
this pull request
Jan 14, 2025
* Fix corrupted Dynamic Contracts table on restart * Add a few more test cases * Fix test
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.
Case:
Solution:
Clean up dcs after a restart point from db, two prevent the invalid state.