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

Commit766571b

Browse files
committed
Additional write barrier in AdvanceXLInsertBuffer().
First, mark the xlblocks member with InvalidXLogRecPtr, then issue awrite barrier, then initialize it. That ensures that the xlblocksmember doesn't appear valid while the contents are being initialized.In preparation for reading WAL buffer contents without a lock.Author: Bharath RupireddyDiscussion:https://postgr.es/m/CALj2ACVfFMfqD5oLzZSQQZWfXiJqd-NdX0_317veP6FuB31QWA@mail.gmail.comReviewed-by: Andres Freund
1 parentc3a8e2a commit766571b

File tree

1 file changed

+8
-0
lines changed
  • src/backend/access/transam

1 file changed

+8
-0
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,6 +1932,14 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, TimeLineID tli, bool opportunistic)
19321932

19331933
NewPage= (XLogPageHeader) (XLogCtl->pages+nextidx* (Size)XLOG_BLCKSZ);
19341934

1935+
/*
1936+
* Mark the xlblock with InvalidXLogRecPtr and issue a write barrier
1937+
* before initializing. Otherwise, the old page may be partially
1938+
* zeroed but look valid.
1939+
*/
1940+
pg_atomic_write_u64(&XLogCtl->xlblocks[nextidx],InvalidXLogRecPtr);
1941+
pg_write_barrier();
1942+
19351943
/*
19361944
* Be sure to re-zero the buffer so that bytes beyond what we've
19371945
* written will look like zeroes and not valid XLOG records...

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp