mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 19:36:52 +02:00
Fix oversight from 9e149c8
with spin-lock handling
Calling an external function while a pin-lock is held is a bad idea as those are designed to be short-lived. The stress of a first commit into a large git history may contribute to that. Reported-by: Andres Freund Discussion: https://postgr.es/m/20180611164952.vmxdpdpirdtkdsz6@alap3.anarazel.de
This commit is contained in:
parent
69025c5a07
commit
f8795d2ec8
@ -999,6 +999,7 @@ ReplicationSlotReserveWal(void)
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
XLogSegNo segno;
|
XLogSegNo segno;
|
||||||
|
XLogRecPtr restart_lsn;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For logical slots log a standby snapshot and start logical decoding
|
* For logical slots log a standby snapshot and start logical decoding
|
||||||
@ -1016,8 +1017,9 @@ ReplicationSlotReserveWal(void)
|
|||||||
XLogRecPtr flushptr;
|
XLogRecPtr flushptr;
|
||||||
|
|
||||||
/* start at current insert position */
|
/* start at current insert position */
|
||||||
|
restart_lsn = GetXLogInsertRecPtr();
|
||||||
SpinLockAcquire(&slot->mutex);
|
SpinLockAcquire(&slot->mutex);
|
||||||
slot->data.restart_lsn = GetXLogInsertRecPtr();
|
slot->data.restart_lsn = restart_lsn;
|
||||||
SpinLockRelease(&slot->mutex);
|
SpinLockRelease(&slot->mutex);
|
||||||
|
|
||||||
/* make sure we have enough information to start */
|
/* make sure we have enough information to start */
|
||||||
@ -1028,8 +1030,9 @@ ReplicationSlotReserveWal(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
restart_lsn = GetRedoRecPtr();
|
||||||
SpinLockAcquire(&slot->mutex);
|
SpinLockAcquire(&slot->mutex);
|
||||||
slot->data.restart_lsn = GetRedoRecPtr();
|
slot->data.restart_lsn = restart_lsn;
|
||||||
SpinLockRelease(&slot->mutex);
|
SpinLockRelease(&slot->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user