From bb5665331cbf7df1eb85b8ca70e44d1dea0e6110 Mon Sep 17 00:00:00 2001 From: Asias He Date: Mon, 24 Jun 2019 09:51:45 +0800 Subject: [PATCH] repair: Sync schema from follower nodes before repair Since commit "repair: Use the same schema version for repair master and followers", repair master and followers uses the same schema version that master decides to use during the whole repair operation. If master has older version of schema, repair could ignore the data which makes use of the new schema, e.g., writes to new columns. To fix, always sync the schema agreement before repair. The master node pulls schema from followers and applies locally. The master then uses the "merged" schema. The followers use get_schema_for_write() to pull the "merged" schema. Fixes #4575 Backports: 3.1 --- repair/repair.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/repair/repair.cc b/repair/repair.cc index f380cb5a67..87b9f821ef 100644 --- a/repair/repair.cc +++ b/repair/repair.cc @@ -941,6 +941,7 @@ static future<> repair_cf_range(repair_info& ri, static future<> repair_range(repair_info& ri, const dht::token_range& range) { auto id = utils::UUID_gen::get_time_UUID(); return do_with(get_neighbors(ri.db.local(), ri.keyspace, range, ri.data_centers, ri.hosts), [&ri, range, id] (const auto& neighbors) { + return ::service::get_local_migration_manager().sync_schema(ri.db.local(), neighbors).then([&neighbors, &ri, range, id] { rlogger.debug("[repair #{}] new session: will sync {} on range {} for {}.{}", id, neighbors, range, ri.keyspace, ri.cfs); return do_for_each(ri.cfs.begin(), ri.cfs.end(), [&ri, &neighbors, range] (auto&& cf) { ri._sub_ranges_nr++; @@ -950,6 +951,7 @@ static future<> repair_range(repair_info& ri, const dht::token_range& range) { return repair_cf_range(ri, cf, range, neighbors); } }); + }); }); }