Skip to content

Commit

Permalink
Format hnsw/build.c and hnsw/insert.c
Browse files Browse the repository at this point in the history
  • Loading branch information
juuu-jiii committed Oct 12, 2023
1 parent a1019cf commit 226ecd6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/hnsw/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
}

Expand Down Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion src/hnsw/insert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 226ecd6

Please sign in to comment.