Skip to content

Trellis 0.3.0

Choose a tag to compare

@mmmries mmmries released this 16 Nov 16:03
63eaabd

Highlights

  • A rolling deploy needs no migrate step. Once every old process has
    stopped, a background process of the new release runs the pending
    migrations itself and takes over in the same pass (#1852). The takeover
    work runs once per binary version, recorded with the work (#1855).
  • Faster aggregate and JOIN builds. A plain aggregate's fresh build
    writes each group once, per leaf on a partitioned source; rebuilds update
    hidden rows in key order; JOIN … GROUP BY builds write their hidden
    tables in sorted single passes. At 10M groups a fresh aggregate build takes
    82 s from define to live, against 1,535 s for 0.2.0's form (#1938,
    Benchmarks).
  • Correct on the PostgreSQL 2026-11 minors (15.20, 16.16, 17.12, 18.7),
    whose attribute versions (CVE-2026-6460) hid a same-type column rewrite
    from capture (#1947). Also in 0.2.1.
  • A revoked schema USAGE halts only the definitions that read or write
    that schema,
    instead of failing the staging pass for every table
    (#1921, #1925).
  • Alertable metrics for definitions by status, pauses by cause, held
    keys, tripped column fuses, drain failures, capture holdups and worker
    liveness (#1957).
  • The Ruby gem follows Rails conventions: logs to Rails.logger, a
    metrics endpoint and exporter middleware, read-only Trellis::Target
    models, a test-environment off switch with refresh_trellis_target, and a
    CI check for risky deploys. Trellis is now off in a Rails app's test
    environment by default
    (Behaviour changes).

0.3.0 includes every fix in 0.2.1. 80 pull requests merged since v0.2.0
(changelog).

Bugfixes

  • A deadlock between a page and a rebuild start (#2019, #2021; also in
    0.2.x).
    A page that parked a quarantined key's change, or wrote a 1-1
    JOIN's hidden state, took definition rows in two places out of id order.
    A rebuild start (request_backfill, the last capture install) locks the same
    rows in one sorted statement, so the two could deadlock. The start usually
    lost and returned deadlock detected (40P01) to its caller; no data went
    wrong. A page now takes all its definition rows in one id order, after its
    other targets. Truncate clears run in target order too.

  • A 1-1 JOIN build could go live with a stale target row (#2027; also in
    0.2.x).
    A page that re-derived an entry while the build's M pass ran,
    whose a row was deleted before its chunk read the range, left a target row
    joined to a replaced M entry until the delete's page drained. The sweep's
    stale bound now sits past the M pass, and every 1-1 JOIN build, fresh
    ones too, ends with the sweep. A fresh build takes about 18% longer (5M
    rows: 36.7 s to 43.4 s); a build in 0.3.0 is still much faster than in 0.2.x.

  • Same-type column rewrites on the 2026-11 minors (#1947, #1948; also in
    0.2.1).
    Capture missed an ALTER COLUMN … TYPE … USING that kept the
    type, and its readers' targets stayed silently stale. The rewrite check now
    leaves the attribute version out of its hash. Tests simulate attribute
    versions on every server, so pull-request CI covers these minors.

  • A revoked USAGE on a source's schema (#1921, #1925). The definitions
    reading or writing a table in that schema halt (capture_failure kind
    halt, naming the role and schema), and status() answers for them.
    Every other table keeps staging. After GRANT USAGE, RESUME rebuilds
    them. In 0.2.x the drain failed the page forever, status() of an affected
    aggregate returned a permission error, and the staging pass failed for
    every table.

  • A star JOIN paused by an ON-column retype (#1950) names only the
    retyped column, once. A two-table JOIN whose only ON column re-renders
    (integer to text) now also says the pair no longer matches.

  • Key types are matched by OID, not type text (#1875). A user type or
    domain named like a key type (create domain "integer" as numeric) is not
    taken for the built-in one in a retype pause reason. A refused extension
    type is named in full (public.citext).

    Behaviour changes

  • Ruby: Trellis is off in the test environment (#1959).
    config.trellis.off_in defaults to %w[test], read from every
    environment, so db:prepare from development leaves Trellis out of the
    test database too. There nothing connects at boot; Trellis::Railtie.connect
    and trellis:migrate warn and do nothing; a schema load creates the
    targets as plain tables and leaves the definitions in the restore queue;
    the migration helpers (define, apply, status) raise
    ActiveRecord::MigrationError, so build the test database with
    db:schema:load or db:test:prepare, not db:migrate. Tests write
    targets directly or fill one with refresh_trellis_target.
    Action: a suite that runs Trellis in its tests sets
    config.trellis.off_in = [] (the gem README's "Running Trellis in
    tests"). Without it nothing connects and Trellis::Railtie.connect warns.

  • Ruby: Rails sends the engine's log lines to Rails.logger, at its
    level (#1954). Action, if a debug log is too much:
    config.trellis.log_level = :info, or config.trellis.log_bridge = false.

  • Rust: while migrations are pending, a failing status() or
    definitions() returns TrellisError::MigrationsPending
    (code
    version_handover, the SQL error as its source), not the bare SQL error.
    Action: code matching that SQL error matches the new variant.

  • A worker role that can't alter Trellis's tables stands by until
    migrate runs
    (above). Action: keep the deploy step.

  • A queued restore runs before the takeover (#1855). While it refuses (a
    conflicting definition, a role without DDL), every background process
    stands by, retries every minute and reports why in its log and status().
    0.2.x took over and left the queue unrestored. Action: fix what the
    reason names.

  • More rebuilds on the 2026-11 minors (also in 0.2.1). There an
    ALTER COLUMN … TYPE re-stamps every later column. When the table's file
    also moved, each later column a definition reads counts as rewritten and
    its readers rebuild, some for nothing: one rule that errs toward
    rebuilding (decided on #1948). Action: expect such an ALTER to
    rebuild the readers of the table's later columns.

  • Rolling back to 0.2.x and forward again skips the takeover work
    (below). Action: none
    for 0.3.0.