v2_add_modbuf_flag.diff
application/octet-stream
Filename: v2_add_modbuf_flag.diff
Type: application/octet-stream
Part: 0
Patch
Format: unified
Series: patch v2
| File | + | − |
|---|---|---|
| src/backend/access/hash/hash_xlog.c | 12 | 2 |
diff --git a/src/backend/access/hash/hash_xlog.c b/src/backend/access/hash/hash_xlog.c
index cb1a63cfee..a9188a5d2a 100644
--- a/src/backend/access/hash/hash_xlog.c
+++ b/src/backend/access/hash/hash_xlog.c
@@ -666,6 +666,7 @@ hash_xlog_squeeze_page(XLogReaderState *record)
char *data;
Size datalen;
uint16 ninserted = 0;
+ bool mod_wbuf = false;
data = begin = XLogRecGetBlockData(record, 1, &datalen);
@@ -695,7 +696,11 @@ hash_xlog_squeeze_page(XLogReaderState *record)
ninserted++;
}
+
+ mod_wbuf = true;
}
+ else
+ Assert(xldata->is_prim_bucket_same_wrt || xldata->is_prev_bucket_same_wrt);
/*
* number of tuples inserted must be same as requested in REDO record.
@@ -711,10 +716,15 @@ hash_xlog_squeeze_page(XLogReaderState *record)
HashPageOpaque writeopaque = HashPageGetOpaque(writepage);
writeopaque->hasho_nextblkno = xldata->nextblkno;
+ mod_wbuf = true;
}
- PageSetLSN(writepage, lsn);
- MarkBufferDirty(writebuf);
+ /* Set LSN and mark writebuf dirty iff it is modified */
+ if (mod_wbuf)
+ {
+ PageSetLSN(writepage, lsn);
+ MarkBufferDirty(writebuf);
+ }
}
/* replay the record for initializing overflow buffer */