Commit ea447964 authored by 蔡宇东's avatar 蔡宇东
Browse files

MS-574 rename config deploy_mode


Former-commit-id: 3af9ae2e5251f174c680c884200d57c3a8247c8e
parent 2b3d16ca
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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);
    }
@@ -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();
    }

@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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();
        }

@@ -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);
        }

+13 −13
Original line number Diff line number Diff line
@@ -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;
@@ -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") {
@@ -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;
}
@@ -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
@@ -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();
}

+6 −6
Original line number Diff line number Diff line
@@ -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";

@@ -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 */
@@ -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 */
@@ -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 */
@@ -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