| From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
|---|---|
| To: | Salma El-Sayed <salmasayed182003(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com> |
| Cc: | Kirk Wolak <wolakk(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
| Subject: | Re: PoC: Simplify recovery after dropping a table by LOGGING the restore LSN |
| Date: | 2026-10-10 22:27:04 |
| Message-ID: | 47129b4f-02a3-47c9-aee8-c6e69ee85342@uni-muenster.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Salma
On 28/09/2026 15:54, Salma El-Sayed wrote:
> Attached is v6 of the patch to log the target LSN on DROP TABLE,
> TRUNCATE TABLE, and DROP DATABASE when the GUC log_object_drops is
> enabled (default off). This is based on Dmitry Lebedev's earlier work,
> which I have revised and extended.
Thanks for the patch!
v6 no longer applies to master, since two new tests were added. 0001 is
v6 rebased, with the test file renamed to
060_drop_table_logging.pl and meson.build updated accordingly -- no
other changes.
== drop database ==
IIUC simply adding a lsn recorded after a drop database expectedly
restores an invalid database, which I can confirm:
psql: error: connection to server on socket "/tmp/.s.PGSQL.5433" failed:
FATAL: cannot connect to invalid database "db"
HINT: Use DROP DATABASE to drop invalid databases.
But I was wondering if capturing the lsn right after
pgstat_drop_database(db_id) woul be a better option here.I tested that
locally, and recovering to that lsn gives back a valid database, with
its original CONNECTION LIMIT, settings and data, and no manual step
needed -- That's in 0002. It still needs more testing..
WDYT?
Thanks for working on this.
Best, Jim
| Attachment | Content-Type | Size |
|---|---|---|
| v7-0001-Add-LSN-logging-for-DROP-and-TRUNCATE-TABLE-opera.patch | text/x-patch | 45.1 KB |
| v7-0002-Log-DROP-DATABASE-LSN-before-the-database-is-mark.patch | text/x-patch | 2.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Geoghegan | 2026-10-10 22:32:16 | Re: index prefetching |
| Previous Message | Peter Geoghegan | 2026-10-10 21:52:47 | Re: index prefetching |