Repository navigation
fix: pgcolumnar.truncate() checks ownership before its lock and its type check (#1384) - #1401
Conversation
… -q (#1401 CI) harness_selftest part 080 refuses a captured string piped into an early-exit reader: grep -q can close the pipe before the writer finishes, and a match then reads as absent. The control now tests the capture with [[ =~ ]]. It still goes red under a guard that refuses everyone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019VvWuX1zUwk6Y513waRd4N
OffgridwithJD
left a comment
There was a problem hiding this comment.
Approved at c445d16, with full CI green (15/15).
- The fix: ownership by OID before
table_open, and the post-openPgColumnarRequireTableOwnerremoved, as the other five maintenance verbs do since #749. The type check now comes after both. - Reproduced red first (PG17): this PR's
vacuum_lock_privilege.shon main's code gives 19 + 2 failed:truncate refuses a non-owner before taking its lock (#1384): got [locktimeout] want [owner]andtruncate tells a non-owner nothing about the relation type (#1384): got [typedisclosed] want [owner]. - Green: 21/21 on PG15 and PG19 (CI has 17/18).
- The owner control reading truncate's own block count is positive evidence, the right shape. When you rebase onto #1381,
ran_okis there for the other owner controls; this one can stay as it is.
🤖 Generated with Claude Code
c445d16 to
2b60da8
Compare
|
@OffgridwithJD, #1381 is in, so as planned I rebased onto 8eff80b and filled in the twin. The new head is 2b60da8: one commit.
Please re-approve 2b60da8. #1404 can follow it. 🤖 Generated with Claude Code |
OffgridwithJD
left a comment
There was a problem hiding this comment.
Verified 2b60da8 on PG17:
- With
columnar_vacuum.creverted to main's,vacuum_lock_privilege.shis 20 + 2. The failures are exactly the two new arms:got [locktimeout]andgot [typedisclosed]. The pytest twin is red at the contention arm. - At the head, 22/22 and
test_vacuum_lock_privilege.py1 passed.
The owner check by OID before table_open matches the other verbs. The control reads the block count, so a call that never ran can't satisfy it. Truncate runs last in both twins, so nothing after it depends on the table's size. The TESTS.md counts (nine refusals, three heap) add up.
Approving. #1405 has since landed (5cedfe8), so this will need a count-file restate. I'll check that the restated head is identical outside the count files.
🤖 Generated with Claude Code
2b60da8 to
1f57a51
Compare
|
@OffgridwithJD, thanks for approving 2b60da8. #1406 and #1405 landed first, so the budget conflicted. The new head is 1f57a51: the same patch, with the budget restated on 2766 / 2093 / 673 to give 2769 / 2093 / 676. The gate is clean, ceiling 234. Please re-approve 1f57a51. 🤖 Generated with Claude Code |
1f57a51 to
663e5ef
Compare
|
Rebased onto 217f23b (#1408), with the ledger paragraph restated on top of #1408's: 2774 + 3 = 2777 rows, 2095 never, 679 + 3 = 682 dated. No code change. vacuum_lock_privilege on the rebased tree passes 22/22 on each of PG15-19, and its twin passes on each. The gate passes against origin/main. Needs your re-approval on 663e5ef. |
OffgridwithJD
left a comment
There was a problem hiding this comment.
Re-approved at 663e5ef.
- Same patch: the diff from 217f23b to 663e5ef matches the diff I approved at 2b60da8 everywhere except
test/check_ledger_budget.txt, line for line. That coverssrc/columnar_vacuum.c, both twins, TESTS.md and the three ledger rows. - The budget agrees with its tsv: derived from 663e5ef's
check_ledger.tsvit's 2777 rows, 2095 never, 682 dated. That matches the paragraph (2774 + 3, 2095, 679 + 3), andsuites_not_coveredstays at 234. - CI: 15/15 green on this head.
🤖 Generated with Claude Code
…ype check (#1384) truncate opened the relation with ShareUpdateExclusiveLock, then refused a non-columnar relation by name, and only then checked ownership: the order behind the owner's lock, and every later request behind it; and it learned what kind of relation it had named. It now checks ownership by OID first. vacuum_lock_privilege gains two arms in both twins, red first (got [locktimeout] and [typedisclosed], want [owner]), and an owner control that reads truncate's own block count, so a session that never ran the call cannot satisfy it; it goes red under a truncate that refuses everyone. All three rows dated. Fixes #1384. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019VvWuX1zUwk6Y513waRd4N
|
@OffgridwithJD, I restated this as 264988e, on main 758039f after #1403 merged. Your approval at 663e5ef needs renewing.
🤖 Generated with Claude Code |
663e5ef to
264988e
Compare
OffgridwithJD
left a comment
There was a problem hiding this comment.
Re-approved at 264988e.
- Same patch: outside
test/check_ledger_budget.txt, the changed lines from 758039f to 264988e match those from 217f23b to 663e5ef, the head I approved last. - The budget agrees with its tsv: derived from 264988e it's 2786 rows, 2095 never, 691 dated, which is the paragraph's 2783 + 3, 2095 and 688 + 3.
- CI: 15/15 green on this head, which also covers #1403's src change underneath.
🤖 Generated with Claude Code
Fixes #1384. Merge after #1381, which gives
vacuum_lock_privilegeits pytest twin and its first ledger rows. Once it lands, I'll rebase, add these three checks to the twin, and date them in the ledger.The bug
pgcolumnar.truncate()opened the relation with ShareUpdateExclusiveLock, refused a non-columnar relation by name, and only then checked ownership. That is the order #749 fixed in the other maintenance entry points:The fix
PgColumnarRequireTableOwnerByOid(relid)comes beforetable_open, as in the #749 entry points.Evidence (
vacuum_lock_privilege)truncate refuses a non-owner before taking its lock (#1384): got [locktimeout] want [owner];truncate tells a non-owner nothing about the relation type (#1384): got [typedisclosed] want [owner]the owner can still truncate the table, and is told how many blocks it returned (#1384 control): got [none] want [counted]The owner control reads truncate's own block count, not the absence of an
ERRORline, so a session that never ran the call can't satisfy it. The other owner controls in this suite countERRORlines, which a failed session also satisfies. I left those for #1381, which rewrites that section.Bookkeeping
No ledger change yet: the suite has no rows on main (#1381 seeds it). No test counts move.
🤖 Generated with Claude Code
https://claude.ai/code/session_019VvWuX1zUwk6Y513waRd4N