8000 Fix second cluster bootstrap hanger. (#4841) · Sandychuang/arangodb@52dd3e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 52dd3e8

Browse files
authored
Fix second cluster bootstrap hanger. (arangodb#4841)
Call loadCurrentDBServers regularly.
1 parent f1a2ace commit 52dd3e8

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

arangod/Cluster/HeartbeatThread.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,8 @@ void HeartbeatThread::runCoordinator() {
697697
uint64_t lastPlanVersionNoticed = 0;
698698
// last value of current which we have noticed:
699699
uint64_t lastCurrentVersionNoticed = 0;
700+
// For periodic update of the current DBServer list:
701+
int DBServerUpdateCounter = 0;
700702

701703
while (!isStopping()) {
702704
try {
@@ -893,6 +895,12 @@ void HeartbeatThread::runCoordinator() {
893895
}
894896
invalidateCoordinators = !invalidateCoordinators;
895897

898+
// Periodically update the list of DBServers:
899+
if (++DBServerUpdateCounter >= 60) {
900+
ClusterInfo::instance()->loadCurrentDBServers();
901+
DBServerUpdateCounter = 0;
902+
}
903+
896904
double remain = interval - (TRI_microtime() - start);
897905

898906
// sleep for a while if appropriate, on some systems usleep does not

arangod/MMFiles/MMFilesLogfileManager.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,8 @@ MMFilesWalLogfile* MMFilesLogfileManager::getCollectableLogfile() {
13971397
// iterate over all active readers and find their minimum used logfile id
13981398
MMFilesWalLogfile::IdType minId = UINT64_MAX;
13991399

1400+
LOG_TOPIC(DEBUG, Logger::FIXME) << "getCollectableLogfile: called";
1401+
14001402
auto cb = [&minId](TRI_voc_tid_t, TransactionData const* data) {
14011403
MMFilesWalLogfile::IdType lastWrittenId = static_cast<MMFilesTransactionData const*>(data)->lastSealedId;
14021404

@@ -1422,16 +1424,26 @@ MMFilesWalLogfile* MMFilesLogfileManager::getCollectableLogfile() {
14221424
}
14231425

14241426
if (logfile->id() <= minId && logfile->canBeCollected(released)) {
1427+
LOG_TOPIC(DEBUG, Logger::FIXME) << "getCollectableLogfile: found logfile id: " << logfile->id();
14251428
return logfile;
14261429
}
14271430

1428-
if (logfile->id() > minId || !logfile->hasBeenReleased(released)) {
1431+
if (logfile->id() > minId) {
1432+
LOG_TOPIC(DEBUG, Logger::FIXME) << "getCollectableLogfile: abort early1 "
1433+
<< logfile->id() << " minId: " << minId;
1434+
break;
1435+
}
1436+
if (!logfile->hasBeenReleased(released)) {
14291437
// abort early
1438+
LOG_TOPIC(DEBUG, Logger::FIXME) << "getCollectableLogfile: abort early2 released: " << released;
14301439
break;
14311440
}
14321441
}
14331442
}
14341443

1444+
LOG_TOPIC(DEBUG, Logger::FIXME) << "getCollectableLogfile: "
1445+
<< "found no logfile to collect, minId:" << minId;
1446+
14351447
return nullptr;
14361448
}
14371449

@@ -1741,8 +1753,7 @@ int MMFilesLogfileManager::waitForCollector(MMFilesWalLogfile::IdType logfileId,
17411753

17421754
locker.unlock();
17431755

1744-
// LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "still waiting for collector. logfileId: " << logfileId <<
1745-
// " lastCollected: " << _lastCollectedId << ", result: " << res;
1756+
LOG_TOPIC(DEBUG, arangodb::Logger::FIXME) << "still waiting for collector. logfileId: " << logfileId << " lastCollected: " << _lastCollectedId << ", result: " << res;
17461757

17471758
if (res != TRI_ERROR_LOCK_TIMEOUT && res != TRI_ERROR_NO_ERROR) {
17481759
// some error occurred

arangod/RestServer/BootstrapFeature.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ static void raceForClusterBootstrap() {
112112
<< "raceForClusterBootstrap: race won, we do the bootstrap";
113113

114114
// let's see whether a DBserver is there:
115+
ci->loadCurrentDBServers();
115116
auto dbservers = ci->getCurrentDBServers();
116117
if (dbservers.size() == 0) {
117118
LOG_TOPIC(TRACE, Logger::STARTUP)

0 commit comments

Comments
 (0)
0