Skip to content

An interrupted backfill leaves rows in an unattached partition; plan / validate report ok #76

Closed

Description

@alexluong

Backfill moves a window's rows into a new table, then attaches it. If the process is killed in between, the rows sit in a table that isn't attached and reads through the parent don't see them. Killing backfill mid-window left 5,000 rows in an unattached events__2026_05; plan and validate both reported ok. Re-running backfill recovered them with nothing lost or duplicated.

Suggestion: have plan / validate flag tables that match the partition naming, aren't attached, and hold rows, and point at re-running backfill.

Heads-up: I found this while testing pg-partsmith against Outpost's schema with a fair amount of LLM help. I reproduced it myself, but haven't dug deep, so treat it as a report rather than a requirement; your call on whether and how to fix it.

Activity

  1. AlexeyShalaev commented on Sep 29, 2026

    @AlexeyShalaev
    Member

    Fixed in 1.7.0 (#85). What your run left behind now shows up in plan:

    [warning] unattached_rows: public.events__2026_05 holds rows of 2026_05 but is attached to nothing, so no query through public.events sees them; backfill (partition_data) attaches it.
    

    It's a warning, so plan --check exits 3 on it. And backfill finishes the job itself: once DEFAULT has nothing left to move, it attaches such a table the same way it attaches a window it has just filled. So re-running it is still the fix, it just no longer depends on DEFAULT still holding rows of that month.

    Only a table named exactly what the scheme gives a window under that root counts, so events_remote__2026_05 next to events isn't taken for May and its rows are never read. A table with a window's name but rows outside that window wasn't left by a backfill; backfill says so and leaves it alone.

    validate stays a check of the config against the catalog (method, key, unique constraints) and doesn't read data, so the report went into plan.

    Checked on a reproduction of your case: killed between the fill and the attach, 0 of 744 rows visible through the parent, the warning in plan, then backfill attached the table, all 744 visible and the warning gone.

    Thanks for all four of these, by the way. Each one turned into a real fix.

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