Skip to content

Commit 7212340

Browse files
committed
change rum versioning
1 parent 183b747 commit 7212340

File tree

3 files changed

+9
-31
lines changed

3 files changed

+9
-31
lines changed

rum.h

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ typedef RumPageOpaqueData *RumPageOpaque;
5959

6060
typedef struct RumMetaPageData
6161
{
62+
/*
63+
* RUM version number
64+
*/
65+
uint32 rumVersion;
66+
6267
/*
6368
* Pointers to head and tail of pending list, which consists of RUM_LIST
6469
* pages. These store fast-inserted entries that haven't yet been moved
@@ -86,21 +91,9 @@ typedef struct RumMetaPageData
8691
BlockNumber nEntryPages;
8792
BlockNumber nDataPages;
8893
int64 nEntries;
89-
90-
/*
91-
* RUM version number (ideally this should have been at the front, but too
92-
* late now. Don't move it!)
93-
*
94-
* Currently 1 (for indexes initialized in 9.1 or later)
95-
*
96-
* Version 0 (indexes initialized in 9.0 or before) is compatible but may
97-
* be missing null entries, including both null keys and placeholders.
98-
* Reject full-index-scan attempts on such indexes.
99-
*/
100-
int32 rumVersion;
10194
} RumMetaPageData;
10295

103-
#define RUM_CURRENT_VERSION 1
96+
#define RUM_CURRENT_VERSION (0xC0DE0001)
10497

10598
#define RumPageGetMeta(p) \
10699
((RumMetaPageData *) PageGetContents(p))

rumscan.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -436,24 +436,6 @@ rumNewScanKey(IndexScanDesc scan)
436436
NULL, NULL, NULL, NULL, false);
437437
}
438438

439-
/*
440-
* If the index is version 0, it may be missing null and placeholder
441-
* entries, which would render searches for nulls and full-index scans
442-
* unreliable. Throw an error if so.
443-
*/
444-
if (hasNullQuery && !so->isVoidRes)
445-
{
446-
GinStatsData rumStats;
447-
448-
rumGetStats(scan->indexRelation, &rumStats);
449-
if (rumStats.ginVersion < 1)
450-
ereport(ERROR,
451-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
452-
errmsg("old RUM indexes do not support whole-index scans nor searches for nulls"),
453-
errhint("To fix this, do REINDEX INDEX \"%s\".",
454-
RelationGetRelationName(scan->indexRelation))));
455-
}
456-
457439
pgstat_count_index_scan(scan->indexRelation);
458440
}
459441

rumutil.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,9 @@ rumGetStats(Relation index, GinStatsData *stats)
811811
stats->nEntries = metadata->nEntries;
812812
stats->ginVersion = metadata->rumVersion;
813813

814+
if (stats->ginVersion != RUM_CURRENT_VERSION)
815+
elog(ERROR, "unexpected RUM index version. Reindex");
816+
814817
UnlockReleaseBuffer(metabuffer);
815818
}
816819

0 commit comments

Comments
 (0)