Skip to content

Commit d223293

Browse files
committed
implement forward-backward scan, right now its only used only for ordering by add info
1 parent dd83c34 commit d223293

File tree

4 files changed

+180
-58
lines changed

4 files changed

+180
-58
lines changed

rum.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ typedef struct RumMetaPageData
9696
int64 nEntries;
9797
} RumMetaPageData;
9898

99-
#define RUM_CURRENT_VERSION (0xC0DE0001)
99+
#define RUM_CURRENT_VERSION (0xC0DE0002)
100100

101101
#define RumPageGetMeta(p) \
102102
((RumMetaPageData *) PageGetContents(p))
@@ -149,9 +149,9 @@ typedef struct RumMetaPageData
149149
(RumItemPointerGetOffsetNumber(p) == (OffsetNumber)0 && \
150150
RumItemPointerGetBlockNumber(p) == (BlockNumber)0)
151151
#define ItemPointerSetMax(p) \
152-
ItemPointerSet((p), InvalidBlockNumber, (OffsetNumber)0xffff)
152+
ItemPointerSet((p), InvalidBlockNumber, (OffsetNumber)0xfffe)
153153
#define ItemPointerIsMax(p) \
154-
(RumItemPointerGetOffsetNumber(p) == (OffsetNumber)0xffff && \
154+
(RumItemPointerGetOffsetNumber(p) == (OffsetNumber)0xfffe && \
155155
RumItemPointerGetBlockNumber(p) == InvalidBlockNumber)
156156
#define ItemPointerSetLossyPage(p, b) \
157157
ItemPointerSet((p), (b), (OffsetNumber)0xffff)
@@ -641,8 +641,8 @@ typedef struct RumScanEntryData
641641
/* used for Posting list and one page in Posting tree */
642642
RumKey *list;
643643
MemoryContext context;
644-
uint32 nlist;
645-
OffsetNumber offset;
644+
int16 nlist;
645+
int16 offset;
646646

647647
ScanDirection scanDirection;
648648
bool isFinished;
@@ -687,7 +687,7 @@ typedef struct RumScanOpaqueData
687687
bool useFastScan;
688688
TIDBitmap *tbm;
689689

690-
bool naturalOrder;
690+
ScanDirection naturalOrder;
691691
} RumScanOpaqueData;
692692

693693
typedef RumScanOpaqueData *RumScanOpaque;

rum_timestamp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ rum_timestamp_config(PG_FUNCTION_ARGS)
283283
config->strategyInfo[0].strategy = RUM_TMST_LEFT_DISTANCE;
284284
config->strategyInfo[0].direction = ForwardScanDirection;
285285

286-
config->strategyInfo[1].strategy = InvalidStrategy;
286+
config->strategyInfo[1].strategy = RUM_TMST_RIGHT_DISTANCE;
287+
config->strategyInfo[1].direction = BackwardScanDirection;
288+
289+
config->strategyInfo[2].strategy = InvalidStrategy;
287290

288291
PG_RETURN_VOID();
289292
}

0 commit comments

Comments
 (0)