mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 20:09:57 +08:00
Merge branch 'branch-0.3.1' into 'branch-0.3.1'
MS-273 Add some logs and reformat code See merge request megasearch/milvus!270 Former-commit-id: fe9e27aefd9bd73e12dd7aeaf709884b68da9ae6
This commit is contained in:
commit
afc40c454a
2
cpp/src/cache/Cache.cpp
vendored
2
cpp/src/cache/Cache.cpp
vendored
@ -89,7 +89,7 @@ void Cache::erase(const std::string& key) {
|
||||
const DataObjPtr& data_ptr = obj_ptr->data_;
|
||||
usage_ -= data_ptr->size();
|
||||
|
||||
SERVER_LOG_DEBUG << "Erase " << key << " from cache";
|
||||
SERVER_LOG_DEBUG << "Erase " << key << " size: " << data_ptr->size();
|
||||
|
||||
lru_.erase(key);
|
||||
}
|
||||
|
13
cpp/src/cache/CacheMgr.cpp
vendored
13
cpp/src/cache/CacheMgr.cpp
vendored
@ -4,6 +4,7 @@
|
||||
// Proprietary and confidential.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "utils/Log.h"
|
||||
#include "CacheMgr.h"
|
||||
#include "metrics/Metrics.h"
|
||||
|
||||
@ -20,6 +21,7 @@ CacheMgr::~CacheMgr() {
|
||||
|
||||
uint64_t CacheMgr::ItemCount() const {
|
||||
if(cache_ == nullptr) {
|
||||
SERVER_LOG_ERROR << "Cache doesn't exist";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -28,6 +30,7 @@ uint64_t CacheMgr::ItemCount() const {
|
||||
|
||||
bool CacheMgr::ItemExists(const std::string& key) {
|
||||
if(cache_ == nullptr) {
|
||||
SERVER_LOG_ERROR << "Cache doesn't exist";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -36,6 +39,7 @@ bool CacheMgr::ItemExists(const std::string& key) {
|
||||
|
||||
DataObjPtr CacheMgr::GetItem(const std::string& key) {
|
||||
if(cache_ == nullptr) {
|
||||
SERVER_LOG_ERROR << "Cache doesn't exist";
|
||||
return nullptr;
|
||||
}
|
||||
server::Metrics::GetInstance().CacheAccessTotalIncrement();
|
||||
@ -45,6 +49,7 @@ DataObjPtr CacheMgr::GetItem(const std::string& key) {
|
||||
engine::Index_ptr CacheMgr::GetIndex(const std::string& key) {
|
||||
DataObjPtr obj = GetItem(key);
|
||||
if(obj != nullptr) {
|
||||
SERVER_LOG_ERROR << "Can't get object from key: " << key;
|
||||
return obj->data();
|
||||
}
|
||||
|
||||
@ -53,6 +58,7 @@ engine::Index_ptr CacheMgr::GetIndex(const std::string& key) {
|
||||
|
||||
void CacheMgr::InsertItem(const std::string& key, const DataObjPtr& data) {
|
||||
if(cache_ == nullptr) {
|
||||
SERVER_LOG_ERROR << "Cache doesn't exist";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -62,6 +68,7 @@ void CacheMgr::InsertItem(const std::string& key, const DataObjPtr& data) {
|
||||
|
||||
void CacheMgr::InsertItem(const std::string& key, const engine::Index_ptr& index) {
|
||||
if(cache_ == nullptr) {
|
||||
SERVER_LOG_ERROR << "Cache doesn't exist";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -72,6 +79,7 @@ void CacheMgr::InsertItem(const std::string& key, const engine::Index_ptr& index
|
||||
|
||||
void CacheMgr::EraseItem(const std::string& key) {
|
||||
if(cache_ == nullptr) {
|
||||
SERVER_LOG_ERROR << "Cache doesn't exist";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,6 +89,7 @@ void CacheMgr::EraseItem(const std::string& key) {
|
||||
|
||||
void CacheMgr::PrintInfo() {
|
||||
if(cache_ == nullptr) {
|
||||
SERVER_LOG_ERROR << "Cache doesn't exist";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -89,6 +98,7 @@ void CacheMgr::PrintInfo() {
|
||||
|
||||
void CacheMgr::ClearCache() {
|
||||
if(cache_ == nullptr) {
|
||||
SERVER_LOG_ERROR << "Cache doesn't exist";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -97,6 +107,7 @@ void CacheMgr::ClearCache() {
|
||||
|
||||
int64_t CacheMgr::CacheUsage() const {
|
||||
if(cache_ == nullptr) {
|
||||
SERVER_LOG_ERROR << "Cache doesn't exist";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -105,6 +116,7 @@ int64_t CacheMgr::CacheUsage() const {
|
||||
|
||||
int64_t CacheMgr::CacheCapacity() const {
|
||||
if(cache_ == nullptr) {
|
||||
SERVER_LOG_ERROR << "Cache doesn't exist";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -113,6 +125,7 @@ int64_t CacheMgr::CacheCapacity() const {
|
||||
|
||||
void CacheMgr::SetCapacity(int64_t capacity) {
|
||||
if(cache_ == nullptr) {
|
||||
SERVER_LOG_ERROR << "Cache doesn't exist";
|
||||
return;
|
||||
}
|
||||
cache_->set_capacity(capacity);
|
||||
|
6
cpp/src/cache/CpuCacheMgr.cpp
vendored
6
cpp/src/cache/CpuCacheMgr.cpp
vendored
@ -12,10 +12,14 @@ namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace cache {
|
||||
|
||||
namespace {
|
||||
constexpr int64_t unit = 1024 * 1024 * 1024;
|
||||
}
|
||||
|
||||
CpuCacheMgr::CpuCacheMgr() {
|
||||
server::ConfigNode& config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_CACHE);
|
||||
int64_t cap = config.GetInt64Value(server::CONFIG_CPU_CACHE_CAPACITY, 16);
|
||||
cap *= 1024*1024*1024;
|
||||
cap *= unit;
|
||||
cache_ = std::make_shared<Cache>(cap, 1UL<<32);
|
||||
|
||||
double free_percent = config.GetDoubleValue(server::CACHE_FREE_PERCENT, 0.85);
|
||||
|
6
cpp/src/cache/GpuCacheMgr.cpp
vendored
6
cpp/src/cache/GpuCacheMgr.cpp
vendored
@ -11,10 +11,14 @@ namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace cache {
|
||||
|
||||
namespace {
|
||||
constexpr int64_t unit = 1024 * 1024 * 1024;
|
||||
}
|
||||
|
||||
GpuCacheMgr::GpuCacheMgr() {
|
||||
server::ConfigNode& config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_CACHE);
|
||||
int64_t cap = config.GetInt64Value(server::CONFIG_GPU_CACHE_CAPACITY, 1);
|
||||
cap *= 1024*1024*1024;
|
||||
cap *= unit;
|
||||
cache_ = std::make_shared<Cache>(cap, 1UL<<32);
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ double
|
||||
ConfigNode::GetDoubleValue(const std::string ¶m_key, double default_val) const {
|
||||
std::string val = GetValue(param_key);
|
||||
if (!val.empty()) {
|
||||
return std::strtold(val.c_str(), nullptr);
|
||||
return std::strtod(val.c_str(), nullptr);
|
||||
} else {
|
||||
return default_val;
|
||||
}
|
||||
|
@ -9,14 +9,14 @@ namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
|
||||
const size_t K = 1024UL;
|
||||
const size_t M = K * K;
|
||||
const size_t G = K * M;
|
||||
const size_t T = K * G;
|
||||
constexpr size_t K = 1024UL;
|
||||
constexpr size_t M = K * K;
|
||||
constexpr size_t G = K * M;
|
||||
constexpr size_t T = K * G;
|
||||
|
||||
const size_t MAX_TABLE_FILE_MEM = 128 * M;
|
||||
constexpr size_t MAX_TABLE_FILE_MEM = 128 * M;
|
||||
|
||||
const int VECTOR_TYPE_SIZE = sizeof(float);
|
||||
constexpr int VECTOR_TYPE_SIZE = sizeof(float);
|
||||
|
||||
} // namespace engine
|
||||
} // namespace milvus
|
||||
|
@ -12,11 +12,10 @@ namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
|
||||
DB::~DB() {}
|
||||
DB::~DB() = default;
|
||||
|
||||
void DB::Open(const Options& options, DB** dbptr) {
|
||||
*dbptr = DBFactory::Build(options);
|
||||
return;
|
||||
}
|
||||
|
||||
} // namespace engine
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
DB(const DB&) = delete;
|
||||
DB& operator=(const DB&) = delete;
|
||||
|
||||
virtual ~DB();
|
||||
virtual ~DB() = 0;
|
||||
}; // DB
|
||||
|
||||
} // namespace engine
|
||||
|
@ -8,67 +8,88 @@
|
||||
#include "Meta.h"
|
||||
#include "Options.h"
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace meta {
|
||||
|
||||
auto StoragePrototype(const std::string& path);
|
||||
auto StoragePrototype(const std::string &path);
|
||||
|
||||
class DBMetaImpl : public Meta {
|
||||
public:
|
||||
DBMetaImpl(const DBMetaOptions& options_);
|
||||
public:
|
||||
explicit DBMetaImpl(const DBMetaOptions &options_);
|
||||
|
||||
virtual Status CreateTable(TableSchema& table_schema) override;
|
||||
virtual Status DescribeTable(TableSchema& group_info_) override;
|
||||
virtual Status HasTable(const std::string& table_id, bool& has_or_not) override;
|
||||
virtual Status AllTables(std::vector<TableSchema>& table_schema_array) override;
|
||||
Status
|
||||
CreateTable(TableSchema &table_schema) override;
|
||||
|
||||
virtual Status DeleteTable(const std::string& table_id) override;
|
||||
virtual Status DeleteTableFiles(const std::string& table_id) override;
|
||||
Status
|
||||
DescribeTable(TableSchema &group_info_) override;
|
||||
|
||||
virtual Status CreateTableFile(TableFileSchema& file_schema) override;
|
||||
virtual Status DropPartitionsByDates(const std::string& table_id,
|
||||
const DatesT& dates) override;
|
||||
Status
|
||||
HasTable(const std::string &table_id, bool &has_or_not) override;
|
||||
|
||||
virtual Status GetTableFiles(const std::string& table_id,
|
||||
const std::vector<size_t>& ids,
|
||||
TableFilesSchema& table_files) override;
|
||||
Status
|
||||
AllTables(std::vector<TableSchema> &table_schema_array) override;
|
||||
|
||||
virtual Status HasNonIndexFiles(const std::string& table_id, bool& has) override;
|
||||
Status
|
||||
DeleteTable(const std::string &table_id) override;
|
||||
|
||||
virtual Status UpdateTableFilesToIndex(const std::string& table_id) override;
|
||||
Status
|
||||
DeleteTableFiles(const std::string &table_id) override;
|
||||
|
||||
virtual Status UpdateTableFile(TableFileSchema& file_schema) override;
|
||||
Status
|
||||
CreateTableFile(TableFileSchema &file_schema) override;
|
||||
|
||||
virtual Status UpdateTableFiles(TableFilesSchema& files) override;
|
||||
Status
|
||||
DropPartitionsByDates(const std::string &table_id, const DatesT &dates) override;
|
||||
|
||||
virtual Status FilesToSearch(const std::string& table_id,
|
||||
const DatesT& partition,
|
||||
DatePartionedTableFilesSchema& files) override;
|
||||
Status
|
||||
GetTableFiles(const std::string &table_id, const std::vector<size_t> &ids, TableFilesSchema &table_files) override;
|
||||
|
||||
virtual Status FilesToMerge(const std::string& table_id,
|
||||
DatePartionedTableFilesSchema& files) override;
|
||||
Status
|
||||
HasNonIndexFiles(const std::string &table_id, bool &has) override;
|
||||
|
||||
virtual Status FilesToIndex(TableFilesSchema&) override;
|
||||
Status
|
||||
UpdateTableFilesToIndex(const std::string &table_id) override;
|
||||
|
||||
virtual Status Archive() override;
|
||||
Status
|
||||
UpdateTableFile(TableFileSchema &file_schema) override;
|
||||
|
||||
virtual Status Size(uint64_t& result) override;
|
||||
Status
|
||||
UpdateTableFiles(TableFilesSchema &files) override;
|
||||
|
||||
virtual Status CleanUp() override;
|
||||
Status
|
||||
FilesToSearch(const std::string &table_id, const DatesT &partition, DatePartionedTableFilesSchema &files) override;
|
||||
|
||||
virtual Status CleanUpFilesWithTTL(uint16_t seconds) override;
|
||||
Status
|
||||
FilesToMerge(const std::string &table_id, DatePartionedTableFilesSchema &files) override;
|
||||
|
||||
virtual Status DropAll() override;
|
||||
Status
|
||||
FilesToIndex(TableFilesSchema &) override;
|
||||
|
||||
virtual Status Count(const std::string& table_id, uint64_t& result) override;
|
||||
Status
|
||||
Archive() override;
|
||||
|
||||
virtual ~DBMetaImpl();
|
||||
Status
|
||||
Size(uint64_t &result) override;
|
||||
|
||||
private:
|
||||
Status NextFileId(std::string& file_id);
|
||||
Status NextTableId(std::string& table_id);
|
||||
Status
|
||||
CleanUp() override;
|
||||
|
||||
Status
|
||||
CleanUpFilesWithTTL(uint16_t seconds) override;
|
||||
|
||||
Status
|
||||
DropAll() override;
|
||||
|
||||
Status Count(const std::string &table_id, uint64_t &result) override;
|
||||
|
||||
~DBMetaImpl() override;
|
||||
|
||||
private:
|
||||
Status NextFileId(std::string &file_id);
|
||||
Status NextTableId(std::string &table_id);
|
||||
Status DiscardFiles(long to_discard_size);
|
||||
Status Initialize();
|
||||
|
||||
|
@ -13,7 +13,9 @@ namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
|
||||
IDGenerator::~IDGenerator() {}
|
||||
IDGenerator::~IDGenerator() = default;
|
||||
|
||||
constexpr size_t SimpleIDGenerator::MAX_IDS_PER_MICRO;
|
||||
|
||||
IDNumber SimpleIDGenerator::GetNextIDNumber() {
|
||||
auto now = std::chrono::system_clock::now();
|
||||
|
@ -10,28 +10,39 @@
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
|
||||
class IDGenerator {
|
||||
public:
|
||||
virtual IDNumber GetNextIDNumber() = 0;
|
||||
virtual void GetNextIDNumbers(size_t n, IDNumbers& ids) = 0;
|
||||
public:
|
||||
virtual
|
||||
IDNumber GetNextIDNumber() = 0;
|
||||
|
||||
virtual ~IDGenerator();
|
||||
virtual void
|
||||
GetNextIDNumbers(size_t n, IDNumbers &ids) = 0;
|
||||
|
||||
virtual
|
||||
~IDGenerator() = 0;
|
||||
}; // IDGenerator
|
||||
|
||||
|
||||
class SimpleIDGenerator : public IDGenerator {
|
||||
public:
|
||||
virtual IDNumber GetNextIDNumber() override;
|
||||
virtual void GetNextIDNumbers(size_t n, IDNumbers& ids) override;
|
||||
public:
|
||||
~SimpleIDGenerator() override = default;
|
||||
|
||||
private:
|
||||
void NextIDNumbers(size_t n, IDNumbers& ids);
|
||||
const size_t MAX_IDS_PER_MICRO = 1000;
|
||||
IDNumber
|
||||
GetNextIDNumber() override;
|
||||
|
||||
void
|
||||
GetNextIDNumbers(size_t n, IDNumbers &ids) override;
|
||||
|
||||
private:
|
||||
void
|
||||
NextIDNumbers(size_t n, IDNumbers &ids);
|
||||
|
||||
static constexpr size_t MAX_IDS_PER_MICRO = 1000;
|
||||
|
||||
}; // SimpleIDGenerator
|
||||
|
||||
|
@ -13,6 +13,8 @@ namespace milvus {
|
||||
namespace engine {
|
||||
namespace meta {
|
||||
|
||||
Meta::~Meta() = default;
|
||||
|
||||
DateT Meta::GetDate(const std::time_t& t, int day_delta) {
|
||||
struct tm ltm;
|
||||
localtime_r(&t, <m);
|
||||
|
@ -20,56 +20,86 @@ namespace meta {
|
||||
|
||||
|
||||
class Meta {
|
||||
public:
|
||||
public:
|
||||
using Ptr = std::shared_ptr<Meta>;
|
||||
|
||||
virtual Status CreateTable(TableSchema& table_schema) = 0;
|
||||
virtual Status DescribeTable(TableSchema& table_schema) = 0;
|
||||
virtual Status HasTable(const std::string& table_id, bool& has_or_not) = 0;
|
||||
virtual Status AllTables(std::vector<TableSchema>& table_schema_array) = 0;
|
||||
virtual
|
||||
~Meta() = 0;
|
||||
|
||||
virtual Status DeleteTable(const std::string& table_id) = 0;
|
||||
virtual Status DeleteTableFiles(const std::string& table_id) = 0;
|
||||
virtual Status
|
||||
CreateTable(TableSchema &table_schema) = 0;
|
||||
|
||||
virtual Status CreateTableFile(TableFileSchema& file_schema) = 0;
|
||||
virtual Status DropPartitionsByDates(const std::string& table_id,
|
||||
const DatesT& dates) = 0;
|
||||
virtual Status
|
||||
DescribeTable(TableSchema &table_schema) = 0;
|
||||
|
||||
virtual Status GetTableFiles(const std::string& table_id,
|
||||
const std::vector<size_t>& ids,
|
||||
TableFilesSchema& table_files) = 0;
|
||||
virtual Status
|
||||
HasTable(const std::string &table_id, bool &has_or_not) = 0;
|
||||
|
||||
virtual Status UpdateTableFilesToIndex(const std::string& table_id) = 0;
|
||||
virtual Status
|
||||
AllTables(std::vector<TableSchema> &table_schema_array) = 0;
|
||||
|
||||
virtual Status UpdateTableFile(TableFileSchema& file_schema) = 0;
|
||||
virtual Status
|
||||
DeleteTable(const std::string &table_id) = 0;
|
||||
|
||||
virtual Status UpdateTableFiles(TableFilesSchema& files) = 0;
|
||||
virtual Status
|
||||
DeleteTableFiles(const std::string &table_id) = 0;
|
||||
|
||||
virtual Status FilesToSearch(const std::string &table_id,
|
||||
const DatesT &partition,
|
||||
DatePartionedTableFilesSchema& files) = 0;
|
||||
virtual Status
|
||||
CreateTableFile(TableFileSchema &file_schema) = 0;
|
||||
|
||||
virtual Status FilesToMerge(const std::string& table_id,
|
||||
DatePartionedTableFilesSchema& files) = 0;
|
||||
virtual Status
|
||||
DropPartitionsByDates(const std::string &table_id, const DatesT &dates) = 0;
|
||||
|
||||
virtual Status Size(uint64_t& result) = 0;
|
||||
virtual Status
|
||||
GetTableFiles(const std::string &table_id, const std::vector<size_t> &ids, TableFilesSchema &table_files) = 0;
|
||||
|
||||
virtual Status Archive() = 0;
|
||||
virtual Status
|
||||
UpdateTableFilesToIndex(const std::string &table_id) = 0;
|
||||
|
||||
virtual Status FilesToIndex(TableFilesSchema&) = 0;
|
||||
virtual Status
|
||||
UpdateTableFile(TableFileSchema &file_schema) = 0;
|
||||
|
||||
virtual Status HasNonIndexFiles(const std::string& table_id, bool& has) = 0;
|
||||
virtual Status
|
||||
UpdateTableFiles(TableFilesSchema &files) = 0;
|
||||
|
||||
virtual Status CleanUp() = 0;
|
||||
virtual Status CleanUpFilesWithTTL(uint16_t) = 0;
|
||||
virtual Status
|
||||
FilesToSearch(const std::string &table_id, const DatesT &partition, DatePartionedTableFilesSchema &files) = 0;
|
||||
|
||||
virtual Status DropAll() = 0;
|
||||
virtual Status
|
||||
FilesToMerge(const std::string &table_id, DatePartionedTableFilesSchema &files) = 0;
|
||||
|
||||
virtual Status Count(const std::string& table_id, uint64_t& result) = 0;
|
||||
virtual Status
|
||||
Size(uint64_t &result) = 0;
|
||||
|
||||
static DateT GetDate(const std::time_t& t, int day_delta = 0);
|
||||
static DateT GetDate();
|
||||
static DateT GetDateWithDelta(int day_delta);
|
||||
virtual Status
|
||||
Archive() = 0;
|
||||
|
||||
virtual Status
|
||||
FilesToIndex(TableFilesSchema &) = 0;
|
||||
|
||||
virtual Status
|
||||
HasNonIndexFiles(const std::string &table_id, bool &has) = 0;
|
||||
|
||||
virtual Status
|
||||
CleanUp() = 0;
|
||||
|
||||
virtual Status
|
||||
CleanUpFilesWithTTL(uint16_t) = 0;
|
||||
|
||||
virtual Status
|
||||
DropAll() = 0;
|
||||
|
||||
virtual Status
|
||||
Count(const std::string &table_id, uint64_t &result) = 0;
|
||||
|
||||
static DateT
|
||||
GetDate(const std::time_t &t, int day_delta = 0);
|
||||
|
||||
static DateT
|
||||
GetDate();
|
||||
|
||||
static DateT
|
||||
GetDateWithDelta(int day_delta);
|
||||
|
||||
}; // MetaData
|
||||
|
||||
|
@ -12,79 +12,80 @@
|
||||
#include "mysql++/mysql++.h"
|
||||
#include <mutex>
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace meta {
|
||||
|
||||
// auto StoragePrototype(const std::string& path);
|
||||
using namespace mysqlpp;
|
||||
using namespace mysqlpp;
|
||||
|
||||
class MySQLMetaImpl : public Meta {
|
||||
public:
|
||||
MySQLMetaImpl(const DBMetaOptions& options_, const int& mode);
|
||||
class MySQLMetaImpl : public Meta {
|
||||
public:
|
||||
MySQLMetaImpl(const DBMetaOptions &options_, const int &mode);
|
||||
|
||||
virtual Status CreateTable(TableSchema& table_schema) override;
|
||||
virtual Status DescribeTable(TableSchema& group_info_) override;
|
||||
virtual Status HasTable(const std::string& table_id, bool& has_or_not) override;
|
||||
virtual Status AllTables(std::vector<TableSchema>& table_schema_array) override;
|
||||
Status CreateTable(TableSchema &table_schema) override;
|
||||
Status DescribeTable(TableSchema &group_info_) override;
|
||||
Status HasTable(const std::string &table_id, bool &has_or_not) override;
|
||||
Status AllTables(std::vector<TableSchema> &table_schema_array) override;
|
||||
|
||||
virtual Status DeleteTable(const std::string& table_id) override;
|
||||
virtual Status DeleteTableFiles(const std::string& table_id) override;
|
||||
Status DeleteTable(const std::string &table_id) override;
|
||||
Status DeleteTableFiles(const std::string &table_id) override;
|
||||
|
||||
virtual Status CreateTableFile(TableFileSchema& file_schema) override;
|
||||
virtual Status DropPartitionsByDates(const std::string& table_id,
|
||||
const DatesT& dates) override;
|
||||
Status CreateTableFile(TableFileSchema &file_schema) override;
|
||||
Status DropPartitionsByDates(const std::string &table_id,
|
||||
const DatesT &dates) override;
|
||||
|
||||
virtual Status GetTableFiles(const std::string& table_id,
|
||||
const std::vector<size_t>& ids,
|
||||
TableFilesSchema& table_files) override;
|
||||
Status GetTableFiles(const std::string &table_id,
|
||||
const std::vector<size_t> &ids,
|
||||
TableFilesSchema &table_files) override;
|
||||
|
||||
virtual Status HasNonIndexFiles(const std::string& table_id, bool& has) override;
|
||||
Status HasNonIndexFiles(const std::string &table_id, bool &has) override;
|
||||
|
||||
virtual Status UpdateTableFile(TableFileSchema& file_schema) override;
|
||||
Status UpdateTableFile(TableFileSchema &file_schema) override;
|
||||
|
||||
virtual Status UpdateTableFilesToIndex(const std::string& table_id) override;
|
||||
Status UpdateTableFilesToIndex(const std::string &table_id) override;
|
||||
|
||||
virtual Status UpdateTableFiles(TableFilesSchema& files) override;
|
||||
Status UpdateTableFiles(TableFilesSchema &files) override;
|
||||
|
||||
virtual Status FilesToSearch(const std::string& table_id,
|
||||
const DatesT& partition,
|
||||
DatePartionedTableFilesSchema& files) override;
|
||||
Status FilesToSearch(const std::string &table_id,
|
||||
const DatesT &partition,
|
||||
DatePartionedTableFilesSchema &files) override;
|
||||
|
||||
virtual Status FilesToMerge(const std::string& table_id,
|
||||
DatePartionedTableFilesSchema& files) override;
|
||||
Status FilesToMerge(const std::string &table_id,
|
||||
DatePartionedTableFilesSchema &files) override;
|
||||
|
||||
virtual Status FilesToIndex(TableFilesSchema&) override;
|
||||
Status FilesToIndex(TableFilesSchema &) override;
|
||||
|
||||
virtual Status Archive() override;
|
||||
Status Archive() override;
|
||||
|
||||
virtual Status Size(uint64_t& result) override;
|
||||
Status Size(uint64_t &result) override;
|
||||
|
||||
virtual Status CleanUp() override;
|
||||
Status CleanUp() override;
|
||||
|
||||
virtual Status CleanUpFilesWithTTL(uint16_t seconds) override;
|
||||
Status CleanUpFilesWithTTL(uint16_t seconds) override;
|
||||
|
||||
virtual Status DropAll() override;
|
||||
Status DropAll() override;
|
||||
|
||||
virtual Status Count(const std::string& table_id, uint64_t& result) override;
|
||||
Status Count(const std::string &table_id, uint64_t &result) override;
|
||||
|
||||
virtual ~MySQLMetaImpl();
|
||||
virtual ~MySQLMetaImpl();
|
||||
|
||||
private:
|
||||
Status NextFileId(std::string& file_id);
|
||||
Status NextTableId(std::string& table_id);
|
||||
Status DiscardFiles(long long to_discard_size);
|
||||
Status Initialize();
|
||||
private:
|
||||
Status NextFileId(std::string &file_id);
|
||||
Status NextTableId(std::string &table_id);
|
||||
Status DiscardFiles(long long to_discard_size);
|
||||
Status Initialize();
|
||||
|
||||
const DBMetaOptions options_;
|
||||
const int mode_;
|
||||
const DBMetaOptions options_;
|
||||
const int mode_;
|
||||
|
||||
std::shared_ptr<MySQLConnectionPool> mysql_connection_pool_;
|
||||
bool safe_grab = false;
|
||||
std::shared_ptr<MySQLConnectionPool> mysql_connection_pool_;
|
||||
bool safe_grab = false;
|
||||
|
||||
// std::mutex connectionMutex_;
|
||||
}; // DBMetaImpl
|
||||
}; // DBMetaImpl
|
||||
|
||||
} // namespace meta
|
||||
} // namespace engine
|
||||
|
@ -20,6 +20,7 @@ class ReuseCacheIndexStrategy {
|
||||
public:
|
||||
bool Schedule(const SearchContextPtr &context, std::list<ScheduleTaskPtr>& task_list) {
|
||||
if(context == nullptr) {
|
||||
ENGINE_LOG_ERROR << "Task Dispatch context doesn't exist";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -64,6 +65,7 @@ class DeleteTableStrategy {
|
||||
public:
|
||||
bool Schedule(const DeleteContextPtr &context, std::list<ScheduleTaskPtr> &task_list) {
|
||||
if (context == nullptr) {
|
||||
ENGINE_LOG_ERROR << "Task Dispatch context doesn't exist";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -103,6 +105,7 @@ public:
|
||||
bool TaskDispatchStrategy::Schedule(const ScheduleContextPtr &context_ptr,
|
||||
std::list<zilliz::milvus::engine::ScheduleTaskPtr> &task_list) {
|
||||
if(context_ptr == nullptr) {
|
||||
ENGINE_LOG_ERROR << "Task Dispatch context doesn't exist";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@ TaskScheduler& TaskScheduler::GetInstance() {
|
||||
bool
|
||||
TaskScheduler::Start() {
|
||||
if(!stopped_) {
|
||||
SERVER_LOG_INFO << "Task Scheduler isn't started";
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -47,6 +48,7 @@ TaskScheduler::Start() {
|
||||
bool
|
||||
TaskScheduler::Stop() {
|
||||
if(stopped_) {
|
||||
SERVER_LOG_INFO << "Task Scheduler already stopped";
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -80,7 +82,7 @@ TaskScheduler::TaskDispatchWorker() {
|
||||
ScheduleTaskPtr task_ptr = task_dispatch_queue_.Take();
|
||||
if(task_ptr == nullptr) {
|
||||
SERVER_LOG_INFO << "Stop db task dispatch thread";
|
||||
break;//exit
|
||||
return true;
|
||||
}
|
||||
|
||||
//execute task
|
||||
@ -98,8 +100,8 @@ TaskScheduler::TaskWorker() {
|
||||
while(true) {
|
||||
ScheduleTaskPtr task_ptr = task_queue_.Take();
|
||||
if(task_ptr == nullptr) {
|
||||
SERVER_LOG_INFO << "Stop db task thread";
|
||||
break;//exit
|
||||
SERVER_LOG_INFO << "Stop db task worker thread";
|
||||
return true;
|
||||
}
|
||||
|
||||
//execute task
|
||||
|
Loading…
Reference in New Issue
Block a user