Skip to content

Commit

Permalink
EVEREST-866 PG PITR fallback to heuristics (#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
oksana-grishchenko authored and recharte committed Nov 12, 2024
1 parent becc9e1 commit a45c5f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions api/database_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,9 @@ func getDefaultUploadInterval(engine everestv1alpha1.Engine, uploadInterval *int
// so we still use heuristics
return valueOrDefault(uploadInterval, psmdbDefaultUploadInterval)
case everestv1alpha1.DatabaseEnginePostgresql:
// latest restorable time appeared in PG 2.4.0
if common.CheckConstraint(version, "<2.4.0") {
return valueOrDefault(uploadInterval, pgDefaultUploadInterval)
}
// latest restorable time appeared in PG 2.4.0, however it's not reliable https://perconadev.atlassian.net/browse/K8SPG-681
// so we still use heuristics
return valueOrDefault(uploadInterval, pgDefaultUploadInterval)
}
// for newer versions don't use the heuristics, so return 0 upload interval
return 0
Expand Down
6 changes: 3 additions & 3 deletions api/database_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,19 @@ func TestGetDefaultUploadInterval(t *testing.T) {
name: "new pg, no interval is set",
engine: everestv1alpha1.Engine{Type: everestv1alpha1.DatabaseEnginePostgresql, Version: "2.4.0"},
interval: nil,
expected: 0,
expected: pgDefaultUploadInterval,
},
{
name: "new pg, interval is set",
engine: everestv1alpha1.Engine{Type: everestv1alpha1.DatabaseEnginePostgresql, Version: "2.4.0"},
interval: pointer.ToInt(1000),
expected: 0,
expected: 1000,
},
{
name: "newer pg",
engine: everestv1alpha1.Engine{Type: everestv1alpha1.DatabaseEnginePostgresql, Version: "2.4.1"},
interval: nil,
expected: 0,
expected: pgDefaultUploadInterval,
},
}
for _, tc := range cases {
Expand Down

0 comments on commit a45c5f9

Please sign in to comment.