aboutsummaryrefslogtreecommitdiffstats
path: root/storageserver
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-11-19 23:22:55 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-11-20 21:55:01 +0000
commitcf3b20dba22718b533eac6854cde86b6538958af (patch)
tree9a0e795cd74d2721140c48012f794298dfef7420 /storageserver
parent64b7c822099d7cda921699e380c4d95608a1ab00 (diff)
FastOS_Time -> std::chrono.
Diffstat (limited to 'storageserver')
-rw-r--r--storageserver/src/apps/storaged/storage.cpp30
-rw-r--r--storageserver/src/tests/storageservertest.cpp6
-rw-r--r--storageserver/src/vespa/storageserver/app/distributorprocess.cpp11
-rw-r--r--storageserver/src/vespa/storageserver/app/distributorprocess.h2
-rw-r--r--storageserver/src/vespa/storageserver/app/process.cpp4
-rw-r--r--storageserver/src/vespa/storageserver/app/process.h7
6 files changed, 30 insertions, 30 deletions
diff --git a/storageserver/src/apps/storaged/storage.cpp b/storageserver/src/apps/storaged/storage.cpp
index b1eafcbad93..0748cc3cb1e 100644
--- a/storageserver/src/apps/storaged/storage.cpp
+++ b/storageserver/src/apps/storaged/storage.cpp
@@ -11,21 +11,21 @@
* application, but as little as possible else.
*/
-#include <csignal>
+#include "forcelink.h"
#include <vespa/persistence/spi/exceptions.h>
-#include <vespa/storage/storageutil/utils.h>
#include <vespa/storageserver/app/distributorprocess.h>
-#include "forcelink.h"
#include <vespa/storageserver/app/dummyservicelayerprocess.h>
#include <vespa/vespalib/util/programoptions.h>
#include <vespa/vespalib/util/shutdownguard.h>
-#include <iostream>
#include <vespa/config/helper/configgetter.hpp>
#include <vespa/fastos/app.h>
+#include <iostream>
+#include <csignal>
#include <vespa/log/log.h>
LOG_SETUP("vds.application");
+using namespace std::chrono_literals;
namespace storage {
namespace {
@@ -39,7 +39,7 @@ Process::UP createProcess(vespalib::stringref configId) {
} else switch (serverConfig->persistenceProvider.type) {
case vespa::config::content::core::StorServerConfig::PersistenceProvider::Type::STORAGE:
case vespa::config::content::core::StorServerConfig::PersistenceProvider::Type::DUMMY:
- return Process::UP(new DummyServiceLayerProcess(configId));
+ return std::make_unique<DummyServiceLayerProcess>(configId);
default:
throw vespalib::IllegalStateException("Unknown persistence provider.", VESPA_STRLOC);
}
@@ -59,7 +59,7 @@ class StorageApp : public FastOS_Application,
public:
StorageApp();
- ~StorageApp();
+ ~StorageApp() override;
void handleSignal(int signal) {
LOG(info, "Got signal %d, waiting for lock", signal);
@@ -96,7 +96,7 @@ StorageApp::StorageApp()
"abruptly killing the process.");
}
-StorageApp::~StorageApp() {}
+StorageApp::~StorageApp() = default;
bool StorageApp::Init()
{
@@ -118,13 +118,13 @@ bool StorageApp::Init()
}
namespace {
- storage::StorageApp *sigtramp = 0;
+ storage::StorageApp *sigtramp = nullptr;
uint32_t _G_signalCount = 0;
void killHandler(int sig) {
if (_G_signalCount == 0) {
_G_signalCount++;
- if (sigtramp == 0) _exit(EXIT_FAILURE);
+ if (sigtramp == nullptr) _exit(EXIT_FAILURE);
// note: this is not totally safe, sigtramp is not protected by a lock
sigtramp->handleSignal(sig);
} else if (_G_signalCount > 2) {
@@ -143,8 +143,8 @@ namespace {
usr_action.sa_handler = killHandler;
usr_action.sa_mask = block_mask;
usr_action.sa_flags = 0;
- sigaction (SIGTERM, &usr_action, NULL);
- sigaction (SIGINT, &usr_action, NULL);
+ sigaction (SIGTERM, &usr_action, nullptr);
+ sigaction (SIGINT, &usr_action, nullptr);
}
}
@@ -162,7 +162,7 @@ int StorageApp::Main()
{
try{
_process = createProcess(_configId);
- _process->setupConfig(600000);
+ _process->setupConfig(600000ms);
_process->createNode();
} catch (const spi::HandledException & e) {
LOG(warning, "Died due to known cause: %s", e.what());
@@ -192,7 +192,7 @@ int StorageApp::Main()
}
// Wait until we get a kill signal.
vespalib::MonitorGuard lock(_signalLock);
- lock.wait(1000);
+ lock.wait(1000ms);
handleSignals();
}
LOG(debug, "Server was attempted stopped, shutting down");
@@ -200,7 +200,7 @@ int StorageApp::Main()
// time than given timeout.
vespalib::ShutdownGuard shutdownGuard(_maxShutdownTime);
LOG(debug, "Attempting proper shutdown");
- _process.reset(0);
+ _process.reset();
LOG(debug, "Completed controlled shutdown.");
return 0;
}
@@ -212,7 +212,7 @@ int main(int argc, char **argv)
storage::StorageApp app;
storage::sigtramp = &app;
int retval = app.Entry(argc,argv);
- storage::sigtramp = NULL;
+ storage::sigtramp = nullptr;
LOG(debug, "Exiting");
return retval;
}
diff --git a/storageserver/src/tests/storageservertest.cpp b/storageserver/src/tests/storageservertest.cpp
index 5e50fff8f94..2f165c69470 100644
--- a/storageserver/src/tests/storageservertest.cpp
+++ b/storageserver/src/tests/storageservertest.cpp
@@ -11,6 +11,8 @@
LOG_SETUP(".storageservertest");
+using namespace std::chrono_literals;
+
namespace storage {
struct StorageServerTest : public ::testing::Test {
@@ -61,7 +63,7 @@ struct Storage : public Node {
Distributor::Distributor(vdstestlib::DirConfig& config)
: _process(config.getConfigId())
{
- _process.setupConfig(60000);
+ _process.setupConfig(60000ms);
_process.createNode();
}
@@ -70,7 +72,7 @@ Distributor::~Distributor() = default;
Storage::Storage(vdstestlib::DirConfig& config)
: _process(config.getConfigId())
{
- _process.setupConfig(60000);
+ _process.setupConfig(60000ms);
_process.createNode();
_component.reset(new StorageComponent(
getContext().getComponentRegister(), "test"));
diff --git a/storageserver/src/vespa/storageserver/app/distributorprocess.cpp b/storageserver/src/vespa/storageserver/app/distributorprocess.cpp
index ff4b2e98cca..938ca63b50f 100644
--- a/storageserver/src/vespa/storageserver/app/distributorprocess.cpp
+++ b/storageserver/src/vespa/storageserver/app/distributorprocess.cpp
@@ -28,7 +28,7 @@ DistributorProcess::shutdown()
}
void
-DistributorProcess::setupConfig(uint64_t subscribeTimeout)
+DistributorProcess::setupConfig(milliseconds subscribeTimeout)
{
using vespa::config::content::core::StorServerConfig;
using vespa::config::content::core::StorDistributormanagerConfig;
@@ -39,13 +39,10 @@ DistributorProcess::setupConfig(uint64_t subscribeTimeout)
if (stor_config->persistenceProvider.type != StorServerConfig::PersistenceProvider::Type::STORAGE) {
_activeFlag = DistributorNode::NEED_ACTIVE_BUCKET_STATES_SET;
}
- auto dist_config = config::ConfigGetter<StorDistributormanagerConfig>::getConfig(
- _configUri.getConfigId(), _configUri.getContext(), subscribeTimeout);
+ auto dist_config = config::ConfigGetter<StorDistributormanagerConfig>::getConfig(_configUri.getConfigId(), _configUri.getContext(), subscribeTimeout);
_use_btree_database = dist_config->useBtreeDatabase;
- _distributorConfigHandler
- = _configSubscriber.subscribe<StorDistributormanagerConfig>(_configUri.getConfigId(), subscribeTimeout);
- _visitDispatcherConfigHandler
- = _configSubscriber.subscribe<StorVisitordispatcherConfig>(_configUri.getConfigId(), subscribeTimeout);
+ _distributorConfigHandler = _configSubscriber.subscribe<StorDistributormanagerConfig>(_configUri.getConfigId(), subscribeTimeout);
+ _visitDispatcherConfigHandler = _configSubscriber.subscribe<StorVisitordispatcherConfig>(_configUri.getConfigId(), subscribeTimeout);
Process::setupConfig(subscribeTimeout);
}
diff --git a/storageserver/src/vespa/storageserver/app/distributorprocess.h b/storageserver/src/vespa/storageserver/app/distributorprocess.h
index 57193f77e42..48fa331ba54 100644
--- a/storageserver/src/vespa/storageserver/app/distributorprocess.h
+++ b/storageserver/src/vespa/storageserver/app/distributorprocess.h
@@ -27,7 +27,7 @@ public:
~DistributorProcess() override;
void shutdown() override;
- void setupConfig(uint64_t subscribeTimeout) override;
+ void setupConfig(milliseconds subscribeTimeout) override;
void createNode() override;
bool configUpdated() override;
void updateConfig() override;
diff --git a/storageserver/src/vespa/storageserver/app/process.cpp b/storageserver/src/vespa/storageserver/app/process.cpp
index 0ebce27eebb..df5e8f4a10e 100644
--- a/storageserver/src/vespa/storageserver/app/process.cpp
+++ b/storageserver/src/vespa/storageserver/app/process.cpp
@@ -19,7 +19,7 @@ Process::Process(const config::ConfigUri & configUri)
{ }
void
-Process::setupConfig(uint64_t subscribeTimeout)
+Process::setupConfig(milliseconds subscribeTimeout)
{
_documentHandler = _configSubscriber.subscribe<document::DocumenttypesConfig>(_configUri.getConfigId(), subscribeTimeout);
if (!_configSubscriber.nextConfig()) {
@@ -32,7 +32,7 @@ Process::setupConfig(uint64_t subscribeTimeout)
bool
Process::configUpdated()
{
- _configSubscriber.nextGeneration(0);
+ _configSubscriber.nextGenerationNow();
if (_documentHandler->isChanged()) {
LOG(info, "Document config detected changed");
return true;
diff --git a/storageserver/src/vespa/storageserver/app/process.h b/storageserver/src/vespa/storageserver/app/process.h
index e8f7fd62ccf..a5c5b656677 100644
--- a/storageserver/src/vespa/storageserver/app/process.h
+++ b/storageserver/src/vespa/storageserver/app/process.h
@@ -38,12 +38,13 @@ private:
std::vector<DocumentTypeRepoSP> _repos;
public:
- typedef std::unique_ptr<Process> UP;
+ using UP = std::unique_ptr<Process>;
+ using milliseconds = std::chrono::milliseconds;
Process(const config::ConfigUri & configUri);
virtual ~Process() {}
- virtual void setupConfig(uint64_t subscribeTimeout);
+ virtual void setupConfig(milliseconds subscribeTimeout);
virtual void createNode() = 0;
virtual bool configUpdated();
virtual void updateConfig();
@@ -54,7 +55,7 @@ public:
virtual StorageNode& getNode() = 0;
virtual StorageNodeContext& getContext() = 0;
- virtual int64_t getGeneration() const override;
+ int64_t getGeneration() const override;
};
} // storage