-
Notifications
You must be signed in to change notification settings - Fork 6
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
Create BackfillProcessorStatus Table and Write to it when backfill_alias is set #6
Conversation
… backfill alias is present
417e9c1
to
cb0d0ce
Compare
pub struct DefaultProcessorStatusSaver { | ||
pub conn_pool: ArcDbPool, | ||
pub processor_type: String, |
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.
nit: we call this processor_name
in other places, so let's rename it here too
) | ||
.await? | ||
{ | ||
Some(status) => Ok(Some(status.last_success_version as u64 + 1)), |
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.
Since we're already here, we should probably move the +1
to a higher level, this function seems like the wrong place for it.
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.
good call. it disagrees with the name of the function. We now have:
get_starting_version():
return get_latest_processed_version_from_db() + 1
…o processor_name to be consistent with codebase
dependent on #8
cherry picked from PR in old repo structure
Purpose
Repoint backfill processors to write to the new
backfill_processor_status
table instead of theprocessor_status
table so that backfill processors can run concurrently as head processors without having their checkpoints overwritten. Read more in design here.Technical Overview
BackfillConfig
BackfillConfig.backfill_alias
is introduced toIndexerProcessorConfig
. This optional field introduced a new logic branch inLatestVersionTracker
(saved as fieldbackfill_mode
) which writes to the new table whenbackfill_alias
isSome
(equivalently whenbackfill_mode
istrue
).The
backfill_alias
field is similarly used in theget_starting_version
logic to determine where to read from.ProcessorVersionSaverEnum
Created a
ProcessorStatusSaverEnum
for theDefaultProcessorStatusSaver
andBackfillProcessorStatusSaver
. This makes it easier to init the VersionTracker without exposing too much logic. See usage:Where
Testing
Ran a few manual tests validating existing and new behavior. Screenshots below:
Regular processor working as expected. No backfillconfig set.
Backfill processor starting from genesis and writing to new table. Backfillconfig.backfill_alias set to
events_processor_backfill_1
:Backfill processor picking up where it left off (see bottom):
Backfill processor starting from
starting_version