hashscan-no-lsn.patch
application/octet-stream
Filename: hashscan-no-lsn.patch
Type: application/octet-stream
Part: 1
Message:
Re: Page Scan Mode in Hash Index
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/access/hash/hashsearch.c | 0 | 8 |
| src/backend/access/hash/hashutil.c | 0 | 14 |
| src/include/access/hash.h | 0 | 2 |
diff --git a/src/backend/access/hash/hashsearch.c b/src/backend/access/hash/hashsearch.c
index ce5515dbcb..81a206eeb7 100644
--- a/src/backend/access/hash/hashsearch.c
+++ b/src/backend/access/hash/hashsearch.c
@@ -463,12 +463,6 @@ _hash_readpage(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
opaque = (HashPageOpaque) PageGetSpecialPointer(page);
so->currPos.buf = buf;
-
- /*
- * We save the LSN of the page as we read it, so that we know whether it
- * is safe to apply LP_DEAD hints to the page later.
- */
- so->currPos.lsn = PageGetLSN(page);
so->currPos.currPage = BufferGetBlockNumber(buf);
if (ScanDirectionIsForward(dir))
@@ -508,7 +502,6 @@ _hash_readpage(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
{
so->currPos.buf = buf;
so->currPos.currPage = BufferGetBlockNumber(buf);
- so->currPos.lsn = PageGetLSN(page);
}
else
{
@@ -562,7 +555,6 @@ _hash_readpage(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
{
so->currPos.buf = buf;
so->currPos.currPage = BufferGetBlockNumber(buf);
- so->currPos.lsn = PageGetLSN(page);
}
else
{
diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c
index a825b82706..df77252267 100644
--- a/src/backend/access/hash/hashutil.c
+++ b/src/backend/access/hash/hashutil.c
@@ -579,21 +579,7 @@ _hash_kill_items(IndexScanDesc scan)
else
buf = _hash_getbuf(rel, blkno, HASH_READ, LH_OVERFLOW_PAGE);
- /*
- * If page LSN differs it means that the page was modified since the last
- * read. killedItems could be not valid so applying LP_DEAD hints is not
- * safe.
- */
page = BufferGetPage(buf);
- if (PageGetLSN(page) != so->currPos.lsn)
- {
- if (havePin)
- LockBuffer(buf, BUFFER_LOCK_UNLOCK);
- else
- _hash_relbuf(rel, buf);
- return;
- }
-
opaque = (HashPageOpaque) PageGetSpecialPointer(page);
maxoff = PageGetMaxOffsetNumber(page);
diff --git a/src/include/access/hash.h b/src/include/access/hash.h
index 0e0f3e17a7..e3135c1738 100644
--- a/src/include/access/hash.h
+++ b/src/include/access/hash.h
@@ -117,7 +117,6 @@ typedef struct HashScanPosItem /* what we remember about each match */
typedef struct HashScanPosData
{
Buffer buf; /* if valid, the buffer is pinned */
- XLogRecPtr lsn; /* pos in the WAL stream when page was read */
BlockNumber currPage; /* current hash index page */
BlockNumber nextPage; /* next overflow page */
BlockNumber prevPage; /* prev overflow or bucket page */
@@ -153,7 +152,6 @@ typedef struct HashScanPosData
#define HashScanPosInvalidate(scanpos) \
do { \
(scanpos).buf = InvalidBuffer; \
- (scanpos).lsn = InvalidXLogRecPtr; \
(scanpos).currPage = InvalidBlockNumber; \
(scanpos).nextPage = InvalidBlockNumber; \
(scanpos).prevPage = InvalidBlockNumber; \