Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit5ed8b4a

Browse files
committed
Fix instance of elog() called while holding a spinlock
This broke the project rule to not call any complex code while aspinlock is held. Issue introduced byb89e151.Discussion:https://postgr.es/m/20200602.161518.1399689010416646074.horikyota.ntt@gmail.comBackpatch-through: 9.5
1 parent0c735c6 commit5ed8b4a

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

‎src/backend/replication/logical/logical.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -887,25 +887,33 @@ LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart
887887
{
888888
slot->candidate_restart_valid=current_lsn;
889889
slot->candidate_restart_lsn=restart_lsn;
890+
SpinLockRelease(&slot->mutex);
890891

891892
elog(DEBUG1,"got new restart lsn %X/%X at %X/%X",
892893
(uint32) (restart_lsn >>32), (uint32)restart_lsn,
893894
(uint32) (current_lsn >>32), (uint32)current_lsn);
894895
}
895896
else
896897
{
898+
XLogRecPtrcandidate_restart_lsn;
899+
XLogRecPtrcandidate_restart_valid;
900+
XLogRecPtrconfirmed_flush;
901+
902+
candidate_restart_lsn=slot->candidate_restart_lsn;
903+
candidate_restart_valid=slot->candidate_restart_valid;
904+
confirmed_flush=slot->data.confirmed_flush;
905+
SpinLockRelease(&slot->mutex);
906+
897907
elog(DEBUG1,"failed to increase restart lsn: proposed %X/%X, after %X/%X, current candidate %X/%X, current after %X/%X, flushed up to %X/%X",
898908
(uint32) (restart_lsn >>32), (uint32)restart_lsn,
899909
(uint32) (current_lsn >>32), (uint32)current_lsn,
900-
(uint32) (slot->candidate_restart_lsn >>32),
901-
(uint32)slot->candidate_restart_lsn,
902-
(uint32) (slot->candidate_restart_valid >>32),
903-
(uint32)slot->candidate_restart_valid,
904-
(uint32) (slot->data.confirmed_flush >>32),
905-
(uint32)slot->data.confirmed_flush
906-
);
910+
(uint32) (candidate_restart_lsn >>32),
911+
(uint32)candidate_restart_lsn,
912+
(uint32) (candidate_restart_valid >>32),
913+
(uint32)candidate_restart_valid,
914+
(uint32) (confirmed_flush >>32),
915+
(uint32)confirmed_flush);
907916
}
908-
SpinLockRelease(&slot->mutex);
909917

910918
/* candidates are already valid with the current flush position, apply */
911919
if (updated_lsn)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp