8000 Remove fixPrototypeChain agency migration by neunhoef · Pull Request #14658 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Remove fixPrototypeChain agency migration #14658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove fixPrototypeChain code.
This was fixing a very rare user configuration in the collection setup
and was introduced in 3.2. This change will make it impossible to
upgrade from <= 3.1 directly to 3.9, provided somebody has a chain
of `distributeShardsLike` settings, which is OK.
  • Loading branch information
neunhoef committed Aug 18, 2021
commit 10e64eea057a57d57aed388dbc18a034326fb13a
51 changes: 0 additions & 51 deletions arangod/Agency/Supervision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ void Supervision::upgradeAgency() {
{
VPackArrayBuilder trxs(&builder);
upgradeZero(builder);
fixPrototypeChain(builder);
upgradeOne(builder);
upgradeHealthRecords(builder);
upgradeMaintenance(builder);
Expand Down Expand Up @@ -2577,56 +2576,6 @@ void Supervision::enforceReplication() {
}


void Supervision::fixPrototypeChain(Builder& migrate) {
_lock.assertLockedByCurrentThread();

auto const& snap = snapshot();

std::function<std::string(std::string const&, std::string const&)> resolve;
resolve = [&](std::string const& db, std::string const& col) {
std::string s;
auto const& tmp_n = snap.hasAsNode(planColPrefix + db + "/" + col);
if (tmp_n) {
Node const& n = tmp_n->get();
s = n.hasAsString("distributeShardsLike").value();
}
return (s.empty()) ? col : resolve(db, s);
};

for (auto const& database : snapshot().hasAsChildren(planColPrefix).value().get()) {
for (auto const& collection : database.second->children()) {
if (collection.second->has("distributeShardsLike")) {
auto prototype =
(*collection.second).hasAsString("distributeShardsLike").value();
if (!prototype.empty()) {
std::string u;
try {
u = resolve(database.first, prototype);
} catch (...) {
}
if (u != prototype) {
{
VPackArrayBuilder trx(&migrate);
{
VPackObjectBuilder oper(&migrate);
migrate.add(planColPrefix + database.first + "/" +
collection.first + "/" + "distributeShardsLike",
VPackValue(u));
}
{
VPackObjectBuilder prec(&migrate);
migrate.add(planColPrefix + database.first + "/" +
collection.first + "/" + "distributeShardsLike",
VPackValue(prototype));
}
}
}
}
}
}
}
}

// Shrink cluster if applicable, guarded by caller
void Supervision::shrinkCluster() {
_lock.assertLockedByCurrentThread();
Expand Down
0