Unverified Commit e25c5af2 authored by groot's avatar groot Committed by GitHub
Browse files

rename table to collection (#1888)



* rename table to collection

Signed-off-by: default avatargroot <yihua.mo@zilliz.com>

* rename collection

Signed-off-by: default avatargroot <yihua.mo@zilliz.com>

* rename

Signed-off-by: default avatargroot <yihua.mo@zilliz.com>

* Update change log

Signed-off-by: default avatarJinHai-CN <hai.jin@zilliz.com>

Co-authored-by: default avatarJinHai-CN <hai.jin@zilliz.com>
parent 9074366f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -680,7 +680,7 @@ Please mark all change in change log and use the issue from GitHub
-   MS-67 Fix license check bug
-   MS-76 Fix pipeline crash bug
-   MS-100 cmake: fix AWS build issue
-   MS-101 change AWS build type to Release
-   MS-101 Change AWS build type to Release

## Improvement

+5 −5
Original line number Diff line number Diff line
@@ -261,7 +261,7 @@ Config::ResetDefaultConfig() {

    /* db config */
    CONFIG_CHECK(SetDBConfigBackendUrl(CONFIG_DB_BACKEND_URL_DEFAULT));
    CONFIG_CHECK(SetDBConfigPreloadCollection(CONFIG_DB_PRELOAD_TABLE_DEFAULT));
    CONFIG_CHECK(SetDBConfigPreloadCollection(CONFIG_DB_PRELOAD_COLLECTION_DEFAULT));
    CONFIG_CHECK(SetDBConfigArchiveDiskThreshold(CONFIG_DB_ARCHIVE_DISK_THRESHOLD_DEFAULT));
    CONFIG_CHECK(SetDBConfigArchiveDaysThreshold(CONFIG_DB_ARCHIVE_DAYS_THRESHOLD_DEFAULT));
    CONFIG_CHECK(SetDBConfigAutoFlushInterval(CONFIG_DB_AUTO_FLUSH_INTERVAL_DEFAULT));
@@ -353,7 +353,7 @@ Config::SetConfigCli(const std::string& parent_key, const std::string& child_key
    } else if (parent_key == CONFIG_DB) {
        if (child_key == CONFIG_DB_BACKEND_URL) {
            status = SetDBConfigBackendUrl(value);
        } else if (child_key == CONFIG_DB_PRELOAD_TABLE) {
        } else if (child_key == CONFIG_DB_PRELOAD_COLLECTION) {
            status = SetDBConfigPreloadCollection(value);
        } else if (child_key == CONFIG_DB_AUTO_FLUSH_INTERVAL) {
            status = SetDBConfigAutoFlushInterval(value);
@@ -795,7 +795,7 @@ Config::CheckDBConfigPreloadCollection(const std::string& value) {
        bool exist = false;
        auto status = DBWrapper::DB()->HasNativeCollection(collection, exist);
        if (!(status.ok() && exist)) {
            return Status(SERVER_TABLE_NOT_EXIST, "Collection " + collection + " not exist");
            return Status(SERVER_COLLECTION_NOT_EXIST, "Collection " + collection + " not exist");
        }
        table_set.insert(collection);
    }
@@ -1503,7 +1503,7 @@ Config::GetDBConfigArchiveDaysThreshold(int64_t& value) {

Status
Config::GetDBConfigPreloadCollection(std::string& value) {
    value = GetConfigStr(CONFIG_DB, CONFIG_DB_PRELOAD_TABLE);
    value = GetConfigStr(CONFIG_DB, CONFIG_DB_PRELOAD_COLLECTION);
    return Status::OK();
}

@@ -1856,7 +1856,7 @@ Status
Config::SetDBConfigPreloadCollection(const std::string& value) {
    CONFIG_CHECK(CheckDBConfigPreloadCollection(value));
    std::string cor_value = value == "*" ? "\'*\'" : value;
    return SetConfigValueInMem(CONFIG_DB, CONFIG_DB_PRELOAD_TABLE, cor_value);
    return SetConfigValueInMem(CONFIG_DB, CONFIG_DB_PRELOAD_COLLECTION, cor_value);
}

Status
+2 −2
Original line number Diff line number Diff line
@@ -57,8 +57,8 @@ static const char* CONFIG_DB_ARCHIVE_DISK_THRESHOLD = "archive_disk_threshold";
static const char* CONFIG_DB_ARCHIVE_DISK_THRESHOLD_DEFAULT = "0";
static const char* CONFIG_DB_ARCHIVE_DAYS_THRESHOLD = "archive_days_threshold";
static const char* CONFIG_DB_ARCHIVE_DAYS_THRESHOLD_DEFAULT = "0";
static const char* CONFIG_DB_PRELOAD_TABLE = "preload_table";
static const char* CONFIG_DB_PRELOAD_TABLE_DEFAULT = "";
static const char* CONFIG_DB_PRELOAD_COLLECTION = "preload_table";
static const char* CONFIG_DB_PRELOAD_COLLECTION_DEFAULT = "";
static const char* CONFIG_DB_AUTO_FLUSH_INTERVAL = "auto_flush_interval";
static const char* CONFIG_DB_AUTO_FLUSH_INTERVAL_DEFAULT = "1";

+8 −8
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ ConstructParentFolder(const std::string& db_path, const meta::SegmentSchema& tab
}

static std::string
GetTableFileParentFolder(const DBMetaOptions& options, const meta::SegmentSchema& table_file) {
GetCollectionFileParentFolder(const DBMetaOptions& options, const meta::SegmentSchema& table_file) {
    uint64_t path_count = options.slave_paths_.size() + 1;
    std::string target_path = options.path_;
    uint64_t index = 0;
@@ -102,7 +102,7 @@ CreateCollectionPath(const DBMetaOptions& options, const std::string& collection
}

Status
DeleteTablePath(const DBMetaOptions& options, const std::string& collection_id, bool force) {
DeleteCollectionPath(const DBMetaOptions& options, const std::string& collection_id, bool force) {
    std::vector<std::string> paths = options.slave_paths_;
    paths.push_back(options.path_);

@@ -136,7 +136,7 @@ DeleteTablePath(const DBMetaOptions& options, const std::string& collection_id,

Status
CreateCollectionFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_file) {
    std::string parent_path = GetTableFileParentFolder(options, table_file);
    std::string parent_path = GetCollectionFileParentFolder(options, table_file);

    auto status = server::CommonUtil::CreateDirectory(parent_path);
    fiu_do_on("CreateCollectionFilePath.fail_create", status = Status(DB_INVALID_PATH, ""));
@@ -151,14 +151,14 @@ CreateCollectionFilePath(const DBMetaOptions& options, meta::SegmentSchema& tabl
}

Status
GetTableFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_file) {
GetCollectionFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_file) {
    std::string parent_path = ConstructParentFolder(options.path_, table_file);
    std::string file_path = parent_path + "/" + table_file.file_id_;

    bool s3_enable = false;
    server::Config& config = server::Config::GetInstance();
    config.GetStorageConfigS3Enable(s3_enable);
    fiu_do_on("GetTableFilePath.enable_s3", s3_enable = true);
    fiu_do_on("GetCollectionFilePath.enable_s3", s3_enable = true);
    if (s3_enable) {
        /* need not check file existence */
        table_file.location_ = file_path;
@@ -188,15 +188,15 @@ GetTableFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_file)
}

Status
DeleteTableFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_file) {
    utils::GetTableFilePath(options, table_file);
DeleteCollectionFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_file) {
    utils::GetCollectionFilePath(options, table_file);
    boost::filesystem::remove(table_file.location_);
    return Status::OK();
}

Status
DeleteSegment(const DBMetaOptions& options, meta::SegmentSchema& table_file) {
    utils::GetTableFilePath(options, table_file);
    utils::GetCollectionFilePath(options, table_file);
    std::string segment_dir;
    GetParentPath(table_file.location_, segment_dir);
    boost::filesystem::remove_all(segment_dir);
+3 −3
Original line number Diff line number Diff line
@@ -28,14 +28,14 @@ GetMicroSecTimeStamp();
Status
CreateCollectionPath(const DBMetaOptions& options, const std::string& collection_id);
Status
DeleteTablePath(const DBMetaOptions& options, const std::string& collection_id, bool force = true);
DeleteCollectionPath(const DBMetaOptions& options, const std::string& collection_id, bool force = true);

Status
CreateCollectionFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_file);
Status
GetTableFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_file);
GetCollectionFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_file);
Status
DeleteTableFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_file);
DeleteCollectionFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_file);
Status
DeleteSegment(const DBMetaOptions& options, meta::SegmentSchema& table_file);

Loading