From 861f0841c41a6f260c11e968672435fde10f3fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=9F=E6=89=BF=E5=BF=97?= <842536125@qq.com> Date: Wed, 4 Dec 2024 15:28:25 +0800 Subject: [PATCH] modified: ../bin/initdb/initdb.cpp modified: ../common/backend/catalog/heap.cpp modified: bootstrap/bootstrap.cpp modified: optimizer/commands/indexcmds.cpp modified: optimizer/commands/tablecmds.cpp --- src/bin/initdb/initdb.cpp | 6 +++--- src/common/backend/catalog/heap.cpp | 18 +++++++++--------- src/gausskernel/bootstrap/bootstrap.cpp | 9 +++++---- .../optimizer/commands/indexcmds.cpp | 4 ++++ .../optimizer/commands/tablecmds.cpp | 4 ++-- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/bin/initdb/initdb.cpp b/src/bin/initdb/initdb.cpp index 42b217b3e6..a666d0bb3e 100644 --- a/src/bin/initdb/initdb.cpp +++ b/src/bin/initdb/initdb.cpp @@ -1599,9 +1599,9 @@ static void setup_config(void) securec_check_c(nRet, "\0", "\0"); conflines = replace_token(conflines, "#ss_enable_dss = off", repltok); - nRet = strcpy_s(repltok, sizeof(repltok), "enable_segment = on"); - securec_check_c(nRet, "\0", "\0"); - conflines = replace_token(conflines, "#enable_segment = off", repltok); + // nRet = strcpy_s(repltok, sizeof(repltok), "enable_segment = on"); + // securec_check_c(nRet, "\0", "\0"); + // conflines = replace_token(conflines, "#enable_segment = off", repltok); nRet = strcpy_s(repltok, sizeof(repltok), "enable_double_write = off"); securec_check_c(nRet, "\0", "\0"); diff --git a/src/common/backend/catalog/heap.cpp b/src/common/backend/catalog/heap.cpp index 605f73e195..cbf6aa87be 100644 --- a/src/common/backend/catalog/heap.cpp +++ b/src/common/backend/catalog/heap.cpp @@ -552,9 +552,9 @@ Relation heap_create(const char* relname, Oid relnamespace, Oid reltablespace, O if ((IsInitdb && EnableInitDBSegment) || (u_sess->attr.attr_common.IsInplaceUpgrade && ENABLE_DMS)) { /* store tables in segment storage as all possible while initdb */ - if (relpersistence == RELPERSISTENCE_PERMANENT) { - storage_type = SEGMENT_PAGE; - } + // if (relpersistence == RELPERSISTENCE_PERMANENT) { + // storage_type = SEGMENT_PAGE; + // } } /* The caller must have provided an OID for the relation. */ @@ -2719,12 +2719,12 @@ Oid heap_create_with_catalog(const char *relname, Oid relnamespace, Oid reltable } /* store tables in segment storage as all possible while initdb */ - if (relpersistence == RELPERSISTENCE_PERMANENT && - (relkind != RELKIND_SEQUENCE && relkind != RELKIND_LARGE_SEQUENCE && - relkind != RELKIND_TOASTVALUE && relkind != RELKIND_VIEW)) { - storage_type = SEGMENT_PAGE; - reloptions = AddSegmentOption(reloptions); - } + // if (relpersistence == RELPERSISTENCE_PERMANENT && + // (relkind != RELKIND_SEQUENCE && relkind != RELKIND_LARGE_SEQUENCE && + // relkind != RELKIND_TOASTVALUE && relkind != RELKIND_VIEW)) { + // storage_type = SEGMENT_PAGE; + // reloptions = AddSegmentOption(reloptions); + // } } pg_class_desc = heap_open(RelationRelationId, RowExclusiveLock); diff --git a/src/gausskernel/bootstrap/bootstrap.cpp b/src/gausskernel/bootstrap/bootstrap.cpp index a1719d5d9b..f486d44609 100755 --- a/src/gausskernel/bootstrap/bootstrap.cpp +++ b/src/gausskernel/bootstrap/bootstrap.cpp @@ -275,7 +275,8 @@ void BootStrapProcessMain(int argc, char* argv[]) SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV); break; case 'G': - EnableInitDBSegment = true; + // EnableInitDBSegment = true; + EnableInitDBSegment = false; break; case 'g': SetConfigOption("xlog_file_path", optCtxt.optarg, PGC_POSTMASTER, PGC_S_ARGV); @@ -734,9 +735,9 @@ void InsertOneTuple(Oid objectid) ereport(FATAL, (errmsg("Built-in functions should not be added into pg_proc"))); } - if (IsBootingPgClass(t_thrd.bootstrap_cxt.boot_reldesc) && EnableInitDBSegment) { - ChangePgClassBucketValueForSegment(); - } + // if (IsBootingPgClass(t_thrd.bootstrap_cxt.boot_reldesc) && EnableInitDBSegment) { + // ChangePgClassBucketValueForSegment(); + // } tupDesc = CreateTupleDesc(t_thrd.bootstrap_cxt.numattr, RelationGetForm(t_thrd.bootstrap_cxt.boot_reldesc)->relhasoids, t_thrd.bootstrap_cxt.attrtypes, diff --git a/src/gausskernel/optimizer/commands/indexcmds.cpp b/src/gausskernel/optimizer/commands/indexcmds.cpp index 285d5bd35a..1e8ea78b1a 100644 --- a/src/gausskernel/optimizer/commands/indexcmds.cpp +++ b/src/gausskernel/optimizer/commands/indexcmds.cpp @@ -803,6 +803,10 @@ ObjectAddress DefineIndex(Oid relationId, IndexStmt* stmt, Oid indexRelationId, lockmode = concurrent ? ShareUpdateExclusiveLock : ShareLock; rel = heap_open(relationId, lockmode); + if (rel->storage_type == SEGMENT_PAGE) { + ereport(WARNING, (errmsg("open a segment table. %s", rel->rd_rel->relname.data))); + } + bool segment = get_rel_segment(rel); TableCreateSupport indexCreateSupport{(int)COMPRESS_TYPE_NONE, false, false, false, false, false, true, false}; ListCell *cell = NULL; diff --git a/src/gausskernel/optimizer/commands/tablecmds.cpp b/src/gausskernel/optimizer/commands/tablecmds.cpp index 37ee861a9e..16d7cc1048 100755 --- a/src/gausskernel/optimizer/commands/tablecmds.cpp +++ b/src/gausskernel/optimizer/commands/tablecmds.cpp @@ -3029,8 +3029,8 @@ ObjectAddress DefineRelation(CreateStmt* stmt, char relkind, Oid ownerId, Object } if (ENABLE_DMS && !u_sess->attr.attr_common.IsInplaceUpgrade) { - if ((relkind == RELKIND_RELATION && storage_type != SEGMENT_PAGE) || - relkind == RELKIND_MATVIEW || + // if ((relkind == RELKIND_RELATION && storage_type != SEGMENT_PAGE) || + if (relkind == RELKIND_MATVIEW || pg_strcasecmp(storeChar, ORIENTATION_ROW) != 0 || relkind == RELKIND_FOREIGN_TABLE || stmt->relation->relpersistence == RELPERSISTENCE_UNLOGGED || -- Gitee