Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit044aa9e

Browse files
author
Amit Kapila
committed
Fix relation descriptor leak.
We missed closing the relation descriptor while sending changes via theroot of partitioned relations during logical replication.Author: Amit Langote and Mark ZhaoReviewed-by: Amit Kapila and Ashutosh BapatBackpatch-through: 13, where it was introducedDiscussion:https://postgr.es/m/tencent_41FEA657C206F19AB4F406BE9252A0F69C06@qq.comDiscussion:https://postgr.es/m/tencent_6E296D2F7D70AFC90D83353B69187C3AA507@qq.com
1 parentd6ad34f commit044aa9e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

‎src/backend/replication/pgoutput/pgoutput.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ pgoutput_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
502502
MemoryContextold;
503503
RelationSyncEntry*relentry;
504504
TransactionIdxid=InvalidTransactionId;
505+
Relationancestor=NULL;
505506

506507
if (!is_publishable_relation(relation))
507508
return;
@@ -552,7 +553,8 @@ pgoutput_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
552553
if (relentry->publish_as_relid!=RelationGetRelid(relation))
553554
{
554555
Assert(relation->rd_rel->relispartition);
555-
relation=RelationIdGetRelation(relentry->publish_as_relid);
556+
ancestor=RelationIdGetRelation(relentry->publish_as_relid);
557+
relation=ancestor;
556558
/* Convert tuple if needed. */
557559
if (relentry->map)
558560
tuple=execute_attr_map_tuple(tuple,relentry->map);
@@ -574,7 +576,8 @@ pgoutput_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
574576
if (relentry->publish_as_relid!=RelationGetRelid(relation))
575577
{
576578
Assert(relation->rd_rel->relispartition);
577-
relation=RelationIdGetRelation(relentry->publish_as_relid);
579+
ancestor=RelationIdGetRelation(relentry->publish_as_relid);
580+
relation=ancestor;
578581
/* Convert tuples if needed. */
579582
if (relentry->map)
580583
{
@@ -598,7 +601,8 @@ pgoutput_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
598601
if (relentry->publish_as_relid!=RelationGetRelid(relation))
599602
{
600603
Assert(relation->rd_rel->relispartition);
601-
relation=RelationIdGetRelation(relentry->publish_as_relid);
604+
ancestor=RelationIdGetRelation(relentry->publish_as_relid);
605+
relation=ancestor;
602606
/* Convert tuple if needed. */
603607
if (relentry->map)
604608
oldtuple=execute_attr_map_tuple(oldtuple,relentry->map);
@@ -616,6 +620,12 @@ pgoutput_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
616620
Assert(false);
617621
}
618622

623+
if (RelationIsValid(ancestor))
624+
{
625+
RelationClose(ancestor);
626+
ancestor=NULL;
627+
}
628+
619629
/* Cleanup */
620630
MemoryContextSwitchTo(old);
621631
MemoryContextReset(data->context);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp