segmented_changelog: update idmap version before writing idmap in seeder

Summary:
We are also going to make update the IdMapVersionStore before we start writing
the IdMap.  This means that if we crash while writing the IdMap, future runs
don't try to use the same IdMapVersion that we used previously.

Reviewed By: quark-zju

Differential Revision: D27145097

fbshipit-source-id: b911e2dca32d0fe8ae0aead3de75373dd2f936c4
This commit is contained in:
Stefan Filip 2021-03-18 09:49:59 -07:00 committed by Facebook GitHub Bot
parent 11454ae053
commit cd6d171167

View File

@ -84,11 +84,6 @@ impl SegmentedChangelogSeeder {
.set(&ctx, sc_version)
.await
.context("error updating segmented changelog version store")?;
// Update IdMapVersion
self.idmap_version_store
.set(&ctx, self.idmap_version)
.await
.context("updating idmap version")?;
info!(
ctx.logger(),
"successfully finished seeding segmented changelog",
@ -135,6 +130,13 @@ impl SegmentedChangelogSeeder {
update::update_iddag(ctx, &mut iddag, &start_state, &mem_idmap, head_vertex)?;
// Update IdMapVersion
self.idmap_version_store
.set(&ctx, self.idmap_version)
.await
.context("updating idmap version")?;
update::update_idmap(ctx, &idmap, &mem_idmap).await?;
let owned = OwnedSegmentedChangelog::new(iddag, idmap);