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

Appearance settings

Commit e37662f

Browse filesBrowse files
committed
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
1 parent 9301308 commit e37662f
Copy full SHA for e37662f

File tree

Expand file treeCollapse file tree

1 file changed

+4
-14
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-14
lines changed

‎src/backend/commands/waitlsn.c

Copy file name to clipboardExpand all lines: src/backend/commands/waitlsn.c
+4-14Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,18 @@
1818
#include <math.h>
1919

2020
#include "pgstat.h"
21-
#include "fmgr.h"
22-
#include "access/transam.h"
23-
#include "access/xact.h"
2421
#include "access/xlog.h"
25-
#include "access/xlogdefs.h"
2622
#include "access/xlogrecovery.h"
27-
#include "catalog/pg_type.h"
2823
#include "commands/waitlsn.h"
29-
#include "executor/spi.h"
3024
#include "funcapi.h"
3125
#include "miscadmin.h"
32-
#include "storage/ipc.h"
3326
#include "storage/latch.h"
34-
#include "storage/pmsignal.h"
3527
#include "storage/proc.h"
3628
#include "storage/shmem.h"
37-
#include "storage/sinvaladt.h"
38-
#include "utils/builtins.h"
3929
#include "utils/pg_lsn.h"
4030
#include "utils/snapmgr.h"
41-
#include "utils/timestamp.h"
4231
#include "utils/fmgrprotos.h"
32+
#include "utils/wait_event_types.h"
4333

4434
/* Add to / delete from shared memory array */
4535
static void addLSNWaiter(XLogRecPtr lsn);
@@ -88,11 +78,11 @@ addLSNWaiter(XLogRecPtr lsn)
8878
WaitLSNProcInfo cur;
8979
int i;
9080

91-
SpinLockAcquire(&waitLSN->mutex);
92-
9381
cur.procnum = MyProcNumber;
9482
cur.waitLSN = lsn;
9583

84+
SpinLockAcquire(&waitLSN->mutex);
85+
9686
for (i = 0; i < waitLSN->numWaitedProcs; i++)
9787
{
9888
if (waitLSN->procInfos[i].waitLSN >= cur.waitLSN)
@@ -226,7 +216,7 @@ void
226216
WaitForLSN(XLogRecPtr targetLSN, int64 timeout)
227217
{
228218
XLogRecPtr currentLSN;
229-
TimestampTz endtime;
219+
TimestampTz endtime = 0;
230220

231221
/* Shouldn't be called when shmem isn't initialized */
232222
Assert(waitLSN);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.