FuelLabs / fuel-indexer

*Archived* 🗃 The Fuel indexer is a standalone service that can be used to index various components of the Fuel blockchain.
140 stars 67 forks source link

feature: internal block store for backfilling newly-deployed indexers #990

Open deekerno opened 1 year ago

deekerno commented 1 year ago

From a message I sent in a discussion on Slack about #932:

Here’s what I would consider the “gold standard”:

  1. Have an internal table/DS that holds BlockData somehow, so we don’t have to hit the client again.
  2. Re-enable/fix forc index revert.
  3. Upon re-deploying an indexer with saved data, inform the user that the tables from the previous version have been renamed for backup purposes, and if needed, the old indexer and its tables can be restored through the use of forc index revert.
  4. Begin backfilling from the internal block table.
  5. Once the last persisted block is added, set the indexer’s executor to request for blocks starting with last_persisted_block + 1.
  6. In the case that there is another re-deployment, we then do the following:
    • Rename the already-renamed tables to a temp table name
    • Rename the currently used tables to the backup name
    • Delete the tables that are now two versions old.
    • Go to step 3.

In short, we should consider having a local store for blocks. I feel the main benefits of this feature are three-fold:

Concerns for this approach:

ra0x3 commented 1 year ago
ra0x3 commented 1 year ago

@lostman Will this issue be handled by #1150 ?

lostman commented 1 year ago

@ra0x3, no, that's only for missing blocks. Initially both were handled by a single PR: https://github.com/FuelLabs/fuel-indexer/pull/1297 but I split the missing blocks out. Missing blocks will be merged first and I'm bringing https://github.com/FuelLabs/fuel-indexer/pull/1297 up to date to reflect this.