Skip to content

Commit a7374ff

Browse files
Fenimorkindmpgpro
authored andcommitted
Fix
1 parent a397aa4 commit a7374ff

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/backend/commands/waitlsn.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ WaitLSNSetLatch(void)
133133
for (i = 0; i < (MaxConnections+1); i++)
134134
{
135135
SpinLockAcquire(&state->l_arr[i].slock);
136-
if (state->l_arr[i].pid != 0)
136+
if (state->l_arr[i].pid != 0 && !(TestLatch(&state->l_arr[i].latch)))
137+
{
137138
SetLatch(&state->l_arr[i].latch);
139+
}
138140
SpinLockRelease(&state->l_arr[i].slock);
139141
}
140142
}
@@ -151,9 +153,6 @@ WaitLSNUtility(const char *lsn, const int delay)
151153
TimestampTz timer = GetCurrentTimestamp();
152154

153155
trg_lsn = DatumGetLSN(DirectFunctionCall1(pg_lsn_in, CStringGetDatum(lsn)));
154-
// tdelay *= 1000;
155-
156-
elog(LOG,"ACHTUNG tdelay %u",tdelay);
157156

158157
if (delay > 0)
159158
latch_events = WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH;
@@ -182,7 +181,6 @@ WaitLSNUtility(const char *lsn, const int delay)
182181
break;
183182
TimestampDifference(timer,GetCurrentTimestamp(),&secs, &microsecs);
184183
tdelay -= (secs*1000 + microsecs/1000);
185-
elog(LOG,"ACHTUNG tdelay %u, %d",tdelay, TimestampDifferenceExceeds(timer,GetCurrentTimestamp(),tdelay));
186184
timer = GetCurrentTimestamp();
187185
}
188186

0 commit comments

Comments
 (0)