aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gistget.c
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2013-03-22 13:54:07 +0000
committerSimon Riggs <simon@2ndQuadrant.com>2013-03-22 13:54:07 +0000
commit96ef3b8ff1cf1950e897fd2f766d4bd9ef0d5d56 (patch)
tree65849014627f4e211c6be8a4e9905b67694ed4ae /src/backend/access/gist/gistget.c
parente4a05c7512b23c8f48c186e685f2ef186374a20a (diff)
downloadpostgresql-96ef3b8ff1cf1950e897fd2f766d4bd9ef0d5d56.tar.gz
postgresql-96ef3b8ff1cf1950e897fd2f766d4bd9ef0d5d56.zip
Allow I/O reliability checks using 16-bit checksums
Checksums are set immediately prior to flush out of shared buffers and checked when pages are read in again. Hint bit setting will require full page write when block is dirtied, which causes various infrastructure changes. Extensive comments, docs and README. WARNING message thrown if checksum fails on non-all zeroes page; ERROR thrown but can be disabled with ignore_checksum_failure = on. Feature enabled by an initdb option, since transition from option off to option on is long and complex and has not yet been implemented. Default is not to use checksums. Checksum used is WAL CRC-32 truncated to 16-bits. Simon Riggs, Jeff Davis, Greg Smith Wide input and assistance from many community members. Thank you.
Diffstat (limited to 'src/backend/access/gist/gistget.c')
-rw-r--r--src/backend/access/gist/gistget.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index 3300fec644e..cef31ce66e9 100644
--- a/src/backend/access/gist/gistget.c
+++ b/src/backend/access/gist/gistget.c
@@ -362,8 +362,12 @@ gistScanPage(IndexScanDesc scan, GISTSearchItem *pageItem, double *myDistances,
{
/* Creating index-page GISTSearchItem */
item->blkno = ItemPointerGetBlockNumber(&it->t_tid);
- /* lsn of current page is lsn of parent page for child */
- item->data.parentlsn = PageGetLSN(page);
+
+ /*
+ * LSN of current page is lsn of parent page for child. We only
+ * have a shared lock, so we need to get the LSN atomically.
+ */
+ item->data.parentlsn = BufferGetLSNAtomic(buffer);
}
/* Insert it into the queue using new distance data */