Skip to content

Table swap fails due to exclusive lock #472

@Alytv13

Description

@Alytv13

Hi!
When running pg_repack on a table ~1TB with --order-by, the process reaches the APPLY stage. When the row count drops below --switch-threshold, pg_repack should acquire an exclusive lock for the final table swap, but fails to do so. The row count then increases again, causing an infinite loop.
The problem occurred with default --switch-threshold settings. We tried increasing --switch-threshold to 4900 and --apply-count to 5000, but the issue persists.
Manually acquiring an exclusive lock on the table for 0.5 seconds allows pg_repack to complete successfully.
pg_repack version:
pg_repack | 1.5.2 | public | Reorganize tables in PostgreSQL databases with minimal locks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions