Skip to content

Commit 4cc1c78

Browse files
gbartolinilitaocdl
andcommitted
feat: change default value of switchoverDelay to 3600 (#2846)
IMPORTANT: The default value of `switchoverDelay` has now been changed to 3600 seconds, equivalent of 1 hour. Previously, it was set to 40000000 seconds. Closes #2845 Signed-off-by: Gabriele Bartolini <[email protected]> Signed-off-by: Tao Li <[email protected]> Co-authored-by: Tao Li <[email protected]> (cherry picked from commit 9565f9f)
1 parent 8269c9a commit 4cc1c78

4 files changed

Lines changed: 7 additions & 13 deletions

File tree

‎api/v1/cluster_types.go‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,8 @@ type ClusterSpec struct {
242242

243243
// The time in seconds that is allowed for a primary PostgreSQL instance
244244
// to gracefully shutdown during a switchover.
245-
// Default value is 40000000, greater than one year in seconds,
246-
// big enough to simulate an infinite delay
247-
// +kubebuilder:default:=40000000
245+
// Default value is 3600 seconds (1 hour).
246+
// +kubebuilder:default:=3600
248247
// +optional
249248
MaxSwitchoverDelay int32 `json:"switchoverDelay,omitempty"`
250249

@@ -913,7 +912,7 @@ const (
913912
// DefaultMaxSwitchoverDelay is the default for the pg_ctl timeout in seconds when a primary PostgreSQL instance
914913
// is gracefully shutdown during a switchover.
915914
// It is greater than one year in seconds, big enough to simulate an infinite timeout
916-
DefaultMaxSwitchoverDelay = 40000000
915+
DefaultMaxSwitchoverDelay = 3600
917916
)
918917

919918
// PostgresConfiguration defines the PostgreSQL configuration

‎config/crd/bases/postgresql.cnpg.io_clusters.yaml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3224,11 +3224,10 @@ spec:
32243224
- name
32253225
type: object
32263226
switchoverDelay:
3227-
default: 40000000
3227+
default: 3600
32283228
description: The time in seconds that is allowed for a primary PostgreSQL
32293229
instance to gracefully shutdown during a switchover. Default value
3230-
is 40000000, greater than one year in seconds, big enough to simulate
3231-
an infinite delay
3230+
is 3600 seconds (1 hour).
32323231
format: int32
32333232
type: integer
32343233
topologySpreadConstraints:

‎docs/src/cloudnative-pg.v1.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,8 +1439,7 @@ gracefully shutdown (default 30)</p>
14391439
<td>
14401440
<p>The time in seconds that is allowed for a primary PostgreSQL instance
14411441
to gracefully shutdown during a switchover.
1442-
Default value is 40000000, greater than one year in seconds,
1443-
big enough to simulate an infinite delay</p>
1442+
Default value is 3600 seconds (1 hour).</p>
14441443
</td>
14451444
</tr>
14461445
<tr><td><code>failoverDelay</code><br/>

‎docs/src/instance_manager.md‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,7 @@ in order to ensure that all the data are available on the new primary.
7777

7878
For this reason, the `.spec.switchoverDelay`, expressed in seconds, controls
7979
the time given to the former primary to shut down gracefully and archive all
80-
the WAL files.
81-
During this time frame, the primary instance does not accept connections.
82-
The value defaults is greater than one year in seconds, big enough to simulate
83-
an infinite delay and therefore preserve data durability.
80+
the WAL files. By default it is set to `3600` (1 hour).
8481

8582
!!! Warning
8683
The `.spec.switchoverDelay` option affects the RPO and RTO of your

0 commit comments

Comments
 (0)