Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ab77b2d

Browse files
committed
Fix incorrect comment in SetBufferCommitInfoNeedsSave().
Noah Misch spotted the fact that the old comment is in fact incorrect, due to memory ordering hazards.
1 parent e93c0b8 commit ab77b2d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/backend/storage/buffer/bufmgr.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,9 +2376,11 @@ SetBufferCommitInfoNeedsSave(Buffer buffer)
23762376
* making the first scan after commit of an xact that added/deleted many
23772377
* tuples. So, be as quick as we can if the buffer is already dirty. We
23782378
* do this by not acquiring spinlock if it looks like the status bits are
2379-
* already OK. (Note it is okay if someone else clears BM_JUST_DIRTIED
2380-
* immediately after we look, because the buffer content update is already
2381-
* done and will be reflected in the I/O.)
2379+
* already. Since we make this test unlocked, there's a chance we might
2380+
* fail to notice that the flags have just been cleared, and failed to reset
2381+
* them, due to memory-ordering issues. But since this function is only
2382+
* intended to be used in cases where failing to write out the data would
2383+
* be harmless anyway, it doesn't really matter.
23822384
*/
23832385
if ((bufHdr->flags & (BM_DIRTY | BM_JUST_DIRTIED)) !=
23842386
(BM_DIRTY | BM_JUST_DIRTIED))

0 commit comments

Comments
 (0)