Skip to content

Commit

Permalink
schema_tables: Don't alter tables which differ only in version
Browse files Browse the repository at this point in the history
We apply deletion of scylla_tables.version to the incoming schema
mutations so that table schema version is recalculated after merge.
The mutations which we read from local schema tables may not have it
deleted in which case all tables would be considered as differing on
the presence of the version field. Avoid this by deleting the field
from old mutations as well.
  • Loading branch information
tgrabiec committed Sep 14, 2017
1 parent 9927208 commit f943d2e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions db/schema_tables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,15 @@ static future<> do_merge_schema(distributed<service::storage_proxy>& proxy, std:
/*auto& old_aggregates = */read_schema_for_keyspaces(proxy, AGGREGATES, keyspaces).get0();
#endif

// Incoming mutations have the version field deleted. Delete here as well so that
// schemas which are otherwise equal don't appear as differing.
for (auto&& e : old_column_families) {
schema_mutations& sm = e.second;
if (sm.scylla_tables()) {
delete_schema_version(*sm.scylla_tables());
}
}

proxy.local().mutate_locally(std::move(mutations)).get0();

if (do_flush) {
Expand Down
4 changes: 4 additions & 0 deletions schema_mutations.hh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public:
return _scylla_tables;
}

mutation_opt& scylla_tables() {
return _scylla_tables;
}

const mutation_opt& indices_mutation() const {
return _indices;
}
Expand Down

0 comments on commit f943d2e

Please sign in to comment.