Repository navigation
Conversation
A wait that ran out on overlapping readers reported only the last reader's share, printed as "0s"; report the unbroken hold instead.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Review 1/2 (correctness) of d71452e: 0 blocking, 1 non-blocking in this comment (3 across both comments). Inspected the whole change at The PR changes only what is reported, not what is bounded. Invariants ( Non-blocking
Test case (not run here: needs a live PostgreSQL): the in-loop deadline names a holder no read saw at the deadline// A holder is seen at the first read; the wait's whole budget is spent
// during the sleep, so the second read is cut off before it starts. The wait
// still reports the holder, for the whole wait, though nothing read after
// the first sample.
func TestAwaitLockQueueNamesAHolderItNeverReReadAtTheDeadline(t *testing.T) {
f := newHolderWaitFixture(t)
f.exec(t, "CREATE TABLE %s.t (id int PRIMARY KEY)")
readerPID := holdLock(t, f.admin, fmt.Sprintf("SELECT count(*) FROM %s.t", f.schema))
tables, err := nativeLockedTables(parseStatement(t, fmt.Sprintf("ALTER TABLE %s.t ADD COLUMN note text", f.schema)), f.schema, "t")
require.NoError(t, err)
const limit = 500 * time.Millisecond
start := time.Unix(0, 0)
slept := false
clock := holderWaitClock{
now: func() time.Time {
if slept {
return start.Add(limit)
}
return start
},
sleep: func(context.Context, time.Duration) error { slept = true; return nil },
}
err = awaitLockQueue(t.Context(), f.admin, tables, limit, clock, func(*progress.LockHolderWait) {})
var lingering *LingeringHolderError
require.ErrorAs(t, err, &lingering)
assert.Equal(t, uint32(readerPID), lingering.PID)
assert.Equal(t, limit, lingering.Watched)
assert.Contains(t, lingering.Error(), "at the wait's last read", "the message claims only what the last completed read showed")
}The last assertion is the one a wording fix would make pass; at the head the message says "still held it when the wait ran out". Not run here, because it needs a PostgreSQL container. Verified
This review was generated by Claude Code (claude-sonnet-5-5). |
|
🤖 Review 2/2 (OSS adoption and integration) of d71452e: 0 blocking, 2 non-blocking in this comment (3 across both comments). Read the change from two seats: an operator or CI log reader who meets the new error text, and a host or downstream importer (the SchemaBot adapter and anyone else decoding the verdict JSON) that shows Non-blocking
What reads well for adopters
This review was generated by Claude Code (claude-sonnet-5-5). |
aparajon
left a comment
There was a problem hiding this comment.
🤖 Stamping with comments: 0 blocking, 3 non-blocking (see the review comments above).
This stamp was left by Claude Code (claude-sonnet-5-5).
|
🤖 I reviewed head
I read the full diff, PR discussion and current checks, including the unit and PostgreSQL 14–18 jobs. I did not run local tests. |
JashLal
left a comment
There was a problem hiding this comment.
🤖 Approved on the maintainer’s behalf after reviewing head d71452e. The diagnostic issue remains documented in the review comment.
When the wait outside the lock queue runs out on a chain of overlapping readers, the error and the verdict's
lock_holder.held_nsnow report the whole wait, not just the last reader's share.Why
Before taking a strong lock, pg-sprite waits for existing lock holders to finish, so other sessions do not queue up behind it. If the table is never free for the whole wait, the step stops and names who held the lock. When many short readers overlapped with no gap between them, it named the last one and said that one backend "held a lock for the whole 0s the step waited", which is both wrong and confusing to an operator.
What
awaitLockQueuesetsLingeringHolderError.Watchedto the whole wait. The wait only runs out when every read shared a holder with the read before, so the table was held with no gap for all of it.sincestill picks the PID to name.LingeringHolderError,verdict.LockHolder.Heldandmigrate.lockHolder, and theheld_nstext indocs/schemabot-integration.mdanddocs/cli-output-examples.md, now say it is the whole wait.TestAwaitLockQueueReportsTheWholeWaitOnAChainOfOverlappingReadersruns test(executor): pin the lock-queue wait stopping on chained readers #687's chain throughawaitLockQueueand assertsPID(reader 4),Watched950 ms exactly (fake clock), andbudget-lock-exceeded. It fails without the fix withexpected: 950ms, actual: 150ms.Before / after
Five short readers on
public.ordersoverlap with no gap during a 950 ms wait; reader 4 is the last and was seen for the final 150 ms.