mirror of https://gitee.com/bigwinds/arangodb
allow for faster shutdowns in case there are pending cursors
This commit is contained in:
parent
0651a2c1ca
commit
7aaa212d8a
|
@ -351,6 +351,24 @@ void DatabaseFeature::start() {
|
||||||
updateContexts();
|
updateContexts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// signal to all databases that active cursors can be wiped
|
||||||
|
// this speeds up the actual shutdown because no waiting is necessary
|
||||||
|
// until the cursors happen to free their underlying transactions
|
||||||
|
void DatabaseFeature::beginShutdown() {
|
||||||
|
auto unuser(_databasesProtector.use());
|
||||||
|
auto theLists = _databasesLists.load();
|
||||||
|
|
||||||
|
for (auto& p : theLists->_databases) {
|
||||||
|
TRI_vocbase_t* vocbase = p.second;
|
||||||
|
// iterate over all databases
|
||||||
|
TRI_ASSERT(vocbase != nullptr);
|
||||||
|
TRI_ASSERT(vocbase->type() == TRI_VOCBASE_TYPE_NORMAL);
|
||||||
|
|
||||||
|
// throw away all open cursors in order to speed up shutdown
|
||||||
|
vocbase->cursorRepository()->garbageCollect(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DatabaseFeature::stop() {
|
void DatabaseFeature::stop() {
|
||||||
auto logfileManager = arangodb::wal::LogfileManager::instance();
|
auto logfileManager = arangodb::wal::LogfileManager::instance();
|
||||||
logfileManager->flush(true, true, false);
|
logfileManager->flush(true, true, false);
|
||||||
|
|
|
@ -72,6 +72,7 @@ class DatabaseFeature final : public application_features::ApplicationFeature {
|
||||||
void validateOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
void validateOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||||
void prepare() override final;
|
void prepare() override final;
|
||||||
void start() override final;
|
void start() override final;
|
||||||
|
void beginShutdown() override final;
|
||||||
void stop() override final;
|
void stop() override final;
|
||||||
void unprepare() override final;
|
void unprepare() override final;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue