Skip to content

Commit

Permalink
fix chunk_to_commit.is_reconfig
Browse files Browse the repository at this point in the history
this resulted in last state checkpoint of every chunk being persisted to
db and persisted synchronously on the critical path, except the epoch
endings.
  • Loading branch information
msmouse committed Nov 7, 2024
1 parent f08cd51 commit fe0b542
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion execution/executor-types/src/state_compute_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl StateComputeResult {
.state_updates_before_last_checkpoint
.as_ref(),
sharded_state_cache: Some(&self.execution_output.state_cache.sharded_state_cache),
is_reconfig: self.execution_output.block_end_info.is_some(),
is_reconfig: self.execution_output.next_epoch_state.is_some(),
}
}
}
12 changes: 12 additions & 0 deletions storage/aptosdb/src/db/include/aptosdb_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,18 @@ impl AptosDB {
current_epoch,
);

// Ensure that state tree at the end of the epoch is persisted
if ledger_info_with_sig.ledger_info().ends_epoch() {
let state_snapshot = self.state_store.get_state_snapshot_before(version + 1)?;
ensure!(
state_snapshot.is_some()
&& state_snapshot.unwrap().0 == version,
"State checkpoint not persisted at the end of the epoch, version {}, epoch {}",
version,
ledger_info_with_sig.ledger_info().epoch(),
);
}

// Put write to batch.
self.ledger_db
.metadata_db()
Expand Down

0 comments on commit fe0b542

Please sign in to comment.