summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-03-29 09:13:57 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2023-03-29 09:13:57 -0400
commit58c9600a9f5818f63712ae4262143c42517dcba7 (patch)
tree37e998d858acca5dc39e08d39f51ee27c6aa9561
parent7081ac46ace8c459966174400b53418683c9fe5c (diff)
downloadpostgresql-58c9600a9f5818f63712ae4262143c42517dcba7.tar.gz
Remove empty function BufmgrCommit().
This function has been a no-op for over a decade. Even if bufmgr regains a need to be called during commit, it seems unlikely that the most appropriate call points would be precisely here, so it's not doing us much good as a placeholder either. Now, removing it probably doesn't save any noticeable number of cycles --- but the main call is inside the commit critical section, and the less work done there the better. Matthias van de Meent Discussion: https://postgr.es/m/CAEze2Wi1=tLKbxZnXzcD+8fYKyKqBtivVakLQC_mYBsP4Y8qVA@mail.gmail.com
-rw-r--r--src/backend/access/transam/xact.c12
-rw-r--r--src/backend/storage/buffer/bufmgr.c10
-rw-r--r--src/include/storage/bufmgr.h1
3 files changed, 3 insertions, 20 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index b876401260..231af52cc9 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1374,12 +1374,6 @@ RecordTransactionCommit(void)
replorigin_session_origin != DoNotReplicateId);
/*
- * Begin commit critical section and insert the commit XLOG record.
- */
- /* Tell bufmgr and smgr to prepare for commit */
- BufmgrCommit();
-
- /*
* Mark ourselves as within our "commit critical section". This
* forces any concurrent checkpoint to wait until we've updated
* pg_xact. Without this, it is possible for the checkpoint to set
@@ -1400,6 +1394,9 @@ RecordTransactionCommit(void)
START_CRIT_SECTION();
MyProc->delayChkptFlags |= DELAY_CHKPT_START;
+ /*
+ * Insert the commit XLOG record.
+ */
XactLogCommitRecord(GetCurrentTransactionStopTimestamp(),
nchildren, children, nrels, rels,
ndroppedstats, droppedstats,
@@ -2536,9 +2533,6 @@ PrepareTransaction(void)
prepared_at = GetCurrentTimestamp();
- /* Tell bufmgr and smgr to prepare for commit */
- BufmgrCommit();
-
/*
* Reserve the GID for this transaction. This could fail if the requested
* GID is invalid or already in use.
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 95212a3941..fe029d2ea6 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -2789,16 +2789,6 @@ CheckPointBuffers(int flags)
BufferSync(flags);
}
-
-/*
- * Do whatever is needed to prepare for commit at the bufmgr and smgr levels
- */
-void
-BufmgrCommit(void)
-{
- /* Nothing to do in bufmgr anymore... */
-}
-
/*
* BufferGetBlockNumber
* Returns the block number associated with a buffer.
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index b8a18b8081..73762cb1ec 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -182,7 +182,6 @@ extern bool HoldingBufferPinThatDelaysRecovery(void);
extern void AbortBufferIO(void);
-extern void BufmgrCommit(void);
extern bool BgBufferSync(struct WritebackContext *wb_context);
extern void TestForOldSnapshot_impl(Snapshot snapshot, Relation relation);