Implement M7.4a checkpoint publication and verified recovery
ADR-0061 publishes environmental-v1 full checkpoints. Manifest v1 is a fixed 280-byte record (identity, chain, lease, versions, build, zero RNG/history declarations, durability policy, payload length/SHA-256) that PostgreSQL parses and digests itself. Schema v3 adds region_commits with a digest CHECK and a composite head FK, owner-managed retained builds, fenced publish/load functions and owner-only genesis; it drops the bare v2 head kernel and fails closed while v2 heads exist. Linux evo::region_store adds OpenSSL SHA-256, an immutable content-addressed filesystem object store (temp+fsync+link, no overwrite/delete, O_NOFOLLOW exact-length verified reads), and publication (validate -> upload -> read back -> fenced transaction -> receipt check) and recovery (re-digest, allowlist, verify, full restore). Portable evo::region_checkpoint holds the codec and payload validation. Validated: Windows CTest 56/56; WSL Release, clang-tidy and ASan/UBSan private-PostgreSQL suites; four SQL and one host mutation each caught. M7.4 stays open for 7.4b (lineage archive codec and history binding). No Docker/Gitea CI, remote store, process kill or deployment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
// Real PostgreSQL M7.3 fencing checks (ADR-0060). Run by tools/ci/postgres-check.sh.
|
||||
// Real PostgreSQL M7.3 fencing checks (ADR-0060), publishing M7.4 manifests
|
||||
// (ADR-0061) with synthetic payload digests. Run by tools/ci/postgres-check.sh.
|
||||
#include "evo/persistence/region_checkpoint.hpp"
|
||||
#include "evo/persistence/region_lease_store.hpp"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
@@ -8,6 +10,7 @@
|
||||
#include <latch>
|
||||
#include <memory>
|
||||
#include <source_location>
|
||||
#include <span>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
@@ -52,29 +55,76 @@ Sha256Digest digest(std::uint8_t seed) {
|
||||
out.fill(seed);
|
||||
return out;
|
||||
}
|
||||
std::string hex_text(std::uint8_t seed, std::size_t bytes) {
|
||||
const Sha256Digest build = digest(0xB1);
|
||||
void retain_build(Postgres& db) {
|
||||
CHECK(db.query("INSERT INTO evolution.retained_builds(build_identity) VALUES "
|
||||
"(decode(repeat('b1', 32), 'hex')) ON CONFLICT DO NOTHING",
|
||||
{}, 5s));
|
||||
}
|
||||
std::string bytea(std::span<const std::uint8_t> bytes) {
|
||||
constexpr char digits[] = "0123456789abcdef";
|
||||
std::string out;
|
||||
for (std::size_t i = 0; i < bytes; ++i) {
|
||||
out.push_back(digits[seed >> 4U]);
|
||||
out.push_back(digits[seed & 0x0FU]);
|
||||
std::string out = "\\x";
|
||||
for (const auto b : bytes) {
|
||||
out.push_back(digits[b >> 4U]);
|
||||
out.push_back(digits[b & 0x0FU]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
std::string uuid_literal(std::uint8_t seed) {
|
||||
const auto h = hex_text(seed, 16);
|
||||
return h.substr(0, 8) + '-' + h.substr(8, 4) + '-' + h.substr(12, 4) + '-' + h.substr(16, 4) +
|
||||
'-' + h.substr(20);
|
||||
}
|
||||
// Genesis commit/digest bytes are the region number; frame is 7.
|
||||
// Genesis commit ID bytes are the region number; frame is 7. Payload digests are
|
||||
// synthetic: the database records them and never reads the object store.
|
||||
RegionKey provision(Postgres& db, std::uint64_t region) {
|
||||
const auto seed = static_cast<std::uint8_t>(region);
|
||||
const std::array<std::string, 4> p{std::to_string(region), uuid_literal(seed),
|
||||
"\\x" + hex_text(seed, 32), "7"};
|
||||
CHECK(db.query("SELECT evolution.provision_region(1, $1::evolution.u64, $4::evolution.u64, "
|
||||
"$2::uuid, $3::bytea)",
|
||||
p, 5s));
|
||||
return {1, region};
|
||||
retain_build(db);
|
||||
const RegionKey key{1, region};
|
||||
auto g = genesis_manifest(key, 7, id(static_cast<std::uint8_t>(region)), 50000, build, 100,
|
||||
digest(0xA0));
|
||||
CHECK(g);
|
||||
auto bytes = encode_manifest(*g);
|
||||
CHECK(bytes);
|
||||
const std::array<std::string, 1> p{bytea(*bytes)};
|
||||
CHECK(db.query("SELECT evolution.provision_region_checkpoint($1::bytea)", p, 5s));
|
||||
return key;
|
||||
}
|
||||
CommittedCheckpoint committed(Postgres& db, RegionKey key) {
|
||||
auto c = load_region_checkpoint(db, key, 5s);
|
||||
CHECK(c);
|
||||
return std::move(*c);
|
||||
}
|
||||
// Successor fields set directly, so tests can send links the local builder refuses.
|
||||
CheckpointManifest link(const CommittedCheckpoint& from, const LeaseGrant& lease,
|
||||
std::uint8_t commit, std::uint64_t end_tick) {
|
||||
auto m = decode_manifest(from.manifest);
|
||||
CHECK(m);
|
||||
m->commit = id(commit);
|
||||
m->sequence = from.head.sequence + 1;
|
||||
m->predecessor_commit = from.head.commit;
|
||||
m->predecessor_digest = from.head.digest;
|
||||
m->begin_tick = from.head.end_tick;
|
||||
m->end_tick = end_tick;
|
||||
m->holder = lease.holder;
|
||||
m->epoch = lease.epoch;
|
||||
m->payload_sha256 = digest(0xA1);
|
||||
return *m;
|
||||
}
|
||||
std::expected<CommittedCheckpoint, LeaseStoreFailure> publish(Postgres& db,
|
||||
std::vector<std::uint8_t> bytes) {
|
||||
auto head = publish_region_checkpoint(db, bytes, 5s);
|
||||
if (!head)
|
||||
return std::unexpected{head.error()};
|
||||
return CommittedCheckpoint{*head, std::move(bytes)};
|
||||
}
|
||||
std::expected<CommittedCheckpoint, LeaseStoreFailure> publish(Postgres& db,
|
||||
const CheckpointManifest& m) {
|
||||
auto bytes = encode_manifest(m);
|
||||
CHECK(bytes);
|
||||
return publish(db, std::move(*bytes));
|
||||
}
|
||||
// Encodes a valid link, then overwrites raw bytes the encoder would refuse.
|
||||
std::vector<std::uint8_t> patched(const CheckpointManifest& m, std::size_t offset,
|
||||
std::span<const std::uint8_t> value) {
|
||||
auto bytes = encode_manifest(m);
|
||||
CHECK(bytes);
|
||||
std::ranges::copy(value, bytes->begin() + static_cast<std::ptrdiff_t>(offset));
|
||||
return std::move(*bytes);
|
||||
}
|
||||
bool failed(const auto& result, LeaseStoreError kind) {
|
||||
return !result && result.error().kind == kind;
|
||||
@@ -94,7 +144,10 @@ void runtime_cannot_bypass_the_guard() {
|
||||
"INSERT INTO evolution.region_leases(world_id,region_id,frame_id) VALUES (9,9,9)",
|
||||
"SELECT * FROM evolution.region_leases",
|
||||
"SELECT * FROM evolution.region_heads",
|
||||
"SELECT evolution.provision_region(1, 11, 7, gen_random_uuid(), '\\x00')",
|
||||
"SELECT evolution.provision_region_checkpoint('\\x00')",
|
||||
"SELECT * FROM evolution.region_commits",
|
||||
"INSERT INTO evolution.retained_builds VALUES ('\\x00')",
|
||||
"SELECT evolution.parse_checkpoint_manifest('\\x00')",
|
||||
"SELECT evolution.check_region_lease(1, 10, gen_random_uuid(), 1)",
|
||||
"CREATE FUNCTION evolution.bypass() RETURNS int LANGUAGE sql AS 'SELECT 1'",
|
||||
"CREATE TABLE evolution.bypass(x int)",
|
||||
@@ -110,7 +163,7 @@ void runtime_cannot_bypass_the_guard() {
|
||||
CHECK(release_region_lease(*db, key, *lease, 5s));
|
||||
}
|
||||
|
||||
void acquire_renew_release_and_advance() {
|
||||
void acquire_renew_release_and_publish() {
|
||||
auto admin = owner();
|
||||
const auto key = provision(*admin, 20);
|
||||
auto db = runtime();
|
||||
@@ -130,39 +183,50 @@ void acquire_renew_release_and_advance() {
|
||||
stale_epoch.epoch = 2;
|
||||
CHECK(failed(renew_region_lease(*db, key, stale_epoch, 20000ms, 5s), LeaseStoreError::fenced));
|
||||
|
||||
auto genesis = load_region_head(*db, key, 5s);
|
||||
CHECK(genesis && genesis->sequence == 0 && genesis->end_tick == 0 && genesis->frame == 7);
|
||||
CHECK(genesis->commit == id(20) && genesis->digest == digest(20));
|
||||
CHECK(failed(advance_region_head(*db, key, *lease, *genesis, {id(21), digest(21), 65}, 5s),
|
||||
const auto genesis = committed(*db, key);
|
||||
CHECK(genesis.head.sequence == 0 && genesis.head.end_tick == 0 && genesis.head.frame == 7);
|
||||
CHECK(genesis.head.commit == id(20) && genesis.head.digest != Sha256Digest{});
|
||||
const std::array<std::uint8_t, 1> tick65{65};
|
||||
CHECK(failed(publish(*db, patched(link(genesis, *lease, 21, 64), 120, tick65)),
|
||||
LeaseStoreError::invalid));
|
||||
CHECK(failed(advance_region_head(*db, key, *lease, *genesis, {id(20), digest(21), 1}, 5s),
|
||||
const auto reused = id(20);
|
||||
CHECK(failed(publish(*db, patched(link(genesis, *lease, 21, 1), 40, reused)),
|
||||
LeaseStoreError::invalid));
|
||||
const HeadAdvance first{id(21), digest(21), 64};
|
||||
auto head = advance_region_head(*db, key, *lease, *genesis, first, 5s);
|
||||
CHECK(head && head->sequence == 1 && head->end_tick == 64 && head->commit == id(21));
|
||||
CHECK(failed(advance_region_head(*db, key, forged, *head, {id(22), digest(22), 65}, 5s),
|
||||
LeaseStoreError::fenced));
|
||||
// Exact retry after an applied advance: mismatch, then the head proves it committed.
|
||||
CHECK(failed(advance_region_head(*db, key, *lease, *genesis, first, 5s),
|
||||
LeaseStoreError::head_mismatch));
|
||||
auto current = load_region_head(*db, key, 5s);
|
||||
CHECK(current && *current == *head);
|
||||
auto changed = *head;
|
||||
changed.digest[31] ^= 1U;
|
||||
CHECK(failed(advance_region_head(*db, key, *lease, changed, {id(22), digest(22), 65}, 5s),
|
||||
LeaseStoreError::head_mismatch));
|
||||
CHECK(failed(advance_region_head(*db, key, *lease, *head, {id(22), digest(22), 64}, 5s),
|
||||
const auto first = link(genesis, *lease, 21, 64);
|
||||
auto head = publish(*db, first);
|
||||
CHECK(head && head->head.sequence == 1 && head->head.end_tick == 64 &&
|
||||
head->head.commit == id(21));
|
||||
CHECK(failed(publish(*db, link(*head, forged, 22, 65)), LeaseStoreError::fenced));
|
||||
// Exact retry after an applied publication: mismatch, then the head proves it.
|
||||
CHECK(failed(publish(*db, first), LeaseStoreError::head_mismatch));
|
||||
auto current = committed(*db, key);
|
||||
CHECK(current.head == head->head && current.manifest == head->manifest);
|
||||
auto changed = link(*head, *lease, 22, 65);
|
||||
changed.predecessor_digest[31] ^= 1U;
|
||||
CHECK(failed(publish(*db, changed), LeaseStoreError::head_mismatch));
|
||||
const std::array<std::uint8_t, 1> tick64{64};
|
||||
CHECK(failed(publish(*db, patched(link(*head, *lease, 22, 65), 120, tick64)),
|
||||
LeaseStoreError::invalid));
|
||||
auto other_quantum = link(*head, *lease, 22, 65);
|
||||
other_quantum.tick_microseconds = 25000; // Fixed per region; changing it is a migration.
|
||||
CHECK(failed(publish(*db, other_quantum), LeaseStoreError::unsupported));
|
||||
auto unretained = link(*head, *lease, 22, 65);
|
||||
unretained.build = digest(0xB2);
|
||||
CHECK(failed(publish(*db, unretained), LeaseStoreError::unsupported));
|
||||
auto future = link(*head, *lease, 22, 65);
|
||||
future.versions.rules = 3;
|
||||
CHECK(failed(publish(*db, future), LeaseStoreError::unsupported));
|
||||
// Commit IDs are globally unique: region 10's genesis ID cannot be reused here.
|
||||
CHECK(failed(publish(*db, link(*head, *lease, 10, 65)), LeaseStoreError::commit_conflict));
|
||||
|
||||
CHECK(release_region_lease(*db, key, *lease, 5s));
|
||||
CHECK(failed(release_region_lease(*db, key, *lease, 5s), LeaseStoreError::fenced));
|
||||
CHECK(failed(renew_region_lease(*db, key, *lease, 20000ms, 5s), LeaseStoreError::fenced));
|
||||
CHECK(failed(advance_region_head(*db, key, *lease, *head, {id(22), digest(22), 65}, 5s),
|
||||
LeaseStoreError::fenced));
|
||||
CHECK(failed(publish(*db, link(*head, *lease, 22, 65)), LeaseStoreError::fenced));
|
||||
auto next = acquire_region_lease(*db, key, 20000ms, 5s);
|
||||
CHECK(next && next->epoch == 2 && next->holder != lease->holder);
|
||||
auto final_head = advance_region_head(*db, key, *next, *head, {id(22), digest(22), 65}, 5s);
|
||||
CHECK(final_head && final_head->sequence == 2);
|
||||
auto final_head = publish(*db, link(*head, *next, 22, 65));
|
||||
CHECK(final_head && final_head->head.sequence == 2);
|
||||
}
|
||||
|
||||
void database_time_expiry_and_paused_writer() {
|
||||
@@ -176,29 +240,23 @@ void database_time_expiry_and_paused_writer() {
|
||||
auto lease_a = acquire_region_lease(*worker_a, key, fast.duration, 5s);
|
||||
CHECK(lease_a && a.acquired(*lease_a, sent, LeaseClock::now()));
|
||||
CHECK(failed(acquire_region_lease(*worker_b, key, 20000ms, 5s), LeaseStoreError::busy));
|
||||
auto genesis = load_region_head(*worker_a, key, 5s);
|
||||
CHECK(genesis);
|
||||
const auto genesis = committed(*worker_a, key);
|
||||
|
||||
std::this_thread::sleep_for(1200ms); // Worker A is paused past its lease.
|
||||
CHECK(a.state(LeaseClock::now()) == LeaseState::fenced);
|
||||
// Expiry is decided by database time; the successor acquires a newer epoch.
|
||||
auto lease_b = acquire_region_lease(*worker_b, key, 20000ms, 5s);
|
||||
CHECK(lease_b && lease_b->epoch == lease_a->epoch + 1);
|
||||
auto head_b =
|
||||
advance_region_head(*worker_b, key, *lease_b, *genesis, {id(31), digest(31), 3}, 5s);
|
||||
auto head_b = publish(*worker_b, link(genesis, *lease_b, 31, 3));
|
||||
CHECK(head_b);
|
||||
// A resumes and ignores its local fence: every database path rejects it.
|
||||
CHECK(failed(renew_region_lease(*worker_a, key, *lease_a, fast.duration, 5s),
|
||||
LeaseStoreError::fenced));
|
||||
CHECK(
|
||||
failed(advance_region_head(*worker_a, key, *lease_a, *genesis, {id(32), digest(32), 1}, 5s),
|
||||
LeaseStoreError::fenced));
|
||||
CHECK(
|
||||
failed(advance_region_head(*worker_a, key, *lease_a, *head_b, {id(32), digest(32), 4}, 5s),
|
||||
LeaseStoreError::fenced));
|
||||
CHECK(failed(publish(*worker_a, link(genesis, *lease_a, 32, 1)), LeaseStoreError::fenced));
|
||||
CHECK(failed(publish(*worker_a, link(*head_b, *lease_a, 32, 4)), LeaseStoreError::fenced));
|
||||
CHECK(failed(release_region_lease(*worker_a, key, *lease_a, 5s), LeaseStoreError::fenced));
|
||||
auto head = load_region_head(*worker_a, key, 5s);
|
||||
CHECK(head && *head == *head_b);
|
||||
CHECK(head && *head == head_b->head);
|
||||
|
||||
// Expired renewal cannot revive a lease even without a successor.
|
||||
CHECK(release_region_lease(*worker_b, key, *lease_b, 5s));
|
||||
@@ -216,24 +274,23 @@ void queued_writer_uses_post_lock_database_time() {
|
||||
const auto key = provision(*admin, 40);
|
||||
auto worker = runtime();
|
||||
auto lease = acquire_region_lease(*worker, key, 1000ms, 5s);
|
||||
auto genesis = load_region_head(*worker, key, 5s);
|
||||
CHECK(lease && genesis);
|
||||
CHECK(lease);
|
||||
const auto genesis = committed(*worker, key);
|
||||
auto blocker = owner();
|
||||
const std::array<std::string, 1> region{"40"};
|
||||
CHECK(blocker->query("BEGIN", {}, 5s));
|
||||
CHECK(blocker->query("SELECT 1 FROM evolution.region_leases WHERE world_id = 1 AND "
|
||||
"region_id = $1::evolution.u64 FOR UPDATE",
|
||||
region, 5s));
|
||||
std::expected<RegionHead, LeaseStoreFailure> queued = std::unexpected{LeaseStoreFailure{}};
|
||||
std::thread writer([&] {
|
||||
queued = advance_region_head(*worker, key, *lease, *genesis, {id(41), digest(41), 1}, 5s);
|
||||
});
|
||||
std::expected<CommittedCheckpoint, LeaseStoreFailure> queued =
|
||||
std::unexpected{LeaseStoreFailure{}};
|
||||
std::thread writer([&] { queued = publish(*worker, link(genesis, *lease, 41, 1)); });
|
||||
std::this_thread::sleep_for(1300ms);
|
||||
CHECK(blocker->query("ROLLBACK", {}, 5s));
|
||||
writer.join();
|
||||
CHECK(failed(queued, LeaseStoreError::fenced));
|
||||
auto head = load_region_head(*worker, key, 5s);
|
||||
CHECK(head && *head == *genesis);
|
||||
CHECK(head && *head == genesis.head);
|
||||
}
|
||||
|
||||
// Partition: the renewal's outcome is unknown and the connection is gone. The
|
||||
@@ -300,10 +357,9 @@ void contenders_serialize_on_the_database() {
|
||||
// The same holder racing two commits from the same predecessor: exactly one wins.
|
||||
auto lease = acquire_region_lease(*workers[0], key, 20000ms, 5s);
|
||||
CHECK(lease);
|
||||
auto head = load_region_head(*workers[0], key, 5s);
|
||||
CHECK(head);
|
||||
auto head = committed(*workers[0], key);
|
||||
for (std::uint8_t round = 0; round < 32; ++round) {
|
||||
std::array<std::expected<RegionHead, LeaseStoreFailure>, 2> results{
|
||||
std::array<std::expected<CommittedCheckpoint, LeaseStoreFailure>, 2> results{
|
||||
std::unexpected{LeaseStoreFailure{}}, std::unexpected{LeaseStoreFailure{}}};
|
||||
std::latch start{2};
|
||||
std::vector<std::thread> threads;
|
||||
@@ -312,18 +368,17 @@ void contenders_serialize_on_the_database() {
|
||||
threads.emplace_back([&, i] {
|
||||
const auto seed = static_cast<std::uint8_t>(100 + (round * 2) + i);
|
||||
start.arrive_and_wait();
|
||||
results[i] = advance_region_head(*workers[i], key, *lease, *head,
|
||||
{id(seed), digest(seed), head->end_tick + 1}, 5s);
|
||||
results[i] = publish(*workers[i], link(head, *lease, seed, head.head.end_tick + 1));
|
||||
});
|
||||
for (auto& t : threads)
|
||||
t.join();
|
||||
const std::size_t w = results[0] ? 0 : 1;
|
||||
CHECK(results[w] && failed(results[1 - w], LeaseStoreError::head_mismatch));
|
||||
CHECK(results[w]->sequence == head->sequence + 1);
|
||||
CHECK(results[w]->head.sequence == head.head.sequence + 1);
|
||||
head = *results[w];
|
||||
}
|
||||
auto committed = load_region_head(*workers[1], key, 5s);
|
||||
CHECK(committed && *committed == *head && committed->sequence == 32);
|
||||
auto last = load_region_head(*workers[1], key, 5s);
|
||||
CHECK(last && *last == head.head && last->sequence == 32);
|
||||
}
|
||||
|
||||
void exhaustion_fails_closed() {
|
||||
@@ -337,13 +392,24 @@ void exhaustion_fails_closed() {
|
||||
const auto other = provision(*admin, 71);
|
||||
auto lease = acquire_region_lease(*db, other, 20000ms, 5s);
|
||||
CHECK(lease);
|
||||
// Owner-only fixture: a chain link at the last sequence (the head FK requires it).
|
||||
CHECK(admin->query(
|
||||
"INSERT INTO evolution.region_commits(world_id, region_id, commit_sequence, commit_id, "
|
||||
"commit_digest, manifest, begin_tick, end_tick, published_epoch, tick_microseconds, "
|
||||
"versions, build_identity, payload_bytes, payload_sha256) SELECT world_id, region_id, "
|
||||
"18446744073709551615, '000000ff-0000-0000-0000-000000000000', commit_digest, manifest, 0, "
|
||||
"5, 1, tick_microseconds, versions, build_identity, payload_bytes, payload_sha256 FROM "
|
||||
"evolution.region_commits WHERE world_id = 1 AND region_id = 71",
|
||||
{}, 5s));
|
||||
CHECK(admin->query("UPDATE evolution.region_heads SET commit_sequence = 18446744073709551615, "
|
||||
"end_tick = 5, published_epoch = 1 WHERE world_id = 1 AND region_id = 71",
|
||||
"commit_id = '000000ff-0000-0000-0000-000000000000', end_tick = 5, "
|
||||
"published_epoch = 1 WHERE world_id = 1 AND region_id = 71",
|
||||
{}, 5s));
|
||||
auto head = load_region_head(*db, other, 5s);
|
||||
CHECK(head && head->sequence == 18446744073709551615ULL);
|
||||
CHECK(failed(advance_region_head(*db, other, *lease, *head, {id(72), digest(72), 6}, 5s),
|
||||
LeaseStoreError::exhausted));
|
||||
const auto last = committed(*db, other);
|
||||
CHECK(last.head.sequence == 18446744073709551615ULL);
|
||||
auto beyond = link(last, *lease, 72, 6);
|
||||
beyond.sequence = 18446744073709551615ULL; // Any value: exhaustion is checked first.
|
||||
CHECK(failed(publish(*db, beyond), LeaseStoreError::exhausted));
|
||||
}
|
||||
|
||||
struct Summary {
|
||||
@@ -372,8 +438,7 @@ void measure_round_trips() {
|
||||
auto db = runtime();
|
||||
constexpr int n = 200;
|
||||
Summary acquire, renew, advance, release;
|
||||
auto head = load_region_head(*db, key, 5s);
|
||||
CHECK(head);
|
||||
auto head = committed(*db, key);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
std::expected<LeaseGrant, LeaseStoreFailure> lease = std::unexpected{LeaseStoreFailure{}};
|
||||
acquire.samples.push_back(
|
||||
@@ -381,29 +446,27 @@ void measure_round_trips() {
|
||||
CHECK(lease);
|
||||
renew.samples.push_back(
|
||||
timed([&] { CHECK(renew_region_lease(*db, key, *lease, 20000ms, 5s)); }));
|
||||
const auto seed = static_cast<std::uint8_t>(i);
|
||||
Uuid commit = id(seed);
|
||||
commit[0] = 0xAA; // Distinct from genesis 0x50 bytes.
|
||||
commit[1] = static_cast<std::uint8_t>(i >> 8);
|
||||
auto m = link(head, *lease, 0, head.head.end_tick + 64);
|
||||
m.commit[0] = 0xAA; // Unique across all tests: 0xAA, index, zeros.
|
||||
m.commit[1] = static_cast<std::uint8_t>(i);
|
||||
advance.samples.push_back(timed([&] {
|
||||
auto next = advance_region_head(*db, key, *lease, *head,
|
||||
{commit, digest(seed), head->end_tick + 64}, 5s);
|
||||
auto next = publish(*db, m);
|
||||
CHECK(next);
|
||||
head = *next;
|
||||
head = std::move(*next);
|
||||
}));
|
||||
release.samples.push_back(
|
||||
timed([&] { CHECK(release_region_lease(*db, key, *lease, 5s)); }));
|
||||
}
|
||||
acquire.print("acquire");
|
||||
renew.print("renew");
|
||||
advance.print("advance_head");
|
||||
advance.print("publish_manifest");
|
||||
release.print("release");
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void run_region_lease_store_tests() {
|
||||
runtime_cannot_bypass_the_guard();
|
||||
acquire_renew_release_and_advance();
|
||||
acquire_renew_release_and_publish();
|
||||
database_time_expiry_and_paused_writer();
|
||||
queued_writer_uses_post_lock_database_time();
|
||||
partitioned_renewal_fences_locally();
|
||||
|
||||
Reference in New Issue
Block a user