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

Commit4fc8e23

Browse files
Code cleanup in SyncRepWaitForLSN()
Commit14e8803 removed LWLocks when accessing MyProc->syncRepStatebut didn't clean up the surrounding code and comments.Cleanup and backpatch to 9.5, to keep code similar.Julien Rouhaud, improved by suggestion from Michael Paquier,implemented trivially by myself.
1 parent270c29f commit4fc8e23

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

‎src/backend/replication/syncrep.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,24 +160,16 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
160160
*/
161161
for (;;)
162162
{
163-
intsyncRepState;
164-
165163
/* Must reset the latch before testing state. */
166164
ResetLatch(MyLatch);
167165

168166
/*
169-
* Try checking the state without the lock first. There's no
170-
* guarantee that we'll read the most up-to-date value, so if it looks
171-
* like we're still waiting, recheck while holding the lock. But if
172-
* it looks like we're done, we must really be done, because once
173-
* walsender changes the state to SYNC_REP_WAIT_COMPLETE, it will
174-
* never update it again, so we can't be seeing a stale value in that
175-
* case.
167+
* Acquiring the lock is not needed, the latch ensures proper barriers.
168+
* If it looks like we're done, we must really be done, because once
169+
* walsender changes the state to SYNC_REP_WAIT_COMPLETE, it will never
170+
* update it again, so we can't be seeing a stale value in that case.
176171
*/
177-
syncRepState=MyProc->syncRepState;
178-
if (syncRepState==SYNC_REP_WAITING)
179-
syncRepState=MyProc->syncRepState;
180-
if (syncRepState==SYNC_REP_WAIT_COMPLETE)
172+
if (MyProc->syncRepState==SYNC_REP_WAIT_COMPLETE)
181173
break;
182174

183175
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp