Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite85a4b2

Browse files
committed
*: add InitMode new options for initdb
This patch adds under the cluster spec a new NewConfig field fordefining initialization option that will be passed to initdb.Currently the supported options are for Locale, Encoding andDataChecksums. In future other options like specific locale categoriescould be added.The options aren't validated by stolon so if a wrong one is provided dbinitialization will fail at initdb execution time.
1 parentbee6560 commite85a4b2

File tree

5 files changed

+68
-23
lines changed

5 files changed

+68
-23
lines changed

‎cmd/keeper/keeper.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,14 @@ func (p *PostgresKeeper) postgresKeeperSM(pctx context.Context) {
966966
// update pgm postgres parameters
967967
pgm.SetParameters(pgParameters)
968968

969+
initConfig:=&postgresql.InitConfig{}
970+
971+
ifdb.Spec.NewConfig!=nil {
972+
initConfig.Locale=db.Spec.NewConfig.Locale
973+
initConfig.Encoding=db.Spec.NewConfig.Encoding
974+
initConfig.DataChecksums=db.Spec.NewConfig.DataChecksums
975+
}
976+
969977
ifstarted {
970978
iferr=pgm.Stop(true);err!=nil {
971979
log.Errorw("failed to stop pg instance",zap.Error(err))
@@ -977,7 +985,7 @@ func (p *PostgresKeeper) postgresKeeperSM(pctx context.Context) {
977985
log.Errorw("failed to remove the postgres data dir",zap.Error(err))
978986
return
979987
}
980-
iferr=pgm.Init();err!=nil {
988+
iferr=pgm.Init(initConfig);err!=nil {
981989
log.Errorw("failed to initialize postgres database cluster",zap.Error(err))
982990
return
983991
}

‎cmd/sentinel/sentinel.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ func (s *Sentinel) updateCluster(cd *cluster.ClusterData, pis cluster.ProxiesInf
751751
Spec:&cluster.DBSpec{
752752
KeeperUID:k.UID,
753753
InitMode:cluster.DBInitModeNew,
754+
NewConfig:clusterSpec.NewConfig,
754755
Role:common.RoleMaster,
755756
Followers: []string{},
756757
IncludeConfig:*clusterSpec.MergePgParameters,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp