324 lines
14 KiB
Diff
324 lines
14 KiB
Diff
From d12721addbe02a005ba0e8733c45e78aba88964b Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=E8=B5=B5=E9=87=91?= <jin.zhao@enmotech.com>
|
|
Date: Fri, 9 Aug 2024 11:58:48 +0800
|
|
Subject: [PATCH] clean code jin
|
|
|
|
---
|
|
src/gausskernel/process/stream/streamCore.cpp | 6 ++---
|
|
.../storage/access/hbstore/hbindex_am.cpp | 2 +-
|
|
.../storage/access/index/indexam.cpp | 8 +++----
|
|
.../storage/access/nbtree/nbtree.cpp | 22 +++++++++----------
|
|
.../storage/access/nbtree/nbtsearch.cpp | 19 ++++++++--------
|
|
.../storage/access/nbtree/nbtutils.cpp | 2 +-
|
|
src/include/access/genam.h | 4 ++--
|
|
src/include/access/nbtree.h | 2 +-
|
|
src/include/access/relscan.h | 4 ++--
|
|
9 files changed, 34 insertions(+), 35 deletions(-)
|
|
|
|
diff --git a/src/gausskernel/process/stream/streamCore.cpp b/src/gausskernel/process/stream/streamCore.cpp
|
|
index d5352986d..25fbd65d3 100755
|
|
--- a/src/gausskernel/process/stream/streamCore.cpp
|
|
+++ b/src/gausskernel/process/stream/streamCore.cpp
|
|
@@ -1918,7 +1918,7 @@ void StreamNodeGroup::BuildStreamDesc(const uint64& queryId, Plan* node)
|
|
parallelDesc = palloc0(sizeof(ParallelIndexScanDescData));
|
|
((ParallelIndexScanDescData*)parallelDesc)->ps_indexid = ((IndexScan*)node)->indexid;
|
|
((ParallelIndexScanDescData*)parallelDesc)->ps_relid = ((IndexScan*)node)->scan.scanrelid;
|
|
- ((ParallelIndexScanDescData*)parallelDesc)->ps_btpscan = btbuildparallelscan();
|
|
+ ((ParallelIndexScanDescData*)parallelDesc)->psBtpscan = Btbuildparallelscan();
|
|
break;
|
|
default:
|
|
break;
|
|
@@ -1946,8 +1946,8 @@ void StreamNodeGroup::DestroyStreamDesc(const uint64& queryId, Plan* node)
|
|
return;
|
|
}
|
|
if (iter->second) {
|
|
- if (((ParallelIndexScanDescData*)iter->second)->ps_btpscan) {
|
|
- delete ((ParallelIndexScanDescData*)iter->second)->ps_btpscan;
|
|
+ if (((ParallelIndexScanDescData*)iter->second)->psBtpscan) {
|
|
+ delete ((ParallelIndexScanDescData*)iter->second)->psBtpscan;
|
|
}
|
|
pfree(iter->second);
|
|
}
|
|
diff --git a/src/gausskernel/storage/access/hbstore/hbindex_am.cpp b/src/gausskernel/storage/access/hbstore/hbindex_am.cpp
|
|
index 16ce1ca84..8113a673c 100644
|
|
--- a/src/gausskernel/storage/access/hbstore/hbindex_am.cpp
|
|
+++ b/src/gausskernel/storage/access/hbstore/hbindex_am.cpp
|
|
@@ -584,7 +584,7 @@ void scan_handler_idx_rescan(IndexScanDesc scan, ScanKey key, int nkeys, ScanKey
|
|
void scan_handler_idx_rescan_parallel(IndexScanDesc scan)
|
|
{
|
|
Assert(scan != NULL);
|
|
- index_rescan_parallel(scan);
|
|
+ IndexRescanParallel(scan);
|
|
}
|
|
|
|
void scan_handler_idx_rescan_local(IndexScanDesc scan, ScanKey key, int nkeys, ScanKey orderbys, int norderbys)
|
|
diff --git a/src/gausskernel/storage/access/index/indexam.cpp b/src/gausskernel/storage/access/index/indexam.cpp
|
|
index 7007d1473..b85522a6c 100644
|
|
--- a/src/gausskernel/storage/access/index/indexam.cpp
|
|
+++ b/src/gausskernel/storage/access/index/indexam.cpp
|
|
@@ -329,7 +329,7 @@ static IndexScanDesc index_beginscan_internal(Relation index_relation, int nkeys
|
|
#endif
|
|
|
|
/* Initialize information for parallel scan. */
|
|
- scan->parallel_scan = pscan;
|
|
+ scan->parallelScan = pscan;
|
|
|
|
return scan;
|
|
}
|
|
@@ -383,9 +383,9 @@ void index_rescan(IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys,
|
|
* ----------------
|
|
*/
|
|
|
|
-void index_rescan_parallel(IndexScanDesc scan)
|
|
+void IndexRescanParallel(IndexScanDesc scan)
|
|
{
|
|
- if (scan->parallel_scan) {
|
|
+ if (scan->parallelScan) {
|
|
btparallelrescan(scan);
|
|
}
|
|
}
|
|
@@ -518,7 +518,7 @@ void index_parallelscan_initialize(Relation heap_relation, Relation index_relati
|
|
target->ps_relid = RelationGetRelid(heap_relation);
|
|
target->ps_indexid = RelationGetRelid(index_relation);
|
|
|
|
- btinitparallelscan(target->ps_btpscan);
|
|
+ btinitparallelscan(target->psBtpscan);
|
|
}
|
|
|
|
/* ----------------
|
|
diff --git a/src/gausskernel/storage/access/nbtree/nbtree.cpp b/src/gausskernel/storage/access/nbtree/nbtree.cpp
|
|
index 183fe7af7..cea5cccab 100644
|
|
--- a/src/gausskernel/storage/access/nbtree/nbtree.cpp
|
|
+++ b/src/gausskernel/storage/access/nbtree/nbtree.cpp
|
|
@@ -762,11 +762,11 @@ void Btinitparallelscan(void *target)
|
|
void btparallelrescan(IndexScanDesc scan)
|
|
{
|
|
BTParallelScanDesc btscan;
|
|
- ParallelIndexScanDesc parallel_scan = scan->parallel_scan;
|
|
+ ParallelIndexScanDesc parallel_scan = scan->parallelScan;
|
|
|
|
Assert(parallel_scan);
|
|
|
|
- btscan = (BTParallelScanDesc) parallel_scan->ps_btpscan;
|
|
+ btscan = (BTParallelScanDesc) parallel_scan->psBtpscan;
|
|
|
|
/*
|
|
* In theory, we don't need to acquire the spinlock here, because there
|
|
@@ -804,12 +804,12 @@ bool _bt_parallel_seize(IndexScanDesc scan, BlockNumber *pageno)
|
|
BTPS_State pageStatus;
|
|
bool exitLoop = false;
|
|
bool status = true;
|
|
- ParallelIndexScanDesc parallel_scan = scan->parallel_scan;
|
|
+ ParallelIndexScanDesc parallel_scan = scan->parallelScan;
|
|
BTParallelScanDesc btscan;
|
|
|
|
*pageno = P_NONE;
|
|
|
|
- btscan = (BTParallelScanDesc) (parallel_scan->ps_btpscan);
|
|
+ btscan = (BTParallelScanDesc) (parallel_scan->psBtpscan);
|
|
|
|
while (1) {
|
|
LWLockAcquire(ParallelIndexScanLock, LW_EXCLUSIVE);
|
|
@@ -849,10 +849,10 @@ bool _bt_parallel_seize(IndexScanDesc scan, BlockNumber *pageno)
|
|
*/
|
|
void _bt_parallel_release(IndexScanDesc scan, BlockNumber scan_page)
|
|
{
|
|
- ParallelIndexScanDesc parallel_scan = scan->parallel_scan;
|
|
+ ParallelIndexScanDesc parallel_scan = scan->parallelScan;
|
|
BTParallelScanDesc btscan;
|
|
|
|
- btscan = (BTParallelScanDesc) (parallel_scan->ps_btpscan);
|
|
+ btscan = (BTParallelScanDesc) (parallel_scan->psBtpscan);
|
|
|
|
{
|
|
LWLockAcquire(ParallelIndexScanLock, LW_EXCLUSIVE);
|
|
@@ -872,7 +872,7 @@ void _bt_parallel_release(IndexScanDesc scan, BlockNumber scan_page)
|
|
void _bt_parallel_done(IndexScanDesc scan)
|
|
{
|
|
BTScanOpaque so = (BTScanOpaque) scan->opaque;
|
|
- ParallelIndexScanDesc parallel_scan = scan->parallel_scan;
|
|
+ ParallelIndexScanDesc parallel_scan = scan->parallelScan;
|
|
BTParallelScanDesc btscan;
|
|
bool statusChanged = false;
|
|
|
|
@@ -881,7 +881,7 @@ void _bt_parallel_done(IndexScanDesc scan)
|
|
return;
|
|
}
|
|
|
|
- btscan = (BTParallelScanDesc) (parallel_scan->ps_btpscan);
|
|
+ btscan = (BTParallelScanDesc) (parallel_scan->psBtpscan);
|
|
|
|
/*
|
|
* Mark the parallel scan as done for this combination of scan keys,
|
|
@@ -909,10 +909,10 @@ void _bt_parallel_done(IndexScanDesc scan)
|
|
void _bt_parallel_advance_array_keys(IndexScanDesc scan)
|
|
{
|
|
BTScanOpaque so = (BTScanOpaque) scan->opaque;
|
|
- ParallelIndexScanDesc parallel_scan = scan->parallel_scan;
|
|
+ ParallelIndexScanDesc parallel_scan = scan->parallelScan;
|
|
BTParallelScanDesc btscan;
|
|
|
|
- btscan = (BTParallelScanDesc) (parallel_scan->ps_btpscan);
|
|
+ btscan = (BTParallelScanDesc) (parallel_scan->psBtpscan);
|
|
|
|
so->arrayKeyCount++;
|
|
LWLockAcquire(ParallelIndexScanLock, LW_EXCLUSIVE);
|
|
@@ -1621,7 +1621,7 @@ static BTVacuumPosting btree_vacuum_posting(BTVacState *vac_state, IndexTuple po
|
|
/*
|
|
* btestimateparallelscan -- estimate storage for BTParallelScanDescData
|
|
*/
|
|
-void* btbuildparallelscan(void)
|
|
+void* Btbuildparallelscan(void)
|
|
{
|
|
void *btPscan = new BTParallelScanDescData;
|
|
return btPscan;
|
|
diff --git a/src/gausskernel/storage/access/nbtree/nbtsearch.cpp b/src/gausskernel/storage/access/nbtree/nbtsearch.cpp
|
|
index d2e16c848..3b91e0957 100644
|
|
--- a/src/gausskernel/storage/access/nbtree/nbtsearch.cpp
|
|
+++ b/src/gausskernel/storage/access/nbtree/nbtsearch.cpp
|
|
@@ -620,7 +620,7 @@ bool _bt_first(IndexScanDesc scan, ScanDirection dir)
|
|
* way while keeping other participating processes waiting. If the scan
|
|
* has already begun, use the page number from the shared structure.
|
|
*/
|
|
- if (scan->parallel_scan != NULL) {
|
|
+ if (scan->parallelScan != NULL) {
|
|
status = _bt_parallel_seize(scan, &blkno);
|
|
if (!status) {
|
|
return false;
|
|
@@ -1215,7 +1215,7 @@ static bool _bt_readpage(IndexScanDesc scan, ScanDirection dir, OffsetNumber off
|
|
opaque = (BTPageOpaqueInternal)PageGetSpecialPointer(page);
|
|
|
|
/* allow next page be processed by parallel worker */
|
|
- if (scan->parallel_scan) {
|
|
+ if (scan->parallelScan) {
|
|
if (ScanDirectionIsForward(dir))
|
|
_bt_parallel_release(scan, opaque->btpo_next);
|
|
else
|
|
@@ -1406,7 +1406,7 @@ static bool _bt_steppage(IndexScanDesc scan, ScanDirection dir)
|
|
so->currPos.buf = InvalidBuffer;
|
|
|
|
/* Walk right to the next page with data */
|
|
- if (scan->parallel_scan != NULL) {
|
|
+ if (scan->parallelScan != NULL) {
|
|
/*
|
|
* Seize the scan to get the next block number; if the scan has
|
|
* ended already, bail out.
|
|
@@ -1424,7 +1424,7 @@ static bool _bt_steppage(IndexScanDesc scan, ScanDirection dir)
|
|
} else {
|
|
/* Remember we left a page with data */
|
|
so->currPos.moreRight = true;
|
|
- if (scan->parallel_scan != NULL) {
|
|
+ if (scan->parallelScan != NULL) {
|
|
/*
|
|
* Seize the scan to get the current block number; if the scan has
|
|
* ended already, bail out.
|
|
@@ -1492,7 +1492,7 @@ static bool _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno,
|
|
if (_bt_readpage(scan, dir, P_FIRSTDATAKEY(opaque))) {
|
|
break;
|
|
}
|
|
- } else if (scan->parallel_scan != NULL) {
|
|
+ } else if (scan->parallelScan != NULL) {
|
|
/* allow next page be processed by parallel worker */
|
|
_bt_parallel_release(scan, opaque->btpo_next);
|
|
}
|
|
@@ -1502,7 +1502,7 @@ static bool _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno,
|
|
so->currPos.buf = InvalidBuffer;
|
|
|
|
/* nope, keep going */
|
|
- if (scan->parallel_scan != NULL) {
|
|
+ if (scan->parallelScan != NULL) {
|
|
status = _bt_parallel_seize(scan, &blkno);
|
|
if (!status) {
|
|
return false;
|
|
@@ -1577,7 +1577,7 @@ static bool _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno,
|
|
if (_bt_readpage(scan, dir, PageGetMaxOffsetNumber(page))) {
|
|
break;
|
|
}
|
|
- } else if (scan->parallel_scan != NULL) {
|
|
+ } else if (scan->parallelScan != NULL) {
|
|
/* allow next page be processed by parallel worker */
|
|
_bt_parallel_release(scan, BufferGetBlockNumber(so->currPos.buf));
|
|
}
|
|
@@ -1588,11 +1588,10 @@ static bool _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno,
|
|
* worker has already advanced the scan to a different page. We
|
|
* must continue based on the latest page scanned by any worker.
|
|
*/
|
|
- if (scan->parallel_scan != NULL) {
|
|
+ if (scan->parallelScan != NULL) {
|
|
_bt_relbuf(rel, so->currPos.buf);
|
|
status = _bt_parallel_seize(scan, &blkno);
|
|
- if (!status)
|
|
- {
|
|
+ if (!status) {
|
|
so->currPos.buf = InvalidBuffer;
|
|
return false;
|
|
}
|
|
diff --git a/src/gausskernel/storage/access/nbtree/nbtutils.cpp b/src/gausskernel/storage/access/nbtree/nbtutils.cpp
|
|
index 1c477b6b0..616da34cc 100644
|
|
--- a/src/gausskernel/storage/access/nbtree/nbtutils.cpp
|
|
+++ b/src/gausskernel/storage/access/nbtree/nbtutils.cpp
|
|
@@ -555,7 +555,7 @@ bool _bt_advance_array_keys(IndexScanDesc scan, ScanDirection dir)
|
|
}
|
|
|
|
/* advance parallel scan */
|
|
- if (scan->parallel_scan != NULL)
|
|
+ if (scan->parallelScan != NULL)
|
|
_bt_parallel_advance_array_keys(scan);
|
|
|
|
return found;
|
|
diff --git a/src/include/access/genam.h b/src/include/access/genam.h
|
|
index b14da2568..99044ac07 100644
|
|
--- a/src/include/access/genam.h
|
|
+++ b/src/include/access/genam.h
|
|
@@ -136,10 +136,10 @@ extern bool index_insert(Relation indexRelation, Datum* values, const bool* isnu
|
|
extern IndexScanDesc index_beginscan(Relation heapRelation, Relation indexRelation, Snapshot snapshot,
|
|
int nkeys, int norderbys, ScanState* scan_state = NULL, ParallelIndexScanDesc pscan = NULL);
|
|
extern void index_parallelscan_initialize(Relation heap_relation,
|
|
- Relation index_relation, ParallelIndexScanDesc p_index_scan);
|
|
+ Relation index_relation, ParallelIndexScanDesc pIndexScan);
|
|
extern IndexScanDesc index_beginscan_bitmap(Relation indexRelation, Snapshot snapshot, int nkeys, ScanState* scan_state=NULL);
|
|
extern void index_rescan(IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys, int norderbys);
|
|
-extern void index_rescan_parallel(IndexScanDesc scan);
|
|
+extern void IndexRescanParallel(IndexScanDesc scan);
|
|
extern void index_endscan(IndexScanDesc scan);
|
|
extern void index_markpos(IndexScanDesc scan);
|
|
extern void index_restrpos(IndexScanDesc scan);
|
|
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
|
|
index e0e5afa38..bb6d1e83c 100644
|
|
--- a/src/include/access/nbtree.h
|
|
+++ b/src/include/access/nbtree.h
|
|
@@ -1286,7 +1286,7 @@ extern Datum btbuild(PG_FUNCTION_ARGS);
|
|
extern Datum btbuildempty(PG_FUNCTION_ARGS);
|
|
extern Datum btinsert(PG_FUNCTION_ARGS);
|
|
extern Datum btbeginscan(PG_FUNCTION_ARGS);
|
|
-extern void* btbuildparallelscan(void);
|
|
+extern void* Btbuildparallelscan(void);
|
|
extern void Btinitparallelscan(void *target);
|
|
extern Datum btgettuple(PG_FUNCTION_ARGS);
|
|
extern Datum btgetbitmap(PG_FUNCTION_ARGS);
|
|
diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h
|
|
index cb40b95df..cc67b1be8 100644
|
|
--- a/src/include/access/relscan.h
|
|
+++ b/src/include/access/relscan.h
|
|
@@ -171,7 +171,7 @@ typedef struct IndexScanDescData {
|
|
#endif
|
|
IndexFetchTableData *xs_heapfetch;
|
|
/* parallel index scan information, in global variables */
|
|
- struct ParallelIndexScanDescData *parallel_scan;
|
|
+ struct ParallelIndexScanDescData *parallelScan;
|
|
/* put decompressed heap tuple data into xs_ctbuf_hdr be careful! when malloc memory should give extra mem for
|
|
*xs_ctbuf_hdr. t_bits which is varlength arr
|
|
*/
|
|
@@ -183,7 +183,7 @@ typedef struct IndexScanDescData {
|
|
typedef struct ParallelIndexScanDescData {
|
|
Oid ps_relid;
|
|
Oid ps_indexid;
|
|
- void* ps_btpscan;
|
|
+ void* psBtpscan;
|
|
} ParallelIndexScanDescData;
|
|
|
|
#define SizeofIndexScanDescData (offsetof(IndexScanDescData, xs_ctbuf_hdr) + SizeofHeapTupleHeader)
|
|
--
|
|
2.39.1.windows.1
|
|
|