diff options
author | Robert Haas <rhaas@postgresql.org> | 2012-04-18 10:55:40 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2012-04-18 10:55:40 -0400 |
commit | ab77b2da8bf2cd1c8068f2f90e95c42d426aba3c (patch) | |
tree | b84c8fb055930e817004978baea2ea5a27c08f38 /src/backend/storage/buffer/bufmgr.c | |
parent | e93c0b820f03e96ae0549cd30805ae734e5d5e2f (diff) | |
download | postgresql-ab77b2da8bf2cd1c8068f2f90e95c42d426aba3c.tar.gz postgresql-ab77b2da8bf2cd1c8068f2f90e95c42d426aba3c.zip |
Fix incorrect comment in SetBufferCommitInfoNeedsSave().
Noah Misch spotted the fact that the old comment is in fact incorrect, due
to memory ordering hazards.
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 613d7544c63..ad5a97a3523 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -2376,9 +2376,11 @@ SetBufferCommitInfoNeedsSave(Buffer buffer) * making the first scan after commit of an xact that added/deleted many * tuples. So, be as quick as we can if the buffer is already dirty. We * do this by not acquiring spinlock if it looks like the status bits are - * already OK. (Note it is okay if someone else clears BM_JUST_DIRTIED - * immediately after we look, because the buffer content update is already - * done and will be reflected in the I/O.) + * already. Since we make this test unlocked, there's a chance we might + * fail to notice that the flags have just been cleared, and failed to reset + * them, due to memory-ordering issues. But since this function is only + * intended to be used in cases where failing to write out the data would + * be harmless anyway, it doesn't really matter. */ if ((bufHdr->flags & (BM_DIRTY | BM_JUST_DIRTIED)) != (BM_DIRTY | BM_JUST_DIRTIED)) |