Merge 38d2efa23b into a7aaad0a0b
This commit is contained in:
commit
c1a027ffe8
|
|
@ -2404,6 +2404,12 @@ spec:
|
||||||
properties:
|
properties:
|
||||||
failsafe_mode:
|
failsafe_mode:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
ignore_slots:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
initdb:
|
initdb:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
type: string
|
type: string
|
||||||
|
|
|
||||||
|
|
@ -250,6 +250,7 @@ type Patroni struct {
|
||||||
SynchronousModeStrict bool `json:"synchronous_mode_strict,omitempty"`
|
SynchronousModeStrict bool `json:"synchronous_mode_strict,omitempty"`
|
||||||
SynchronousNodeCount uint32 `json:"synchronous_node_count,omitempty" defaults:"1"`
|
SynchronousNodeCount uint32 `json:"synchronous_node_count,omitempty" defaults:"1"`
|
||||||
FailsafeMode *bool `json:"failsafe_mode,omitempty"`
|
FailsafeMode *bool `json:"failsafe_mode,omitempty"`
|
||||||
|
IgnoreSlots []map[string]string `json:"ignore_slots,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// StandbyDescription contains remote primary config and/or s3/gs wal path.
|
// StandbyDescription contains remote primary config and/or s3/gs wal path.
|
||||||
|
|
|
||||||
|
|
@ -697,6 +697,19 @@ func (in *Patroni) DeepCopyInto(out *Patroni) {
|
||||||
*out = new(bool)
|
*out = new(bool)
|
||||||
**out = **in
|
**out = **in
|
||||||
}
|
}
|
||||||
|
if in.IgnoreSlots != nil {
|
||||||
|
in, out := &in.IgnoreSlots, &out.IgnoreSlots
|
||||||
|
*out = make([]map[string]string, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
if (*in)[i] != nil {
|
||||||
|
in, out := &(*in)[i], &(*out)[i]
|
||||||
|
*out = make(map[string]string, len(*in))
|
||||||
|
for key, val := range *in {
|
||||||
|
(*out)[key] = val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ type patroniDCS struct {
|
||||||
PGBootstrapConfiguration map[string]interface{} `json:"postgresql,omitempty"`
|
PGBootstrapConfiguration map[string]interface{} `json:"postgresql,omitempty"`
|
||||||
Slots map[string]map[string]string `json:"slots,omitempty"`
|
Slots map[string]map[string]string `json:"slots,omitempty"`
|
||||||
FailsafeMode *bool `json:"failsafe_mode,omitempty"`
|
FailsafeMode *bool `json:"failsafe_mode,omitempty"`
|
||||||
|
IgnoreSlots []map[string]string `json:"ignore_slots,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type pgBootstrap struct {
|
type pgBootstrap struct {
|
||||||
|
|
@ -449,6 +450,10 @@ PatroniInitDBParams:
|
||||||
config.Bootstrap.DCS.FailsafeMode = opConfig.EnablePatroniFailsafeMode
|
config.Bootstrap.DCS.FailsafeMode = opConfig.EnablePatroniFailsafeMode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if patroni.IgnoreSlots != nil {
|
||||||
|
config.Bootstrap.DCS.IgnoreSlots = patroni.IgnoreSlots
|
||||||
|
}
|
||||||
config.PgLocalConfiguration = make(map[string]interface{})
|
config.PgLocalConfiguration = make(map[string]interface{})
|
||||||
|
|
||||||
// the newer and preferred way to specify the PG version is to use the `PGVERSION` env variable
|
// the newer and preferred way to specify the PG version is to use the `PGVERSION` env variable
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,17 @@ func TestGenerateSpiloJSONConfiguration(t *testing.T) {
|
||||||
},
|
},
|
||||||
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/18/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},{"auth-local":"trust"}],"dcs":{"failsafe_mode":true}}}`,
|
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/18/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},{"auth-local":"trust"}],"dcs":{"failsafe_mode":true}}}`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
subtest: "Patroni ignore_slots configured for PostgreSQL 17 slot sync",
|
||||||
|
pgParam: &acidv1.PostgresqlParam{PgVersion: "17"},
|
||||||
|
patroni: &acidv1.Patroni{
|
||||||
|
IgnoreSlots: []map[string]string{
|
||||||
|
{"type": "logical"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opConfig: &config.Config{},
|
||||||
|
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"md5"},{"auth-local":"trust"}],"dcs":{"ignore_slots":[{"type":"logical"}]}}}`,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
cluster.OpConfig = *tt.opConfig
|
cluster.OpConfig = *tt.opConfig
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue