Loading cpp/src/db/DBImpl.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ Status DBImpl::Start() { shutting_down_.store(false, std::memory_order_release); //for distribute version, some nodes are read only if (options_.mode_ != DBOptions::MODE::READ_ONLY) { if (options_.mode_ != DBOptions::MODE::CLUSTER_READONLY) { ENGINE_LOG_TRACE << "StartTimerTasks"; bg_timer_thread_ = std::thread(&DBImpl::BackgroundTimerTask, this); } Loading @@ -98,7 +98,7 @@ Status DBImpl::Stop() { //wait compaction/buildindex finish bg_timer_thread_.join(); if (options_.mode_ != DBOptions::MODE::READ_ONLY) { if (options_.mode_ != DBOptions::MODE::CLUSTER_READONLY) { meta_ptr_->CleanUp(); } Loading Loading @@ -684,7 +684,7 @@ void DBImpl::BackgroundCompaction(std::set<std::string> table_ids) { meta_ptr_->Archive(); int ttl = 5*meta::M_SEC;//default: file will be deleted after 5 minutes if (options_.mode_ == DBOptions::MODE::CLUSTER) { if (options_.mode_ == DBOptions::MODE::CLUSTER_WRITABLE) { ttl = meta::D_SEC; } meta_ptr_->CleanUpFilesWithTTL(ttl); Loading cpp/src/db/Options.h +3 −3 Original line number Diff line number Diff line Loading @@ -60,9 +60,9 @@ struct DBMetaOptions { struct DBOptions { typedef enum { SINGLE, CLUSTER, READ_ONLY SINGLE = 0, CLUSTER_READONLY, CLUSTER_WRITABLE } MODE; uint16_t merge_trigger_number_ = 2; Loading cpp/src/db/meta/MySQLMetaImpl.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -284,7 +284,7 @@ Status MySQLMetaImpl::Initialize() { //step 5: create meta tables try { if (mode_ != DBOptions::MODE::READ_ONLY) { if (mode_ != DBOptions::MODE::CLUSTER_READONLY) { CleanUp(); } Loading Loading @@ -758,7 +758,7 @@ Status MySQLMetaImpl::DeleteTable(const std::string &table_id) { } //Scoped Connection if (mode_ == DBOptions::MODE::CLUSTER) { if (mode_ == DBOptions::MODE::CLUSTER_WRITABLE) { DeleteTableFiles(table_id); } Loading cpp/src/server/Config.cpp +13 −13 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ Config::ValidateConfig() { if (!s.ok()) return s; std::string server_mode; s = GetServerConfigMode(server_mode); s = GetServerConfigDeployMode(server_mode); if (!s.ok()) return s; std::string server_time_zone; Loading Loading @@ -219,7 +219,7 @@ Config::CheckServerConfigPort(const std::string &value) { } Status Config::CheckServerConfigMode(const std::string &value) { Config::CheckServerConfigDeployMode(const std::string &value) { if (value != "single" && value != "cluster_readonly" && value != "cluster_writable") { Loading Loading @@ -511,12 +511,12 @@ Config::GetServerConfigStrPort() { } std::string Config::GetServerConfigStrMode() { Config::GetServerConfigStrDeployMode() { std::string value; if (!GetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_MODE, value).ok()) { value = GetConfigNode(CONFIG_SERVER).GetValue(CONFIG_SERVER_MODE, CONFIG_SERVER_MODE_DEFAULT); SetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_MODE, value); if (!GetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_DEPLOY_MODE, value).ok()) { value = GetConfigNode(CONFIG_SERVER).GetValue(CONFIG_SERVER_DEPLOY_MODE, CONFIG_SERVER_DEPLOY_MODE_DEFAULT); SetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_DEPLOY_MODE, value); } return value; } Loading Loading @@ -755,9 +755,9 @@ Config::GetServerConfigPort(std::string& value) { } Status Config::GetServerConfigMode(std::string& value) { value = GetServerConfigStrMode(); return CheckServerConfigMode(value); Config::GetServerConfigDeployMode(std::string& value) { value = GetServerConfigStrDeployMode(); return CheckServerConfigDeployMode(value); } Status Loading Loading @@ -938,10 +938,10 @@ Config::SetServerConfigPort(const std::string& value) { } Status Config::SetServerConfigMode(const std::string& value) { Status s = CheckServerConfigMode(value); Config::SetServerConfigDeployMode(const std::string& value) { Status s = CheckServerConfigDeployMode(value); if (!s.ok()) return s; SetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_MODE, value); SetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_DEPLOY_MODE, value); return Status::OK(); } Loading cpp/src/server/Config.h +6 −6 Original line number Diff line number Diff line Loading @@ -34,8 +34,8 @@ static const char* CONFIG_SERVER_ADDRESS = "address"; static const char* CONFIG_SERVER_ADDRESS_DEFAULT = "127.0.0.1"; static const char* CONFIG_SERVER_PORT = "port"; static const char* CONFIG_SERVER_PORT_DEFAULT = "19530"; static const char* CONFIG_SERVER_MODE = "mode"; static const char* CONFIG_SERVER_MODE_DEFAULT = "single"; static const char* CONFIG_SERVER_DEPLOY_MODE = "deploy_mode"; static const char* CONFIG_SERVER_DEPLOY_MODE_DEFAULT = "single"; static const char* CONFIG_SERVER_TIME_ZONE = "time_zone"; static const char* CONFIG_SERVER_TIME_ZONE_DEFAULT = "UTC+8"; Loading Loading @@ -117,7 +117,7 @@ class Config { /* server config */ Status CheckServerConfigAddress(const std::string& value); Status CheckServerConfigPort(const std::string& value); Status CheckServerConfigMode(const std::string& value); Status CheckServerConfigDeployMode(const std::string& value); Status CheckServerConfigTimeZone(const std::string& value); /* db config */ Loading Loading @@ -153,7 +153,7 @@ class Config { /* server config */ std::string GetServerConfigStrAddress(); std::string GetServerConfigStrPort(); std::string GetServerConfigStrMode(); std::string GetServerConfigStrDeployMode(); std::string GetServerConfigStrTimeZone(); /* db config */ Loading Loading @@ -188,7 +188,7 @@ class Config { /* server config */ Status GetServerConfigAddress(std::string& value); Status GetServerConfigPort(std::string& value); Status GetServerConfigMode(std::string& value); Status GetServerConfigDeployMode(std::string& value); Status GetServerConfigTimeZone(std::string& value); /* db config */ Loading Loading @@ -224,7 +224,7 @@ class Config { /* server config */ Status SetServerConfigAddress(const std::string& value); Status SetServerConfigPort(const std::string& value); Status SetServerConfigMode(const std::string& value); Status SetServerConfigDeployMode(const std::string& value); Status SetServerConfigTimeZone(const std::string& value); /* db config */ Loading Loading
cpp/src/db/DBImpl.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ Status DBImpl::Start() { shutting_down_.store(false, std::memory_order_release); //for distribute version, some nodes are read only if (options_.mode_ != DBOptions::MODE::READ_ONLY) { if (options_.mode_ != DBOptions::MODE::CLUSTER_READONLY) { ENGINE_LOG_TRACE << "StartTimerTasks"; bg_timer_thread_ = std::thread(&DBImpl::BackgroundTimerTask, this); } Loading @@ -98,7 +98,7 @@ Status DBImpl::Stop() { //wait compaction/buildindex finish bg_timer_thread_.join(); if (options_.mode_ != DBOptions::MODE::READ_ONLY) { if (options_.mode_ != DBOptions::MODE::CLUSTER_READONLY) { meta_ptr_->CleanUp(); } Loading Loading @@ -684,7 +684,7 @@ void DBImpl::BackgroundCompaction(std::set<std::string> table_ids) { meta_ptr_->Archive(); int ttl = 5*meta::M_SEC;//default: file will be deleted after 5 minutes if (options_.mode_ == DBOptions::MODE::CLUSTER) { if (options_.mode_ == DBOptions::MODE::CLUSTER_WRITABLE) { ttl = meta::D_SEC; } meta_ptr_->CleanUpFilesWithTTL(ttl); Loading
cpp/src/db/Options.h +3 −3 Original line number Diff line number Diff line Loading @@ -60,9 +60,9 @@ struct DBMetaOptions { struct DBOptions { typedef enum { SINGLE, CLUSTER, READ_ONLY SINGLE = 0, CLUSTER_READONLY, CLUSTER_WRITABLE } MODE; uint16_t merge_trigger_number_ = 2; Loading
cpp/src/db/meta/MySQLMetaImpl.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -284,7 +284,7 @@ Status MySQLMetaImpl::Initialize() { //step 5: create meta tables try { if (mode_ != DBOptions::MODE::READ_ONLY) { if (mode_ != DBOptions::MODE::CLUSTER_READONLY) { CleanUp(); } Loading Loading @@ -758,7 +758,7 @@ Status MySQLMetaImpl::DeleteTable(const std::string &table_id) { } //Scoped Connection if (mode_ == DBOptions::MODE::CLUSTER) { if (mode_ == DBOptions::MODE::CLUSTER_WRITABLE) { DeleteTableFiles(table_id); } Loading
cpp/src/server/Config.cpp +13 −13 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ Config::ValidateConfig() { if (!s.ok()) return s; std::string server_mode; s = GetServerConfigMode(server_mode); s = GetServerConfigDeployMode(server_mode); if (!s.ok()) return s; std::string server_time_zone; Loading Loading @@ -219,7 +219,7 @@ Config::CheckServerConfigPort(const std::string &value) { } Status Config::CheckServerConfigMode(const std::string &value) { Config::CheckServerConfigDeployMode(const std::string &value) { if (value != "single" && value != "cluster_readonly" && value != "cluster_writable") { Loading Loading @@ -511,12 +511,12 @@ Config::GetServerConfigStrPort() { } std::string Config::GetServerConfigStrMode() { Config::GetServerConfigStrDeployMode() { std::string value; if (!GetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_MODE, value).ok()) { value = GetConfigNode(CONFIG_SERVER).GetValue(CONFIG_SERVER_MODE, CONFIG_SERVER_MODE_DEFAULT); SetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_MODE, value); if (!GetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_DEPLOY_MODE, value).ok()) { value = GetConfigNode(CONFIG_SERVER).GetValue(CONFIG_SERVER_DEPLOY_MODE, CONFIG_SERVER_DEPLOY_MODE_DEFAULT); SetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_DEPLOY_MODE, value); } return value; } Loading Loading @@ -755,9 +755,9 @@ Config::GetServerConfigPort(std::string& value) { } Status Config::GetServerConfigMode(std::string& value) { value = GetServerConfigStrMode(); return CheckServerConfigMode(value); Config::GetServerConfigDeployMode(std::string& value) { value = GetServerConfigStrDeployMode(); return CheckServerConfigDeployMode(value); } Status Loading Loading @@ -938,10 +938,10 @@ Config::SetServerConfigPort(const std::string& value) { } Status Config::SetServerConfigMode(const std::string& value) { Status s = CheckServerConfigMode(value); Config::SetServerConfigDeployMode(const std::string& value) { Status s = CheckServerConfigDeployMode(value); if (!s.ok()) return s; SetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_MODE, value); SetConfigValueInMem(CONFIG_SERVER, CONFIG_SERVER_DEPLOY_MODE, value); return Status::OK(); } Loading
cpp/src/server/Config.h +6 −6 Original line number Diff line number Diff line Loading @@ -34,8 +34,8 @@ static const char* CONFIG_SERVER_ADDRESS = "address"; static const char* CONFIG_SERVER_ADDRESS_DEFAULT = "127.0.0.1"; static const char* CONFIG_SERVER_PORT = "port"; static const char* CONFIG_SERVER_PORT_DEFAULT = "19530"; static const char* CONFIG_SERVER_MODE = "mode"; static const char* CONFIG_SERVER_MODE_DEFAULT = "single"; static const char* CONFIG_SERVER_DEPLOY_MODE = "deploy_mode"; static const char* CONFIG_SERVER_DEPLOY_MODE_DEFAULT = "single"; static const char* CONFIG_SERVER_TIME_ZONE = "time_zone"; static const char* CONFIG_SERVER_TIME_ZONE_DEFAULT = "UTC+8"; Loading Loading @@ -117,7 +117,7 @@ class Config { /* server config */ Status CheckServerConfigAddress(const std::string& value); Status CheckServerConfigPort(const std::string& value); Status CheckServerConfigMode(const std::string& value); Status CheckServerConfigDeployMode(const std::string& value); Status CheckServerConfigTimeZone(const std::string& value); /* db config */ Loading Loading @@ -153,7 +153,7 @@ class Config { /* server config */ std::string GetServerConfigStrAddress(); std::string GetServerConfigStrPort(); std::string GetServerConfigStrMode(); std::string GetServerConfigStrDeployMode(); std::string GetServerConfigStrTimeZone(); /* db config */ Loading Loading @@ -188,7 +188,7 @@ class Config { /* server config */ Status GetServerConfigAddress(std::string& value); Status GetServerConfigPort(std::string& value); Status GetServerConfigMode(std::string& value); Status GetServerConfigDeployMode(std::string& value); Status GetServerConfigTimeZone(std::string& value); /* db config */ Loading Loading @@ -224,7 +224,7 @@ class Config { /* server config */ Status SetServerConfigAddress(const std::string& value); Status SetServerConfigPort(const std::string& value); Status SetServerConfigMode(const std::string& value); Status SetServerConfigDeployMode(const std::string& value); Status SetServerConfigTimeZone(const std::string& value); /* db config */ Loading