moonlink 0.3.0-pgsty.1: Mirror Generations, Iceberg 0.11 & Security Audit
Moonlink v0.3.0-pgsty.1 can acknowledge a forced snapshot (create_snapshot) before Apache Iceberg persists the last table commit. Upgrade to Moonlink v0.3.0-pgsty.2 (paired with pg_mooncake 0.3.3 or 0.3.4 and duckdb_mooncake v0.0.5) and take a fresh snapshot of each mirror before relying on it for backups or migrations.
Moonlink v0.3.0-pgsty.1 is the PGSTY-hardened storage engine and RPC client paired with pg_mooncake 0.3.2 and duckdb_mooncake v0.0.4. Building on the upstream-aligned v0.3.0 baseline (dcf999a9), this release layers PGSTY commit 71c9dfcf to harden mirror lifecycle management, isolate on-disk storage layout, and upgrade the entire persistence dependency stack to zero RustSec vulnerabilities.
Summary of Changes
| Area | Change |
|---|---|
| Generation-checked lifecycle | Every mirror registration now carries a unique generation token. Stale cleanup requests from a dropped or interrupted create_table call cannot retire a replacement mirror created under the same name. |
| Append-only RPC extensions | Retains all earlier wire request numbers (0–9) and appends 10 Registration, 11 DropRegistration, 12 RegisteredDatabases, 13 CreateRegisteredTable, and 14 ManagedRegistrations, plus SOURCE_WATERMARK (u64::MAX) for source-side WAL freshness. |
| Storage & staging safety | Fixes snapshot metadata for deletion vectors and file indexes; validates safe catalog namespaces/table names (MooncakeTableId::storage_key using v2-<sha256>); isolates write cache under temp/write_cache/v2-<digest>/; stages atomic writes in .moonlink_atomic_tmp without deleting unrelated files; refuses occupied local Iceberg directories and nonempty legacy _wal directories. |
| Persistence stack upgrade | Upgrades to Apache Iceberg 0.11.0, OpenDAL 0.58.2, Arrow & Parquet 58.4.2, SQLx 0.9.1 (libsqlite3-sys 0.40.0), and Inferno 0.12.8 (optional pprof rendering). |
| RustSec security audit | Eliminates all remaining vulnerability and unsoundness advisories across the workspace lockfile and default dependency graph (0 vulnerabilities, 0 unsoundness; 3 unmaintained-crate notices remain). |
Generation-Checked Mirror Management & RPC Wire Protocol
Previously, creating, dropping, and recreating a mirror with the same schema.table name across restarts or aborted DDL transactions could race with delayed cleanup requests. v0.3.0-pgsty.1 introduces explicit registration generations:
CreateRegisteredTablereturns a fresh generation identifier bound into PostgreSQL’smooncake.mirror_registrationscatalog table inside the destination transaction.DropRegistrationrequires both(database, table)and the exactgeneration, ensuring that late retries or orphan reconciliation never delete a newer replacement mirror.RegisteredDatabasesandManagedRegistrationsletpg_mooncakereconcile committed drops and interrupted creations across restarts and guard database renames/drops cleanly.SOURCE_WATERMARK(u64::MAX) instructs Moonlink to sample the mirror’s source server WAL position for freshness-sensitive scans and snapshots, working consistently for both local and remote sources.
All additions are strictly append-only and covered by wire-format golden tests in src/moonlink_rpc/tests/wire_golden.rs and src/moonlink_service/src/schema_wire_golden.rs.
Storage Hardening & Persistence Upgrade
- Clean layout separation: Scratch directories (
temp/,read_through_cache/,.moonlink_atomic_tmp/) are strictly separated from Iceberg table directories (<db>/<schema>.<table>/{data,metadata}), and reserved directory names are rejected as catalog namespaces. Each new local mirror requires an unoccupied Iceberg directory; separate deployments sharing object storage must use exclusive table prefixes. - Deletion vector & index metadata: Fixed snapshot metadata handling for deletion vectors and file indexes, and ensured atomic write staging under
.moonlink_atomic_tmppreserves unrelated files. - Zero-vulnerability audit (2026-11-23): Upgrading to
iceberg 0.11.0,opendal 0.58.2,arrow/parquet 58.4.2, andsqlx 0.9.1(libsqlite3-sys 0.40.0) resolved thequick-xml,thrift,arrow-data, andlibsqlite3-sysadvisories present inv0.3.0. Bothcargo auditand strictcargo deny(with an empty ignore list) reported 0 vulnerabilities and 0 unsoundness matches in Moonlink (reporting only three unmaintained-crate notices:RUSTSEC-2025-0141,RUSTSEC-2026-0543, andRUSTSEC-2024-0436).
Testing & Migration Notes
- Tested against both local filesystem storage and MinIO object storage.
- Migrating from
v0.0.1(pg_mooncake 0.3.0): Stop source writers, take and verify a snapshot of each mirror on the old binaries, compare source and mirror in both directions, stop PostgreSQL cleanly, and preserve the complete storage backup and old_waldirectory offline before starting the new worker. The worker refuses to start if a nonempty_waldirectory remains present. - Recommended target: Deploy
Moonlink v0.3.0-pgsty.2instead ofv0.3.0-pgsty.1to include thecreate_snapshotdurability fix.