Skip to content

Marten 9.50.0

Choose a tag to compare

@jeremydmiller jeremydmiller released this 13 Oct 23:17
· 760 commits to master since this release
afefc4a

A bug-fix release. Nothing here requires a configuration or code change, but three things change what an application observes — read the box below before upgrading.

Observable changes

  • TotalResults changes value for Stats() + Include() + Select() + Take(). It was reporting the size of the page; it now reports the number of matches (#5654). If you compute page counts from it, those counts change — to the correct ones.
  • A new warning may appear at startup if tag-type auto-discovery cannot register a projection's identity type. That condition is not new; it was previously silent (#5649).
  • db-patch drop files no longer DROP ... CASCADE every schema — they roll back only what the patch touched (Weasel 9.45.0, weasel#706). This is the one to look at if you apply drop files in an environment you care about.

LINQ — Include() joined on the queried document's own id

Three separate defects in the same corner, found by pulling on the first one. An Include() joined on the queried document's own id builds a temp table, and that temp table was missing the id it is joined on.

  • #5650 — failed with 42703: column d.id does not exist in a query session when the queried document had any duplicated field. Lightweight, identity-map and dirty-tracked sessions were unaffected. Thanks to @Blackclaws for the report and the fix (#5651).
  • #5653 — the same 42703, in a query session, when the query also called Stats(). Unlike #5650 this did not depend on a duplicated field; Stats() wraps the select clause, which hid it from the check that puts the id back.
  • #5654 — Stats() with an Include() and a Select() projection reported TotalResults as the size of the page rather than the number of matches, whenever Take() was used. No exception, just a wrong number, on every session kind. The temp table already held the correct count — PostgreSQL evaluates a window function before LIMIT — but re-applying the projection emitted a second count(*) over() against the already-truncated temp table.

If you page a projected grid with Stats() and Include(), #5654 is the one to read.

Event store

  • #5652 — a store with no event types and no projections never has its event tables migrated, so building a usage descriptor asked Postgres for a table that was not there. Marten swallowed the failure, but Postgres logged an ERROR for every attempt; under UseWolverineManagedEventSubscriptionDistribution the leader does this for every store on a ten-second heartbeat, which is tens of thousands of server-side ERROR lines a day for a store that can never hold an event. Marten now asks the catalog first, so nothing reaches the server log. Thanks to @uniquelau for a report that came with the heartbeat maths already done.
  • #5658 — IEventStore.FindDatabaseForTenantAsync, so a caller waiting on or querying a single tenant touches only that tenant's database instead of all of them. Goes through ITenancy.TryFindDatabase, never FindOrCreateDatabase, so a lookup cannot bring an unknown tenant into existence.

Native AOT

  • #5649 (partial) — a DCB [BoundaryAggregate] fetch failed natively with MissingMethodException, because EventGraph.Build<TDoc>() closed SingleStreamProjection<,> at runtime even though both type arguments were known at compile time. And tag-type auto-discovery swallowed the AOT failure in the same breath as a benign one, leaving a store running with the tag type quietly absent; it now says so. Verified by publishing and running the native binary, not by a clean publish.

    Still open: RegisterTagType<TTag>() closes its own open generic and remains broken under Native AOT. That needs a reflection-free construction path in JasperFx.Events plus a new overload — see the discussion on #5649. Thanks to @skoging for an unusually thorough report, with native runs and three costed alternatives.

Dependencies

  • Weasel 9.45.0 — db-patch drop files no longer drop every schema with CASCADE; they roll back only what the patch touched (weasel#706). This changes what an existing drop file does. Primary keys can also now be added to and removed from existing tables (weasel#707).
  • JasperFx 2.87.0 — across all five packages.

Known issue

Stats() with Include() and a Select() projection is fixed here, but note that the Include() itself still follows the page, not the match set — it reads from the same truncated temp table. Only the statistics column outlives the Take(). That is existing, intended behaviour; it is called out because #5654 makes the distinction visible for the first time.