Publish cellular births with durable control
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 43s
Foundation / checks (ecs) (push) Successful in 1m52s
Foundation / checks (postgres) (push) Failing after 52s
Foundation / checks (tsan) (push) Failing after 32s
Foundation / checks (network) (push) Failing after 3m4s
Foundation / checks (client) (push) Failing after 4m24s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-11 00:44:57 -04:00
parent b4fe9e7628
commit bb6e00ebca
14 changed files with 458 additions and 25 deletions
+23 -3
View File
@@ -55,6 +55,7 @@ bool prepared_is_canonical(const CellularPreparedCommit& prepared,
manifest.end_tick)
: std::expected<std::vector<std::uint8_t>, server::CellularActionBlockError>{
std::unexpected{server::CellularActionBlockError::format}};
const auto encoded_trace = server::encode_cellular_batch(trace);
const auto digest = sha256(prepared.trace);
return manifest.profile == CheckpointProfile::cellular_lives_v1 &&
manifest.key == prepared.key && manifest.commit == prepared.commit &&
@@ -66,7 +67,8 @@ bool prepared_is_canonical(const CellularPreparedCommit& prepared,
trace.header.predecessor == manifest.predecessor_commit &&
trace.header.predecessor_digest == manifest.predecessor_digest &&
trace.header.begin_tick == manifest.begin_tick && trace.header.end_tick == manifest.end_tick &&
encoded_actions && *encoded_actions == prepared.actions;
encoded_actions && *encoded_actions == prepared.actions && encoded_trace &&
*encoded_trace == prepared.trace;
}
} // namespace
@@ -135,7 +137,8 @@ retry_cellular_prepared(Postgres& db, const CellularPreparedCommit& prepared,
auto trace = server::decode_cellular_batch(prepared.trace);
if (!manifest || !trace || !prepared_is_canonical(prepared, *manifest, *trace))
return std::unexpected{failure(PublicationError::candidate)};
auto result = publish_cellular_checkpoint(db, prepared.manifest, {}, prepared.actions, timeout);
auto result = publish_cellular_checkpoint(db, prepared.manifest, {}, prepared.actions,
prepared.trace, timeout);
if (!result) {
return std::unexpected{failure(
result.error().kind == LeaseStoreError::unknown ? PublicationError::unknown
@@ -153,7 +156,7 @@ resolve_cellular_prepared(Postgres& db, const CellularPreparedCommit& prepared,
if (!manifest || !trace || !prepared_is_canonical(prepared, *manifest, *trace))
return std::unexpected{LeaseStoreFailure{LeaseStoreError::invalid, {}}};
return resolve_cellular_region_commit(db, prepared.key, prepared.commit, prepared.manifest,
{}, prepared.actions, timeout);
{}, prepared.actions, prepared.trace, timeout);
}
std::expected<PublishedCellularBatch, CellularPublicationFailure>
@@ -278,6 +281,23 @@ recover_cellular_checkpoint(Postgres& db, const FilesystemObjectStore& objects,
trace->header.end_tick != manifest->end_tick)
return fail_with(RecoveryError::tail);
auto committed_births = load_cellular_publication_births(db, key, lease,
manifest->commit, timeout);
if (!committed_births)
return std::unexpected{RecoveryFailure{RecoveryError::store,
committed_births.error()}};
std::vector<CellularBirthBinding> traced_births;
for (std::size_t tick_index = 0; tick_index < trace->ticks.size(); ++tick_index) {
for (const auto& birth : trace->ticks[tick_index].births) {
traced_births.push_back({birth.account, manifest->commit, birth.request,
birth.identity,
manifest->begin_tick + tick_index + 1,
manifest->sequence});
}
}
if (traced_births != *committed_births)
return fail_with(RecoveryError::history);
auto predecessor = load_region_commit(db, key, manifest->sequence - 1, timeout);
if (!predecessor)
return std::unexpected{RecoveryFailure{RecoveryError::tail, predecessor.error()}};