Skip to content

V2.39.0

Choose a tag to compare

@jeremydmiller jeremydmiller released this 04 Aug 12:18
· 601 commits to main since this release

Projection lag, per-tenant high-water parsing, and a large cut in the async daemon's idle database traffic.

Highlights

A supported per-tenant projection lag read (#619, #627). "How far behind is projection X, at its current version, for tenant T on this database?" had no supported answer, so the correlation had been reinvented three times — the daemon's blue/green side-effect gate, Marten's WaitForNonStaleDataAsync, and application code in the field — each rediscovering the same traps. ProjectionLag + ProjectionLagCalculator + IEventDatabase.FetchProjectionLagAsync / IEventStore<,>.FetchProjectionLagAsync now express it once, anchored on registered sources at their current version, over the single AllProjectionProgress round trip that already exists. No new SQL, and every store gets it through a default interface implementation. A registered cell with no row reads as fully behind, not caught up.

Per-tenant HighWaterMark:{tenant} rows round-trip through ShardName (#618, #623). ShardName.TryParse("HighWaterMark:acme", ...) used to return true and a wrong answer — the tenant id in the shard-key slot, TenantId null, and an Identity that didn't match the input. Those rows are real and persisted (Marten writes one per tenant on every vectorized high-water poll), so any consumer grouping progression rows by tenant silently attributed every tenant's mark to the store-global one. ShardName.HighWaterMarkFor(tenantId) and ShardName.IsHighWaterMark are the supported way to compose and recognize them.

Only a daemon that actually runs agents writes extended progression telemetry (#621, #625). The ShardStateTracker is per-database and shared, and every JasperFxAsyncDaemon subscribed an ExtendedProgressionWriter to it in the constructor — including daemons built ad hoc purely to read state, which is a documented thing to do. N daemons for one database meant N writers on one publication stream, each renting a connection and issuing the same UPDATE against the same rows. The subscription is now armed on the start path and released on stop; an unstarted daemon writes nothing at all.

The periodic per-shard heartbeat is off by default (#622, #628). It cost one pooled connection and one transaction per database per node every 5 seconds — ~37 connection acquisitions/sec/node on a 512-shard-database deployment — and an audit across JasperFx, Marten and CritterWatch found nothing that reads the persisted value. Agent status transitions are still written, which is what the extended columns are actually for. The cadence is now reachable from application code for the first time via DaemonSettings.ExtendedProgressionHeartbeatInterval; a positive value restores the old behavior as a compatibility hatch.

Upgrade notes

  • Per-tenant high-water ShardNames are now distinct values where they previously all compared equal to the store-global mark. That collapse was the bug; nothing in JasperFx constructed such a name.
  • TryParse now rejects HighWaterMark-prefixed strings other than the bare constant and HighWaterMark:{tenant}, instead of forcing them into the generic grammar.
  • If you depend on the persisted 5-second heartbeat, set DaemonSettings.ExtendedProgressionHeartbeatInterval. Nothing in the Critter Stack reads it today.

What's Changed

Full Changelog: V2.38.0...V2.39.0