From 02e6584586ae7aed4407bffd1b5f5b3495fd15af Mon Sep 17 00:00:00 2001 From: Sami Hiltunen Date: Tue, 31 Jan 2023 19:45:22 +0200 Subject: [PATCH] Default enable invalid metadata deletion in Praefect Praefect has a metadata verifier that checks whether the replicas recorded in the database actually exist. For now, it has only logged and gathered metrics on invalid metadata records by default. The verifier also supports deleting invalid metadata which clean up the stale records and allows Praefect to realize the replicas are missing and trigger replication. This functionality has been disabled in the past as renames racing with the verificaton could cause data loss. Since 15.3, Praefect has been using Praefect generate replica paths and not performing any more renames on disk. Given this, there are no more races that we know of, so we can default enable the invalid metadata deletion. Changelog: changed --- internal/praefect/config/config.go | 5 ++++- internal/praefect/config/config_test.go | 2 +- internal/praefect/config/testdata/config.toml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/praefect/config/config.go b/internal/praefect/config/config.go index dd270edb5e..6df903efbc 100644 --- a/internal/praefect/config/config.go +++ b/internal/praefect/config/config.go @@ -92,7 +92,10 @@ type BackgroundVerification struct { // DefaultBackgroundVerificationConfig returns the default background verification configuration. func DefaultBackgroundVerificationConfig() BackgroundVerification { - return BackgroundVerification{VerificationInterval: duration.Duration(7 * 24 * time.Hour)} + return BackgroundVerification{ + VerificationInterval: duration.Duration(7 * 24 * time.Hour), + DeleteInvalidRecords: true, + } } // Reconciliation contains reconciliation specific configuration options. diff --git a/internal/praefect/config/config_test.go b/internal/praefect/config/config_test.go index 68e24b6a88..1ed5e0cd91 100644 --- a/internal/praefect/config/config_test.go +++ b/internal/praefect/config/config_test.go @@ -345,7 +345,7 @@ func TestConfigParsing(t *testing.T) { }, BackgroundVerification: BackgroundVerification{ VerificationInterval: duration.Duration(24 * time.Hour), - DeleteInvalidRecords: true, + DeleteInvalidRecords: false, }, Yamux: Yamux{ MaximumStreamWindowSizeBytes: 1000, diff --git a/internal/praefect/config/testdata/config.toml b/internal/praefect/config/testdata/config.toml index a3112a9f2d..9c109a9202 100644 --- a/internal/praefect/config/testdata/config.toml +++ b/internal/praefect/config/testdata/config.toml @@ -8,7 +8,7 @@ graceful_stop_timeout = "30s" [background_verification] verification_interval = "24h" -delete_invalid_records = true +delete_invalid_records = false [replication] batch_size = 1 -- GitLab