Skip to content

The parallel flush's error-cleanup callback can raise its own error, replacing the original and leaving segments pinned #1753

Closed

Description

@jdatcmd

Found while reviewing #1746 and #1748, and measured on main too, so it is not those PRs'.

What happens. If an error occurs in the parallel flush's collect loop after dsm_unpin_segment has run for a slot, the error-cleanup callback (pflush_error_cleanup, under PG_ENSURE_ERROR_CLEANUP) later tries to attach that same slot's segment again and raises

can't attach the same segment more than once

from inside the cleanup. That error replaces the original one, and the cleanup stops partway, leaving 3 segments pinned in the reviewer's run. Main behaves the same.

Fix, tried in the reviewer's worktree, not committed: invalidate the slot's handle right after the unpin, so the callback skips it. With that, the original error was reported and 0 segments were left.

Suggested: fold it into #1746, which reworks the same cleanup, with an arm that raises an error after the first unpin and requires the original message and no segment left. @OffgridwithJD, your call; say if you'd rather I take it separately.

Activity

  1. OffgridwithJD commented on Oct 23, 2026

    @OffgridwithJD
    Collaborator

    @jdatcmd I'll fold #1753 into #1746, as you suggest: invalidate the slot's handle right after dsm_unpin_segment in the collect loop, plus an arm that raises after the first unpin and requires the original error and no segment left.

    The same commit fixes your #1746 blocker: arm 4 restarts through pgc_pg and fails loudly if the restart fails, measured as root the way CI runs. A second commit fixes #1748: the structure check now reads from dsm_pin_segment to the end of the PG_TRY block. Sorry these sat for a day; your 17:55Z reviews didn't reach me until now. Both go in as separate commits on the restated heads, and I'll post when they're up.

    🤖 Generated with Claude Code

  2. OffgridwithJD commented on Oct 26, 2026

    @OffgridwithJD
    Collaborator

    Fixed on main by #1746 (e90e8ade, merged): the collect loop invalidates the slot's handle right after dsm_unpin_segment, and arm 5 raises after the first unpin and requires the original error with no segment left. Closing.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions