From 226ecd6ca1bcf521aacbb4bc8ec56e2fed968d29 Mon Sep 17 00:00:00 2001 From: juuu-jiii Date: Thu, 12 Oct 2023 23:52:49 +0800 Subject: [PATCH] Format hnsw/build.c and hnsw/insert.c --- src/hnsw/build.c | 13 +++++++------ src/hnsw/insert.c | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/hnsw/build.c b/src/hnsw/build.c index 834995cf..9408fb3c 100644 --- a/src/hnsw/build.c +++ b/src/hnsw/build.c @@ -437,15 +437,16 @@ static void BuildIndex( BlockNumber numBlocks; // Populate numBlocks correctly by explicitly handling each possible value forkNum can take - switch (forkNum) { + switch(forkNum) { case MAIN_FORKNUM: numBlocks = RelationGetNumberOfBlocks(heap); break; - default: // should be case INIT_FORKNUM, but set to default to keep compiler quiet + default: // should be case INIT_FORKNUM, but set to default to keep compiler quiet numBlocks = RelationGetNumberOfBlocksInFork(index, forkNum); + break; } - uint32_t estimated_row_count = 0; + uint32_t estimated_row_count = 0; if(numBlocks > 0) { // Read the first block Buffer buffer = ReadBufferExtended(heap, MAIN_FORKNUM, 0, RBM_NORMAL, NULL); @@ -473,7 +474,7 @@ static void BuildIndex( UpdateProgress(PROGRESS_CREATEIDX_PHASE, PROGRESS_HNSW_PHASE_IN_MEMORY_INSERT); - if (buildstate->heap != NULL) { + if(buildstate->heap != NULL) { LanternBench("build hnsw index", ScanTable(buildstate)); } @@ -527,8 +528,8 @@ IndexBuildResult *ldb_ambuild(Relation heap, Relation index, IndexInfo *indexInf void ldb_ambuildunlogged(Relation index) { // Manually construct index info - IndexInfo *indexInfo = BuildIndexInfo(index); - HnswBuildState buildState; + IndexInfo *indexInfo = BuildIndexInfo(index); + HnswBuildState buildState; BuildIndex(NULL, index, indexInfo, &buildState, INIT_FORKNUM); } diff --git a/src/hnsw/insert.c b/src/hnsw/insert.c index 43baa644..51c05af0 100644 --- a/src/hnsw/insert.c +++ b/src/hnsw/insert.c @@ -176,7 +176,7 @@ bool ldb_aminsert(Relation index, XLogRecPtr ptr = GenericXLogFinish(state); // If the table is unlogged, GenericXLogFinish returns InvalidXLogRecPtr as saving to WAL is not required. - if (!RelationNeedsWAL(index)) { + if(!RelationNeedsWAL(index)) { assert(ptr == InvalidXLogRecPtr); } else { assert(ptr != InvalidXLogRecPtr);