Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/backend/access/gin/gininsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ ginbuild(Relation heap, Relation index, IndexInfo *indexInfo)
elog(ERROR, "index \"%s\" already contains data",
RelationGetRelationName(index));

smgr_start_unlogged_build(index->rd_smgr);
smgr_start_unlogged_build(RelationGetSmgr(index));

initGinState(&buildstate.ginstate, index);
buildstate.indtuples = 0;
Expand Down Expand Up @@ -410,7 +410,7 @@ ginbuild(Relation heap, Relation index, IndexInfo *indexInfo)
buildstate.buildStats.nTotalPages = RelationGetNumberOfBlocks(index);
ginUpdateStats(index, &buildstate.buildStats, true);

smgr_finish_unlogged_build_phase_1(index->rd_smgr);
smgr_finish_unlogged_build_phase_1(RelationGetSmgr(index));

/*
* We didn't write WAL records as we built the index, so if WAL-logging is
Expand All @@ -423,7 +423,7 @@ ginbuild(Relation heap, Relation index, IndexInfo *indexInfo)
true);
}

smgr_end_unlogged_build(index->rd_smgr);
smgr_end_unlogged_build(RelationGetSmgr(index));

/*
* Return statistics
Expand Down
18 changes: 9 additions & 9 deletions src/backend/access/gist/gistbuild.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ gistbuild(Relation heap, Relation index, IndexInfo *indexInfo)
Buffer buffer;
Page page;

smgr_start_unlogged_build(index->rd_smgr);
smgr_start_unlogged_build(RelationGetSmgr(index));

/* initialize the root page */
buffer = gistNewBuffer(index);
Expand Down Expand Up @@ -331,7 +331,7 @@ gistbuild(Relation heap, Relation index, IndexInfo *indexInfo)
gistFreeBuildBuffers(buildstate.gfbb);
}

smgr_finish_unlogged_build_phase_1(index->rd_smgr);
smgr_finish_unlogged_build_phase_1(RelationGetSmgr(index));

/*
* We didn't write WAL records as we built the index, so if
Expand All @@ -343,7 +343,7 @@ gistbuild(Relation heap, Relation index, IndexInfo *indexInfo)
0, RelationGetNumberOfBlocks(index),
true);
}
smgr_end_unlogged_build(index->rd_smgr);
smgr_end_unlogged_build(RelationGetSmgr(index));
}

/* okay, all heap tuples are indexed */
Expand Down Expand Up @@ -463,18 +463,18 @@ gist_indexsortbuild(GISTBuildState *state)
gist_indexsortbuild_flush_ready_pages(state);

/* Write out the root */
smgr_start_unlogged_build(state->indexrel->rd_smgr);
smgr_start_unlogged_build(RelationGetSmgr(state->indexrel));
PageSetLSN(levelstate->pages[0], GistBuildLSN);
PageSetChecksumInplace(levelstate->pages[0], GIST_ROOT_BLKNO);
smgrwrite(RelationGetSmgr(state->indexrel), MAIN_FORKNUM, GIST_ROOT_BLKNO,
levelstate->pages[0], true);
smgr_finish_unlogged_build_phase_1(state->indexrel->rd_smgr);
smgr_finish_unlogged_build_phase_1(RelationGetSmgr(state->indexrel));
if (RelationNeedsWAL(state->indexrel))
{
log_newpage(&state->indexrel->rd_node, MAIN_FORKNUM, GIST_ROOT_BLKNO,
levelstate->pages[0], true);
}
smgr_end_unlogged_build(state->indexrel->rd_smgr);
smgr_end_unlogged_build(RelationGetSmgr(state->indexrel));

pfree(levelstate->pages[0]);
pfree(levelstate);
Expand Down Expand Up @@ -656,7 +656,7 @@ gist_indexsortbuild_flush_ready_pages(GISTBuildState *state)
if (state->ready_num_pages == 0)
return;

smgr_start_unlogged_build(state->indexrel->rd_smgr);
smgr_start_unlogged_build(RelationGetSmgr(state->indexrel));

for (int i = 0; i < state->ready_num_pages; i++)
{
Expand All @@ -675,13 +675,13 @@ gist_indexsortbuild_flush_ready_pages(GISTBuildState *state)
state->pages_written++;
}

smgr_finish_unlogged_build_phase_1(state->indexrel->rd_smgr);
smgr_finish_unlogged_build_phase_1(RelationGetSmgr(state->indexrel));

if (RelationNeedsWAL(state->indexrel))
log_newpages(&state->indexrel->rd_node, MAIN_FORKNUM, state->ready_num_pages,
state->ready_blknos, state->ready_pages, true);

smgr_end_unlogged_build(state->indexrel->rd_smgr);
smgr_end_unlogged_build(RelationGetSmgr(state->indexrel));

for (int i = 0; i < state->ready_num_pages; i++)
pfree(state->ready_pages[i]);
Expand Down
6 changes: 3 additions & 3 deletions src/backend/access/spgist/spginsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ spgbuild(Relation heap, Relation index, IndexInfo *indexInfo)
elog(ERROR, "index \"%s\" already contains data",
RelationGetRelationName(index));

smgr_start_unlogged_build(index->rd_smgr);
smgr_start_unlogged_build(RelationGetSmgr(index));

/*
* Initialize the meta page and root pages
Expand Down Expand Up @@ -133,7 +133,7 @@ spgbuild(Relation heap, Relation index, IndexInfo *indexInfo)

SpGistUpdateMetaPage(index);

smgr_finish_unlogged_build_phase_1(index->rd_smgr);
smgr_finish_unlogged_build_phase_1(RelationGetSmgr(index));

/*
* We didn't write WAL records as we built the index, so if WAL-logging is
Expand All @@ -146,7 +146,7 @@ spgbuild(Relation heap, Relation index, IndexInfo *indexInfo)
true);
}

smgr_end_unlogged_build(index->rd_smgr);
smgr_end_unlogged_build(RelationGetSmgr(index));

result = (IndexBuildResult *) palloc0(sizeof(IndexBuildResult));
result->heap_tuples = reltuples;
Expand Down