Re: Handle concurrent drop when doing whole database vacuum

From: cca5507 <cca5507(at)qq(dot)com>
To: surya poondla <suryapoondla4(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Handle concurrent drop when doing whole database vacuum
Date: 2026-06-18 06:44:26
Message-ID: tencent_8F84EE14BED66AA768C854E0E11E14D8850A@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Surya,

Thanks for the comments!

> A couple of points on the patch itself:
> 1. The bug is racy but the injection_points framework (src/test/modules/injection_points) can make it deterministic.
> We can put an INJECTION_POINT() inside the heap_getnext() loop in get_all_vacuum_rels() and adding an isolation spec that parks
> VACUUM there, runs DROP TABLE in another session, then resumes VACUUM and asserts it completes with a WARNING.
>
> 2. Minor comment vacuum_open_relation() already emits an identically-worded
> "relation no longer exists" message with errcode(ERRCODE_UNDEFINED_TABLE).
> Worth adding the same errcode to the two new ereports so the SQLSTATE stays consistent for the same logical event.

Fixed. Please see the v2 patches.

--
Regards,
ChangAo Chen

Attachment Content-Type Size
v2-0001-Handle-concurrent-drop-when-doing-whole-database-.patch application/octet-stream 2.6 KB
v2-0002-Add-test-case-for-vacuum-with-a-concurrent-drop.patch application/octet-stream 4.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-06-18 06:46:04 Re: Fix tuple deformation with virtual generated NOT NULL columns
Previous Message Heikki Linnakangas 2026-06-18 06:42:39 Re: Unexpected behavior after OOM errors