Skip to content

Phase D6e: native-mode suites green + format-dependent tests and fixes - #65

Merged
jdatcmd merged 1 commit into
re-originationfrom
phase-d/d6-finalize
Jul 22, 2026
Merged

Phase D6e: native-mode suites green + format-dependent tests and fixes#65
jdatcmd merged 1 commit into
re-originationfrom
phase-d/d6-finalize

Conversation

@jdatcmd

@jdatcmd jdatcmd commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Phase D6e: native-mode green across PostgreSQL 13-19

Runs the full suite in native mode and closes the gaps it surfaced.

Mechanism

  • New pgcolumnar.default_format_version GUC (0 = format 2.2, 1 = native). ColumnarTableFormatVersion falls back to it when a table sets no explicit format_version. This is the single flip point D6f will change; D6e drives it from the harness (PGC_NATIVE=1) to run every suite native.
  • The writer anchors to the on-disk format: a storage with 2.2 stripes stays 2.2 and a native storage stays native even after the default flips, so no table is ever rewritten in a mixed format.

Correctness fixes exposed by native-mode runs

  • Projection scan over a native base returned nothing — the liveness cache was 2.2-only. ColumnarBuildLivenessCache now has a native branch (row groups + whole-group row mask).
  • Concurrent first-inserts raced on storage_pkey — native storage-row creation is now serialized by a transaction advisory lock, re-checking against a fresh pushed-active snapshot (which also satisfies PostgreSQL 18's registered-or-active heap-visibility assertion).
  • Parallel scan double-counted native rows — the native row-group loop now claims groups from the shared parallel counter, the counterpart of the 2.2 stripe claim, so each group is read by exactly one worker.

Format-dependent tests

Made mode-aware: layout introspection runs against native catalogs where a clean equivalent exists, otherwise only in 2.2 mode (native layout is covered by the native_* suites). corruption/hardening gained native-catalog tamper equivalents; the native reader was verified robust to every case.

Testing

Full PostgreSQL 13-19 matrix, assert-enabled, in both modes: ALL VERSIONS PASSED in default (2.2) mode and in native mode.

Part of the Phase D6 stacked series. D6f (flip the default + docs) follows.

🤖 Generated with Claude Code

Runs the full suite in native mode (PGC_NATIVE=1) across PostgreSQL 13-19
and closes the gaps that surfaced. Native is selected by a new instance
default GUC so the whole suite can exercise the native path, and the
format-layout tests become mode-aware.

New mechanism
- pgcolumnar.default_format_version GUC (0 = format 2.2, 1 = native).
  ColumnarTableFormatVersion falls back to it when a table sets no explicit
  format_version option. This is the single flip point D6f will change; D6e
  uses it (via PGC_NATIVE in the harness) to run every suite native.
- The writer anchors to the format already on disk: a storage that holds
  2.2 stripes stays 2.2 and a native storage stays native even after the
  default flips, so an existing table is never rewritten in a mixed format
  (ColumnarStorageHasStripes joins ColumnarStorageIsNative for this).

Correctness fixes exposed by native-mode runs
- Projection scan over a native base returned nothing: the liveness cache
  was 2.2-only (empty for a native base, so every projected row read as not
  visible). ColumnarBuildLivenessCache now has a native branch built from
  row groups and the whole-group row mask.
- Concurrent first-inserts to the same native table raced on the storage
  catalog row (duplicate key on storage_pkey). Creation is now serialized
  by a transaction advisory lock keyed by the storage id, re-checking
  against a fresh pushed-active snapshot; a second flush in the same
  transaction still sees its own row. Pushing the snapshot active satisfies
  PostgreSQL 18's heap-visibility assertion (registered-or-active).
- Parallel scan over a native table returned each row once per participating
  backend: the native row-group loop ignored the shared parallel counter.
  It now claims row groups from the counter (columnar_next_group_index),
  the native counterpart of the 2.2 stripe claim, so each group is read by
  exactly one worker.

Format-dependent tests (mode-aware; native layout is covered by the
native_* suites)
- lib.sh: stripe_count / chunk_group_count count row groups / vectors in
  native mode; a native_mode helper and the PGC_NATIVE conf switch.
- differential, projections, generated_columns, sorted_projection: the 2.2
  catalog-introspection checks (encoding-type codes, bloom presence, min/max
  columns, chunk-group counts, metadata-count EXPLAIN lines) run against the
  native catalogs where a clean equivalent exists, and otherwise only in 2.2
  mode. The oracle/behaviour checks run in both modes.
- corruption, hardening: native-catalog tamper equivalents (poke row_group /
  column_chunk / bloom) asserting a clean error or safe degradation with the
  backend surviving. The native reader was verified robust to every case.
- native_writer pins the instance default to legacy so its format-selection
  assertions hold regardless of the harness default.

Full PostgreSQL 13-19 matrix, assert-enabled, in both modes:
ALL VERSIONS PASSED in default (2.2) mode and in native mode.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant