Thom Brown wrote:
Thanks for testing.
> Thanks for the patch, but I seem to have immediately hit a snag:
>
> pgbench=# CREATE INDEX minmaxtest ON pgbench_accounts USING minmax (aid);
> PANIC: invalid xlog record length 0
Silly mistake I had already made in another patch. Here's an
incremental patch which fixes this bug. Apply this on top of previous
minmax-1.patch.
I also renumbered the duplicate OID pointed out by Peter, and fixed the
two compiler warnings reported by Jaime.
Note you'll need to re-initdb in order to get the right catalog entries.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
diff --git a/src/backend/access/minmax/mmrevmap.c b/src/backend/access/minmax/mmrevmap.c
index 3e19f90..76cddde 100644
--- a/src/backend/access/minmax/mmrevmap.c
+++ b/src/backend/access/minmax/mmrevmap.c
@@ -147,12 +147,10 @@ mmSetHeapBlockItemptr(mmRevmapAccess *rmAccess, BlockNumber heapBlk,
{
xl_minmax_rm_set xlrec;
XLogRecPtr recptr;
- XLogRecData rdata;
+ XLogRecData rdata[2];
uint8 info;
info = XLOG_MINMAX_REVMAP_SET;
- if (extend)
- info |= XLOG_MINMAX_INIT_PAGE;
xlrec.node = rmAccess->idxrel->rd_node;
xlrec.mapBlock = mapBlk;
@@ -160,13 +158,26 @@ mmSetHeapBlockItemptr(mmRevmapAccess *rmAccess, BlockNumber heapBlk,
xlrec.heapBlock = heapBlk;
ItemPointerSet(&(xlrec.newval), blkno, offno);
- rdata.data = (char *) &xlrec;
- rdata.len = SizeOfMinmaxRevmapSet;
- rdata.buffer = rmAccess->currBuf;
- rdata.buffer_std = false;
- rdata.next = NULL;
+ rdata[0].data = (char *) &xlrec;
+ rdata[0].len = SizeOfMinmaxRevmapSet;
+ rdata[0].buffer = InvalidBuffer;
+ rdata[0].buffer_std = false;
+ rdata[0].next = &(rdata[1]);
+
+ rdata[1].data = NULL;
+ rdata[1].len = 0;
+ rdata[1].buffer = rmAccess->currBuf;
+ rdata[1].buffer_std = false;
+ rdata[1].next = NULL;
+
+ if (extend)
+ {
+ info |= XLOG_MINMAX_INIT_PAGE;
+ /* If the page is new, there's no need for a full page image */
+ rdata[0].next = NULL;
+ }
- recptr = XLogInsert(RM_MINMAX_ID, info, &rdata);
+ recptr = XLogInsert(RM_MINMAX_ID, info, rdata);
PageSetLSN(BufferGetPage(rmAccess->currBuf), recptr);
}
diff --git a/src/backend/access/minmax/mmxlog.c b/src/backend/access/minmax/mmxlog.c
index ee095a2..758fc5f 100644
--- a/src/backend/access/minmax/mmxlog.c
+++ b/src/backend/access/minmax/mmxlog.c
@@ -158,7 +158,6 @@ minmax_xlog_revmap_set(XLogRecPtr lsn, XLogRecord *record)
{
xl_minmax_rm_set *xlrec = (xl_minmax_rm_set *) XLogRecGetData(record);
bool init;
- BlockNumber blkno;
Buffer buffer;
Page page;
diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c
index 1e7cbac..d1a3ca7 100644
--- a/src/backend/storage/page/bufpage.c
+++ b/src/backend/storage/page/bufpage.c
@@ -1040,6 +1040,7 @@ PageIndexDeleteNoCompact(Page page, OffsetNumber *itemnos, int nitems)
* page.
*/
memcpy(pageCopy, page, BLCKSZ);
+ lastused = FirstOffsetNumber;
upper = pd_special;
PageClearHasFreeLinePointers(page);
for (i = 0, itemidptr = itemidbase; i < nline; i++, itemidptr++)
diff --git a/src/include/catalog/pg_amop.h b/src/include/catalog/pg_amop.h
index 8109949..192e295 100644
--- a/src/include/catalog/pg_amop.h
+++ b/src/include/catalog/pg_amop.h
@@ -784,28 +784,28 @@ DATA(insert ( 3474 3831 3831 18 s 3882 4000 0 ));
/*
* MinMax int4_ops
*/
-DATA(insert ( 3177 23 23 1 s 97 403 0 ));
-DATA(insert ( 3177 23 23 2 s 523 403 0 ));
-DATA(insert ( 3177 23 23 3 s 96 403 0 ));
-DATA(insert ( 3177 23 23 4 s 525 403 0 ));
-DATA(insert ( 3177 23 23 5 s 521 403 0 ));
+DATA(insert ( 3192 23 23 1 s 97 3847 0 ));
+DATA(insert ( 3192 23 23 2 s 523 3847 0 ));
+DATA(insert ( 3192 23 23 3 s 96 3847 0 ));
+DATA(insert ( 3192 23 23 4 s 525 3847 0 ));
+DATA(insert ( 3192 23 23 5 s 521 3847 0 ));
/*
* MinMax numeric_ops
*/
-DATA(insert ( 3192 1700 1700 1 s 1754 403 0 ));
-DATA(insert ( 3192 1700 1700 2 s 1755 403 0 ));
-DATA(insert ( 3192 1700 1700 3 s 1752 403 0 ));
-DATA(insert ( 3192 1700 1700 4 s 1757 403 0 ));
-DATA(insert ( 3192 1700 1700 5 s 1756 403 0 ));
+DATA(insert ( 3193 1700 1700 1 s 1754 3847 0 ));
+DATA(insert ( 3193 1700 1700 2 s 1755 3847 0 ));
+DATA(insert ( 3193 1700 1700 3 s 1752 3847 0 ));
+DATA(insert ( 3193 1700 1700 4 s 1757 3847 0 ));
+DATA(insert ( 3193 1700 1700 5 s 1756 3847 0 ));
/*
* MinMax text_ops
*/
-DATA(insert ( 3193 25 25 1 s 664 403 0 ));
-DATA(insert ( 3193 25 25 2 s 665 403 0 ));
-DATA(insert ( 3193 25 25 3 s 98 403 0 ));
-DATA(insert ( 3193 25 25 4 s 667 403 0 ));
-DATA(insert ( 3193 25 25 5 s 666 403 0 ));
+DATA(insert ( 3194 25 25 1 s 664 3847 0 ));
+DATA(insert ( 3194 25 25 2 s 665 3847 0 ));
+DATA(insert ( 3194 25 25 3 s 98 3847 0 ));
+DATA(insert ( 3194 25 25 4 s 667 3847 0 ));
+DATA(insert ( 3194 25 25 5 s 666 3847 0 ));
#endif /* PG_AMOP_H */
diff --git a/src/include/catalog/pg_amproc.h b/src/include/catalog/pg_amproc.h
index 53ecb58..7155cb2 100644
--- a/src/include/catalog/pg_amproc.h
+++ b/src/include/catalog/pg_amproc.h
@@ -379,10 +379,4 @@ DATA(insert ( 3474 3831 3831 3 3471 ));
DATA(insert ( 3474 3831 3831 4 3472 ));
DATA(insert ( 3474 3831 3831 5 3473 ));
-/* MinMax */
-DATA(insert ( 3177 23 23 1 2132 ));
-DATA(insert ( 3177 23 23 2 2116 ));
-DATA(insert ( 3192 1700 1700 1 2146 ));
-DATA(insert ( 3192 1700 1700 2 2130 ));
-
#endif /* PG_AMPROC_H */
diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h
index da3337d..3a434de 100644
--- a/src/include/catalog/pg_opclass.h
+++ b/src/include/catalog/pg_opclass.h
@@ -227,8 +227,8 @@ DATA(insert ( 4000 range_ops PGNSP PGUID 3474 3831 t 0 ));
DATA(insert ( 4000 quad_point_ops PGNSP PGUID 4015 600 t 0 ));
DATA(insert ( 4000 kd_point_ops PGNSP PGUID 4016 600 f 0 ));
DATA(insert ( 4000 text_ops PGNSP PGUID 4017 25 t 0 ));
-DATA(insert ( 3847 int4_ops PGNSP PGUID 3177 23 t 0 ));
-DATA(insert ( 3847 numeric_ops PGNSP PGUID 3192 1700 t 0 ));
-DATA(insert ( 3847 text_ops PGNSP PGUID 3193 25 t 0 ));
+DATA(insert ( 3847 int4_ops PGNSP PGUID 3192 23 t 0 ));
+DATA(insert ( 3847 numeric_ops PGNSP PGUID 3193 1700 t 0 ));
+DATA(insert ( 3847 text_ops PGNSP PGUID 3194 25 t 0 ));
#endif /* PG_OPCLASS_H */
diff --git a/src/include/catalog/pg_opfamily.h b/src/include/catalog/pg_opfamily.h
index a9ac8d7..4fd761a 100644
--- a/src/include/catalog/pg_opfamily.h
+++ b/src/include/catalog/pg_opfamily.h
@@ -147,8 +147,8 @@ DATA(insert OID = 4015 ( 4000 quad_point_ops PGNSP PGUID ));
DATA(insert OID = 4016 ( 4000 kd_point_ops PGNSP PGUID ));
DATA(insert OID = 4017 ( 4000 text_ops PGNSP PGUID ));
#define TEXT_SPGIST_FAM_OID 4017
-DATA(insert OID = 3177 ( 3847 int4_ops PGNSP PGUID ));
-DATA(insert OID = 3192 ( 3847 numeric_ops PGNSP PGUID ));
-DATA(insert OID = 3193 ( 3847 text_ops PGNSP PGUID ));
+DATA(insert OID = 3192 ( 3847 int4_ops PGNSP PGUID ));
+DATA(insert OID = 3193 ( 3847 numeric_ops PGNSP PGUID ));
+DATA(insert OID = 3194 ( 3847 text_ops PGNSP PGUID ));
#endif /* PG_OPFAMILY_H */
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers