From 8be779fd3ab9e87206da96a7e4842ef1abf04f44 Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Fri, 16 May 2025 22:00:12 +0300 Subject: [PATCH] Use RelationGetSmgr in calls of unlogged_build functions --- src/backend/access/gin/gininsert.c | 6 +++--- src/backend/access/gist/gistbuild.c | 6 +++--- src/backend/access/spgist/spginsert.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c index 27fcd7604c1..271df9abbff 100644 --- a/src/backend/access/gin/gininsert.c +++ b/src/backend/access/gin/gininsert.c @@ -332,7 +332,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; @@ -407,7 +407,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 @@ -420,7 +420,7 @@ ginbuild(Relation heap, Relation index, IndexInfo *indexInfo) true); } - smgr_end_unlogged_build(index->rd_smgr); + smgr_end_unlogged_build(RelationGetSmgr(index)); /* * Return statistics diff --git a/src/backend/access/gist/gistbuild.c b/src/backend/access/gist/gistbuild.c index aca0ad8634d..4f28dff1d72 100644 --- a/src/backend/access/gist/gistbuild.c +++ b/src/backend/access/gist/gistbuild.c @@ -295,7 +295,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, heap); @@ -329,7 +329,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 @@ -342,7 +342,7 @@ gistbuild(Relation heap, Relation index, IndexInfo *indexInfo) true); } - smgr_end_unlogged_build(index->rd_smgr); + smgr_end_unlogged_build(RelationGetSmgr(index)); } /* okay, all heap tuples are indexed */ diff --git a/src/backend/access/spgist/spginsert.c b/src/backend/access/spgist/spginsert.c index 2a78849f41f..27d9e5a52b1 100644 --- a/src/backend/access/spgist/spginsert.c +++ b/src/backend/access/spgist/spginsert.c @@ -83,7 +83,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 @@ -131,7 +131,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 @@ -144,7 +144,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;