10000 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
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
devel
-----

* Remove old fixPrototypeChain agency migration, which was introduced in 3.2
and is no longer necessary. This will make it impossible to upgrade
directly from a version < 3.2 to a version >= 3.9, provided one has
a chain of `distributeShardsLike` collections.

* Added metrics for the number of errors and warnings logged:
- `arangodb_logger_warnings_total`: total number of warnings (WARN messages)
logged since server start.
Expand Down
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