Add M10.4b durable action records (schema v11)
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m47s
Foundation / checks (network) (push) Successful in 9m30s
Foundation / checks (client) (push) Successful in 12m19s
Foundation / checks (tsan) (push) Successful in 7m43s
Foundation / checks (checks) (push) Successful in 31m29s
Foundation / checks (postgres) (push) Successful in 36m39s
Foundation / postgres-tools (push) Successful in 19s
Foundation / image (push) Successful in 2m15s
Foundation / server-image (push) Successful in 20m37s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m47s
Foundation / checks (network) (push) Successful in 9m30s
Foundation / checks (client) (push) Successful in 12m19s
Foundation / checks (tsan) (push) Successful in 7m43s
Foundation / checks (checks) (push) Successful in 31m29s
Foundation / checks (postgres) (push) Successful in 36m39s
Foundation / postgres-tools (push) Successful in 19s
Foundation / image (push) Successful in 2m15s
Foundation / server-image (push) Successful in 20m37s
Each batch's actions are recorded in the same statement as its checkpoint: one region_actions row per (world, account, action id) and the block in an append-only table, compared on exact retries and resolution. The region host attaches actions to the ticks they ride and reports acknowledgements and drops, keeping unknown-outcome batches unresolved. Outcomes come from the durable record via ActionLedger, so crashes before or after a commit, unknown publications and cross-region moves all resolve to one answer; a repeated id keeps its first record instead of stalling a region. ADR-0092. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -49,7 +49,7 @@ publish_batch(Postgres& db, const FilesystemObjectStore& objects, const LeaseGra
|
||||
const CommittedCheckpoint& predecessor,
|
||||
const RegionBatch<typename Codec::State>& batch, Uuid commit,
|
||||
const Sha256Digest& build, std::size_t budget, milliseconds timeout,
|
||||
const PublishHooks& hooks) {
|
||||
const PublishHooks& hooks, std::span<const ActionRecord> actions) {
|
||||
const auto previous = decode_manifest(predecessor.manifest);
|
||||
if (!previous || previous->profile != Codec::profile || !batch.sealed() ||
|
||||
batch.steps().empty() || batch.begin_tick() != previous->end_tick)
|
||||
@@ -81,7 +81,8 @@ publish_batch(Postgres& db, const FilesystemObjectStore& objects, const LeaseGra
|
||||
batch.begin_tick(),
|
||||
batch.end_tick()};
|
||||
auto trace = encode_trace(header, batch.steps());
|
||||
if (!decision_bytes || !trace)
|
||||
auto action_bytes = encode_actions(actions, batch.begin_tick(), batch.end_tick());
|
||||
if (!decision_bytes || !trace || !action_bytes)
|
||||
return std::unexpected{fail(PublicationError::candidate)};
|
||||
const auto payload_digest = sha256(*payload);
|
||||
const auto trace_digest = sha256(*trace);
|
||||
@@ -104,10 +105,10 @@ publish_batch(Postgres& db, const FilesystemObjectStore& objects, const LeaseGra
|
||||
if (auto stored = put_verified(objects, *trace, {*trace_digest, trace->size()}); !stored)
|
||||
return std::unexpected{stored.error()};
|
||||
|
||||
PreparedCommit prepared{previous->key, commit, *bytes, *decision_bytes};
|
||||
PreparedCommit prepared{previous->key, commit, *bytes, *decision_bytes, *action_bytes};
|
||||
if (hooks.before_transaction)
|
||||
hooks.before_transaction();
|
||||
auto published = publish_region_checkpoint(db, *bytes, *decision_bytes, timeout);
|
||||
auto published = retry_prepared(db, prepared, timeout);
|
||||
auto committed = confirm(published, std::move(*bytes), *manifest, std::move(prepared));
|
||||
if (!committed)
|
||||
return std::unexpected{committed.error()};
|
||||
@@ -128,9 +129,10 @@ publish_environmental_batch(Postgres& db, const FilesystemObjectStore& objects,
|
||||
const LeaseGrant& lease, const CommittedCheckpoint& predecessor,
|
||||
const RegionBatch<processes::EnvironmentalCommunity>& batch,
|
||||
Uuid commit, const Sha256Digest& build, std::size_t restore_budget,
|
||||
milliseconds timeout, const PublishHooks& hooks) {
|
||||
milliseconds timeout, const PublishHooks& hooks,
|
||||
std::span<const ActionRecord> actions) {
|
||||
return publish_batch<EnvironmentalCodec>(db, objects, lease, predecessor, batch, commit, build,
|
||||
restore_budget, timeout, hooks);
|
||||
restore_budget, timeout, hooks, actions);
|
||||
}
|
||||
std::expected<RecoveredCheckpoint, RecoveryFailure>
|
||||
recover_environmental_checkpoint(Postgres& db, const FilesystemObjectStore& objects, RegionKey key,
|
||||
@@ -152,9 +154,9 @@ publish_lineage_batch(Postgres& db, const FilesystemObjectStore& objects, const
|
||||
const CommittedCheckpoint& predecessor,
|
||||
const RegionBatch<processes::LineageRegion>& batch, Uuid commit,
|
||||
const Sha256Digest& build, std::size_t restore_budget, milliseconds timeout,
|
||||
const PublishHooks& hooks) {
|
||||
const PublishHooks& hooks, std::span<const ActionRecord> actions) {
|
||||
return publish_batch<LineageCodec>(db, objects, lease, predecessor, batch, commit, build,
|
||||
restore_budget, timeout, hooks);
|
||||
restore_budget, timeout, hooks, actions);
|
||||
}
|
||||
std::expected<RecoveredLineageCheckpoint, RecoveryFailure>
|
||||
recover_lineage_checkpoint(Postgres& db, const FilesystemObjectStore& objects, RegionKey key,
|
||||
@@ -165,11 +167,18 @@ recover_lineage_checkpoint(Postgres& db, const FilesystemObjectStore& objects, R
|
||||
|
||||
std::expected<ResolvedCommit, LeaseStoreFailure>
|
||||
resolve_prepared(Postgres& db, const PreparedCommit& prepared, milliseconds timeout) {
|
||||
if (!prepared.actions.empty())
|
||||
return resolve_region_commit(db, prepared.key, prepared.commit, prepared.manifest,
|
||||
prepared.decisions, prepared.actions, timeout);
|
||||
return resolve_region_commit(db, prepared.key, prepared.commit, prepared.manifest,
|
||||
prepared.decisions, timeout);
|
||||
}
|
||||
std::expected<RegionHead, LeaseStoreFailure>
|
||||
retry_prepared(Postgres& db, const PreparedCommit& prepared, milliseconds timeout) {
|
||||
// Without actions the schema v5 publication is used, exactly as before v11.
|
||||
if (!prepared.actions.empty())
|
||||
return publish_region_checkpoint(db, prepared.manifest, prepared.decisions,
|
||||
prepared.actions, timeout);
|
||||
return publish_region_checkpoint(db, prepared.manifest, prepared.decisions, timeout);
|
||||
}
|
||||
} // namespace evo::persistence
|
||||
|
||||
Reference in New Issue
Block a user