mirror of https://gitee.com/bigwinds/arangodb
corrected hot backup lock timings (#10075)
* corrected hot backup lock timings * the lock timeout added to overall unlock timeout] * Update CHANGELOG
This commit is contained in:
parent
f15fe22c7c
commit
44232d856e
|
@ -1,6 +1,8 @@
|
||||||
v3.5.1 (XXXX-XX-XX)
|
v3.5.1 (XXXX-XX-XX)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
* DB server locking / unlocking for hot backup revisited and enhanced.
|
||||||
|
|
||||||
* Rely on reboot ids for declaring end of cluster hot restore on coordinators.
|
* Rely on reboot ids for declaring end of cluster hot restore on coordinators.
|
||||||
|
|
||||||
* Obtain new unique IDs via a background thread.
|
* Obtain new unique IDs via a background thread.
|
||||||
|
|
|
@ -3715,8 +3715,7 @@ arangodb::Result hotRestoreCoordinator(VPackSlice const payload, VPackBuilder& r
|
||||||
return arangodb::Result();
|
return arangodb::Result();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> lockPath =
|
std::vector<std::string> lockPath = std::vector<std::string>{"result", "lockId"};
|
||||||
std::vector<std::string>{"result", "lockId"};
|
|
||||||
|
|
||||||
arangodb::Result lockDBServerTransactions(std::string const& backupId,
|
arangodb::Result lockDBServerTransactions(std::string const& backupId,
|
||||||
std::vector<ServerID> const& dbServers,
|
std::vector<ServerID> const& dbServers,
|
||||||
|
@ -3740,6 +3739,7 @@ arangodb::Result lockDBServerTransactions(std::string const& backupId,
|
||||||
VPackObjectBuilder o(&lock);
|
VPackObjectBuilder o(&lock);
|
||||||
lock.add("id", VPackValue(backupId));
|
lock.add("id", VPackValue(backupId));
|
||||||
lock.add("timeout", VPackValue(lockWait));
|
lock.add("timeout", VPackValue(lockWait));
|
||||||
|
lock.add("unlockTimeout", VPackValue(5.0 + lockWait));
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_TOPIC("707ed", DEBUG, Logger::BACKUP)
|
LOG_TOPIC("707ed", DEBUG, Logger::BACKUP)
|
||||||
|
@ -4106,10 +4106,8 @@ arangodb::Result hotBackupCoordinator(VPackSlice const payload, VPackBuilder& re
|
||||||
}
|
}
|
||||||
std::vector<ServerID> dbServers = ci->getCurrentDBServers();
|
std::vector<ServerID> dbServers = ci->getCurrentDBServers();
|
||||||
std::vector<ServerID> lockedServers;
|
std::vector<ServerID> lockedServers;
|
||||||
double lockWait = 2.0;
|
double lockWait(0.1);
|
||||||
while (cc != nullptr && steady_clock::now() < end) {
|
while (cc != nullptr && steady_clock::now() < end) {
|
||||||
auto iterEnd = steady_clock::now() + duration<double>(lockWait);
|
|
||||||
|
|
||||||
result = lockDBServerTransactions(backupId, dbServers, lockWait, lockedServers);
|
result = lockDBServerTransactions(backupId, dbServers, lockWait, lockedServers);
|
||||||
if (!result.ok()) {
|
if (!result.ok()) {
|
||||||
unlockDBServerTransactions(backupId, lockedServers);
|
unlockDBServerTransactions(backupId, lockedServers);
|
||||||
|
@ -4121,12 +4119,9 @@ arangodb::Result hotBackupCoordinator(VPackSlice const payload, VPackBuilder& re
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (lockWait < 30.0) {
|
if (lockWait < 30.0) {
|
||||||
lockWait *= 1.1;
|
lockWait *= 1.25;
|
||||||
}
|
|
||||||
double tmp = duration<double>(iterEnd - steady_clock::now()).count();
|
|
||||||
if (tmp > 0) {
|
|
||||||
std::this_thread::sleep_for(duration<double>(tmp));
|
|
||||||
}
|
}
|
||||||
|
std::this_thread::sleep_for(seconds(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gotLocks = result.ok();
|
bool gotLocks = result.ok();
|
||||||
|
|
Loading…
Reference in New Issue