Persist primitive life outcomes across control moves
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (client) (push) Successful in 12m36s
Foundation / checks (network) (push) Successful in 13m43s
Foundation / checks (tsan) (push) Successful in 8m14s
Foundation / checks (postgres) (push) Failing after 17m26s
Foundation / checks (checks) (push) Successful in 33m23s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (client) (push) Successful in 12m36s
Foundation / checks (network) (push) Successful in 13m43s
Foundation / checks (tsan) (push) Successful in 8m14s
Foundation / checks (postgres) (push) Failing after 17m26s
Foundation / checks (checks) (push) Successful in 33m23s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Real PostgreSQL schema v15 adapter checks, isolated world 9752.
|
||||
// Real PostgreSQL schema v17 adapter checks, isolated world 9752.
|
||||
#include "evo/persistence/account_control_store.hpp"
|
||||
#include "evo/persistence/life_reservation_store.hpp"
|
||||
#include "evo/persistence/region_lease_store.hpp"
|
||||
@@ -59,6 +59,8 @@ void run_life_reservation_store_tests() {
|
||||
return reserve_primitive_life(*db, a, *lease_a, alice, control->generation, action, rules,
|
||||
5s);
|
||||
};
|
||||
const auto absent = query_primitive_life(*db, a, *lease_a, alice, control->generation, 77, 5s);
|
||||
CHECK(absent && !*absent);
|
||||
CHECK(failed(reserve(request), LifeReservationError::not_available));
|
||||
CHECK(admin->query("INSERT INTO evolution.life_allocators VALUES "
|
||||
"(9752,9223372036854775808)",
|
||||
@@ -72,7 +74,15 @@ void run_life_reservation_store_tests() {
|
||||
first->refusal == LifeRefusal::none);
|
||||
db = connect_as(env("EVO_PG_RUNTIME_USER"));
|
||||
CHECK(reserve(request) == *first);
|
||||
CHECK(failed(reserve(2), LifeReservationError::existing_life));
|
||||
const auto conflict = reserve(2);
|
||||
CHECK(conflict && conflict->refusal == LifeRefusal::existing_life && conflict->region == 1 &&
|
||||
conflict->identity == first->identity + 1);
|
||||
CHECK(reserve(2) == *conflict);
|
||||
auto conflict_result =
|
||||
query_primitive_life(*db, a, *lease_a, alice, control->generation, 2, 5s);
|
||||
CHECK(conflict_result && *conflict_result &&
|
||||
(**conflict_result).reservation.refusal == LifeRefusal::existing_life &&
|
||||
!(**conflict_result).published);
|
||||
CHECK(failed(reserve_primitive_life(*db, a, *lease_a, alice, 2, request, 1, 5s),
|
||||
LifeReservationError::fenced));
|
||||
CHECK(failed(reject_primitive_life(*db, a, *lease_a, alice, 1, request, LifeRefusal::none, 5s),
|
||||
@@ -91,30 +101,35 @@ void run_life_reservation_store_tests() {
|
||||
CHECK(admin->query("BEGIN", {}, 5s));
|
||||
CHECK(admin->query("SELECT * FROM evolution.life_allocators WHERE world_id=9752 FOR UPDATE", {},
|
||||
5s));
|
||||
CHECK(failed(reserve_primitive_life(*db, a, *lease_a, alice, 1, 2, 1, 20ms),
|
||||
CHECK(failed(reserve_primitive_life(*db, a, *lease_a, alice, 1, 3, 1, 20ms),
|
||||
LifeReservationError::unknown));
|
||||
CHECK(admin->query("COMMIT", {}, 5s));
|
||||
db = connect_as(env("EVO_PG_RUNTIME_USER"));
|
||||
const auto reconciled = reserve(2);
|
||||
CHECK(reconciled && reconciled->identity == first->identity + 1);
|
||||
CHECK(reserve(2) == *reconciled);
|
||||
const auto reconciled = reserve(3);
|
||||
CHECK(reconciled && reconciled->identity == first->identity + 2);
|
||||
CHECK(reserve(3) == *reconciled);
|
||||
const auto counter = admin->query(
|
||||
"SELECT next_identity FROM evolution.life_allocators WHERE world_id=9752", {}, 5s);
|
||||
CHECK(counter && (*counter)[0][0] == "9223372036854775810");
|
||||
CHECK(reject_primitive_life(*db, a, *lease_a, alice, 1, 2, LifeRefusal::no_placement, 5s) ==
|
||||
CHECK(counter && (*counter)[0][0] == "9223372036854775811");
|
||||
CHECK(reject_primitive_life(*db, a, *lease_a, alice, 1, 3, LifeRefusal::no_placement, 5s) ==
|
||||
LifeRefusal::no_placement);
|
||||
const auto pending = reserve(4);
|
||||
CHECK(pending && pending->refusal == LifeRefusal::none);
|
||||
const auto moved = claim_account_control(*db, b, *lease_b, alice, 2, 2, 20000ms, 5s);
|
||||
CHECK(moved);
|
||||
auto moved_result = query_primitive_life(*db, b, *lease_b, alice, moved->generation, 4, 5s);
|
||||
CHECK(moved_result && *moved_result && (**moved_result).reservation.region == 1 &&
|
||||
(**moved_result).reservation.refusal == LifeRefusal::cancelled);
|
||||
const auto cancelled_retry =
|
||||
reserve_primitive_life(*db, b, *lease_b, alice, moved->generation, 4, 1, 5s);
|
||||
CHECK(cancelled_retry && cancelled_retry->refusal == LifeRefusal::cancelled);
|
||||
CHECK(admin->query("UPDATE evolution.life_allocators SET next_identity=18446744073709551615 "
|
||||
"WHERE world_id=9752",
|
||||
{}, 5s));
|
||||
CHECK(failed(reserve(3), LifeReservationError::exhausted));
|
||||
|
||||
const auto moved = claim_account_control(*db, b, *lease_b, alice, 2, 2, 20000ms, 5s);
|
||||
CHECK(moved);
|
||||
CHECK(failed(reserve_primitive_life(*db, b, *lease_b, alice, moved->generation, 5, 1, 5s),
|
||||
LifeReservationError::exhausted));
|
||||
CHECK(reserve_primitive_life(*db, b, *lease_b, alice, moved->generation, request, 1, 5s) ==
|
||||
*refused);
|
||||
CHECK(failed(reject_primitive_life(*db, b, *lease_b, alice, moved->generation, request,
|
||||
LifeRefusal::cancelled, 5s),
|
||||
LifeReservationError::not_available));
|
||||
CHECK(failed(reserve(request), LifeReservationError::fenced));
|
||||
CHECK(release_region_lease(*db, a, *lease_a, 5s));
|
||||
CHECK(release_region_lease(*db, b, *lease_b, 5s));
|
||||
|
||||
@@ -400,9 +400,15 @@ void session_codec() {
|
||||
CHECK(std::get<SessionIntention>(*decode_session(encode_session(intent))) == intent);
|
||||
const ActionOutcome outcome{5, ActionResult::not_committed, 0, 0};
|
||||
CHECK(std::get<ActionOutcome>(*decode_session(encode_session(outcome))) == outcome);
|
||||
const std::array<SessionMessage, 4> life_messages{
|
||||
PrimitiveLifeRequest{7, 8, 9}, PrimitiveLifeReceipt{9, AdmitStatus::admitted, 10},
|
||||
PrimitiveLifeOutcome{9, PrimitiveLifeResult::born, 11, 12}, PrimitiveLifeQuery{9}};
|
||||
const std::array<SessionMessage, 8> life_messages{
|
||||
PrimitiveLifeRequest{7, 8, 9},
|
||||
PrimitiveLifeReceipt{9, AdmitStatus::admitted, 10},
|
||||
PrimitiveLifeOutcome{9, PrimitiveLifeResult::born, 11, 12},
|
||||
PrimitiveLifeOutcome{9, PrimitiveLifeResult::existing_life, 0, 0},
|
||||
PrimitiveLifeOutcome{9, PrimitiveLifeResult::cancelled, 0, 0},
|
||||
PrimitiveLifeOutcome{9, PrimitiveLifeResult::pending, 0, 0},
|
||||
PrimitiveLifeOutcome{9, PrimitiveLifeResult::unknown, 0, 0},
|
||||
PrimitiveLifeQuery{9}};
|
||||
for (const auto& message : life_messages) {
|
||||
const auto bytes = encode_session(message);
|
||||
std::uint16_t version{};
|
||||
|
||||
@@ -199,6 +199,11 @@ void run_primitive_publication_tests() {
|
||||
auto bindings = db->query("SELECT * FROM evolution.load_primitive_lives(9753,1)", {}, 5s);
|
||||
CHECK(bindings && bindings->size() == 1 && (*bindings)[0][2] == "1" &&
|
||||
(*bindings)[0][5] == "1");
|
||||
const auto durable_outcome =
|
||||
query_primitive_life(*db, key, *lease, alice, control->generation, 1, 5s);
|
||||
CHECK(durable_outcome && *durable_outcome && (**durable_outcome).published &&
|
||||
(**durable_outcome).published->identity == 1 &&
|
||||
(**durable_outcome).published->commit_sequence == 1);
|
||||
auto reject = reject_primitive_life(*db, key, *lease, alice, control->generation, 1,
|
||||
LifeRefusal::cancelled, 5s);
|
||||
CHECK(!reject && reject.error().kind == LifeReservationError::existing_life);
|
||||
|
||||
@@ -182,6 +182,7 @@ void upgrade_across_migration_and_barrier() {
|
||||
" -v migration_sha_14=$(s 0014_probe_overdue.sql)"
|
||||
" -v migration_sha_15=$(s 0015_life_reservations.sql)"
|
||||
" -v migration_sha_16=$(s 0016_primitive_publication.sql)"
|
||||
" -v migration_sha_17=$(s 0017_life_request_outcomes.sql)"
|
||||
" -v runtime_role=evo_runtime_test -f migrations/apply.sql"
|
||||
" > /dev/null 2>&1") != 0);
|
||||
CHECK(history(*owner_db) == "1,2,3,4,5,6,7");
|
||||
|
||||
Reference in New Issue
Block a user