未验证 提交 e25c5af2 编写于 作者: G groot 提交者: GitHub

rename table to collection (#1888)

* rename table to collection
Signed-off-by: Ngroot <yihua.mo@zilliz.com>

* rename collection
Signed-off-by: Ngroot <yihua.mo@zilliz.com>

* rename
Signed-off-by: Ngroot <yihua.mo@zilliz.com>

* Update change log
Signed-off-by: NJinHai-CN <hai.jin@zilliz.com>
Co-authored-by: NJinHai-CN <hai.jin@zilliz.com>
上级 9074366f
......@@ -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
......
......@@ -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
......
......@@ -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";
......
......@@ -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);
......
......@@ -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);
......
......@@ -122,7 +122,7 @@ MemTable::Serialize(uint64_t wal_lsn, bool apply_delete) {
}
// Update flush lsn
auto status = meta_->UpdateTableFlushLSN(collection_id_, wal_lsn);
auto status = meta_->UpdateCollectionFlushLSN(collection_id_, wal_lsn);
if (!status.ok()) {
std::string err_msg = "Failed to write flush lsn to meta: " + status.ToString();
ENGINE_LOG_ERROR << err_msg;
......
......@@ -58,7 +58,7 @@ class Meta {
UpdateCollectionFlag(const std::string& collection_id, int64_t flag) = 0;
virtual Status
UpdateTableFlushLSN(const std::string& collection_id, uint64_t flush_lsn) = 0;
UpdateCollectionFlushLSN(const std::string& collection_id, uint64_t flush_lsn) = 0;
virtual Status
GetCollectionFlushLSN(const std::string& collection_id, uint64_t& flush_lsn) = 0;
......@@ -67,13 +67,14 @@ class Meta {
DropCollection(const std::string& collection_id) = 0;
virtual Status
DeleteTableFiles(const std::string& collection_id) = 0;
DeleteCollectionFiles(const std::string& collection_id) = 0;
virtual Status
CreateCollectionFile(SegmentSchema& file_schema) = 0;
virtual Status
GetTableFiles(const std::string& collection_id, const std::vector<size_t>& ids, SegmentsSchema& table_files) = 0;
GetCollectionFiles(const std::string& collection_id, const std::vector<size_t>& ids,
SegmentsSchema& table_files) = 0;
virtual Status
GetCollectionFilesBySegmentId(const std::string& segment_id, SegmentsSchema& table_files) = 0;
......
此差异已折叠。
......@@ -32,32 +32,32 @@ class MySQLMetaImpl : public Meta {
~MySQLMetaImpl();
Status
CreateCollection(CollectionSchema& table_schema) override;
CreateCollection(CollectionSchema& collection_schema) override;
Status
DescribeCollection(CollectionSchema& table_schema) override;
DescribeCollection(CollectionSchema& collection_schema) override;
Status
HasCollection(const std::string& collection_id, bool& has_or_not) override;
Status
AllCollections(std::vector<CollectionSchema>& table_schema_array) override;
AllCollections(std::vector<CollectionSchema>& collection_schema_array) override;
Status
DropCollection(const std::string& collection_id) override;
Status
DeleteTableFiles(const std::string& collection_id) override;
DeleteCollectionFiles(const std::string& collection_id) override;
Status
CreateCollectionFile(SegmentSchema& file_schema) override;
Status
GetTableFiles(const std::string& collection_id, const std::vector<size_t>& ids,
SegmentsSchema& table_files) override;
GetCollectionFiles(const std::string& collection_id, const std::vector<size_t>& ids,
SegmentsSchema& collection_files) override;
Status
GetCollectionFilesBySegmentId(const std::string& segment_id, SegmentsSchema& table_files) override;
GetCollectionFilesBySegmentId(const std::string& segment_id, SegmentsSchema& collection_files) override;
Status
UpdateCollectionIndex(const std::string& collection_id, const CollectionIndex& index) override;
......@@ -66,7 +66,7 @@ class MySQLMetaImpl : public Meta {
UpdateCollectionFlag(const std::string& collection_id, int64_t flag) override;
Status
UpdateTableFlushLSN(const std::string& collection_id, uint64_t flush_lsn) override;
UpdateCollectionFlushLSN(const std::string& collection_id, uint64_t flush_lsn) override;
Status
GetCollectionFlushLSN(const std::string& collection_id, uint64_t& flush_lsn) override;
......@@ -116,7 +116,7 @@ class MySQLMetaImpl : public Meta {
FilesByType(const std::string& collection_id, const std::vector<int>& file_types, SegmentsSchema& files) override;
Status
FilesByID(const std::vector<size_t>& ids, SegmentsSchema& table_files) override;
FilesByID(const std::vector<size_t>& ids, SegmentsSchema& collection_files) override;
Status
Archive() override;
......@@ -146,7 +146,7 @@ class MySQLMetaImpl : public Meta {
Status
NextFileId(std::string& file_id);
Status
NextTableId(std::string& collection_id);
NextCollectionId(std::string& collection_id);
Status
DiscardFiles(int64_t to_discard_size);
......
此差异已折叠。
......@@ -31,32 +31,32 @@ class SqliteMetaImpl : public Meta {
~SqliteMetaImpl();
Status
CreateCollection(CollectionSchema& table_schema) override;
CreateCollection(CollectionSchema& collection_schema) override;
Status
DescribeCollection(CollectionSchema& table_schema) override;
DescribeCollection(CollectionSchema& collection_schema) override;
Status
HasCollection(const std::string& collection_id, bool& has_or_not) override;
Status
AllCollections(std::vector<CollectionSchema>& table_schema_array) override;
AllCollections(std::vector<CollectionSchema>& collection_schema_array) override;
Status
DropCollection(const std::string& collection_id) override;
Status
DeleteTableFiles(const std::string& collection_id) override;
DeleteCollectionFiles(const std::string& collection_id) override;
Status
CreateCollectionFile(SegmentSchema& file_schema) override;
Status
GetTableFiles(const std::string& collection_id, const std::vector<size_t>& ids,
SegmentsSchema& table_files) override;
GetCollectionFiles(const std::string& collection_id, const std::vector<size_t>& ids,
SegmentsSchema& collection_files) override;
Status
GetCollectionFilesBySegmentId(const std::string& segment_id, SegmentsSchema& table_files) override;
GetCollectionFilesBySegmentId(const std::string& segment_id, SegmentsSchema& collection_files) override;
Status
UpdateCollectionIndex(const std::string& collection_id, const CollectionIndex& index) override;
......@@ -65,7 +65,7 @@ class SqliteMetaImpl : public Meta {
UpdateCollectionFlag(const std::string& collection_id, int64_t flag) override;
Status
UpdateTableFlushLSN(const std::string& collection_id, uint64_t flush_lsn) override;
UpdateCollectionFlushLSN(const std::string& collection_id, uint64_t flush_lsn) override;
Status
GetCollectionFlushLSN(const std::string& collection_id, uint64_t& flush_lsn) override;
......@@ -145,7 +145,7 @@ class SqliteMetaImpl : public Meta {
Status
NextFileId(std::string& file_id);
Status
NextTableId(std::string& collection_id);
NextCollectionId(std::string& collection_id);
Status
DiscardFiles(int64_t to_discard_size);
......
......@@ -61,21 +61,21 @@ static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] =
const char descriptor_table_protodef_status_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
"\n\014status.proto\022\013milvus.grpc\"D\n\006Status\022*\n"
"\nerror_code\030\001 \001(\0162\026.milvus.grpc.ErrorCod"
"e\022\016\n\006reason\030\002 \001(\t*\230\004\n\tErrorCode\022\013\n\007SUCCE"
"e\022\016\n\006reason\030\002 \001(\t*\242\004\n\tErrorCode\022\013\n\007SUCCE"
"SS\020\000\022\024\n\020UNEXPECTED_ERROR\020\001\022\022\n\016CONNECT_FA"
"ILED\020\002\022\025\n\021PERMISSION_DENIED\020\003\022\024\n\020TABLE_N"
"OT_EXISTS\020\004\022\024\n\020ILLEGAL_ARGUMENT\020\005\022\025\n\021ILL"
"EGAL_DIMENSION\020\007\022\026\n\022ILLEGAL_INDEX_TYPE\020\010"
"\022\026\n\022ILLEGAL_TABLE_NAME\020\t\022\020\n\014ILLEGAL_TOPK"
"\020\n\022\025\n\021ILLEGAL_ROWRECORD\020\013\022\025\n\021ILLEGAL_VEC"
"TOR_ID\020\014\022\031\n\025ILLEGAL_SEARCH_RESULT\020\r\022\022\n\016F"
"ILE_NOT_FOUND\020\016\022\017\n\013META_FAILED\020\017\022\020\n\014CACH"
"E_FAILED\020\020\022\030\n\024CANNOT_CREATE_FOLDER\020\021\022\026\n\022"
"CANNOT_CREATE_FILE\020\022\022\030\n\024CANNOT_DELETE_FO"
"LDER\020\023\022\026\n\022CANNOT_DELETE_FILE\020\024\022\025\n\021BUILD_"
"INDEX_ERROR\020\025\022\021\n\rILLEGAL_NLIST\020\026\022\027\n\023ILLE"
"GAL_METRIC_TYPE\020\027\022\021\n\rOUT_OF_MEMORY\020\030b\006pr"
"oto3"
"ILED\020\002\022\025\n\021PERMISSION_DENIED\020\003\022\031\n\025COLLECT"
"ION_NOT_EXISTS\020\004\022\024\n\020ILLEGAL_ARGUMENT\020\005\022\025"
"\n\021ILLEGAL_DIMENSION\020\007\022\026\n\022ILLEGAL_INDEX_T"
"YPE\020\010\022\033\n\027ILLEGAL_COLLECTION_NAME\020\t\022\020\n\014IL"
"LEGAL_TOPK\020\n\022\025\n\021ILLEGAL_ROWRECORD\020\013\022\025\n\021I"
"LLEGAL_VECTOR_ID\020\014\022\031\n\025ILLEGAL_SEARCH_RES"
"ULT\020\r\022\022\n\016FILE_NOT_FOUND\020\016\022\017\n\013META_FAILED"
"\020\017\022\020\n\014CACHE_FAILED\020\020\022\030\n\024CANNOT_CREATE_FO"
"LDER\020\021\022\026\n\022CANNOT_CREATE_FILE\020\022\022\030\n\024CANNOT"
"_DELETE_FOLDER\020\023\022\026\n\022CANNOT_DELETE_FILE\020\024"
"\022\025\n\021BUILD_INDEX_ERROR\020\025\022\021\n\rILLEGAL_NLIST"
"\020\026\022\027\n\023ILLEGAL_METRIC_TYPE\020\027\022\021\n\rOUT_OF_ME"
"MORY\020\030b\006proto3"
;
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_status_2eproto_deps[1] = {
};
......@@ -85,7 +85,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_sta
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_status_2eproto_once;
static bool descriptor_table_status_2eproto_initialized = false;
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_status_2eproto = {
&descriptor_table_status_2eproto_initialized, descriptor_table_protodef_status_2eproto, "status.proto", 644,
&descriptor_table_status_2eproto_initialized, descriptor_table_protodef_status_2eproto, "status.proto", 654,
&descriptor_table_status_2eproto_once, descriptor_table_status_2eproto_sccs, descriptor_table_status_2eproto_deps, 1, 0,
schemas, file_default_instances, TableStruct_status_2eproto::offsets,
file_level_metadata_status_2eproto, 1, file_level_enum_descriptors_status_2eproto, file_level_service_descriptors_status_2eproto,
......
......@@ -73,11 +73,11 @@ enum ErrorCode : int {
UNEXPECTED_ERROR = 1,
CONNECT_FAILED = 2,
PERMISSION_DENIED = 3,
TABLE_NOT_EXISTS = 4,
COLLECTION_NOT_EXISTS = 4,
ILLEGAL_ARGUMENT = 5,
ILLEGAL_DIMENSION = 7,
ILLEGAL_INDEX_TYPE = 8,
ILLEGAL_TABLE_NAME = 9,
ILLEGAL_COLLECTION_NAME = 9,
ILLEGAL_TOPK = 10,
ILLEGAL_ROWRECORD = 11,
ILLEGAL_VECTOR_ID = 12,
......
......@@ -13,27 +13,27 @@ message KeyValuePair {
}
/**
* @brief Table name
* @brief Collection name
*/
message TableName {
string table_name = 1;
message CollectionName {
string collection_name = 1;
}
/**
* @brief Table name list
* @brief Collection name list
*/
message TableNameList {
message CollectionNameList {
Status status = 1;
repeated string table_names = 2;
repeated string collection_names = 2;
}
/**
* @brief Table schema
* @brief Collection schema
* metric_type: 1-L2, 2-IP
*/
message TableSchema {
message CollectionSchema {
Status status = 1;
string table_name = 2;
string collection_name = 2;
int64 dimension = 3;
int64 index_file_size = 4;
int32 metric_type = 5;
......@@ -44,7 +44,7 @@ message TableSchema {
* @brief Params of partition
*/
message PartitionParam {
string table_name = 1;
string collection_name = 1;
string tag = 2;
}
......@@ -68,7 +68,7 @@ message RowRecord {
* @brief Params to be inserted
*/
message InsertParam {
string table_name = 1;
string collection_name = 1;
repeated RowRecord row_record_array = 2;
repeated int64 row_id_array = 3; //optional
string partition_tag = 4;
......@@ -87,7 +87,7 @@ message VectorIds {
* @brief Params for searching vector
*/
message SearchParam {
string table_name = 1;
string collection_name = 1;
repeated string partition_tag_array = 2;
repeated RowRecord query_record_array = 3;
int64 topk = 4;
......@@ -106,7 +106,7 @@ message SearchInFilesParam {
* @brief Params for searching vector by ID
*/
message SearchByIDParam {
string table_name = 1;
string collection_name = 1;
repeated string partition_tag_array = 2;
int64 id = 3;
int64 topk = 4;
......@@ -140,11 +140,11 @@ message BoolReply {
}
/**
* @brief Return table row count
* @brief Return collection row count
*/
message TableRowCount {
message CollectionRowCount {
Status status = 1;
int64 table_row_count = 2;
int64 collection_row_count = 2;
}
/**
......@@ -160,7 +160,7 @@ message Command {
*/
message IndexParam {
Status status = 1;
string table_name = 2;
string collection_name = 2;
int32 index_type = 3;
repeated KeyValuePair extra_params = 4;
}
......@@ -169,14 +169,14 @@ message IndexParam {
* @brief Flush params
*/
message FlushParam {
repeated string table_name_array = 1;
repeated string collection_name_array = 1;
}
/**
* @brief Flush params
*/
message DeleteByIDParam {
string table_name = 1;
string collection_name = 1;
repeated int64 id_array = 2;
}
......@@ -191,7 +191,7 @@ message SegmentStat {
}
/**
* @brief table statistics
* @brief collection statistics
*/
message PartitionStat {
string tag = 1;
......@@ -200,9 +200,9 @@ message PartitionStat {
}
/**
* @brief table information
* @brief collection information
*/
message TableInfo {
message CollectionInfo {
Status status = 1;
int64 total_row_count = 2;
repeated PartitionStat partitions_stat = 3;
......@@ -212,7 +212,7 @@ message TableInfo {
* @brief vector identity
*/
message VectorIdentity {
string table_name = 1;
string collection_name = 1;
int64 id = 2;
}
......@@ -228,76 +228,76 @@ message VectorData {
* @brief get vector ids from a segment parameters
*/
message GetVectorIDsParam {
string table_name = 1;
string collection_name = 1;
string segment_name = 2;
}
service MilvusService {
/**
* @brief This method is used to create table
* @brief This method is used to create collection
*
* @param TableSchema, use to provide table information to be created.
* @param CollectionSchema, use to provide collection information to be created.
*
* @return Status
*/
rpc CreateTable(TableSchema) returns (Status){}
rpc CreateCollection(CollectionSchema) returns (Status){}
/**
* @brief This method is used to test table existence.
* @brief This method is used to test collection existence.
*
* @param TableName, table name is going to be tested.
* @param CollectionName, collection name is going to be tested.
*
* @return BoolReply
*/
rpc HasTable(TableName) returns (BoolReply) {}
rpc HasCollection(CollectionName) returns (BoolReply) {}
/**
* @brief This method is used to get table schema.
* @brief This method is used to get collection schema.
*
* @param TableName, target table name.
* @param CollectionName, target collection name.
*
* @return TableSchema
* @return CollectionSchema
*/
rpc DescribeTable(TableName) returns (TableSchema) {}
rpc DescribeCollection(CollectionName) returns (CollectionSchema) {}
/**
* @brief This method is used to get table schema.
* @brief This method is used to get collection schema.
*
* @param TableName, target table name.
* @param CollectionName, target collection name.
*
* @return TableRowCount
* @return CollectionRowCount
*/
rpc CountTable(TableName) returns (TableRowCount) {}
rpc CountCollection(CollectionName) returns (CollectionRowCount) {}
/**
* @brief This method is used to list all tables.
* @brief This method is used to list all collections.
*
* @param Command, dummy parameter.
*
* @return TableNameList
* @return CollectionNameList
*/
rpc ShowTables(Command) returns (TableNameList) {}
rpc ShowCollections(Command) returns (CollectionNameList) {}
/**
* @brief This method is used to get table detail information.
* @brief This method is used to get collection detail information.
*
* @param TableName, target table name.
* @param CollectionName, target collection name.
*
* @return TableInfo
* @return CollectionInfo
*/
rpc ShowTableInfo(TableName) returns (TableInfo) {}
rpc ShowCollectionInfo(CollectionName) returns (CollectionInfo) {}
/**
* @brief This method is used to delete table.
* @brief This method is used to delete collection.
*
* @param TableName, table name is going to be deleted.
* @param CollectionName, collection name is going to be deleted.
*
* @return TableNameList
* @return CollectionNameList
*/
rpc DropTable(TableName) returns (Status) {}
rpc DropCollection(CollectionName) returns (Status) {}
/**
* @brief This method is used to build index by table in sync mode.
* @brief This method is used to build index by collection in sync mode.
*
* @param IndexParam, index paramters.
*
......@@ -308,20 +308,20 @@ service MilvusService {
/**
* @brief This method is used to describe index
*
* @param TableName, target table name.
* @param CollectionName, target collection name.
*
* @return IndexParam
*/
rpc DescribeIndex(TableName) returns (IndexParam) {}
rpc DescribeIndex(CollectionName) returns (IndexParam) {}
/**
* @brief This method is used to drop index
*
* @param TableName, target table name.
* @param CollectionName, target collection name.
*
* @return Status
*/
rpc DropIndex(TableName) returns (Status) {}
rpc DropIndex(CollectionName) returns (Status) {}
/**
* @brief This method is used to create partition
......@@ -335,11 +335,11 @@ service MilvusService {
/**
* @brief This method is used to show partition information
*
* @param TableName, target table name.
* @param CollectionName, target collection name.
*
* @return PartitionList
*/
rpc ShowPartitions(TableName) returns (PartitionList) {}
rpc ShowPartitions(CollectionName) returns (PartitionList) {}
/**
* @brief This method is used to drop partition
......@@ -351,7 +351,7 @@ service MilvusService {
rpc DropPartition(PartitionParam) returns (Status) {}
/**
* @brief This method is used to add vector array to table.
* @brief This method is used to add vector array to collection.
*
* @param InsertParam, insert parameters.
*
......@@ -371,14 +371,14 @@ service MilvusService {
/**
* @brief This method is used to get vector ids from a segment
*
* @param GetVectorIDsParam, target table and segment
* @param GetVectorIDsParam, target collection and segment
*
* @return VectorIds
*/
rpc GetVectorIDs(GetVectorIDsParam) returns (VectorIds) {}
/**
* @brief This method is used to query vector in table.
* @brief This method is used to query vector in collection.
*
* @param SearchParam, search parameters.
*
......@@ -423,13 +423,13 @@ service MilvusService {
rpc DeleteByID(DeleteByIDParam) returns (Status) {}
/**
* @brief This method is used to preload table
* @brief This method is used to preload collection
*
* @param TableName, target table name.
* @param CollectionName, target collection name.
*
* @return Status
*/
rpc PreloadTable(TableName) returns (Status) {}
rpc PreloadCollection(CollectionName) returns (Status) {}
/**
* @brief This method is used to flush buffer into storage.
......@@ -441,11 +441,11 @@ service MilvusService {
rpc Flush(FlushParam) returns (Status) {}
/**
* @brief This method is used to compact table
* @brief This method is used to compact collection
*
* @param TableName, target table name.
* @param CollectionName, target collection name.
*
* @return Status
*/
rpc Compact(TableName) returns (Status) {}
rpc Compact(CollectionName) returns (Status) {}
}
......@@ -7,11 +7,11 @@ enum ErrorCode {
UNEXPECTED_ERROR = 1;
CONNECT_FAILED = 2;
PERMISSION_DENIED = 3;
TABLE_NOT_EXISTS = 4;
COLLECTION_NOT_EXISTS = 4;
ILLEGAL_ARGUMENT = 5;
ILLEGAL_DIMENSION = 7;
ILLEGAL_INDEX_TYPE = 8;
ILLEGAL_TABLE_NAME = 9;
ILLEGAL_COLLECTION_NAME = 9;
ILLEGAL_TOPK = 10;
ILLEGAL_ROWRECORD = 11;
ILLEGAL_VECTOR_ID = 12;
......
......@@ -27,7 +27,7 @@ void
DeleteJob::WaitAndDelete() {
std::unique_lock<std::mutex> lock(mutex_);
cv_.wait(lock, [&] { return done_resource == num_resource_; });
meta_ptr_->DeleteTableFiles(collection_id_);
meta_ptr_->DeleteCollectionFiles(collection_id_);
}
void
......
......@@ -130,7 +130,7 @@ BaseRequest::set_status(const Status& status) {
}
std::string
BaseRequest::TableNotExistMsg(const std::string& collection_name) {
BaseRequest::CollectionNotExistMsg(const std::string& collection_name) {
return "Collection " + collection_name +
" does not exist. Use milvus.has_collection to verify whether the collection exists. "
"You also can check whether the collection name exists.";
......
......@@ -209,7 +209,7 @@ class BaseRequest {
OnPostExecute();
std::string
TableNotExistMsg(const std::string& collection_name);
CollectionNotExistMsg(const std::string& collection_name);
protected:
const std::shared_ptr<milvus::server::Context> context_;
......
......@@ -49,18 +49,18 @@ CompactRequest::OnExecute() {
}
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......
......@@ -46,18 +46,18 @@ CountCollectionRequest::OnExecute() {
}
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......@@ -71,7 +71,7 @@ CountCollectionRequest::OnExecute() {
fiu_do_on("CountCollectionRequest.OnExecute.throw_std_exception", throw std::exception());
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
......
......@@ -93,13 +93,13 @@ CreateCollectionRequest::OnExecute() {
// step 3: create collection
status = DBWrapper::DB()->CreateCollection(collection_info);
fiu_do_on("CreateCollectionRequest.OnExecute.db_already_exist", status = Status(milvus::DB_ALREADY_EXIST, ""));
fiu_do_on("CreateCollectionRequest.OnExecute.create_table_fail",
fiu_do_on("CreateCollectionRequest.OnExecute.create_collection_fail",
status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
fiu_do_on("CreateCollectionRequest.OnExecute.throw_std_exception", throw std::exception());
if (!status.ok()) {
// collection could exist
if (status.code() == DB_ALREADY_EXIST) {
return Status(SERVER_INVALID_TABLE_NAME, status.message());
return Status(SERVER_INVALID_COLLECTION_NAME, status.message());
}
return status;
}
......
......@@ -52,21 +52,21 @@ CreateIndexRequest::OnExecute() {
}
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
fiu_do_on("CreateIndexRequest.OnExecute.not_has_collection",
status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
fiu_do_on("CreateIndexRequest.OnExecute.throw_std.exception", throw std::exception());
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......@@ -75,7 +75,7 @@ CreateIndexRequest::OnExecute() {
return status;
}
status = ValidationUtil::ValidateIndexParams(json_params_, table_schema, index_type_);
status = ValidationUtil::ValidateIndexParams(json_params_, collection_schema, index_type_);
if (!status.ok()) {
return status;
}
......
......@@ -41,7 +41,7 @@ CreatePartitionRequest::OnExecute() {
try {
// step 1: check arguments
auto status = ValidationUtil::ValidateCollectionName(collection_name_);
fiu_do_on("CreatePartitionRequest.OnExecute.invalid_table_name",
fiu_do_on("CreatePartitionRequest.OnExecute.invalid_collection_name",
status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
if (!status.ok()) {
return status;
......@@ -59,20 +59,20 @@ CreatePartitionRequest::OnExecute() {
}
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
fiu_do_on("CreatePartitionRequest.OnExecute.invalid_partition_tags",
status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......@@ -87,7 +87,7 @@ CreatePartitionRequest::OnExecute() {
if (!status.ok()) {
// partition could exist
if (status.code() == DB_ALREADY_EXIST) {
return Status(SERVER_INVALID_TABLE_NAME, status.message());
return Status(SERVER_INVALID_COLLECTION_NAME, status.message());
}
return status;
}
......
......@@ -52,26 +52,26 @@ DeleteByIDRequest::OnExecute() {
}
// step 2: check collection existence
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
// Check collection's index type supports delete
if (table_schema.engine_type_ == (int32_t)engine::EngineType::SPTAG_BKT ||
table_schema.engine_type_ == (int32_t)engine::EngineType::SPTAG_KDT) {
if (collection_schema.engine_type_ == (int32_t)engine::EngineType::SPTAG_BKT ||
collection_schema.engine_type_ == (int32_t)engine::EngineType::SPTAG_KDT) {
std::string err_msg =
"Index type " + std::to_string(table_schema.engine_type_) + " does not support delete operation";
"Index type " + std::to_string(collection_schema.engine_type_) + " does not support delete operation";
SERVER_LOG_ERROR << err_msg;
return Status(SERVER_UNSUPPORTED_ERROR, err_msg);
}
......
......@@ -46,28 +46,28 @@ DescribeCollectionRequest::OnExecute() {
// step 2: get collection info
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
fiu_do_on("DescribeCollectionRequest.OnExecute.describe_table_fail",
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
fiu_do_on("DescribeCollectionRequest.OnExecute.describe_collection_fail",
status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
fiu_do_on("DescribeCollectionRequest.OnExecute.throw_std_exception", throw std::exception());
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
schema_.collection_name_ = table_schema.collection_id_;
schema_.dimension_ = static_cast<int64_t>(table_schema.dimension_);
schema_.index_file_size_ = table_schema.index_file_size_;
schema_.metric_type_ = table_schema.metric_type_;
schema_.collection_name_ = collection_schema.collection_id_;
schema_.dimension_ = static_cast<int64_t>(collection_schema.dimension_);
schema_.index_file_size_ = collection_schema.index_file_size_;
schema_.metric_type_ = collection_schema.metric_type_;
} catch (std::exception& ex) {
return Status(SERVER_UNEXPECTED_ERROR, ex.what());
}
......
......@@ -46,18 +46,18 @@ DescribeIndexRequest::OnExecute() {
}
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......
......@@ -47,22 +47,22 @@ DropCollectionRequest::OnExecute() {
// step 2: check collection existence
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
fiu_do_on("DropCollectionRequest.OnExecute.db_not_found", status = Status(milvus::DB_NOT_FOUND, ""));
fiu_do_on("DropCollectionRequest.OnExecute.describe_table_fail",
fiu_do_on("DropCollectionRequest.OnExecute.describe_collection_fail",
status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
fiu_do_on("DropCollectionRequest.OnExecute.throw_std_exception", throw std::exception());
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......@@ -70,7 +70,7 @@ DropCollectionRequest::OnExecute() {
// step 3: Drop collection
status = DBWrapper::DB()->DropCollection(collection_name_);
fiu_do_on("DropCollectionRequest.OnExecute.drop_table_fail",
fiu_do_on("DropCollectionRequest.OnExecute.drop_collection_fail",
status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
if (!status.ok()) {
return status;
......
......@@ -45,19 +45,20 @@ DropIndexRequest::OnExecute() {
}
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
fiu_do_on("DropIndexRequest.OnExecute.table_not_exist", status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
fiu_do_on("DropIndexRequest.OnExecute.collection_not_exist",
status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......
......@@ -43,7 +43,7 @@ DropPartitionRequest::OnExecute() {
// step 1: check collection name
auto status = ValidationUtil::ValidateCollectionName(collection_name);
fiu_do_on("DropPartitionRequest.OnExecute.invalid_table_name",
fiu_do_on("DropPartitionRequest.OnExecute.invalid_collection_name",
status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
if (!status.ok()) {
return status;
......@@ -53,7 +53,7 @@ DropPartitionRequest::OnExecute() {
if (partition_tag == milvus::engine::DEFAULT_PARTITON_TAG) {
std::string msg = "Default partition cannot be dropped.";
SERVER_LOG_ERROR << msg;
return Status(SERVER_INVALID_TABLE_NAME, msg);
return Status(SERVER_INVALID_COLLECTION_NAME, msg);
}
status = ValidationUtil::ValidatePartitionTags({partition_tag});
......@@ -63,18 +63,18 @@ DropPartitionRequest::OnExecute() {
// step 3: check collection
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......
......@@ -39,7 +39,7 @@ FlushRequest::Create(const std::shared_ptr<milvus::server::Context>& context,
Status
FlushRequest::OnExecute() {
std::string hdr = "FlushRequest flush tables: ";
std::string hdr = "FlushRequest flush collections: ";
for (auto& name : collection_names_) {
hdr += name;
hdr += ", ";
......@@ -51,18 +51,18 @@ FlushRequest::OnExecute() {
for (auto& name : collection_names_) {
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = name;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = name;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(name));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(name));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(name));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(name));
}
}
......
......@@ -60,18 +60,18 @@ GetVectorByIDRequest::OnExecute() {
}
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......
......@@ -55,18 +55,18 @@ GetVectorIDsRequest::OnExecute() {
}
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......
......@@ -46,16 +46,16 @@ HasCollectionRequest::OnExecute() {
return status;
}
// step 2: check table existence
// step 2: check collection existence
status = DBWrapper::DB()->HasNativeCollection(collection_name_, has_collection_);
fiu_do_on("HasCollectionRequest.OnExecute.throw_std_exception", throw std::exception());
// only process root collection, ignore partition collection
if (has_collection_) {
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
if (!table_schema.owner_collection_.empty()) {
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
if (!collection_schema.owner_collection_.empty()) {
has_collection_ = false;
}
}
......
......@@ -77,25 +77,26 @@ InsertRequest::OnExecute() {
// step 2: check collection existence
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
fiu_do_on("InsertRequest.OnExecute.db_not_found", status = Status(milvus::DB_NOT_FOUND, ""));
fiu_do_on("InsertRequest.OnExecute.describe_table_fail", status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
fiu_do_on("InsertRequest.OnExecute.describe_collection_fail",
status = Status(milvus::SERVER_UNEXPECTED_ERROR, ""));
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
SERVER_LOG_ERROR << LogOut("[%s][%ld] Collection %s not found", "insert", 0, collection_name_.c_str());
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
SERVER_LOG_ERROR << LogOut("[%s][%ld] Describe collection %s fail: %s", "insert", 0,
collection_name_.c_str(), status.message().c_str());
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
if (!collection_schema.owner_collection_.empty()) {
SERVER_LOG_ERROR << LogOut("[%s][%ld] owner collection of %s is empty", "insert", 0,
collection_name_.c_str());
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......@@ -103,18 +104,18 @@ InsertRequest::OnExecute() {
// all user provide id, or all internal id
bool user_provide_ids = !vectors_data_.id_array_.empty();
fiu_do_on("InsertRequest.OnExecute.illegal_vector_id", user_provide_ids = false;
table_schema.flag_ = engine::meta::FLAG_MASK_HAS_USERID);
collection_schema.flag_ = engine::meta::FLAG_MASK_HAS_USERID);
// user already provided id before, all insert action require user id
if ((table_schema.flag_ & engine::meta::FLAG_MASK_HAS_USERID) != 0 && !user_provide_ids) {
if ((collection_schema.flag_ & engine::meta::FLAG_MASK_HAS_USERID) != 0 && !user_provide_ids) {
std::string msg = "Entities IDs are user-defined. Please provide IDs for all entities of the collection.";
SERVER_LOG_ERROR << LogOut("[%s][%ld] %s", "insert", 0, msg.c_str());
return Status(SERVER_ILLEGAL_VECTOR_ID, msg);
}
fiu_do_on("InsertRequest.OnExecute.illegal_vector_id2", user_provide_ids = true;
table_schema.flag_ = engine::meta::FLAG_MASK_NO_USERID);
collection_schema.flag_ = engine::meta::FLAG_MASK_NO_USERID);
// user didn't provided id before, no need to provide user id
if ((table_schema.flag_ & engine::meta::FLAG_MASK_NO_USERID) != 0 && user_provide_ids) {
if ((collection_schema.flag_ & engine::meta::FLAG_MASK_NO_USERID) != 0 && user_provide_ids) {
std::string msg =
"Entities IDs are auto-generated. All vectors of this collection must use auto-generated IDs.";
return Status(SERVER_ILLEGAL_VECTOR_ID, msg);
......@@ -128,7 +129,7 @@ InsertRequest::OnExecute() {
#endif
// step 4: some metric type doesn't support float vectors
if (!vectors_data_.float_data_.empty()) { // insert float vectors
if (engine::utils::IsBinaryMetricType(table_schema.metric_type_)) {
if (engine::utils::IsBinaryMetricType(collection_schema.metric_type_)) {
std::string msg = "Collection metric type doesn't support float vectors.";
SERVER_LOG_ERROR << LogOut("[%s][%ld] %s", "insert", 0, msg.c_str());
return Status(SERVER_INVALID_ROWRECORD_ARRAY, msg);
......@@ -141,14 +142,14 @@ InsertRequest::OnExecute() {
return Status(SERVER_INVALID_ROWRECORD_ARRAY, msg);
}
fiu_do_on("InsertRequest.OnExecute.invalid_dim", table_schema.dimension_ = -1);
if (vectors_data_.float_data_.size() / vector_count != table_schema.dimension_) {
fiu_do_on("InsertRequest.OnExecute.invalid_dim", collection_schema.dimension_ = -1);
if (vectors_data_.float_data_.size() / vector_count != collection_schema.dimension_) {
std::string msg = "The vector dimension must be equal to the collection dimension.";
SERVER_LOG_ERROR << LogOut("[%s][%ld] %s", "insert", 0, msg.c_str());
return Status(SERVER_INVALID_VECTOR_DIMENSION, msg);
}
} else if (!vectors_data_.binary_data_.empty()) { // insert binary vectors
if (!engine::utils::IsBinaryMetricType(table_schema.metric_type_)) {
if (!engine::utils::IsBinaryMetricType(collection_schema.metric_type_)) {
std::string msg = "Collection metric type doesn't support binary vectors.";
SERVER_LOG_ERROR << LogOut("[%s][%ld] %s", "insert", 0, msg.c_str());
return Status(SERVER_INVALID_ROWRECORD_ARRAY, msg);
......@@ -161,7 +162,7 @@ InsertRequest::OnExecute() {
return Status(SERVER_INVALID_ROWRECORD_ARRAY, msg);
}
if (vectors_data_.binary_data_.size() * 8 / vector_count != table_schema.dimension_) {
if (vectors_data_.binary_data_.size() * 8 / vector_count != collection_schema.dimension_) {
std::string msg = "The vector dimension must be equal to the collection dimension.";
SERVER_LOG_ERROR << LogOut("[%s][%ld] %s", "insert", 0, msg.c_str());
return Status(SERVER_INVALID_VECTOR_DIMENSION, msg);
......@@ -189,9 +190,9 @@ InsertRequest::OnExecute() {
}
// step 6: update collection flag
user_provide_ids ? table_schema.flag_ |= engine::meta::FLAG_MASK_HAS_USERID
: table_schema.flag_ |= engine::meta::FLAG_MASK_NO_USERID;
status = DBWrapper::DB()->UpdateCollectionFlag(collection_name_, table_schema.flag_);
user_provide_ids ? collection_schema.flag_ |= engine::meta::FLAG_MASK_HAS_USERID
: collection_schema.flag_ |= engine::meta::FLAG_MASK_NO_USERID;
status = DBWrapper::DB()->UpdateCollectionFlag(collection_name_, collection_schema.flag_);
#ifdef MILVUS_ENABLE_PROFILING
ProfilerStop();
......
......@@ -70,18 +70,18 @@ ShowCollectionInfoRequest::OnExecute() {
// step 2: check collection existence
// only process root collection, ignore partition collection
engine::meta::CollectionSchema table_schema;
table_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(table_schema);
engine::meta::CollectionSchema collection_schema;
collection_schema.collection_id_ = collection_name_;
status = DBWrapper::DB()->DescribeCollection(collection_schema);
if (!status.ok()) {
if (status.code() == DB_NOT_FOUND) {
return Status(SERVER_TABLE_NOT_EXIST, TableNotExistMsg(collection_name_));
return Status(SERVER_COLLECTION_NOT_EXIST, CollectionNotExistMsg(collection_name_));
} else {
return status;
}
} else {
if (!table_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_TABLE_NAME, TableNotExistMsg(collection_name_));
if (!collection_schema.owner_collection_.empty()) {
return Status(SERVER_INVALID_COLLECTION_NAME, CollectionNotExistMsg(collection_name_));
}
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册