mirror of https://gitee.com/bigwinds/arangodb
trying to fix cleanup
This commit is contained in:
parent
d0693b8fc1
commit
69e254d28a
|
@ -189,7 +189,7 @@ void AgencyFeature::start() {
|
||||||
_agent->load();
|
_agent->load();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AgencyFeature::stop() {
|
void AgencyFeature::unprepare() {
|
||||||
|
|
||||||
if (!isEnabled()) {
|
if (!isEnabled()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -40,7 +40,7 @@ class AgencyFeature : virtual 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 stop() override final;
|
void unprepare() override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint64_t _size; // agency size (default: 5)
|
uint64_t _size; // agency size (default: 5)
|
||||||
|
|
|
@ -461,7 +461,7 @@ void ClusterFeature::start() {
|
||||||
dispatcher->buildAqlQueue();
|
dispatcher->buildAqlQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterFeature::stop() {
|
void ClusterFeature::unprepare() {
|
||||||
if (_enableCluster) {
|
if (_enableCluster) {
|
||||||
if (_heartbeatThread != nullptr) {
|
if (_heartbeatThread != nullptr) {
|
||||||
_heartbeatThread->beginShutdown();
|
_heartbeatThread->beginShutdown();
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ClusterFeature : 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 stop() override final;
|
void unprepare() override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::string> _agencyEndpoints;
|
std::vector<std::string> _agencyEndpoints;
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
|
|
||||||
#include "Dispatcher.h"
|
#include "Dispatcher.h"
|
||||||
|
|
||||||
#include "Logger/Logger.h"
|
|
||||||
#include "Dispatcher/DispatcherQueue.h"
|
#include "Dispatcher/DispatcherQueue.h"
|
||||||
#include "Dispatcher/DispatcherThread.h"
|
#include "Dispatcher/DispatcherThread.h"
|
||||||
#include "Dispatcher/Job.h"
|
#include "Dispatcher/Job.h"
|
||||||
|
#include "Logger/Logger.h"
|
||||||
|
|
||||||
using namespace arangodb::basics;
|
using namespace arangodb::basics;
|
||||||
using namespace arangodb::rest;
|
using namespace arangodb::rest;
|
||||||
|
@ -59,21 +59,22 @@ void Dispatcher::addStandardQueue(size_t nrThreads, size_t nrExtraThreads,
|
||||||
size_t maxSize) {
|
size_t maxSize) {
|
||||||
TRI_ASSERT(_queues[STANDARD_QUEUE] == nullptr);
|
TRI_ASSERT(_queues[STANDARD_QUEUE] == nullptr);
|
||||||
|
|
||||||
_queues[STANDARD_QUEUE] =
|
_queues[STANDARD_QUEUE] = new DispatcherQueue(
|
||||||
new DispatcherQueue(_scheduler, this, STANDARD_QUEUE,
|
_scheduler, this, STANDARD_QUEUE, CreateDispatcherThread, nrThreads,
|
||||||
CreateDispatcherThread, nrThreads, nrExtraThreads, maxSize);
|
nrExtraThreads, maxSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief adds the AQL queue (used for the cluster)
|
/// @brief adds the AQL queue (used for the cluster)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Dispatcher::addAQLQueue(size_t nrThreads, size_t nrExtraThreads,
|
void Dispatcher::addAQLQueue(size_t nrThreads, size_t nrExtraThreads,
|
||||||
size_t maxSize) {
|
size_t maxSize) {
|
||||||
TRI_ASSERT(_queues[AQL_QUEUE] == nullptr);
|
TRI_ASSERT(_queues[AQL_QUEUE] == nullptr);
|
||||||
|
|
||||||
_queues[AQL_QUEUE] = new DispatcherQueue(
|
_queues[AQL_QUEUE] =
|
||||||
_scheduler, this, AQL_QUEUE, CreateDispatcherThread, nrThreads, nrExtraThreads, maxSize);
|
new DispatcherQueue(_scheduler, this, AQL_QUEUE, CreateDispatcherThread,
|
||||||
|
nrThreads, nrExtraThreads, maxSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -100,7 +101,8 @@ int Dispatcher::addJob(std::unique_ptr<Job>& job, bool startThread) {
|
||||||
// log success, but do this BEFORE the real add, because the addJob might
|
// log success, but do this BEFORE the real add, because the addJob might
|
||||||
// execute
|
// execute
|
||||||
// and delete the job before we have a chance to log something
|
// and delete the job before we have a chance to log something
|
||||||
LOG(TRACE) << "added job " << (void*)(job.get()) << " to queue '" << qnr << "'";
|
LOG(TRACE) << "added job " << (void*)(job.get()) << " to queue '" << qnr
|
||||||
|
<< "'";
|
||||||
|
|
||||||
// add the job to the list of ready jobs
|
// add the job to the list of ready jobs
|
||||||
return queue->addJob(job, startThread);
|
return queue->addJob(job, startThread);
|
||||||
|
@ -152,8 +154,6 @@ void Dispatcher::shutdown() {
|
||||||
LOG(DEBUG) << "shutting down the dispatcher";
|
LOG(DEBUG) << "shutting down the dispatcher";
|
||||||
|
|
||||||
for (auto queue : _queues) {
|
for (auto queue : _queues) {
|
||||||
|
|
||||||
|
|
||||||
if (queue != nullptr) {
|
if (queue != nullptr) {
|
||||||
queue->shutdown();
|
queue->shutdown();
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,11 @@ void Dispatcher::reportStatus() {
|
||||||
DispatcherQueue* queue = _queues[i];
|
DispatcherQueue* queue = _queues[i];
|
||||||
|
|
||||||
if (queue != nullptr) {
|
if (queue != nullptr) {
|
||||||
LOG(INFO) << "dispatcher queue '" << i << "': initial = " << queue->_nrThreads << ", running = " << queue->_nrRunning.load() << ", waiting = " << queue->_nrWaiting.load() << ", blocked = " << queue->_nrBlocked.load();
|
LOG(INFO) << "dispatcher queue '" << i
|
||||||
|
<< "': initial = " << queue->_nrThreads
|
||||||
|
<< ", running = " << queue->_nrRunning.load()
|
||||||
|
<< ", waiting = " << queue->_nrWaiting.load()
|
||||||
|
<< ", blocked = " << queue->_nrBlocked.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,9 @@ DispatcherFeature::DispatcherFeature(
|
||||||
}
|
}
|
||||||
|
|
||||||
DispatcherFeature::~DispatcherFeature() {
|
DispatcherFeature::~DispatcherFeature() {
|
||||||
delete _dispatcher;
|
if (_dispatcher != nullptr) {
|
||||||
|
delete _dispatcher;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DispatcherFeature::collectOptions(
|
void DispatcherFeature::collectOptions(
|
||||||
|
|
|
@ -162,7 +162,7 @@ void BootstrapFeature::start() {
|
||||||
_isReady = true;
|
_isReady = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BootstrapFeature::stop() {
|
void BootstrapFeature::unprepare() {
|
||||||
auto server = ApplicationServer::getFeature<DatabaseServerFeature>("DatabaseServer");
|
auto server = ApplicationServer::getFeature<DatabaseServerFeature>("DatabaseServer");
|
||||||
|
|
||||||
TRI_server_t* s = server->SERVER;
|
TRI_server_t* s = server->SERVER;
|
||||||
|
|
|
@ -33,7 +33,7 @@ class BootstrapFeature final : public application_features::ApplicationFeature {
|
||||||
public:
|
public:
|
||||||
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||||
void start() override final;
|
void start() override final;
|
||||||
void stop() override final;
|
void unprepare() override final;
|
||||||
|
|
||||||
bool isReady() const {
|
bool isReady() const {
|
||||||
return _isReady;
|
return _isReady;
|
||||||
|
|
|
@ -60,7 +60,7 @@ void ConsoleFeature::start() {
|
||||||
_consoleThread->start();
|
_consoleThread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleFeature::stop() {
|
void ConsoleFeature::unprepare() {
|
||||||
if (_operationMode != OperationMode::MODE_CONSOLE) {
|
if (_operationMode != OperationMode::MODE_CONSOLE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,6 @@ void ConsoleFeature::stop() {
|
||||||
while (_consoleThread->isRunning() && ++iterations < 30) {
|
while (_consoleThread->isRunning() && ++iterations < 30) {
|
||||||
usleep(100 * 1000); // spin while console is still needed
|
usleep(100 * 1000); // spin while console is still needed
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void ConsoleFeature::unprepare() {
|
|
||||||
std::cout << std::endl << TRI_BYE_MESSAGE << std::endl;
|
std::cout << std::endl << TRI_BYE_MESSAGE << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ class ConsoleFeature final : public application_features::ApplicationFeature {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void start() override final;
|
void start() override final;
|
||||||
void stop() override final;
|
|
||||||
void unprepare() override final;
|
void unprepare() override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -58,6 +58,12 @@ SchedulerFeature::SchedulerFeature(
|
||||||
startsAfter("WorkMonitor");
|
startsAfter("WorkMonitor");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SchedulerFeature::~SchedulerFeature() {
|
||||||
|
if (_scheduler != nullptr) {
|
||||||
|
delete _scheduler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SchedulerFeature::collectOptions(
|
void SchedulerFeature::collectOptions(
|
||||||
std::shared_ptr<options::ProgramOptions> options) {
|
std::shared_ptr<options::ProgramOptions> options) {
|
||||||
options->addSection("scheduler", "Configure the I/O scheduler");
|
options->addSection("scheduler", "Configure the I/O scheduler");
|
||||||
|
@ -145,11 +151,7 @@ void SchedulerFeature::stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedulerFeature::unprepare() {
|
void SchedulerFeature::unprepare() {
|
||||||
if (_scheduler != nullptr) {
|
SCHEDULER = nullptr;
|
||||||
delete _scheduler;
|
|
||||||
_scheduler = nullptr;
|
|
||||||
SCHEDULER = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -40,6 +40,7 @@ class SchedulerFeature final : public application_features::ApplicationFeature {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SchedulerFeature(application_features::ApplicationServer* server);
|
explicit SchedulerFeature(application_features::ApplicationServer* server);
|
||||||
|
~SchedulerFeature();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||||
|
|
|
@ -54,7 +54,7 @@ void StatisticsFeature::start() {
|
||||||
TRI_InitializeStatistics();
|
TRI_InitializeStatistics();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatisticsFeature::stop() {
|
void StatisticsFeature::unprepare() {
|
||||||
TRI_ShutdownStatistics();
|
TRI_ShutdownStatistics();
|
||||||
STATISTICS = nullptr;
|
STATISTICS = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ class StatisticsFeature final
|
||||||
public:
|
public:
|
||||||
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||||
void start() override final;
|
void start() override final;
|
||||||
void stop() override final;
|
void unprepare() override final;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void disableStatistics() { _statistics = false; }
|
void disableStatistics() { _statistics = false; }
|
||||||
|
|
|
@ -454,7 +454,7 @@ bool LogfileManager::open() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogfileManager::stop() {
|
void LogfileManager::unprepare() {
|
||||||
_shutdown = 1;
|
_shutdown = 1;
|
||||||
|
|
||||||
LOG(TRACE) << "shutting down WAL";
|
LOG(TRACE) << "shutting down WAL";
|
||||||
|
|
|
@ -116,7 +116,7 @@ class LogfileManager 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 stop() override final;
|
void unprepare() override final;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// run the recovery procedure
|
// run the recovery procedure
|
||||||
|
|
|
@ -545,7 +545,7 @@ void ApplicationServer::stop() {
|
||||||
auto feature = *it;
|
auto feature = *it;
|
||||||
|
|
||||||
LOG_TOPIC(TRACE, Logger::STARTUP) << feature->name() << "::stop";
|
LOG_TOPIC(TRACE, Logger::STARTUP) << feature->name() << "::stop";
|
||||||
// feature->stop();
|
feature->stop();
|
||||||
feature->state(FeatureState::STOPPED);
|
feature->state(FeatureState::STOPPED);
|
||||||
reportFeatureProgress(_state, feature->name());
|
reportFeatureProgress(_state, feature->name());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue