Skip to content

v0.18.10

Choose a tag to compare

@github-actions github-actions released this 02 Dec 06:35
Immutable release. Only release title and notes can be modified.

Release v0.18.10

📦 NPM packages

🐳 Docker image

docker pull ms2data/malloy-publisher:0.18.10
docker pull ms2data/malloy-publisher:latest

ℹ️ Details

  • Release branch: release/v0.18.10
  • Triggered by: @kylenesbit

boundManifestDigest says which manifest is bound, and a refused bind never reads as landed

[feature] boundManifestDigest: the sha256 of the bound manifest's bytes. It is reported next to boundManifestUri in these places:

  • a package's or version's entry in GET /api/v0/status;
  • GET …/packages/{pkg}/status;
  • the package resource, while PUBLISHER_PACKAGE_INLINE_FIELDS is on;
  • ManifestBinding.digest in the v1 spec.

It is null whenever the URI is. It covers the object's bytes as stored, a leading byte-order mark included (for a GCS object stored with Content-Encoding: gzip, the decompressed bytes); a manifest that is not UTF-8 is refused with MANIFEST_INVALID. An unchanged rebind still moves it to a rewrite's new bytes. Some hosts write every build of a version to one manifest location, rewriting it in place; for them, the URI alone cannot tell two builds apart. To confirm that a bind it sent landed (a PUT …/versions/{v}/manifest whose response it did not get, say), a host checks that manifestBindingStatus is bound AND that boundManifestDigest equals the sha256 of the bytes it wrote. This is additive: existing fields are unchanged.

[fix] A refused manifest bind restores the build it served before, and never reads as landing. A bind that fails after it has moved the models is refused and undone. This applies to a version's PUT …/manifest and to a PATCH of an unversioned package's manifestLocation. Before this release, two things went wrong:

  • The undo fetched the previous manifest's location again. When a host had rewritten that location with the refused build, the package ended up serving the refused build.
  • On an unversioned package, /status read loading: false and bound, with the refused build's tables serving, for a moment before the undo began.

Now the undo binds the manifest the package had bound, from memory, recorded only once a bind can no longer be refused. With nothing in memory to restore from (a version that was not loaded when its PUT arrived), the undo serves what this server's own runs built, or live, reported bind_failed; it never fetches the location again. The bind and its undo run as one load, and the binding state reported throughout is the one from before the bind. A refused bind ends serving the previous build, with the previous digest. It never reads as bound with the new manifest's digest, and while it is not loading it reads as it did before.

manifestBindingStatus was already reported bound only once queries serve from the new binding, since #2177. boundManifestDigest follows the same rule.


binding a manifest over a busy DuckLake catalog is fast, and an identical rebind is a no-op

[fix] Binding a build manifest's storage= entries reads each DuckLake destination once, on one snapshot. A bind reads each stored table's columns again, to hold it to the contract its build recorded. It sent two statements per table, each its own DuckLake transaction, and one of them read the table's definition through duckdb_tables(), which fetches the statistics of every table in the catalog. Each time a build committed anywhere in the catalog between two statements, the next one fetched the catalog again. Over a Postgres catalog that builds commit to, a manifest of 30 storage= entries took one to several minutes to bind, longer than a host's rebind request waits, while every replica sent thousands of catalog queries. Now each destination's tables are read inside one read-only transaction, with one DESCRIBE per table and one read of the session's collation setting: DuckLake refuses a collation in any table it stores, so no definition is read. The same bind now sends tens of catalog queries and takes about a second. What a bind reads is unchanged: the same columns, types and collations as before, held to the same contracts. A bind's read of its stored tables now ends within 30 seconds in all, besides each statement's own 15 seconds, even when the catalog stops answering. Past either bound the bind stops waiting for the statement and asks DuckDB to interrupt it. A catalog read blocked in Postgres may keep running until the catalog answers, and the read's session closes behind it then. Until it has, a later bind opens no new session on that destination, so a stalled catalog holds one blocked connection per destination per worker, not one per bind, and the worker warns, naming the destination, when that starts and again if it lasts five minutes: that destination's tables answer live and the retry reads them again. A table not read by then answers live and is read again by the bind's retry, as a table whose read fails always has. A statement that fails after its own bound no longer fails the reads queued behind it.

[fix] A rebind of the manifest a package already serves, with nothing changed, reads and commits nothing. PUT …/versions/{version}/manifest with the location already bound, holding the same entries, used to read every stored table again and recompile every model's served copy. It now answers at once, with the same response a full bind gives. It binds in full whenever the location, the version or any field of any entry differs, or a storage destination those entries name is configured differently (a PUT of the environment that moves it to another catalog, data path or schema), and whenever anything moved since the last bind: another bind or a retry's commit, a reload, a re-derived plan, a table left unread, a table found incompatible, an upstream withdrawn while unread, or a source kept serving over an upstream a refresh could not read. A skipped rebind counts on publisher_served_copy_bind_total{scope="manifest"} as outcome unchanged. What to do: nothing.


reads served from one storage destination run concurrently

[change] Statements over one DuckLake storage destination now run at the same time, up to a pool of sessions, instead of one after another. Every package served from a destination shared one DuckDB session for it, and DuckDB runs one statement at a time per session, so a dashboard's stored reads queued: each waited for every read ahead of it, throughput stayed at one statement per service time however many arrived, and the CPU sat idle. A destination now keeps a pool of sessions on its one DuckDB instance (same memory limit, threads, attach and lockdown), and each read goes to the least busy. The sessions join the instance in the background after the first, so the first read waits no longer than before. Answers do not change. Environment connections, including an environment DuckLake connection, keep their one session.

[new] PUBLISHER_DUCKDB_SESSIONS_PER_DESTINATION (--duckdb-sessions-per-destination, file key duckdb.sessionsPerDestination): the sessions per destination. The default is half the native worker pool, at least 1, and at most PUBLISHER_MAX_CONCURRENT_QUERIES when that is above 0: 8 in the Docker image, 2 on Node, and half the CPUs on Bun without UV_THREADPOOL_SIZE. Once its boot load is done, the server warns if the sessions of every destination added up could exceed the native pool, and recommends a lower setting only when that would bring the sum within it; it never warns at 1.

[change] The Docker image sets UV_THREADPOOL_SIZE=16. Every blocking DuckDB call runs on the runtime's native worker pool, which Bun sizes to the container's CPUs (4 on a 4-CPU pod), so it capped concurrent DuckDB statements process-wide whatever the sessions. It must be set at process start. Unset, Bun uses GOMAXPROCS when it is set, else the CPUs (floor 2), and Node (npx) uses 4; Publisher reads both by the same rule, and the boot log names the pool it detected. See deployment.md.

Resources to check before rolling out:

  • Catalog connections. Each running statement holds a Postgres backend of the destination's catalog, so a destination opens about min(sessions, native pool) + 1 backends per worker at peak, kept open, idle, for 60 s after a burst. Check the catalog's max_connections against workers × destinations × that.
  • Memory. Reads that used to queue now run together within one instance's memory_limit. Set PUBLISHER_DUCKDB_MEMORY_LIMIT before rollout: unset, each instance sizes its own limit from the container, and heavy concurrent reads can get the process OOM-killed.
  • A destination edit drains the old sessions while the new ones serve, so up to twice the sessions per destination for that time.
  • No per-session interrupt. A statement its caller abandoned (a query timeout) still runs to the end on its session, holding it, as it held the one session before; reads picked onto that session wait behind it. The upstream ask is malloydata/malloy#3298.

To restore the old behaviour, set PUBLISHER_DUCKDB_SESSIONS_PER_DESTINATION=1. To keep the image's previous native pool, set UV_THREADPOOL_SIZE to the container's CPU count.


a database out of sessions no longer takes a package out of service, or sends its stored sources live

[fix] A transient database error no longer takes a package or a version out of service; it is retried for about five minutes. A transient error is one of these:

  • the database out of sessions (53300);
  • the database shutting down or not yet accepting sessions (57P01, 57P02, 57P03);
  • a session lost (08003, 08006, ECONNRESET, pg's "not queryable" client);
  • a connect refused or timed out (08001, ECONNREFUSED, including a host such as localhost with several addresses, ETIMEDOUT, EAI_AGAIN);
  • no free session in Publisher's own pool.

MySQL's too many connections (1040) and Azure SQL's request limits (10928, 10929) count too. Publisher decides by the driver's error code where it has one.

Before, a package's first load that hit one was marked failed, and a listing never loaded it again. A version's rebind from the store took the version out of service, so its next read loaded it again against the same database. A manifest bind stayed bind_failed until someone named the manifest again.

Now each is tried again in the background with backoff (2 s, doubling to at most 60 s between attempts) for about five minutes from the first failure. That is long enough to ride out a Postgres restart or a managed database's failover. Meanwhile:

  • a first load waiting on its retry is listed as not serving and reported nowhere;
  • a package whose manifest bind failed serves as it did before the bind;
  • a version a run of its own rebinds after its commit keeps serving its previous binding (its files never change, so its models are their own compile).

A rebind before a run rewrites the tables several versions share still takes a version out of service on any failure, as before, so no version is left reading rows another definition built. A load now reports a lost session or a refused connect during a schema read as a transient 503, not as a compile error in every model. A refused login (28xxx), a database that does not exist (3D000), a full disk (53100) and a statement timeout (57014) are never transient, and fail at once as before.

[fix] A refresh that cannot read an upstream table for a transient reason keeps serving the stored tables built from it. This covers a reload with ?reload=true, reload_package, or a publish, that fails to compile. Before, it stopped serving every stored table whose upstream it could not read. When the read failed because the database had no free session, every stored source's queries went live, to the database that had just refused a read, and stayed live after it recovered.

Now, when the read failed on a transient database error, those stored tables keep serving and the upstream is read again in the background (up to 10 times, and at the next manifest bind or rebind). A read that finds it unchanged ends this. A read that finds a column changed stops serving the stored tables, as a refresh that could read it would have. A read that fails for a permanent reason (a refused login, a revoked grant) still stops serving them, as before. Freshness windows still apply at serve time.

The trade-off: a column change made while the upstream could not be read is served across, from the stored table, until a read sees it. /status says so while it lasts (below).

[change] The reason a query reports for a table withdrawn while its upstream is unread is upstream_unread, not STALE. Where a table is still withdrawn on an unread upstream (a permanent read failure, or a rebind that kept a file whose recompile failed), the path report now names it NOT_SERVED with code upstream_unread. Before, it said STALE with "an upstream table that changed since its build". upstream_unread is the reason its serve verdict already gave. A refresh's stale message now says which upstream tables could not be read (upstream_unread), and that their sources keep serving.

[change] For API clients: /status loadErrors entries can carry transient, attempts, lastError and sources, and stale is broader. stale: true now means the package is still serving, but not from its current state. As before, that can be a reload that failed to compile. With transient: true it can also be something the database refused that would bring the package current:

  • a version's rebind, or a manifest bind, that failed for the whole retry window (with attempts and lastError);
  • stored tables serving over an upstream a transient error left unread, with sources naming those sources and lastError the read's error, until a read succeeds.

A package has at most one such entry; its causes' messages are joined. transient: true without stale is a first load that failed for the whole window: the package is not serving, and the next request for it loads it again.

A host that marks a version as errored from loadErrors now sees nothing for a blip that clears within the window. A wrong host or port reads as transient too, so a lasting entry whose lastError is a refused or timed-out connect is most often the connection's configuration. The new fields are documented in api-doc.yaml and api-doc.v1.yaml.

[docs] Size the Postgres pool for a small database. Each Postgres connection holds at most PUBLISHER_POSTGRES_POOL_MAX sessions (default 5) per Publisher process, so the most it opens against one database is about that value times the pods serving the environment. Keep pool size × pods under the database's connection limit, less what its other clients use: a database with 25 connections is run out by five pods at the default. Lower the setting for such a database. Queries beyond the pool then wait in Publisher instead of being refused by the database. See docs/connections.md.


more BigQuery string queries serve from stored tables, declines say which field and why, and a warning names strings a stored table cannot compare

More string queries over a BigQuery .sql() source now serve from its stored table. A storage= table compares strings byte for byte, so Publisher serves a query that groups, filters or orders by a string only when it can prove BigQuery compares that string the same way. For an .sql() source, or any source with a raw SQL expression, it used to prove that for the whole project: every project the SQL could read had to be read in full and hold no collated column anywhere, so one collated column elsewhere, or one project the connection's account could not read, sent every string query live and made the build record the strings compare: none.

Each string field is now judged on its own, from a BigQuery dry run (jobs.insert with dryRun: it reads no rows, bills no bytes, and needs the bigquery.jobs.create permission a query already needs). At each bind Publisher dry-runs one query that selects each of the source's string fields, and at each build it dry-runs the build's SQL. A field compares byte for byte only when the dry run's result schema names no collation for it (a STRUCT member by its own path), and no table the dry run lists as referenced holds a collated column, read from that table's own dataset INFORMATION_SCHEMA. Each connection's dry runs are first checked against a known answer (COLLATE('a', 'und:ci') must come back collated, a plain 'a' must not). Nothing in your model or configuration changes: the next bind serves the strings it proves, and the next build records them compare: exact.

The rule fails closed. A string is left unknown, and its queries answered live, when the connection has setup SQL, the SQL is a script, it references 50 or more tables or a persistent function, the dry run fails, a field is missing from its result, a referenced table's dataset cannot be read, or a referenced table is a wildcard table or not a base table (an external table, a materialized view). A COLLATE in the source's own SQL is read from the dry run, so only the column it collates answers live; one in the caller's query still sends the query live. A persisted source the query reaches (the queried source itself, or one reached through a %{} embed or a join at any depth, extended or not) that a run over bound database tables may read from its bound table is held to that table's own contract. Its table is found the way a run finds it, by the build ID Malloy computes from its SQL, whichever source in whichever file the table was built for. Every table filed under that build ID must store its strings byte for byte. If the build ID cannot be computed while a database table is bound, the query answers live; that happens when the source's SQL reads a given, or when its connection's digest could not be read. The project-wide catalog read no longer proves author SQL. One change can send a query live that used to serve: a caller's own raw SQL expression (sql_string(...) and the like) over a .table() source on BigQuery was proved by that project-wide read, and now always answers live.

For API clients: a skipped table in the query path report says which check declined it, over which field, and why. QueryPathCandidate gains declineCode, the declining leg's own code (served_copy_filter_comparison, served_copy_result_order_comparison, served_copy_row_scope_comparison, and each other leg's counterpart), and, for a string comparison a stored table does not reproduce, comparison: field (the dotted path of the queried source), compare (unread, none or equality) and why (strings_unread, collation_mismatch or caller_collate). The skip's detail now names that field path too, never a table, dataset, project or connection. The access record's path.considered entries carry declineCode and comparison the same way. All are optional and added; nothing existing changes shape.

New package warning stored-strings-compare-unknown. A storage= table whose contract records all its string columns, or a string column of its source's primary key, compared none for a reason that is not a collation now carries a warning naming the source, its destination and the columns (five, and how many more), why, and what to do. Its reason is one of dry_run_failed, dry_run_unverified, dry_run_incomplete, referenced_table_unread, referenced_table_unsupported, referenced_table_collated and contract_unread, and it sets sourceEntityId and sourceName. A compile-scope package dry run lists it too, and marks the table's materialization summary row with a stringsCompare fact. It clears at the next bind or build that reads the strings.


statement_usage separates waiting for a DuckDB session from running

[change] A statement_usage record on a DuckDB connection now says how much of its time was spent waiting. DuckDB runs one statement at a time per session, and a storage destination is one session, so concurrent reads over one destination queue. Until now a record carried only duration_ms, which has always been the wait plus the run, so a queue looked like slow statements: under load a read's duration_ms grew with its place in the queue while the destination sat idle. Its meaning does not change, and its documentation now says so. New fields split it:

  • gate_wait_ms: everything before the first wait for the DuckDB session (the connection lookup, a re-prepare, a cold open), plus each wait for it. gate_wait_ms + exec_ms = duration_ms.
  • exec_ms: the rest. For a single statement, from the session's grant to the settle; a run of several statements also counts the JavaScript between them and the building of its result. It includes any wait for a worker of the process's native pool, which Publisher cannot see start.
  • native_in_flight and native_pool: the blocking DuckDB calls in flight across the process when the session was granted (approximate), and the size of the native pool they run on, as the runtime sizes it: under Bun, which the Docker image runs, UV_THREADPOOL_SIZE, else GOMAXPROCS, else the CPU count (following a container's CPU limit), never below 2; under Node, UV_THREADPOOL_SIZE, else 4. native_in_flight at or above native_pool marks a statement whose exec_ms may include a wait for a native worker.
  • instance, session and session_in_flight: opaque per-process numbers for the DuckDB instance and session the statement ran on, and how many statements were already queued or running on that session when it asked for it. They name no path, catalog or credential.

The fields are left out of a record whose statement ran on no DuckDB connection. Statements run exactly as before. For operators reading these logs: a destination whose records show a large gate_wait_ms, a small exec_ms and a rising session_in_flight is queueing on its one session, not slow. The fields are listed in docs/ducklake.md, under "Meter it".


through an import of an import, a computed-column where: and a query stage over an inline extension are served, and a gated source's verdict says why it answers live

[fix] Two more shapes over a stored query-shaped source are served through an import of an import, as through a direct import. In top.malloy importing mid.malloy, which imports base.malloy, where base is raw -> { group_by: region; aggregate: n is count() } is persisted:

  • on a storage= destination, a source that extends base with a where: on a column base's query computes (where: n > 1) answered live with served_copy_row_scope_inexact: the scope's column was not recognized as the stored table's own. It is now served, judged against the stored column as through a direct import, and so is one extended again, to any depth (b is a extend { … }, a is base extend { where: n > 1 }), including a source top.malloy declares over them, on both tiers;
  • a query stage over an inline extension of base (s is base extend { join_one: r is … } -> { group_by: r.label … }) answered live on storage=, and on the database tier in a model where nothing else proved base (where something did, it was already served), with the serve verdict naming not_rerooted in top.malloy, the code for a Publisher defect. It is now served. One whose join the served copy cannot keep across connections answers live on its own, as through a direct import, and every other source over base in that model is still served.

The answers do not change; they now come from the stored table.

[fix] A stored source with its own #(access_filter) reached through an import of an import names why it answers live. Its queries in top.malloy are answered live, under its gate, because the served copy cannot graft the gate there. The serve verdict, which the path report, get_context and /status read, said serves with nothing in notServedIn; it now lists top.malloy with inherited_gate, as it does for any source whose gate the copy cannot graft. inherited_gate is now named in every model whose copy cannot graft the gate, last, beside any other reason that model's copy reports; before, a reason from elsewhere in the model's copy (a join left out across connections on an unrelated source, say) replaced it. On the database tier the query's path report named no table at all; it now names the stored table it did not read, skipped with NOT_SERVED, code: served_copy and declineCode: served_copy_not_served, as the storage= tier already did. Any query the served copy declines whole (a gate it cannot graft, or a query reading no re-rooted table) now names the nearest database table on its chain this way. What to do: nothing. To serve a gated source through an import of an import, import its declaring file directly.


a stored query-shaped source reached through an import of an import is served from its table

[fix] A query-shaped #@ persist source is served from its stored table in a model that reaches it only through another file's import. Malloy imports are not transitive: in top.malloy importing mid.malloy, which imports base.malloy, where base is raw -> { group_by: … } is persisted, top.malloy sees only what mid.malloy declares over base (funnel is base extend { … }, or a query stage funnel is base -> { … }). Every query in top.malloy on such a source answered live, though the table was built and current, with no package warning. Its serve verdict said serves, and the query's path report said NOT_SERVED, "no stored table is re-rooted in this model's served copy", or named no reason at all. The same source in mid.malloy, or in any file that imports base.malloy, was served. It now serves in top.malloy too, on the database tier and on a storage= destination. The answers do not change; they now come from the stored table instead of the warehouse. #(materialize) sources in this position were already served. A join across connections in one of the sources over base now sends only the queries that read that join live, as a direct import does; before, it sent every source over base in that model live.

A stored source with its own #(access_filter) still answers live in top.malloy, though a direct import of base.malloy serves it; its serve verdict says so (see the section above). These still answer live however base.malloy is imported: a source the entry model declares under the same name itself, a table past its freshness window, and a column whose collation changed after the build. What to do: nothing. Keep any direct import of base.malloy you added to get its tables served; removing it can send the cases above live.


a stored query-shaped source's non-string column no longer sends a string-comparing scope live

What's Changed

  • chore(release): 0.18.9 by @kylenesbit in #2172
  • fix(deps): clear the open HIGH Trivy findings by @kylenesbit in #2174
  • chore: retire the legacy k6 suites and @grafana/openapi-to-k6; drop its 13 Trivy acceptances by @kylenesbit in #2176
  • fix(server): a stored query-shaped source reached through a transitive import is served from its table by @kylenesbit in #2175
  • chore: the dry-run publish spec snapshots only what a dry run can write; the Malloy upgrade scripts keep the render patch and the server's pg pin by @kylenesbit in #2173
  • feat(server): statement_usage separates waiting for a DuckDB session from running by @kylenesbit in #2179
  • feat(server): BigQuery string columns are judged per column from the dry run, declines say why, and a warning names strings a stored table can't compare by @kylenesbit in #2178
  • fix(server): a transient connection error never takes a version out of service, and a refresh keeps stored tables through an unreadable upstream by @kylenesbit in #2177
  • feat(server): served reads over a storage destination run concurrently (a session pool), with a scaling load test by @kylenesbit in #2180
  • fix(server): binding a storage manifest reads each destination once, and an identical rebind is a no-op by @kylenesbit in #2181
  • ci(perf): the destination sweep cleans up after a containerised server and completes every configuration by @kylenesbit in #2186
  • feat(server): boundManifestDigest, and a refused bind restores the previous build and never reads as landed by @kylenesbit in #2185
  • fix(server): a transitive import's serve verdict names why it answers live; happy-dom 21 (dev) by @kylenesbit in #2187
  • test(server): isolate stored_table_read's still-closing specs and settle the watch-mode live-reload specs (release gate on Windows and macOS) by @kylenesbit in #2189

Full Changelog: v0.18.9...v0.18.10