-
Notifications
You must be signed in to change notification settings - Fork 67
Conversation
9a0b392
to
80e2488
Compare
80e2488
to
d746dc9
Compare
a1fd7e0
to
bd10230
Compare
bd10230
to
56f2430
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a first pass, left a few comments.
I have one suggestion and one question:
- "We need a mechanism for Fuel Indexer to recognize this situation, remove the stale data, and proceed with syncing blocks from scratch."
-- I'm thinking that since there's no way to do reflection, we can serialize the types of each field of theBlockData
struct signature into an arbitrary byte string and store that in a single row of a table. Then, at start-up, we serialize theBlockData
type in use and compare it against the persisted byte string. If they don't match, then a re-sync of formerly saved blocks should start. - Has any testing been done as to whether latency will added by forcing indexers to wait for blocks by hitting a database on a loop? If so, how significant is the slowdown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I see I'm still ping'd for review on this.
- However given @deekerno's feedback and the conflicts I'll just defer my review :)
e2bb077
to
cd75175
Compare
cd75175
to
094e4ba
Compare
@deekerno, I've added a function that checks for No versioning. Pull some blocks, serialize, and compare. Once, at startup. I couldn't think of any other way to check this automatically. Versioning could work, but it would be manual—we would have to bump the version number. This way feels nicer. |
|
I'll sync some blocks and see if I can run the QA tests with block store enabled. That will give us some numbers. I'll update the description once I have something. |
The logic is the same as when the indexers fetch the blocks from the client. The only difference is that they do a Or do you refer to a situation when multiple indexers are fast-forwarded and fetching blocks from the database? I haven't tested the latency, but I doubt it would be an issue. All the indexers do is a simple |
I think my concern was around the following situation:
I was wondering if this solution introduced any noticeable increase in latency, specifically at the head of the chain. But honestly, I think my concerns are probably unfounded given the benefits shown by the QA results. |
|
Description
Closes #990.
This PR adds an
index_block_data
table where we store serializedBlockData
structs. We can use these to get a new indexer up to speed without re-fetching blocks from the client.The table contains a trigger that ensures a full range of blocks—no
block_height
may be missing.--enable-block-store
and--remove-block-data
.Since block fetching is handled by a single
Block Sync
task when--enable-block-store
is on, when there is an indexer which already indexer some blocks, and the block data is removed through--remove-block-data
CLI flag, the indexer will have to wait "a while" until it can fetch any new blocks from the database.An example log output is presented below.
Checking
BlockData
format changesIn this PR, I have implemented a serialization check. When starting up, the
Block Sync
task fetches blocks from the client, serializes them, and compares them against the same blocks already in the database. If they do not match, the blocks in the database are purged and re-synced.The check is here:
https://github.com/FuelLabs/fuel-indexer/pull/1369/files#diff-c08046bf0074327316a6b1016f142fdcccc38eec1171f6e43dccd338228cb2f1R499-R518
Testing steps
Run
Fuel Indexer
with block store enabled:Restart and remove data:
Changelog
--enable-block-store
flag, which enables saving blocks in the database.--remove-block-data
flag, which causes Fuel Indexer to remove all saved blocks from the database.Block Sync
task. Only theBlock Sync
task queries the Fuel Client when'- enable-block-store' is on. The individual indexers fetch blocks from the database.Stats
QA
script with--enable-block-store
:QA
script without block store: