On Thu, May 27, 2021 at 9:47 AM Amit Kapila <amit.kapil...@gmail.com> wrote: > > On Thu, May 27, 2021 at 9:40 AM Dilip Kumar <dilipbal...@gmail.com> wrote: > > True, but if you do this clean-up in ReorderBufferCleanupTXN then you > don't need to take care at separate places. Also, toast_hash is stored > in txn so it appears natural to clean it up in while releasing TXN.
Make sense, basically, IMHO we will have to do in TruncateTXN and ReturnTXN as attached? -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com
From ff049e1ab141ba6bc5c05d62e7a225abfb18fad8 Mon Sep 17 00:00:00 2001 From: Dilip Kumar <dilipkumar@localhost.localdomain> Date: Thu, 27 May 2021 10:03:27 +0530 Subject: [PATCH v1] Cleanup toast hash --- src/backend/replication/logical/reorderbuffer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 4401608..39242f2 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -437,6 +437,10 @@ ReorderBufferReturnTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) txn->tuplecid_hash = NULL; } + /* cleanup the toast hash if it is not done already. */ + if (txn->toast_hash != NULL) + ReorderBufferToastReset(rb, txn); + if (txn->invalidations) { pfree(txn->invalidations); @@ -1629,6 +1633,10 @@ ReorderBufferTruncateTXN(ReorderBuffer *rb, ReorderBufferTXN *txn, bool txn_prep txn->tuplecid_hash = NULL; } + /* cleanup the toast hash if it is not done already. */ + if (txn->toast_hash != NULL) + ReorderBufferToastReset(rb, txn); + /* If this txn is serialized then clean the disk space. */ if (rbtxn_is_serialized(txn)) { -- 1.8.3.1