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

Commit03aa25b

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 parent3d474a0 commit03aa25b

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
@@ -974,25 +974,33 @@ LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart
974974
{
975975
slot->candidate_restart_valid=current_lsn;
976976
slot->candidate_restart_lsn=restart_lsn;
977+
SpinLockRelease(&slot->mutex);
977978

978979
elog(DEBUG1,"got new restart lsn %X/%X at %X/%X",
979980
(uint32) (restart_lsn >>32), (uint32)restart_lsn,
980981
(uint32) (current_lsn >>32), (uint32)current_lsn);
981982
}
982983
else
983984
{
985+
XLogRecPtrcandidate_restart_lsn;
986+
XLogRecPtrcandidate_restart_valid;
987+
XLogRecPtrconfirmed_flush;
988+
989+
candidate_restart_lsn=slot->candidate_restart_lsn;
990+
candidate_restart_valid=slot->candidate_restart_valid;
991+
confirmed_flush=slot->data.confirmed_flush;
992+
SpinLockRelease(&slot->mutex);
993+
984994
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",
985995
(uint32) (restart_lsn >>32), (uint32)restart_lsn,
986996
(uint32) (current_lsn >>32), (uint32)current_lsn,
987-
(uint32) (slot->candidate_restart_lsn >>32),
988-
(uint32)slot->candidate_restart_lsn,
989-
(uint32) (slot->candidate_restart_valid >>32),
990-
(uint32)slot->candidate_restart_valid,
991-
(uint32) (slot->data.confirmed_flush >>32),
992-
(uint32)slot->data.confirmed_flush
993-
);
997+
(uint32) (candidate_restart_lsn >>32),
998+
(uint32)candidate_restart_lsn,
999+
(uint32) (candidate_restart_valid >>32),
1000+
(uint32)candidate_restart_valid,
1001+
(uint32) (confirmed_flush >>32),
1002+
(uint32)confirmed_flush);
9941003
}
995-
SpinLockRelease(&slot->mutex);
9961004

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp