| From: | Salma Elsayed <salmasayed182003(at)gmail(dot)com> |
|---|---|
| To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
| Cc: | Kirk Wolak <wolakk(at)gmail(dot)com>, zsolt(dot)parragi(at)percona(dot)com, Kirill Reshke <reshkekirill(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-30 15:25:14 |
| Message-ID: | CANBEAPH36ERVXT1VOWCj8sxTR6vtERVomcyx3vFhZ-wauaK-cw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Jim,
Thanks for the review.
On Thu, Oct 29, 2026 at 6:24 PM Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:
> == callback functions ==
>
> The comments of RegisterXactCallback and RegisterSubXactCallback suggest
> they're meant for extensions: "These functions are intended for use by
> dynamically loaded modules.". Are they really the best fit here?
>
I removed the RegisterXactCallback and RegisterSubXactCallback calls
and replaced them with AtEOSubXact_DropOrTruncateTable and
AtEOXact_DropOrTruncateTable. They are now called directly from
xact.c, next to AtEOXact_on_commit_actions and
AtEOSubXact_on_commit_actions, which already handle ON COMMIT actions
this way.
> == RegisterDropOrTruncateTable ==
>
> The function already expects reloid, so it could look for rel_name and
> rel_namespace itself if needed -- currently the caller needs to do it.
> Have you considered simply (relid, is_truncate)?
>
Done. It now takes (relid, is_truncate) and looks up the names itself.
> == doDeletion ==
>
> Is the relname != NULL guard and the "unknown" schemaname really
> necessary? I imagined that at this point the relation is locked and must
> exist. Also, IMHO silently skipping a log entry or just logging a
> placeholder is arguably not a good idea for this feature.
>
Agreed. I removed the relname check and the "unknown" schema name.
> == prepared transactions ==
>
> A simplistic approach would be just to make it explicit in the docs and
> not log anything.
>
Agreed. Nothing is logged for prepared transactions now, and the docs say so.
While testing I also found that TRUNCATE of a partitioned table with
no partitions hit an Assert when wal_level is minimal, because no
commit record is written. Fixed in this version.
v12 attached.
Best,
Salma Elsayed
| Attachment | Content-Type | Size |
|---|---|---|
| v12-0001-Log-the-recovery-LSN-of-dropped-and-truncated-ta.patch | text/x-patch | 31.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Burd | 2026-10-30 15:28:19 | Re: nbtree: opt-in leaf key prefix compression |
| Previous Message | Tom Lane | 2026-10-30 15:07:26 | Re: Return INT_MAX or INT_MIN from strtoint() on overflow |