Skip to content

objstore_s3_addressing: refuse any value but path or virtual (#2091) - #2154

Open
jdatcmd wants to merge 3 commits into
mainfrom
fix/2091-s3-addressing-enum
Open

jdatcmd wants to merge 3 commits into
mainfrom
fix/2091-s3-addressing-enum

Conversation

@jdatcmd

@jdatcmd jdatcmd commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2091.

Problem

SET pgcolumnar.objstore_s3_addressing accepted any string. A typo such as 'virtaul', a padded 'VIRTUAL ' or '' was taken without an error, and SHOW echoed it back. Every request then went out path-style. Against AWS this shows up later as a redirect or a signature error, not as a refused SET. docs/configuration.md describes the setting as path or virtual.

Cause

_PG_init defined the setting with DefineCustomStringVariable and no check hook. The object-store module uses virtual-host addressing only when pg_strcasecmp(addr, "virtual") == 0, so it treated every other value as path.

The fix

  • The setting is now an enum GUC with the values path and virtual, like pgcolumnar.compression. PostgreSQL refuses any other value at SET and ALTER SYSTEM with invalid value for parameter (SQLSTATE 22023) and the hint Available values: path, virtual. Case still does not matter.
  • The C variable becomes an int. Nothing read it: the module reads the setting by name through GetConfigOption, which returns the enum's text name, so objstore/columnar_objstore_module.c is unchanged. So is columnar_parallel_export.c, which passes the caller's value to its workers by name.
  • A bad value in postgresql.conf now draws a WARNING at start, and the server uses path. That is what the module did with such a value before. I checked this on the PG18 sandbox: SHOW printed path and the log read WARNING: invalid value for parameter "pgcolumnar.objstore_s3_addressing": "virtaul".
  • docs/configuration.md gives the type as enum. A CHANGELOG entry is under Fixed.

Red, on main's code

PG18, the new tests on d52f6e8's C code.

test/objstore_addressing.sh:

FAIL  the addressing setting refuses the typo 'virtaul': got [virtaul] want [ERROR:  invalid value for parameter "pgcolumnar.objstore_s3_addressing": "virtaul"]
FAIL  the addressing setting refuses 'VIRTUAL ' with a trailing space: got [VIRTUAL ] want [ERROR:  invalid value for parameter "pgcolumnar.objstore_s3_addressing": "VIRTUAL "]
FAIL  the addressing setting refuses the empty string: got [] want [ERROR:  invalid value for parameter "pgcolumnar.objstore_s3_addressing": ""]
PASS  the addressing setting still takes path, virtual and VIRTUAL
accounting: 27 passed + 3 failed + 0 unrunnable + 0 skipped = 30
objstore_addressing.sh: FAILED

test_objstore_addressing.py -k addressing_setting:

E           AssertionError: the addressing setting refuses the typo 'virtaul': got 'virtaul' want '22023 invalid value'
E           AssertionError: the addressing setting refuses 'VIRTUAL ' with a trailing space: got 'VIRTUAL ' want '22023 invalid value'
E           AssertionError: the addressing setting refuses the empty string: got '' want '22023 invalid value'
accounting: 1 pass + 3 fail + 0 unrun = 4
3 failed, 1 passed, 26 deselected in 2.40s

The fourth check passes on main too. It pins that path, virtual and VIRTUAL are still taken.

Green

PG18, with the fix:

PASS  the addressing setting refuses the typo 'virtaul'
PASS  the addressing setting refuses 'VIRTUAL ' with a trailing space
PASS  the addressing setting refuses the empty string
PASS  the addressing setting still takes path, virtual and VIRTUAL
accounting: 30 passed + 0 failed + 0 unrunnable + 0 skipped = 30
accounting: 4 pass + 0 fail + 0 unrun = 4
4 passed, 26 deselected in 2.21s

make after make clean gave no warning: lines on PG18 or PG17.

Suites run

On the final code:

suite PG15 PG16 PG17 PG18 PG19beta4
objstore_addressing.sh 30/30 30/30 30/30 30/30 30/30
parallel_export_parquet.sh 58/58 58/58
objstore_listing.sh 62/62 62/62
objstore_allowlist.sh 52/52 52/52
objstore_s3_read.sh 21/21 21/21
settings_reference.sh 8/8 8/8
docs_style.sh 54/54

pytest, test_objstore_addressing.py, test_parallel_export_parquet.py, test_objstore_listing.py, test_objstore_allowlist.py, test_objstore_s3_read.py and test_settings_reference.py with -n 4:

PG18: accounting: 231 pass + 0 fail + 10 unrun = 241   187 passed in 79.69s
PG17: accounting: 231 pass + 0 fail + 10 unrun = 241   187 passed in 100.88s

The 10 unrun checks are the real-S3 integration arms, which decline without their environment variables, as on main.

Guard half, as the README runs it (PG18): accounting: 2440 pass + 0 fail + 0 unrun = 2440, 894 passed. compare_to_bash.py ../objstore_addressing.sh test_objstore_addressing.py: literal matches: 32 | template matches: 0 | missing: 0.

Registries:

  • expected_tests.txt: cluster_tests 5376 to 5380, collected (5380 tests collected). guard_tests stays 894.
  • TESTS.md: the two new tests in section 326.
  • check_ledger.tsv: four rows from the green logs of PG15 to PG19 and the PG18 red log, merged with --reds-are-real. checks_never_observed_red 4894 to 4895. census-commits: 0 refused.
  • expected_unrunnable.txt: unchanged, because no new test declines.

Not verified

  • I did not run the full shell or pytest corpus. I ran only the suites listed above.
  • I did not run the other suites on PG15, PG16 or PG19beta4. On those I ran only objstore_addressing.sh.
  • I did not test against real AWS S3.

🤖 Generated with Claude Code

SET pgcolumnar.objstore_s3_addressing accepted any string. The
object-store module uses virtual-host addressing only when the value is
"virtual", so a typo such as 'virtaul', a padded 'VIRTUAL ' or '' was
accepted, SHOW echoed it back, and every request went out path-style
without a word.

The setting is now an enum GUC with the values path and virtual, like
pgcolumnar.compression. PostgreSQL refuses any other value at SET and
ALTER SYSTEM with "invalid value for parameter" (22023), and case still
does not matter. The module reads the setting by name through
GetConfigOption, which returns the enum's text name, so the module and
the parallel export workers that receive the caller's value are
unchanged.

A bad value in postgresql.conf now draws a WARNING at start and the
server uses path, which is what the module did with it before.

Tests: four checks in test/objstore_addressing.sh and their twins in
test_objstore_addressing.py. The three refusals were red on main's code
on PG18; the check that path, virtual and VIRTUAL are still taken was
green on both.

Ledger: the green logs of PG15 to PG19 and the PG18 red log are merged.
Four rows are added, three dated by the red log, so
checks_never_observed_red moves from 4894 to 4895.

Ledger-census: rows=9664 never=4895 dated=4769
Co-Authored-By: Claude Opus 5.5 <[email protected]>
jdatcmd and others added 2 commits November 24, 2026 06:34
ubuntu-latest moved from ubuntu-24.04 to ubuntu-26.04 between 2026-11-12
and 2026-11-22. Since then `sudo -E` no longer carries GITHUB_BASE_REF
into run_all_versions.sh. The ledger gate then cannot find the PR's base
and refuses: "no trustworthy prior ceiling: GITHUB_BASE_REF is unset".
Every PR fails suites (PG 17) and suites (PG 18) although every suite
passes (#2056, and every PR from #2127 to #2159).

The step now names the variable in the env list, so it reaches the gate
whatever sudo preserves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The suites (PG 17) and suites (PG 18) jobs fail on every PR with
"ledger integrity failure: no trustworthy prior ceiling:
GITHUB_BASE_REF is unset", because ubuntu-latest moved to 26.04 and
sudo -E no longer carries GITHUB_BASE_REF. PR #2162 (845c83e) passes
it by name and is green, but is not merged into main yet. Merging it
here lets this PR's suites jobs run the ledger gate.

Git merged CHANGELOG.md without conflicts and kept both entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jdatcmd

jdatcmd commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

I pushed 6fa65f5 to this branch: it merges origin/fix/ci-sudo-base-ref (PR #2162, 845c83e). There are no code changes beyond that merge.

Why the merge

The run on 85aa86b failed only suites (PG 17) and suites (PG 18). In both jobs every suite passed. The only failure was the ledger gate, which could not find the PR's base:

ledger integrity failure: no trustworthy prior ceiling: GITHUB_BASE_REF is unset and the local main has no configured upstream.
PG18 could not run the ledger gate at all, which is not a pass:

The cause: ubuntu-latest moved to 26.04, and sudo -E there no longer carries GITHUB_BASE_REF. PR #2162 fixes this by passing the variable by name, but it is not merged into main yet (git merge-base --is-ancestor 845c83ee origin/main is false). So I merged that branch instead of main. Git merged CHANGELOG.md without conflicts and kept both entries.

CI failures I found

I checked the logs of both failed jobs (138207812301 and 138207812185) for any other failure. There was none. Every one of the 13 other checks passed.

  • PG 17: 303 ran, 9 skipped, 0 incomplete, no suite =FAIL
  • PG 18: 306 ran, 6 skipped, 0 incomplete, no suite =FAIL

I made no fix commit, because nothing besides the ledger refusal had failed.

Local checks on the merge, PG 18.6

  • Build after make clean: zero compiler warnings. The make -s build log is empty.
  • Guard half, run as the README says: 894 passed (expected_tests.txt says guard_tests 894).
  • test/objstore_addressing.sh: 30 passed + 0 failed + 0 unrunnable + 0 skipped = 30.
  • test_objstore_addressing.py: 30 passed.
  • pgc_ledger.py census-commits --against origin/main: 1 change test/check_ledger.tsv since d52f6e8c ... 0 refused.
  • Ledger gate, run through test/run_all_versions.sh with GITHUB_BASE_REF=main set. This is the step that failed in CI. It now resolves the base and compares the ceiling:
    ledger coverage: registered=312 | covered=293, not covered=19, ceiling=19
      ceiling against refs/remotes/origin/main (3 commits behind HEAD): 19 -> 19, which does not rise
    census commits: 1 change test/check_ledger.tsv since d52f6e8c (merge base with refs/remotes/origin/main), 0 refused
    

That local matrix run still ended red, for reasons that come from my sandbox, not from this PR:

  • smoke, phase2 to phase6, audit and parallel_flush_optin failed because my sandbox exports PGHOST/PGPORT and was running 8 jobs at once. With those unset, smoke, phase2, audit and parallel_flush_optin each pass (rc=0).
  • logical_subscriber failed with role "postgres" does not exist, because I run as a non-root user. CI runs it as root, and it passed there on 85aa86b.

Still unverified: the new CI run on 6fa65f5. Its result will show on this PR.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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.

objstore: a mistyped pgcolumnar.objstore_s3_addressing such as 'virtaul' is accepted and silently uses path-style addressing

1 participant