diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-03-20 17:18:59 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-03-20 17:18:59 +0000 |
commit | 9a1eec801f596a42a8810b8d53116d12e35eafcb (patch) | |
tree | 443a09a4a55b5806b8234791190513ade0d43151 | |
parent | c54e31b30ff6799ef667bf63409e11db9c7b9900 (diff) |
GC unused code and reduce waittime during startup.
-rw-r--r-- | searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.cpp | 30 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h | 5 |
2 files changed, 8 insertions, 27 deletions
diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.cpp b/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.cpp index a00e4014efc..abe37011850 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.cpp @@ -17,7 +17,7 @@ FastS_NodeManager::configure(std::unique_ptr<PartitionsConfig> cfg) { LOG(config, "configuring datasetcollection from '%s'", _configUri.getConfigId().c_str()); - SetPartMap(*cfg, 20000); + SetPartMap(*cfg, _waitUpMS); _componentConfig.addConfig( vespalib::ComponentConfigProducer::Config("fdispatch.nodemanager", _fetcher->getGeneration(), @@ -98,7 +98,8 @@ FastS_NodeManager::FastS_NodeManager(vespalib::SimpleComponentConfigProducer &co _failed(false), _hasDsc(false), _checkTempFailScheduled(false), - _shutdown(false) + _shutdown(false), + _waitUpMS(20000) { _datasetCollection = new FastS_DataSetCollection(_appCtx); FastS_assert(_datasetCollection != NULL); @@ -148,9 +149,12 @@ FastS_NodeManager::SubscribePartMap(const config::ConfigUri & configUri) LOG(debug, "loading new datasetcollection from %s", configId.c_str()); try { _configUri = configUri; + uint32_t oldWaitTime = _waitUpMS; + _waitUpMS = 100; _fetcher.reset(new config::ConfigFetcher(_configUri.getContext())); _fetcher->subscribe<PartitionsConfig>(configId, this); _fetcher->start(); + _waitUpMS = oldWaitTime; if (_gencnt == 0) { throw new config::InvalidConfigException("failure during initial configuration: bad partition map"); } @@ -235,7 +239,7 @@ FastS_NodeManager::SetCollDesc(FastS_DataSetCollDesc *configDesc, rwait = (unsigned int) last.MilliSecsToNow(); if (rwait >= waitms || allup) break; - FastOS_Thread::Sleep(100); + FastOS_Thread::Sleep(10); }; if (allup) { LOG(debug, "All new engines up after %d ms", rwait); @@ -340,26 +344,6 @@ FastS_NodeManager::ShutdownConfig() } } - -uint32_t -FastS_NodeManager::GetTotalPartitions() -{ - uint32_t ret; - - ret = 0; - std::lock_guard<std::mutex> managerGuard(_managerLock); - FastS_DataSetCollection *dsc = PeekDataSetCollection(); - for (unsigned int i = 0; i < dsc->GetMaxNumDataSets(); i++) { - FastS_DataSetBase *ds; - FastS_PlainDataSet *ds_plain; - if ((ds = dsc->PeekDataSet(i)) != NULL && - (ds_plain = ds->GetPlainDataSet()) != NULL) - ret += ds_plain->GetPartitions(); - } - return ret; -} - - ChildInfo FastS_NodeManager::getChildInfo() { diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h b/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h index 70dc80914f4..21180014995 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h @@ -48,9 +48,9 @@ private: volatile bool _checkTempFailScheduled; volatile bool _shutdown; + volatile uint32_t _waitUpMS; protected: - void SetFailed() { _failed = true; } void configure(std::unique_ptr<PartitionsConfig> cfg) override; @@ -64,7 +64,6 @@ public: uint32_t GetMldPartition() const { return _mldPartit; } uint32_t GetMldDocstamp(); - uint32_t GetGenCnt() const { return _gencnt; } bool Failed() const { return _failed; } bool GetTempFail() const { return _tempFail; } @@ -74,7 +73,6 @@ public: _checkTempFailScheduled = true; } - FastS_AppContext *GetAppContext() { return _appCtx; } FastS_DataSetCollection *PeekDataSetCollection() { return _datasetCollection; } @@ -83,7 +81,6 @@ public: uint32_t SetCollDesc(FastS_DataSetCollDesc *configDesc, unsigned int waitms); uint32_t SetDataSetCollection(FastS_DataSetCollection *dsc); FastS_DataSetCollection *GetDataSetCollection(); - uint32_t GetTotalPartitions(); ChildInfo getChildInfo(); void ShutdownConfig(); |