From cabb5ffa7fb964a3bd19457c5f4a4bf7491e8467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Leszczy=C5=84ski?= <2000michal@wp.pl> Date: Thu, 5 Sep 2024 16:56:21 +0200 Subject: [PATCH] fix(backup): don't allow for incomplete backup Backward compatibility is less important than correctness. It forces us to skip backup of system_traces and system_distributed keyspaces when testing a single dc backup. Fixes #3922 --- pkg/service/backup/model.go | 15 ------------- .../testdata/get_target/filter_dc.golden.json | 21 ------------------- .../testdata/get_target/filter_dc.input.json | 2 +- 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/pkg/service/backup/model.go b/pkg/service/backup/model.go index 7f6cfc47de..a8702123c0 100644 --- a/pkg/service/backup/model.go +++ b/pkg/service/backup/model.go @@ -539,21 +539,6 @@ type tokenRangesValidator struct { } func (v tokenRangesValidator) validate(ks, tab string, ring scyllaclient.Ring) error { - // Skip validation for SimpleStrategy when all hosts from backed up dcs are live - // in order to preserve backward compatibility (#3922). - if ring.Replication == scyllaclient.SimpleStrategy { - missingHost := false - for h, dc := range ring.HostDC { - if v.dcs.Has(dc) && !v.liveNodes.Has(h) { - missingHost = true - break - } - } - if !missingHost { - return nil - } - } - for _, rt := range ring.ReplicaTokens { if !v.liveNodes.HasAny(rt.ReplicaSet...) { return errors.Errorf("%s.%s: the whole replica set %v is filtered out, so the data owned by it can't be backed up", ks, tab, rt.ReplicaSet) diff --git a/pkg/service/backup/testdata/get_target/filter_dc.golden.json b/pkg/service/backup/testdata/get_target/filter_dc.golden.json index 5ec038d309..f9cd403714 100644 --- a/pkg/service/backup/testdata/get_target/filter_dc.golden.json +++ b/pkg/service/backup/testdata/get_target/filter_dc.golden.json @@ -10,16 +10,6 @@ ], "all_tables": true }, - { - "keyspace": "system_distributed", - "tables": [ - "cdc_generation_timestamps", - "cdc_streams_descriptions_v2", - "service_levels", - "view_build_status" - ], - "all_tables": true - }, { "keyspace": "system_distributed_everywhere", "tables": [ @@ -27,17 +17,6 @@ ], "all_tables": true }, - { - "keyspace": "system_traces", - "tables": [ - "node_slow_log_time_idx", - "node_slow_log", - "events", - "sessions_time_idx", - "sessions" - ], - "all_tables": true - }, { "keyspace": "system_schema", "tables": [ diff --git a/pkg/service/backup/testdata/get_target/filter_dc.input.json b/pkg/service/backup/testdata/get_target/filter_dc.input.json index 98b3cc0ceb..2e2f7a857f 100644 --- a/pkg/service/backup/testdata/get_target/filter_dc.input.json +++ b/pkg/service/backup/testdata/get_target/filter_dc.input.json @@ -1 +1 @@ -{"dc": ["dc1"], "location": ["s3:backuptest-get-target"]} \ No newline at end of file +{"dc": ["dc1"], "location": ["s3:backuptest-get-target"], "keyspace": ["*", "!system_traces", "!system_distributed"]} \ No newline at end of file