Repository navigation
Conversation
An INSERT failed when one column held more than 1 GiB of values in one row group or one chunk group. The writer closed both by row count alone, and every buffer it builds is a StringInfo, which PostgreSQL caps at 1 GiB. With the default limits, 150000 rows of 8 KB or 10000 rows of 120 KB failed with "string buffer exceeds maximum allowed length", even though the values compress to almost nothing. Heap stores the same rows. PgColumnarWriteRow now measures each row before it buffers it: the fixed width of each fixed-width value, and the detoasted size plus a 4-byte header of each varlena, read from its header without detoasting. If the row would take the row group past 256 MiB summed over its columns, the writer flushes the row group first. Every chunk group is part of its row group, so this bounds each chunk group's value stream too. A row alone in its row group is always buffered. test/large_values.sh and test_large_values.py gain the two loads from the issue. The opt-in over-1-GiB arm asserted that 1100 rows of 1 MB incompressible text were refused with 54000. That is the defect this change removes, so the arm now asserts the rows load. It is renamed in both harnesses, in expected_unrunnable.txt and in the ledger. docs/limitations.md gains "Write size limits". Ledger: four rows added, one removed (the renamed arm), merged from large_values.sh logs on PG 15, 16, 17, 18 and 19, then one red log each from PG 18 and PG 17 on main's writer. 9660 + 4 - 1 = 9663 rows; never 4894 + 2 - 1 = 4895; dated 4766 + 2 = 4768. Ledger-census: rows=9663 never=4895 dated=4768 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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/18) jobs refuse with "GITHUB_BASE_REF is unset" since ubuntu-latest moved to 26.04. PR #2162 (845c83e) passes the variable through sudo by name. It is not on main yet, so this branch takes it directly; the merge will collapse once #2162 lands. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch closes a row group before its values pass 256 MiB (#2071). cancel_decode loaded 4,000,000 eight-column rows into a table meant to hold one row group. By the writer's own measure those rows come to 409,333,376 bytes, so the writer now splits them into two groups, and "the one-group table has exactly one group" failed with got 2 want 1 in both twins on PG 17 and PG 18. The fixture was wrong under the new writer, not the check. Both twins now load 2,000,000 rows: 201,333,376 bytes, 75% of the cap. The check still asks for exactly one group, and every other check is unchanged. The uncancelled scan of the one group still took 1066 ms locally, against the 300 ms the premise check needs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI fix-up: two commits pushed (head 65c2190)What I merged, and why
CI failures on c40516a, and what I did1. cancel_decode: "the one-group table has exactly one group" failed in all four jobs. It failed in pytest cluster tests on PG 17 and PG 18, and in suites on PG 17 and PG 18. Every job shows the same line: Cause: this PR's own change. The fixture loads 4,000,000 eight-column rows into a table that should hold one row group. By The fixture was wrong, not the check. Commit The uncancelled scan of the single group still takes 1066 ms. That is above the 300 ms premise, and above the 3x + 50 ms ratio bound (440 ms here). So a cancel that waited for the whole group would still fail. I worked that out from these numbers; I did not remove an interrupt check to test it. 2. suites (PG 17/18): the ledger refusal. Both jobs also printed the Local checks on PG 18.6, head 65c2190
Not verified: the new CI run on 65c2190. It has not finished yet. 🤖 Generated with Claude Code |
Fixes #2071.
Problem
An
INSERTinto a pgcolumnar table failed when one column held more than 1 GiB of values in one row group or one chunk group. With the default limits (150000 rows per row group, 10000 per chunk group), that is a column averaging more than about 7 KB per row, such as ajsonbdocument. The load failed withstring buffer exceeds maximum allowed length (1073741823 bytes), even when the values compressed to almost nothing. Heap stores the same rows.Cause
The writer closed row groups and chunk groups by row count alone. Every buffer it builds is a
StringInfo, and PostgreSQL caps aStringInfoat 1 GiB. Two buffers overflowed:flush_one_columncopies a column's chunk-group streams into one region (the 8 KB case: 13 chunk groups of 80040000 bytes fit, the 14th does not).The row group's
databuffer, which holds every column's chunk, has the same exposure for several wide columns.The fix
PgColumnarWriteRownow measures each row before it buffers the row:toast_raw_datum_sizeplus a 4-byte header, read from its header without detoasting.If the row would take the row group past 256 MiB, summed over its columns, the writer flushes the row group first. Every chunk group is part of its row group, so this bounds each chunk-group value stream too. A row alone in its row group is always buffered. The cap matches the export cap from #1811 and leaves room for an encoding or codec that makes data larger.
Wide rows now make row groups with fewer than
stripe_row_limitrows. Checked on PG 18: 150000 rows of 8 KB make 5 row groups (15984 to 33504 rows each). The reader already accepts short row groups, and the unused row numbers are the gapdocs/limitations.mdalready describes.docs/limitations.mdgains "Write size limits", anddocs/configuration.mdpointsstripe_row_limitat it.One existing test changed. The opt-in arm of
large_values.shandtest_large_values.py(PGC_RUN_OVER_1GB=1) asserted that 1100 rows of 1 MB incompressible text, compression off, were refused with 54000. That refusal is the defect this PR removes: on this branch the rows commit. The arm now asserts the rows load at full length and the server stays up. It is renamed in both harnesses, inexpected_unrunnable.txtand in the ledger. I looked for a shape that still reaches the 1 GiB limit (one row with two 550 MB values), but heap refuses that row too, before the table AM sees it (invalid memory alloc request size 1153433660), so no refusal arm is left to keep.Red, on main's code
test/large_values.sh, PG 18.6:PG 17.11 gives the same two failures. PG 17's wording is
ERROR: out of memory, and the server log has the same detail,Cannot enlarge string buffer containing 1040520000 bytes by 80040000 more bytes.test_large_values.py -k rows_past, PG 18.6:Green
test/large_values.sh, PG 18.6, withPGC_RUN_OVER_1GB=1:Without the opt-in, on the other majors:
test_large_values.py: PG 18 withPGC_RUN_OVER_1GB=1, 3 passed (9 checks). PG 18 and PG 17 without it, 3 passed, 8 pass + 1 unrun (the opt-in arm, listed inexpected_unrunnable.txt).The backend's peak memory (VmHWM) for both loads in one session was 813264 kB on PG 18. Before the fix, the backend reached a full 1 GiB buffer before failing.
Builds on PG 17 and PG 18: no compiler warnings.
Suites run
Shell suites, PG 17.11 and PG 18.6, all exit 0, the same counts on both:
pytest twins of the same 12 suites,
-n 4: PG 17, 100 passed. PG 18, first run 99 passed and 1 failed:test_parallel_flush_optin.py::test_double_cancel_the_cheap_workers_published, on its premisethe cheap workers published their segments before the second cancel: got 'no (new segments=[0])'. The file passed alone (11 passed), and a second-n 4run of all 12 files gave 100 passed. That test's row groups are far below 256 MiB, so the new flush never runs there. I count it as a timing flake under load, not proven.Guard half (
NO_CLUSTER,--pgc-expect-tests 894): 894 passed after one fix. The first run failedtest_no_test_mints_its_own_failure_texton my first draft of_load, which turned an error into text;_loadnow lets the error raise.compare_to_bash.py test/large_values.sh test/pytest/test_large_values.py: every bash property is covered (8 of 8).Registries:
expected_tests.txt:cluster_tests5376 to 5377, by collection (6271 collected, lessguard_tests894).TESTS.mdandexpected_unrunnable.txt: the new test, and the renamed opt-in arm.check_ledger.tsv: 4 rows added, 1 removed. The green logs from PG 15 to 19 were merged in one merge, then one red log each from PG 18 and PG 17 on main's writer. The two load checks are dated 2026-11-24.check_ledger_budget.txt:checks_never_observed_red4894 to 4895.census-commits: 0 refused.gateon the PG 17 and PG 18 logs: exit 0.CHANGELOG.md: a Fixed entry.Not verified
large_values.sh. I did not run the opt-in arm on PG 17, 15, 16 or 19.pgcolumnar.parallel_flush = on) with rows past 256 MiB. Its suite passed, but its data stays far below the cap.🤖 Generated with Claude Code