!6268 支持向量数据库ivfflat计算中心点前采样的range scan

Merge pull request !6268 from wangjingyuan8/ivfflat
This commit is contained in:
opengauss_bot
2024-09-18 03:24:14 +00:00
committed by Gitee
4 changed files with 30 additions and 8 deletions

View File

@ -3816,7 +3816,7 @@ static TransactionId GetCatalogOldestXmin(Relation heapRelation)
* chain tip.
*/
double IndexBuildHeapScan(Relation heapRelation, Relation indexRelation, IndexInfo* indexInfo, bool allow_sync,
IndexBuildCallback callback, void* callbackState, TableScanDesc scan)
IndexBuildCallback callback, void* callbackState, TableScanDesc scan, BlockNumber startBlkno, BlockNumber numblocks)
{
bool is_system_catalog = false;
bool checking_uniqueness = false;
@ -3904,6 +3904,22 @@ double IndexBuildHeapScan(Relation heapRelation, Relation indexRelation, IndexIn
snapshot = SnapshotAny;
OldestXmin = GetOldestXmin(heapRelation);
}
/* set our scan endpoints */
if (!allow_sync && BlockNumberIsValid(numblocks)) {
Assert(!scan->rs_inited);
Assert(!(scan->rs_flags & SO_ALLOW_SYNC));
Assert(startBlkno == 0 || startBlkno < scan->rs_nblocks);
scan->rs_rangeScanInRedis.isRangeScanInRedis = true;
scan->rs_startblock = startBlkno;
scan->rs_nblocks = numblocks;
} else {
/* synscan can only be requested on whole relation */
Assert(startBlkno == 0);
Assert(numblocks == InvalidBlockNumber);
}
reltuples = 0;
/*

View File

@ -378,9 +378,11 @@ void HeapamScanInitParallelSeqscan(TableScanDesc sscan, int32 dop, ScanDirection
}
double HeapamIndexBuildScan(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, bool allow_sync,
IndexBuildCallback callback, void *callback_state, TableScanDesc scan)
IndexBuildCallback callback, void *callback_state, TableScanDesc scan,
BlockNumber startBlkno, BlockNumber numblocks)
{
return IndexBuildHeapScan(heapRelation, indexRelation, indexInfo, allow_sync, callback, callback_state, scan);
return IndexBuildHeapScan(heapRelation, indexRelation, indexInfo, allow_sync, callback,
callback_state, scan, startBlkno, numblocks);
}
void HeapamIndexValidateScan (Relation heapRelation, Relation indexRelation,
@ -972,7 +974,8 @@ void UHeapamTslotStoreUHeapTuple(Tuple tuple, TupleTableSlot *slot, Buffer buffe
*/
double UHeapamIndexBuildScan(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, bool allowSync,
IndexBuildCallback callback, void *callback_state, TableScanDesc scan)
IndexBuildCallback callback, void *callback_state, TableScanDesc scan,
BlockNumber startBlkno, BlockNumber numblocks)
{
return IndexBuildUHeapScan(heapRelation, indexRelation, indexInfo, allowSync, callback, callback_state, scan);
}

View File

@ -482,7 +482,8 @@ typedef struct TableAmRoutine {
*/
double (*index_build_scan)(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, bool allow_sync,
IndexBuildCallback callback, void *callback_state, TableScanDesc scan);
IndexBuildCallback callback, void *callback_state, TableScanDesc scan,
BlockNumber startBlkno, BlockNumber numblocks);
void (*index_validate_scan)(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, Snapshot snapshot,
v_i_state *state);
@ -993,10 +994,11 @@ static inline void tableam_scan_init_parallel_seqscan(TableScanDesc sscan, int32
}
static inline double tableam_index_build_scan(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo,
bool allow_sync, IndexBuildCallback callback, void *callback_state, TableScanDesc scan)
bool allow_sync, IndexBuildCallback callback, void *callback_state, TableScanDesc scan,
BlockNumber startBlkno = 0, BlockNumber numblocks = InvalidBlockNumber)
{
return heapRelation->rd_tam_ops->index_build_scan(heapRelation, indexRelation, indexInfo,
allow_sync, callback, callback_state, scan);
allow_sync, callback, callback_state, scan, startBlkno, numblocks);
}
static inline void tableam_index_validate_scan(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo,

View File

@ -169,7 +169,8 @@ extern void index_build(Relation heapRelation,
bool isTruncGTT = false);
extern double IndexBuildHeapScan(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo,
bool allow_sync, IndexBuildCallback callback, void *callback_state, TableScanDesc scan = NULL);
bool allow_sync, IndexBuildCallback callback, void *callback_state, TableScanDesc scan = NULL,
BlockNumber startBlkno = 0, BlockNumber numblocks = InvalidBlockNumber);
extern double IndexBuildUHeapScan(Relation heapRelation,
Relation indexRelation,
IndexInfo *indexInfo,