Skip to content

Commit

Permalink
repair: Sync schema from follower nodes before repair
Browse files Browse the repository at this point in the history
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 scylladb#4575
Backports: 3.1
  • Loading branch information
asias committed Jun 25, 2019
1 parent 14c1a71 commit bb56653
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions repair/repair.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand All @@ -950,6 +951,7 @@ static future<> repair_range(repair_info& ri, const dht::token_range& range) {
return repair_cf_range(ri, cf, range, neighbors);
}
});
});
});
}

Expand Down

0 comments on commit bb56653

Please sign in to comment.