Skip to content

Commit 9565f9f

Browse files
gbartolinilitaocdl
andauthored
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]>
1 parent 0ea6297 commit 9565f9f

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
@@ -278,9 +278,8 @@ type ClusterSpec struct {
278278

279279
// The time in seconds that is allowed for a primary PostgreSQL instance
280280
// to gracefully shutdown during a switchover.
281-
// Default value is 40000000, greater than one year in seconds,
282-
// big enough to simulate an infinite delay
283-
// +kubebuilder:default:=40000000
281+
// Default value is 3600 seconds (1 hour).
282+
// +kubebuilder:default:=3600
284283
// +optional
285284
MaxSwitchoverDelay int32 `json:"switchoverDelay,omitempty"`
286285

@@ -981,7 +980,7 @@ const (
981980
// DefaultMaxSwitchoverDelay is the default for the pg_ctl timeout in seconds when a primary PostgreSQL instance
982981
// is gracefully shutdown during a switchover.
983982
// It is greater than one year in seconds, big enough to simulate an infinite timeout
984-
DefaultMaxSwitchoverDelay = 40000000
983+
DefaultMaxSwitchoverDelay = 3600
985984
)
986985

987986
// 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
@@ -3260,11 +3260,10 @@ spec:
32603260
- name
32613261
type: object
32623262
switchoverDelay:
3263-
default: 40000000
3263+
default: 3600
32643264
description: The time in seconds that is allowed for a primary PostgreSQL
32653265
instance to gracefully shutdown during a switchover. Default value
3266-
is 40000000, greater than one year in seconds, big enough to simulate
3267-
an infinite delay
3266+
is 3600 seconds (1 hour).
32683267
format: int32
32693268
type: integer
32703269
topologySpreadConstraints:

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,8 +1468,7 @@ gracefully shutdown (default 30)</p>
14681468
<td>
14691469
<p>The time in seconds that is allowed for a primary PostgreSQL instance
14701470
to gracefully shutdown during a switchover.
1471-
Default value is 40000000, greater than one year in seconds,
1472-
big enough to simulate an infinite delay</p>
1471+
Default value is 3600 seconds (1 hour).</p>
14731472
</td>
14741473
</tr>
14751474
<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)