Merge 6749c02825 into f05150a81e
This commit is contained in:
commit
ead5023599
|
|
@ -3470,6 +3470,12 @@ spec:
|
|||
properties:
|
||||
failsafe_mode:
|
||||
type: boolean
|
||||
ignore_slots:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: string
|
||||
initdb:
|
||||
additionalProperties:
|
||||
type: string
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ type Patroni struct {
|
|||
SynchronousModeStrict bool `json:"synchronous_mode_strict,omitempty"`
|
||||
SynchronousNodeCount uint32 `json:"synchronous_node_count,omitempty" defaults:"1"`
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -597,6 +597,19 @@ func (in *Patroni) DeepCopyInto(out *Patroni) {
|
|||
*out = new(bool)
|
||||
**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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ type patroniDCS struct {
|
|||
PGBootstrapConfiguration map[string]interface{} `json:"postgresql,omitempty"`
|
||||
Slots map[string]map[string]string `json:"slots,omitempty"`
|
||||
FailsafeMode *bool `json:"failsafe_mode,omitempty"`
|
||||
IgnoreSlots []map[string]string `json:"ignore_slots,omitempty"`
|
||||
}
|
||||
|
||||
type pgBootstrap struct {
|
||||
|
|
@ -449,6 +450,10 @@ PatroniInitDBParams:
|
|||
config.Bootstrap.DCS.FailsafeMode = opConfig.EnablePatroniFailsafeMode
|
||||
}
|
||||
|
||||
|
||||
if patroni.IgnoreSlots != nil {
|
||||
config.Bootstrap.DCS.IgnoreSlots = patroni.IgnoreSlots
|
||||
}
|
||||
config.PgLocalConfiguration = make(map[string]interface{})
|
||||
|
||||
// the newer and preferred way to specify the PG version is to use the `PGVERSION` env variable
|
||||
|
|
|
|||
|
|
@ -135,6 +135,17 @@ func TestGenerateSpiloJSONConfiguration(t *testing.T) {
|
|||
},
|
||||
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"md5"},{"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 {
|
||||
cluster.OpConfig = *tt.opConfig
|
||||
|
|
|
|||
Loading…
Reference in New Issue