1
0
Fork 0

allow for faster shutdowns in case there are pending cursors

This commit is contained in:
jsteemann 2016-10-25 21:44:56 +02:00
parent 0651a2c1ca
commit 7aaa212d8a
2 changed files with 19 additions and 0 deletions

View File

@ -351,6 +351,24 @@ void DatabaseFeature::start() {
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() {
auto logfileManager = arangodb::wal::LogfileManager::instance();
logfileManager->flush(true, true, false);

View File

@ -72,6 +72,7 @@ class DatabaseFeature final : public application_features::ApplicationFeature {
void validateOptions(std::shared_ptr<options::ProgramOptions>) override final;
void prepare() override final;
void start() override final;
void beginShutdown() override final;
void stop() override final;
void unprepare() override final;