8000 Bugfix/agency lock left behind (#10021) · archerli/arangodb@49a01e1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 49a01e1

Browse files
kvahedneunhoef
authored andcommitted
Bugfix/agency lock left behind (arangodb#10021)
* fix potentially left behind agency lock * typo * do not silently patronise the customer
1 parent 85bdf6e commit 49a01e1

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

arangod/Cluster/ClusterInfo.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4430,8 +4430,9 @@ arangodb::Result ClusterInfo::agencyHotBackupLock(std::string const& backupId,
44304430

44314431
if (!rv->slice().isObject() || !rv->slice().hasKey("results") ||
44324432
!rv->slice().get("results").isArray() || rv->slice().get("results").length() != 2) {
4433-
return arangodb::Result(TRI_ERROR_HOT_BACKUP_INTERNAL,
4434-
"invalid agency result while acuiring backup lock");
4433+
return arangodb::Result(
4434+
TRI_ERROR_HOT_BACKUP_INTERNAL,
4435+
"invalid agency result while acquiring backup lock");
44354436
}
44364437
auto ar = rv->slice().get("results");
44374438

@@ -4485,6 +4486,8 @@ arangodb::Result ClusterInfo::agencyHotBackupLock(std::string const& backupId,
44854486
std::this_thread::sleep_for(std::chrono::duration<double>(wait));
44864487
}
44874488

4489+
agencyHotBackupUnlock(backupId, timeout, supervisionOff);
4490+
44884491
return arangodb::Result(
44894492
TRI_ERROR_HOT_BACKUP_INTERNAL,
44904493
"timeout waiting for maintenance mode to be activated in agency");
@@ -4555,11 +4558,10 @@ arangodb::Result ClusterInfo::agencyHotBackupUnlock(std::string const& backupId,
45554558
if (result.successful()) {
45564559
if (!result.slice().isArray() || result.slice().length() != 1 ||
45574560
!result.slice()[0].hasKey(modepv) || !result.slice()[0].get(modepv).isString()) {
4558-
return arangodb::Result(TRI_ERROR_HOT_BACKUP_INTERNAL, std::
4559-
string("invalid JSON from agency, when desctivating supervision mode:") +
4560-
result
4561-
.slice()
4562-
.toJson());
4561+
return arangodb::Result(
4562+
TRI_ERROR_HOT_BACKUP_INTERNAL,
4563+
std::string("invalid JSON from agency, when deactivating supervision mode:") +
4564+
result.slice().toJson());
45634565
}
45644566

45654567
if (result.slice()[0].get(modepv).isEqualString("Normal")) {

arangod/Cluster/ClusterMethods.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,6 +3961,13 @@ arangodb::Result hotBackupCoordinator(VPackSlice const payload, VPackBuilder& re
39613961
double timeout = (payload.isObject() && payload.hasKey("timeout"))
39623962
? payload.get("timeout").getNumber<double>()
39633963
: 120.;
3964+
// unreasonably short even under allowInconsistent
3965+
if (timeout < 2.5) {
3966+
auto const tmp = timeout;
3967+
timeout = 2.5;
3968+
LOG_TOPIC("67ae2", WARN, Logger::BACKUP)
3969+
<< "Backup timeout " << tmp << " is too short - raising to " << timeout;
3970+
}
39643971

39653972
using namespace std::chrono;
39663973
auto end = steady_clock::now() + milliseconds(static_cast<uint64_t>(1000 * timeout));
@@ -3971,6 +3978,7 @@ arangodb::Result hotBackupCoordinator(VPackSlice const payload, VPackBuilder& re
39713978
// We specifically want to make sure that no other backup is going on.
39723979
bool supervisionOff = false;
39733980
auto result = ci->agencyHotBackupLock(backupId, timeout, supervisionOff);
3981+
39743982
if (!result.ok()) {
39753983
// Failed to go to backup mode
39763984
result.reset(TRI_ERROR_HOT_BACKUP_INTERNAL,
@@ -3983,6 +3991,7 @@ arangodb::Result hotBackupCoordinator(VPackSlice const payload, VPackBuilder& re
39833991
LOG_TOPIC("352d6", INFO, Logger::BACKUP)
39843992
<< "hot backup didn't get to locking phase within " << timeout << "s.";
39853993
auto hlRes = ci->agencyHotBackupUnlock(backupId, timeout, supervisionOff);
3994+
39863995
return arangodb::Result(TRI_ERROR_CLUSTER_TIMEOUT,
39873996
"hot backup timeout before locking phase");
39883997
}

0 commit comments

Comments
 (0)
0