M12.4: retain and settle owned population intervals
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m28s
Foundation / checks (tsan) (push) Failing after 18m22s
Foundation / checks (network) (push) Successful in 20m38s
Foundation / checks (client) (push) Failing after 21m6s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 46m54s
Foundation / checks (checks) (push) Canceled after 47m3s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m28s
Foundation / checks (tsan) (push) Failing after 18m22s
Foundation / checks (network) (push) Successful in 20m38s
Foundation / checks (client) (push) Failing after 21m6s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 46m54s
Foundation / checks (checks) (push) Canceled after 47m3s
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "evo/persistence/checkpoint_store.hpp"
|
||||
#include "evo/persistence/life_reservation_store.hpp"
|
||||
#include "evo/persistence/population_checkpoint_store.hpp"
|
||||
#include "evo/persistence/population_interval_store.hpp"
|
||||
#include "evo/server/lifecycle/cellular_batch.hpp"
|
||||
#include "evo/server/ops.hpp"
|
||||
|
||||
@@ -93,6 +94,11 @@ class CellularRegionHost {
|
||||
// Explicit no-tick fenced transition. Uncertain publication pauses the host.
|
||||
[[nodiscard]] std::expected<void, CellularPublishFailure> set_population_mode(bool enabled);
|
||||
[[nodiscard]] bool population_mode() const noexcept;
|
||||
// Service a recorded interval even when new due time is zero after restart.
|
||||
// Otherwise admit a bounded prefix of due ticks before computing it.
|
||||
[[nodiscard]] std::expected<std::optional<persistence::CommittedCheckpoint>,
|
||||
CellularPublishFailure>
|
||||
advance_unattended(std::uint64_t due_ticks);
|
||||
[[nodiscard]] std::expected<persistence::PublishedCellularBatch, CellularPublishFailure>
|
||||
publish(const CellularBatch& batch, std::span<const CellularActionRecord> actions = {},
|
||||
std::span<const CellularMutationActionRecord> mutation_actions = {});
|
||||
@@ -147,6 +153,8 @@ class CellularRegionHost {
|
||||
void resolve();
|
||||
void refresh();
|
||||
bool recover_state(const persistence::LeaseGrant&);
|
||||
void reconcile_interval();
|
||||
void finish_interval();
|
||||
[[nodiscard]] std::expected<persistence::PublishedCellularBatch, CellularPublishFailure>
|
||||
publish_population(const CellularBatch&);
|
||||
void finalize_births(std::span<const CellularTickIntents::Birth> births);
|
||||
@@ -207,6 +215,15 @@ class CellularRegionHost {
|
||||
std::expected<persistence::CommittedCheckpoint, persistence::PopulationPublicationFailure>,
|
||||
OwnedState candidate);
|
||||
OwnedState state_;
|
||||
bool interval_reload_{};
|
||||
std::optional<persistence::PopulationInterval> admitted_interval_;
|
||||
// An uncertain admission must retry its exact source/target, never select again.
|
||||
struct IntervalRequest {
|
||||
persistence::RegionHead source;
|
||||
std::uint64_t end_tick{};
|
||||
};
|
||||
std::optional<IntervalRequest> interval_request_;
|
||||
std::optional<persistence::LeaseStoreFailure> interval_failure_;
|
||||
std::optional<persistence::CommittedCheckpoint> committed_;
|
||||
std::unique_ptr<Pending> pending_;
|
||||
std::vector<FinalCellularAction> finalized_actions_;
|
||||
|
||||
@@ -30,6 +30,9 @@ struct CellularPopulationExecution {
|
||||
CellularPopulationBatch batch;
|
||||
std::unique_ptr<CellularPopulation> state;
|
||||
};
|
||||
// Lingering controlled cells remain vulnerable. Their permanent death path must
|
||||
// stay on profile 4; unattended population intervals require full suspension.
|
||||
[[nodiscard]] bool population_interval_safe(const CellularLives&) noexcept;
|
||||
// Build an unattended interval from a detached biological copy. Controlled cells
|
||||
// receive frozen-only intentions; the unchanged wildlife controller supplies the
|
||||
// rest. The returned recorded intentions replay without rerunning that controller.
|
||||
|
||||
@@ -11,9 +11,15 @@ namespace evo::server {
|
||||
// Historical profiles without offline freeze are not opted into unattended work.
|
||||
[[nodiscard]] bool cellular_unattended_tick_needed(const CellularLives& state) noexcept;
|
||||
|
||||
enum class CellularScheduleError : std::uint8_t { clock_regression, head_regression, authority };
|
||||
enum class CellularScheduleError : std::uint8_t {
|
||||
clock_regression,
|
||||
head_regression,
|
||||
authority,
|
||||
admission
|
||||
};
|
||||
struct CellularScheduleStatus {
|
||||
bool due{};
|
||||
bool retry_ready{true}; // Also permits servicing a recovered durable interval with zero debt.
|
||||
std::uint64_t debt{}, max_debt{};
|
||||
std::uint64_t head_age_us{}; // Since the last confirmed head change/recovery.
|
||||
};
|
||||
@@ -22,11 +28,13 @@ struct CellularScheduleStatus {
|
||||
// be attempted per poll. Rejected work does not consume debt. Authority loss,
|
||||
// restart or absence of tick demand pauses wall-time (ADR-0133); committed
|
||||
// intervals and uncertain outcomes remain the fenced host's responsibility.
|
||||
// On a new anchor, previously_admitted_ticks excludes a recovered durable prefix
|
||||
// from fresh wall-time accounting. It is bounded to 64 and cannot wrap the head.
|
||||
class CellularTickSchedule {
|
||||
public:
|
||||
[[nodiscard]] std::expected<CellularScheduleStatus, CellularScheduleError>
|
||||
observe(std::uint64_t now_us, std::uint64_t epoch, std::uint64_t committed_tick, bool needed,
|
||||
bool authoritative);
|
||||
bool authoritative, std::uint64_t previously_admitted_ticks = 0);
|
||||
void defer(std::uint64_t now_us) noexcept;
|
||||
[[nodiscard]] CellularScheduleStatus status() const noexcept;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ struct HostStatus {
|
||||
std::uint64_t simulated_tick{}, committed_tick{}, committed_sequence{};
|
||||
std::size_t queued{}, queued_bytes{};
|
||||
std::uint64_t tick_debt{}, max_tick_debt{}; // Due minus simulated since running.
|
||||
std::uint64_t ecological_pending_ticks{}; // Durable admitted interval, 0..64.
|
||||
std::uint64_t commits{}, store_failures{}, unknown_outcomes{}, fences{};
|
||||
// Local lease safety: time until this host must stop originating (0 = none).
|
||||
std::uint64_t lease_remaining_ms{};
|
||||
|
||||
Reference in New Issue
Block a user