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

[Draft] multi chain rewind #2627

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

[Draft] multi chain rewind #2627

wants to merge 1 commit into from

Conversation

yoozo
Copy link
Collaborator

@yoozo yoozo commented Dec 12, 2024

Description

In a multi-chain project, after enabling historical mode, a rewind requires coordination with other processes for rollback. Below are the tasks we need to accomplish.

Fixes # (issue)
#2620

TODO

  • cold start requires rollback execution.
  • A pause mechanism is needed where all fetch processes stop in case of a rollback.
  • A logger notification is needed when the API fetch is paused.
  • Before performing the write, check if _global.rewind_lock exist. If they do, perform a rollback.
  • When starting the process, check if rewind_timestamp exists. If it does, perform a rewind.
  • Check if _global contain the rewind_timestamp. If none exist, release _global.rewind_lock.
  • Retrieve the corresponding block height to roll back to using a timestamp, It may require using the binary search method.
  • Use a DB notify/trigger to notify a cooperating process.
  • Extract global lock logic into a separate file.
  • Remove the delay in fetch.service.
  • Modify the lock handling logic to ensure correct release under concurrent conditions. (Add a rewindNum field to rewindLock to ensure the remaining processing count is correct when the lock is released.)
  • When flushing the fetch queue, prevent the currently processing block from being persisted.
  • Test cases for related scenarios.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I have tested locally
  • I have performed a self review of my changes
  • Updated any relevant documentation
  • Linked to any relevant issues
  • I have added tests relevant to my changes
  • Any dependent changes have been merged and published in downstream modules
  • My code is up to date with the base branch
  • I have updated relevant changelogs. We suggest using chan

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.

1 participant