Do not lock tables in get_tables_to_repack
cca5507 <cca5507@qq.com>
From: cca5507 <cca5507@qq.com>
To: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-06-16T07:34:55Z
Lists: pgsql-hackers
Attachments
- v1-0001-Do-not-lock-tables-in-get_tables_to_repack.patch (application/octet-stream) patch v1-0001
Hi hackers, When doing a whole database repack, we build a list of repackable tables and take a lock on them to prevent concurrent drops. But concurrent drops can always happen after we build the list because we process each table in a separate transaction. The ConditionalLockRelationOid() also makes the default behavior like SKIP_LOCKED, which is unexpected. To remove the locks, we need to make repack_is_permitted_for_relation() handles concurrent drops correctly: it should not report an error when failing to search the syscache in pg_class_aclcheck(). Use pg_class_aclcheck_ext() instead to detect a concurrent drop. Also check the return value of get_rel_name(). Thoughts? -- Regards, ChangAo Chen