8000 Replace engine equality feature (#6931) · mnemosdev/arangodb@cb4c07e · GitHub
[go: up one dir, main page]

Skip to content

Commit cb4c07e

Browse files
graetzerjsteemann
authored andcommitted
Replace engine equality feature (arangodb#6931)
* replace engine equality feature * remove pointless code
1 parent 45e4a8d commit cb4c07e

File tree

8 files changed

+128
-258
lines changed

8 files changed

+128
-258
lines changed

arangod/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ SET(ARANGOD_SOURCES
299299
Cluster/CreateCollection.cpp
300300
Cluster/CreateDatabase.cpp
301301
Cluster/CriticalThread.cpp
302-
Cluster/EngineEqualityCheckFeature.cpp
303302
Cluster/FollowerInfo.cpp
304303
Cluster/DBServerAgencySync.cpp
305304
Cluster/DropCollection.cpp

arangod/Cluster/ClusterFeature.cpp

Lines changed: 23 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@
3434
#include "Logger/Logger.h"
3535
#include "ProgramOptions/ProgramOptions.h"
3636
#include "ProgramOptions/Section.h"
37-
#include "Rest/Version.h"
3837
#include "RestServer/DatabaseFeature.h"
3938
#include "Scheduler/Scheduler.h"
4039
#include "Scheduler/SchedulerFeature.h"
41-
#include "StorageEngine/EngineSelectorFeature.h"
4240

4341
using namespace arangodb;
4442
using namespace arangodb::application_features;
@@ -242,7 +240,8 @@ void ClusterFeature::prepare() {
242240
if (_enableCluster &&
243241
_requirePersistedId &&
244242
!ServerState::instance()->hasPersistedId()) {
245-
LOG_TOPIC(FATAL, arangodb::Logger::CLUSTER) << "required persisted UUID file '" << ServerState::instance()->getUuidFilename() << "' not found. Please make sure this instance is started using an already existing database directory";
243+
LOG_TOPIC(FATAL, arangodb::Logger::CLUSTER) << "required persisted UUID file '" << ServerState::instance()->getUuidFilename()
244+
<< "' not found. Please make sure this instance is started using an already existing database directory";
246245
FATAL_ERROR_EXIT();
247246
}
248247

@@ -416,34 +415,6 @@ void ClusterFeature::start() {
416415

417416
startHeartbeatThread(_agencyCallbackRegistry.get(), _heartbeatInterval, 5, endpoints);
418417

419-
while (true) {
420-
VPackBuilder builder;
421-
try {
422-
VPackObjectBuilder b(&builder);
423-
builder.add("endpoint", VPackValue(_myEndpoint));
424-
builder.add("advertisedEndpoint", VPackValue(_myAdvertisedEndpoint));
425-
builder.add("host", VPackValue(ServerState::instance()->getHost()));
426-
builder.add("version", VPackValue(rest::Version::getNumericServerVersion()));
427-
builder.add("engine", VPackValue(EngineSelectorFeature::engineName()));
428-
} catch (...) {
429-
LOG_TOPIC(FATAL, arangodb::Logger::CLUSTER) << "out of memory";
430-
FATAL_ERROR_EXIT();
431-
}
432-
433-
result = comm.setValue("Current/ServersRegistered/" + myId,
434-
builder.slice(), 0.0);
435-
436-
if (result.successful()) {
437-
break;
438-
} else {
439-
LOG_TOPIC(WARN, arangodb::Logger::CLUSTER)
440-
<< "failed to register server in agency: http code: "
441-
<< result.httpCode() << ", body: '" << result.body() << "', retrying ...";
442-
}
443-
444-
std::this_thread::sleep_for(std::chrono::seconds(1));
445-
}
446-
447418
comm.increment("Current/Version");
448419

449420
ServerState::instance()->setState(ServerState::STATE_SERVING);
@@ -473,44 +444,38 @@ void ClusterFeature::stop() {
473444

474445

475446
void ClusterFeature::unprepare() {
476-
if (_enableCluster) {
477-
if (_heartbeatThread != nullptr) {
478-
_heartbeatThread->beginShutdown();
479-
}
480-
481-
// change into shutdown state
482-
ServerState::instance()->setState(ServerState::STATE_SHUTDOWN);
483-
484-
AgencyComm comm;
485-
comm.sendServerState(0.0);
486-
487-
if (_heartbeatThread != nullptr) {
488-
int counter = 0;
489-
while (_heartbeatThread->isRunning()) {
490-
std::this_thread::sleep_for(std::chrono::microseconds(100000));
491-
// emit warning after 5 seconds
492-
if (++counter == 10 * 5) {
493-
LOG_TOPIC(WARN, arangodb::Logger::CLUSTER) << "waiting for heartbeat thread to finish";
494-
}
495-
}
496-
}
497-
498-
if (_unregisterOnShutdown) {
499-
ServerState::instance()->unregister();
500-
}
501-
}
502-
503447
if (!_enableCluster) {
504448
ClusterComm::cleanup();
505449
return;
506450
}
451+
452+
if (_heartbeatThread != nullptr) {
453+
_heartbeatThread->beginShutdown();
454+
}
507455

508456
// change into shutdown state
509457
ServerState::instance()->setState(ServerState::STATE_SHUTDOWN);
510458

511459
AgencyComm comm;
512460
comm.sendServerState(0.0);
513461

462+
if (_heartbeatThread != nullptr) {
463+
int counter = 0;
464+
while (_heartbeatThread->isRunning()) {
465+
std::this_thread::sleep_for(std::chrono::microseconds(100000));
466+
// emit warning after 5 seconds
467+
if (++counter == 10 * 5) {
468+
LOG_TOPIC(WARN, arangodb::Logger::CLUSTER) << "waiting for heartbeat thread to finish";
469+
}
470+
}
471+
}
472+
473+
if (_unregisterOnShutdown) {
474+
ServerState::instance()->unregister();
475+
}
476+
477+
comm.sendServerState(0.0);
478+
514479
// Try only once to unregister because maybe the agencycomm
515480
// is shutting down as well...
516481

arangod/Cluster/EngineEqualityCheckFeature.cpp

Lines changed: 0 additions & 120 deletions
This file was deleted.

arangod/Cluster/EngineEqualityCheckFeature.h

Lines changed: 0 additions & 42 deletions
This file was deleted.

arangod/Cluster/HeartbeatThread.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,9 +1067,6 @@ void HeartbeatThread::beginShutdown() {
10671067
_condition.signal();
10681068
}
10691069

1070-
1071-
1072-
10731070
////////////////////////////////////////////////////////////////////////////////
10741071
/// @brief finished plan change
10751072
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)
0