提交 bd4977b6 编写于 作者: Z zhiru

update


Former-commit-id: 23e7315c4445705a07cac462f4fa6ffae337d133
上级 1d1da7f9
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "scheduler/context/SearchContext.h" #include "scheduler/context/SearchContext.h"
#include "scheduler/context/DeleteContext.h" #include "scheduler/context/DeleteContext.h"
#include "utils/TimeRecorder.h" #include "utils/TimeRecorder.h"
#include "MetaConsts.h"
#include <assert.h> #include <assert.h>
#include <chrono> #include <chrono>
...@@ -595,7 +596,12 @@ void DBImpl::BackgroundCompaction(std::set<std::string> table_ids) { ...@@ -595,7 +596,12 @@ void DBImpl::BackgroundCompaction(std::set<std::string> table_ids) {
} }
meta_ptr_->Archive(); meta_ptr_->Archive();
meta_ptr_->CleanUpFilesWithTTL(1);
int ttl = 1;
if (options_.mode == "cluster") {
ttl = meta::D_SEC;
}
meta_ptr_->CleanUpFilesWithTTL(ttl);
} }
void DBImpl::StartBuildIndexTask() { void DBImpl::StartBuildIndexTask() {
......
...@@ -81,9 +81,11 @@ std::shared_ptr<meta::Meta> DBMetaImplFactory::Build(const DBMetaOptions& metaOp ...@@ -81,9 +81,11 @@ std::shared_ptr<meta::Meta> DBMetaImplFactory::Build(const DBMetaOptions& metaOp
std::string dialect = pieces_match[1].str(); std::string dialect = pieces_match[1].str();
std::transform(dialect.begin(), dialect.end(), dialect.begin(), ::tolower); std::transform(dialect.begin(), dialect.end(), dialect.begin(), ::tolower);
if (dialect.find("mysql") != std::string::npos) { if (dialect.find("mysql") != std::string::npos) {
ENGINE_LOG_DEBUG << "Using MySQL";
return std::make_shared<meta::MySQLMetaImpl>(meta::MySQLMetaImpl(metaOptions)); return std::make_shared<meta::MySQLMetaImpl>(meta::MySQLMetaImpl(metaOptions));
} }
else if (dialect.find("sqlite") != std::string::npos) { else if (dialect.find("sqlite") != std::string::npos) {
ENGINE_LOG_DEBUG << "Using SQLite";
return std::make_shared<meta::DBMetaImpl>(meta::DBMetaImpl(metaOptions)); return std::make_shared<meta::DBMetaImpl>(meta::DBMetaImpl(metaOptions));
} }
else { else {
......
...@@ -47,6 +47,7 @@ struct Options { ...@@ -47,6 +47,7 @@ struct Options {
uint16_t merge_trigger_number = 2; uint16_t merge_trigger_number = 2;
size_t index_trigger_size = ONE_GB; //unit: byte size_t index_trigger_size = ONE_GB; //unit: byte
DBMetaOptions meta; DBMetaOptions meta;
std::string mode;
}; // Options }; // Options
......
...@@ -23,6 +23,7 @@ DBWrapper::DBWrapper() { ...@@ -23,6 +23,7 @@ DBWrapper::DBWrapper() {
if(index_size > 0) {//ensure larger than zero, unit is MB if(index_size > 0) {//ensure larger than zero, unit is MB
opt.index_trigger_size = (size_t)index_size * engine::ONE_MB; opt.index_trigger_size = (size_t)index_size * engine::ONE_MB;
} }
opt.mode = config.GetValue(CONFIG_CLUSTER_MODE, "single");
CommonUtil::CreateDirectory(opt.meta.path); CommonUtil::CreateDirectory(opt.meta.path);
......
...@@ -19,6 +19,7 @@ static const std::string CONFIG_SERVER_ADDRESS = "address"; ...@@ -19,6 +19,7 @@ static const std::string CONFIG_SERVER_ADDRESS = "address";
static const std::string CONFIG_SERVER_PORT = "port"; static const std::string CONFIG_SERVER_PORT = "port";
static const std::string CONFIG_SERVER_PROTOCOL = "transfer_protocol"; static const std::string CONFIG_SERVER_PROTOCOL = "transfer_protocol";
static const std::string CONFIG_SERVER_MODE = "server_mode"; static const std::string CONFIG_SERVER_MODE = "server_mode";
static const std::string CONFIG_CLUSTER_MODE = "mode";
static const std::string CONFIG_DB = "db_config"; static const std::string CONFIG_DB = "db_config";
static const std::string CONFIG_DB_URL = "db_backend_url"; static const std::string CONFIG_DB_URL = "db_backend_url";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册