Forget close an open relation in ReorderBufferProcessTXN()
Japin Li <japinli@hotmail.com>
From: Japin Li <japinli@hotmail.com>
To: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2021-04-15T10:30:14Z
Lists: pgsql-hackers
The RelationIdGetRelation() comment says:
> Caller should eventually decrement count. (Usually,
> that happens by calling RelationClose().)
However, it doesn't do it in ReorderBufferProcessTXN().
I think we should close it, here is a patch that fixes it. Thoughts?
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 52d06285a2..aac6ffc602 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -2261,7 +2261,10 @@ ReorderBufferProcessTXN(ReorderBuffer *rb, ReorderBufferTXN *txn,
elog(ERROR, "could not open relation with OID %u", relid);
if (!RelationIsLogicallyLogged(relation))
+ {
+ RelationClose(relation);
continue;
+ }
relations[nrelations++] = relation;
}
Commits
-
pgoutput: Fix memory leak due to RelationSyncEntry.map.
- eb89cb43a0d0 14.0 landed
- d2505681211b 13.4 landed