Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup batches to a separate table when batches table get emptied #114

Merged
merged 2 commits into from
Apr 8, 2024

Conversation

Stefan-Ethernal
Copy link
Collaborator

@Stefan-Ethernal Stefan-Ethernal commented Apr 3, 2024

The PR introduces the batch_data_backup to the state_db, which creates backup of all the batches in case the trusted state gets resetted as part of the fork id upgrade.

func (p *PostgresStorage) ResetTrustedState(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error {
const resetTrustedStateSQL = "DELETE FROM state.batch WHERE batch_num > $1"
e := p.getExecQuerier(dbTx)
if _, err := e.Exec(ctx, resetTrustedStateSQL, batchNumber); err != nil {
return err
}
return nil
}

@Stefan-Ethernal Stefan-Ethernal self-assigned this Apr 3, 2024
@Stefan-Ethernal Stefan-Ethernal marked this pull request as ready for review April 3, 2024 12:49
@Stefan-Ethernal Stefan-Ethernal requested a review from a team as a code owner April 3, 2024 12:49
@Stefan-Ethernal Stefan-Ethernal merged commit d613b2d into develop Apr 8, 2024
18 checks passed
@Stefan-Ethernal Stefan-Ethernal deleted the CDK-132-data-recovery-mechanism branch April 8, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants