Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2022-05-05 12:46:35 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2022-05-05 12:46:35 +0300
commit889d25f3ac44ed491d29d25c42ba0975f8cc071e (patch)
treefdc4b3776684a4a761a4e08056835fd265b6b611
parentfc32e2cfc2ffe0b890d7bf50cc3efbd58a444c6e (diff)
Add configuration to enable deletions in background verifiersmh-disable-verifier-deletion
Background verifier doesn't delete the metadata records it found for non-existent replicas due to a possible race with renames. This race will mostly manifest with Geo in use as Geo performs a lot of renames. Non-geo setups mostly perform renames for soft-deletions so it might be reasonabl to enable the deletion logic in non-geo setups. This commit adds a config option to enable the verifier to delete invalid metadata records if the admin so chooses. Changelog: added
-rw-r--r--cmd/praefect/main.go2
-rw-r--r--internal/praefect/config/config.go3
-rw-r--r--internal/praefect/config/config_test.go1
-rw-r--r--internal/praefect/config/testdata/config.toml1
4 files changed, 6 insertions, 1 deletions
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go
index 52c30f923..e77fe71c3 100644
--- a/cmd/praefect/main.go
+++ b/cmd/praefect/main.go
@@ -358,7 +358,7 @@ func run(
nodeSet.Connections(),
hm,
conf.BackgroundVerification.VerificationInterval,
- false,
+ conf.BackgroundVerification.DeleteInvalidRecords,
)
promreg.MustRegister(verifier)
diff --git a/internal/praefect/config/config.go b/internal/praefect/config/config.go
index edf864cce..9b5263e61 100644
--- a/internal/praefect/config/config.go
+++ b/internal/praefect/config/config.go
@@ -83,6 +83,9 @@ type BackgroundVerification struct {
// VerificationInterval determines the duration after a replica due for reverification.
// The feature is disabled if verification interval is 0 or below.
VerificationInterval time.Duration `toml:"verification_interval,omitempty"`
+ // DeleteInvalidRecords controls whether the background verifier will actually delete the metadata
+ // records that point to non-existent replicas.
+ DeleteInvalidRecords bool `toml:"delete_invalid_records"`
}
// DefaultBackgroundVerificationConfig returns the default background verification configuration.
diff --git a/internal/praefect/config/config_test.go b/internal/praefect/config/config_test.go
index aa0d0b3c5..f98905671 100644
--- a/internal/praefect/config/config_test.go
+++ b/internal/praefect/config/config_test.go
@@ -337,6 +337,7 @@ func TestConfigParsing(t *testing.T) {
},
BackgroundVerification: BackgroundVerification{
VerificationInterval: 24 * time.Hour,
+ DeleteInvalidRecords: true,
},
},
},
diff --git a/internal/praefect/config/testdata/config.toml b/internal/praefect/config/testdata/config.toml
index 3f2a370e2..f7d591eee 100644
--- a/internal/praefect/config/testdata/config.toml
+++ b/internal/praefect/config/testdata/config.toml
@@ -8,6 +8,7 @@ graceful_stop_timeout = "30s"
[background_verification]
verification_interval = "24h"
+delete_invalid_records = true
[replication]
batch_size = 1