summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Korotkov2024-04-03 08:23:21 +0000
committerAlexander Korotkov2024-04-03 08:32:39 +0000
commite37662f22158c29bc55eda4eda1757f444cf701a (patch)
tree8d419de299db529306c3fbf204e2532da1605dc1 /src
parent9301308bd196f614696e0e9492cf0c52f7857f83 (diff)
Minor improvements for waitlsn.c
* Remove extra includes * Fill 'cur' in addLSNWaiter() before taking the spinlock * Initialize 'endtime' with zero in WaitForLSN() to avoid compiler warning Reported-by: Alvaro Herrera, Masahiko Sawada, Daniel Gustafsson Discussion: https://postgr.es/m/202404030658.hhj3vfxeyhft%40alvherre.pgsql Discussion: https://postgr.es/m/CAD21AoAx7irptnPH1OkkkNh9E0M6X-phfX7sYZfwoMsc1qV1sQ%40mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/waitlsn.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/backend/commands/waitlsn.c b/src/backend/commands/waitlsn.c
index 6679378156c..63e9ebf1730 100644
--- a/src/backend/commands/waitlsn.c
+++ b/src/backend/commands/waitlsn.c
@@ -18,28 +18,18 @@
#include <math.h>
#include "pgstat.h"
-#include "fmgr.h"
-#include "access/transam.h"
-#include "access/xact.h"
#include "access/xlog.h"
-#include "access/xlogdefs.h"
#include "access/xlogrecovery.h"
-#include "catalog/pg_type.h"
#include "commands/waitlsn.h"
-#include "executor/spi.h"
#include "funcapi.h"
#include "miscadmin.h"
-#include "storage/ipc.h"
#include "storage/latch.h"
-#include "storage/pmsignal.h"
#include "storage/proc.h"
#include "storage/shmem.h"
-#include "storage/sinvaladt.h"
-#include "utils/builtins.h"
#include "utils/pg_lsn.h"
#include "utils/snapmgr.h"
-#include "utils/timestamp.h"
#include "utils/fmgrprotos.h"
+#include "utils/wait_event_types.h"
/* Add to / delete from shared memory array */
static void addLSNWaiter(XLogRecPtr lsn);
@@ -88,11 +78,11 @@ addLSNWaiter(XLogRecPtr lsn)
WaitLSNProcInfo cur;
int i;
- SpinLockAcquire(&waitLSN->mutex);
-
cur.procnum = MyProcNumber;
cur.waitLSN = lsn;
+ SpinLockAcquire(&waitLSN->mutex);
+
for (i = 0; i < waitLSN->numWaitedProcs; i++)
{
if (waitLSN->procInfos[i].waitLSN >= cur.waitLSN)
@@ -226,7 +216,7 @@ void
WaitForLSN(XLogRecPtr targetLSN, int64 timeout)
{
XLogRecPtr currentLSN;
- TimestampTz endtime;
+ TimestampTz endtime = 0;
/* Shouldn't be called when shmem isn't initialized */
Assert(waitLSN);