Removing unused parameter in SnapBuildGetOrBuildSnapshot

Started by Melih Mutluover 3 years ago4 messages
#1Melih Mutlu
m.melihmutlu@gmail.com
1 attachment(s)

Hi hackers,

Sharing a small patch to remove an unused parameter
in SnapBuildGetOrBuildSnapshot function in snapbuild.c

With commit 6c2003f8a1bbc7c192a2e83ec51581c018aa162f,
SnapBuildBuildSnapshot no longer needs transaction id. This also makes the
xid parameter in SnapBuildGetOrBuildSnapshot useless.
I couldn't see a reason to keep it and decided to remove it.

Regards,
Melih

Attachments:

0001-Remove-unused-xid-parameter.patchapplication/octet-stream; name=0001-Remove-unused-xid-parameter.patchDownload
From ad8f70bc4249672ed904a63030e8688f54fde025 Mon Sep 17 00:00:00 2001
From: Melih Mutlu <m.melihmutlu@gmail.com>
Date: Wed, 21 Sep 2022 16:45:21 +0300
Subject: [PATCH] Remove unused xid parameter

Commit 6c2003f8a1bbc7c192a2e83ec51581c018aa162f removes transaction id's
used for exporting snapshot.

This commit removes one unused xid parameter left behind in SnapBuildGetOrBuildSnapshot.
---
 src/backend/replication/logical/decode.c    | 2 +-
 src/backend/replication/logical/snapbuild.c | 2 +-
 src/include/replication/snapbuild.h         | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index 4d0bf1930d..2cc0ac9eb0 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -594,7 +594,7 @@ logicalmsg_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 			  SnapBuildXactNeedsSkip(builder, buf->origptr)))
 		return;
 
-	snapshot = SnapBuildGetOrBuildSnapshot(builder, xid);
+	snapshot = SnapBuildGetOrBuildSnapshot(builder);
 	ReorderBufferQueueMessage(ctx->reorder, xid, snapshot, buf->endptr,
 							  message->transactional,
 							  message->message, /* first part of message is
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index 1d8ebb4c0d..54499c06fe 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -694,7 +694,7 @@ SnapBuildExportSnapshot(SnapBuild *builder)
  * Ensure there is a snapshot and if not build one for current transaction.
  */
 Snapshot
-SnapBuildGetOrBuildSnapshot(SnapBuild *builder, TransactionId xid)
+SnapBuildGetOrBuildSnapshot(SnapBuild *builder)
 {
 	Assert(builder->state == SNAPBUILD_CONSISTENT);
 
diff --git a/src/include/replication/snapbuild.h b/src/include/replication/snapbuild.h
index f126ff2e08..2a697e57c3 100644
--- a/src/include/replication/snapbuild.h
+++ b/src/include/replication/snapbuild.h
@@ -73,8 +73,7 @@ extern void SnapBuildClearExportedSnapshot(void);
 extern void SnapBuildResetExportedSnapshotState(void);
 
 extern SnapBuildState SnapBuildCurrentState(SnapBuild *builder);
-extern Snapshot SnapBuildGetOrBuildSnapshot(SnapBuild *builder,
-											TransactionId xid);
+extern Snapshot SnapBuildGetOrBuildSnapshot(SnapBuild *builder);
 
 extern bool SnapBuildXactNeedsSkip(SnapBuild *builder, XLogRecPtr ptr);
 extern XLogRecPtr SnapBuildGetTwoPhaseAt(SnapBuild *builder);
-- 
2.25.1

#2Zhang Mingli
zmlpostgres@gmail.com
In reply to: Melih Mutlu (#1)
Re: Removing unused parameter in SnapBuildGetOrBuildSnapshot

On Sep 21, 2022, 22:22 +0800, Melih Mutlu <m.melihmutlu@gmail.com>, wrote:

Hi hackers,

Sharing a small patch to remove an unused parameter in SnapBuildGetOrBuildSnapshot function in snapbuild.c

With commit 6c2003f8a1bbc7c192a2e83ec51581c018aa162f, SnapBuildBuildSnapshot no longer needs transaction id. This also makes the xid parameter in SnapBuildGetOrBuildSnapshot useless.
I couldn't see a reason to keep it and decided to remove it.

Regards,
Melih

+1, Good Catch.

Regards,
Zhang Mingli

#3Amit Kapila
amit.kapila16@gmail.com
In reply to: Zhang Mingli (#2)
Re: Removing unused parameter in SnapBuildGetOrBuildSnapshot

On Wed, Sep 21, 2022 at 8:11 PM Zhang Mingli <zmlpostgres@gmail.com> wrote:

On Sep 21, 2022, 22:22 +0800, Melih Mutlu <m.melihmutlu@gmail.com>, wrote:

Hi hackers,

Sharing a small patch to remove an unused parameter in SnapBuildGetOrBuildSnapshot function in snapbuild.c

With commit 6c2003f8a1bbc7c192a2e83ec51581c018aa162f, SnapBuildBuildSnapshot no longer needs transaction id. This also makes the xid parameter in SnapBuildGetOrBuildSnapshot useless.
I couldn't see a reason to keep it and decided to remove it.

Regards,
Melih

+1, Good Catch.

LGTM.

--
With Regards,
Amit Kapila.

#4Amit Kapila
amit.kapila16@gmail.com
In reply to: Amit Kapila (#3)
Re: Removing unused parameter in SnapBuildGetOrBuildSnapshot

On Fri, Sep 23, 2022 at 8:58 AM Amit Kapila <amit.kapila16@gmail.com> wrote:

On Wed, Sep 21, 2022 at 8:11 PM Zhang Mingli <zmlpostgres@gmail.com> wrote:

On Sep 21, 2022, 22:22 +0800, Melih Mutlu <m.melihmutlu@gmail.com>, wrote:

Hi hackers,

Sharing a small patch to remove an unused parameter in SnapBuildGetOrBuildSnapshot function in snapbuild.c

+1, Good Catch.

LGTM.

Pushed.

--
With Regards,
Amit Kapila.