Set msg stream

Signed-off-by: neza2017 <yefu.chen@zilliz.com>
pull/4973/head^2
neza2017 2021-01-19 16:14:13 +08:00 committed by yefu.chen
parent 4e5df50a39
commit 918e279869
31 changed files with 1276 additions and 1406 deletions

View File

@ -98,20 +98,6 @@ type DescribeCollectionResponse struct {
} }
``` ```
* *GetCollectionStatistics*
```go
type CollectionStatsRequest struct {
MsgBase
DbName string
CollectionName string
}
type CollectionStatsResponse struct {
Stats []KeyValuePair
}
```
* *ShowCollections* * *ShowCollections*
```go ```go
@ -159,21 +145,6 @@ type HasPartitionRequest struct {
} }
``` ```
* *GetPartitionStatistics*
```go
type PartitionStatsRequest struct {
MsgBase
DbName string
CollectionName string
PartitionName string
}
type PartitionStatsResponse struct {
Stats []KeyValuePair
}
```
* *ShowPartitions* * *ShowPartitions*
```go ```go

View File

@ -21,6 +21,8 @@ enum SegmentType {
Sealed = 2, Sealed = 2,
}; };
typedef enum SegmentType SegmentType;
enum ErrorCode { enum ErrorCode {
Success = 0, Success = 0,
UnexpectedException = 1, UnexpectedException = 1,
@ -31,6 +33,12 @@ typedef struct CStatus {
const char* error_msg; const char* error_msg;
} CStatus; } CStatus;
typedef struct CLoadFieldDataInfo {
int64_t field_id;
void* blob;
int64_t row_count;
} CLoadFieldDataInfo;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -21,8 +21,9 @@
#include <knowhere/index/vector_index/VecIndex.h> #include <knowhere/index/vector_index/VecIndex.h>
#include <knowhere/index/vector_index/adapter/VectorAdapter.h> #include <knowhere/index/vector_index/adapter/VectorAdapter.h>
////////////////////////////// common interfaces //////////////////////////////
CSegmentInterface CSegmentInterface
NewSegment(CCollection collection, uint64_t segment_id, int seg_type) { NewSegment(CCollection collection, uint64_t segment_id, SegmentType seg_type) {
auto col = (milvus::segcore::Collection*)collection; auto col = (milvus::segcore::Collection*)collection;
std::unique_ptr<milvus::segcore::SegmentInterface> segment; std::unique_ptr<milvus::segcore::SegmentInterface> segment;
@ -46,6 +47,7 @@ NewSegment(CCollection collection, uint64_t segment_id, int seg_type) {
void void
DeleteSegment(CSegmentInterface segment) { DeleteSegment(CSegmentInterface segment) {
// TODO: use dynamic cast, and return c status
auto s = (milvus::segcore::SegmentGrowing*)segment; auto s = (milvus::segcore::SegmentGrowing*)segment;
std::cout << "delete segment " << std::endl; std::cout << "delete segment " << std::endl;
@ -58,8 +60,86 @@ DeleteQueryResult(CQueryResult query_result) {
delete res; delete res;
} }
////////////////////////////////////////////////////////////////// CStatus
Search(CSegmentInterface c_segment,
CPlan c_plan,
CPlaceholderGroup* c_placeholder_groups,
uint64_t* timestamps,
int num_groups,
CQueryResult* result) {
auto segment = (milvus::segcore::SegmentGrowing*)c_segment;
auto plan = (milvus::query::Plan*)c_plan;
std::vector<const milvus::query::PlaceholderGroup*> placeholder_groups;
for (int i = 0; i < num_groups; ++i) {
placeholder_groups.push_back((const milvus::query::PlaceholderGroup*)c_placeholder_groups[i]);
}
auto query_result = std::make_unique<milvus::QueryResult>();
auto status = CStatus();
try {
*query_result = segment->Search(plan, placeholder_groups.data(), timestamps, num_groups);
if (plan->plan_node_->query_info_.metric_type_ != "IP") {
for (auto& dis : query_result->result_distances_) {
dis *= -1;
}
}
status.error_code = Success;
status.error_msg = "";
} catch (std::exception& e) {
status.error_code = UnexpectedException;
status.error_msg = strdup(e.what());
}
*result = query_result.release();
// result_ids and result_distances have been allocated memory in goLang,
// so we don't need to malloc here.
// memcpy(result_ids, query_result.result_ids_.data(), query_result.get_row_count() * sizeof(long int));
// memcpy(result_distances, query_result.result_distances_.data(), query_result.get_row_count() * sizeof(float));
return status;
}
CStatus
FillTargetEntry(CSegmentInterface c_segment, CPlan c_plan, CQueryResult c_result) {
auto segment = (milvus::segcore::SegmentGrowing*)c_segment;
auto plan = (milvus::query::Plan*)c_plan;
auto result = (milvus::QueryResult*)c_result;
auto status = CStatus();
try {
segment->FillTargetEntry(plan, *result);
status.error_code = Success;
status.error_msg = "";
} catch (std::runtime_error& e) {
status.error_code = UnexpectedException;
status.error_msg = strdup(e.what());
}
return status;
}
int64_t
GetMemoryUsageInBytes(CSegmentInterface c_segment) {
auto segment = (milvus::segcore::SegmentGrowing*)c_segment;
auto mem_size = segment->GetMemoryUsageInBytes();
return mem_size;
}
int64_t
GetRowCount(CSegmentInterface c_segment) {
auto segment = (milvus::segcore::SegmentGrowing*)c_segment;
auto row_count = segment->get_row_count();
return row_count;
}
int64_t
GetDeletedCount(CSegmentInterface c_segment) {
auto segment = (milvus::segcore::SegmentGrowing*)c_segment;
auto deleted_count = segment->get_deleted_count();
return deleted_count;
}
////////////////////////////// interfaces for growing segment //////////////////////////////
CStatus CStatus
Insert(CSegmentInterface c_segment, Insert(CSegmentInterface c_segment,
int64_t reserved_offset, int64_t reserved_offset,
@ -123,70 +203,33 @@ Delete(CSegmentInterface c_segment,
int64_t int64_t
PreDelete(CSegmentInterface c_segment, int64_t size) { PreDelete(CSegmentInterface c_segment, int64_t size) {
// TODO: use dynamic cast, and return c status
auto segment = (milvus::segcore::SegmentGrowing*)c_segment; auto segment = (milvus::segcore::SegmentGrowing*)c_segment;
return segment->PreDelete(size); return segment->PreDelete(size);
} }
////////////////////////////// interfaces for growing segment //////////////////////////////
CStatus CStatus
Search(CSegmentInterface c_segment, LoadFieldData(CSegmentInterface c_segment, CLoadFieldDataInfo load_field_data_info) {
CPlan c_plan, auto segment = (milvus::segcore::SegmentSealed*)c_segment;
CPlaceholderGroup* c_placeholder_groups,
uint64_t* timestamps,
int num_groups,
CQueryResult* result) {
auto segment = (milvus::segcore::SegmentGrowing*)c_segment;
auto plan = (milvus::query::Plan*)c_plan;
std::vector<const milvus::query::PlaceholderGroup*> placeholder_groups;
for (int i = 0; i < num_groups; ++i) {
placeholder_groups.push_back((const milvus::query::PlaceholderGroup*)c_placeholder_groups[i]);
}
auto query_result = std::make_unique<milvus::QueryResult>();
auto status = CStatus();
try { try {
*query_result = segment->Search(plan, placeholder_groups.data(), timestamps, num_groups); auto load_info =
if (plan->plan_node_->query_info_.metric_type_ != "IP") { LoadFieldDataInfo{load_field_data_info.field_id, load_field_data_info.blob, load_field_data_info.row_count};
for (auto& dis : query_result->result_distances_) { segment->LoadFieldData(load_info);
dis *= -1; auto status = CStatus();
}
}
status.error_code = Success; status.error_code = Success;
status.error_msg = ""; status.error_msg = "";
return status;
} catch (std::exception& e) { } catch (std::exception& e) {
status.error_code = UnexpectedException;
status.error_msg = strdup(e.what());
}
*result = query_result.release();
// result_ids and result_distances have been allocated memory in goLang,
// so we don't need to malloc here.
// memcpy(result_ids, query_result.result_ids_.data(), query_result.get_row_count() * sizeof(long int));
// memcpy(result_distances, query_result.result_distances_.data(), query_result.get_row_count() * sizeof(float));
return status;
}
CStatus
FillTargetEntry(CSegmentInterface c_segment, CPlan c_plan, CQueryResult c_result) {
auto segment = (milvus::segcore::SegmentGrowing*)c_segment;
auto plan = (milvus::query::Plan*)c_plan;
auto result = (milvus::QueryResult*)c_result;
auto status = CStatus(); auto status = CStatus();
try {
segment->FillTargetEntry(plan, *result);
status.error_code = Success;
status.error_msg = "";
} catch (std::runtime_error& e) {
status.error_code = UnexpectedException; status.error_code = UnexpectedException;
status.error_msg = strdup(e.what()); status.error_msg = strdup(e.what());
}
return status; return status;
}
} }
////////////////////////////// deprecated interfaces //////////////////////////////
CStatus CStatus
UpdateSegmentIndex(CSegmentInterface c_segment, CLoadIndexInfo c_load_index_info) { UpdateSegmentIndex(CSegmentInterface c_segment, CLoadIndexInfo c_load_index_info) {
auto status = CStatus(); auto status = CStatus();
@ -203,7 +246,6 @@ UpdateSegmentIndex(CSegmentInterface c_segment, CLoadIndexInfo c_load_index_info
return status; return status;
} }
} }
//////////////////////////////////////////////////////////////////
int int
Close(CSegmentInterface c_segment) { Close(CSegmentInterface c_segment) {
@ -223,26 +265,3 @@ IsOpened(CSegmentInterface c_segment) {
auto status = segment->get_state(); auto status = segment->get_state();
return status == milvus::segcore::SegmentGrowing::SegmentState::Open; return status == milvus::segcore::SegmentGrowing::SegmentState::Open;
} }
int64_t
GetMemoryUsageInBytes(CSegmentInterface c_segment) {
auto segment = (milvus::segcore::SegmentGrowing*)c_segment;
auto mem_size = segment->GetMemoryUsageInBytes();
return mem_size;
}
//////////////////////////////////////////////////////////////////
int64_t
GetRowCount(CSegmentInterface c_segment) {
auto segment = (milvus::segcore::SegmentGrowing*)c_segment;
auto row_count = segment->get_row_count();
return row_count;
}
int64_t
GetDeletedCount(CSegmentInterface c_segment) {
auto segment = (milvus::segcore::SegmentGrowing*)c_segment;
auto deleted_count = segment->get_deleted_count();
return deleted_count;
}

View File

@ -26,8 +26,9 @@ extern "C" {
typedef void* CSegmentInterface; typedef void* CSegmentInterface;
typedef void* CQueryResult; typedef void* CQueryResult;
////////////////////////////// common interfaces //////////////////////////////
CSegmentInterface CSegmentInterface
NewSegment(CCollection collection, uint64_t segment_id, int seg_type); NewSegment(CCollection collection, uint64_t segment_id, SegmentType seg_type);
void void
DeleteSegment(CSegmentInterface segment); DeleteSegment(CSegmentInterface segment);
@ -35,9 +36,27 @@ DeleteSegment(CSegmentInterface segment);
void void
DeleteQueryResult(CQueryResult query_result); DeleteQueryResult(CQueryResult query_result);
////////////////////////////////////////////////////////////////// CStatus
Search(CSegmentInterface c_segment,
CPlan plan,
CPlaceholderGroup* placeholder_groups,
uint64_t* timestamps,
int num_groups,
CQueryResult* result);
// interface for growing segment CStatus
FillTargetEntry(CSegmentInterface c_segment, CPlan c_plan, CQueryResult result);
int64_t
GetMemoryUsageInBytes(CSegmentInterface c_segment);
int64_t
GetRowCount(CSegmentInterface c_segment);
int64_t
GetDeletedCount(CSegmentInterface c_segment);
////////////////////////////// interfaces for growing segment //////////////////////////////
CStatus CStatus
Insert(CSegmentInterface c_segment, Insert(CSegmentInterface c_segment,
int64_t reserved_offset, int64_t reserved_offset,
@ -64,23 +83,13 @@ Delete(CSegmentInterface c_segment,
int64_t int64_t
PreDelete(CSegmentInterface c_segment, int64_t size); PreDelete(CSegmentInterface c_segment, int64_t size);
// common interface ////////////////////////////// interfaces for growing segment //////////////////////////////
CStatus CStatus
Search(CSegmentInterface c_segment, LoadFieldData(CSegmentInterface c_segment, CLoadFieldDataInfo load_field_data_info);
CPlan plan,
CPlaceholderGroup* placeholder_groups,
uint64_t* timestamps,
int num_groups,
CQueryResult* result);
// common interface ////////////////////////////// deprecated interfaces //////////////////////////////
CStatus
FillTargetEntry(CSegmentInterface c_segment, CPlan c_plan, CQueryResult result);
// deprecated
CStatus CStatus
UpdateSegmentIndex(CSegmentInterface c_segment, CLoadIndexInfo c_load_index_info); UpdateSegmentIndex(CSegmentInterface c_segment, CLoadIndexInfo c_load_index_info);
//////////////////////////////////////////////////////////////////
// deprecated // deprecated
int int
@ -94,20 +103,6 @@ BuildIndex(CCollection c_collection, CSegmentInterface c_segment);
bool bool
IsOpened(CSegmentInterface c_segment); IsOpened(CSegmentInterface c_segment);
// common interface
int64_t
GetMemoryUsageInBytes(CSegmentInterface c_segment);
//////////////////////////////////////////////////////////////////
// common interface
int64_t
GetRowCount(CSegmentInterface c_segment);
// ???
int64_t
GetDeletedCount(CSegmentInterface c_segment);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -52,7 +52,7 @@ TEST(CApiTest, GetCollectionNameTest) {
TEST(CApiTest, SegmentTest) { TEST(CApiTest, SegmentTest) {
auto schema_tmp_conf = ""; auto schema_tmp_conf = "";
auto collection = NewCollection(schema_tmp_conf); auto collection = NewCollection(schema_tmp_conf);
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
DeleteCollection(collection); DeleteCollection(collection);
DeleteSegment(segment); DeleteSegment(segment);
} }
@ -60,7 +60,7 @@ TEST(CApiTest, SegmentTest) {
TEST(CApiTest, InsertTest) { TEST(CApiTest, InsertTest) {
auto schema_tmp_conf = ""; auto schema_tmp_conf = "";
auto collection = NewCollection(schema_tmp_conf); auto collection = NewCollection(schema_tmp_conf);
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
std::vector<char> raw_data; std::vector<char> raw_data;
std::vector<uint64_t> timestamps; std::vector<uint64_t> timestamps;
@ -95,7 +95,7 @@ TEST(CApiTest, InsertTest) {
TEST(CApiTest, DeleteTest) { TEST(CApiTest, DeleteTest) {
auto schema_tmp_conf = ""; auto schema_tmp_conf = "";
auto collection = NewCollection(schema_tmp_conf); auto collection = NewCollection(schema_tmp_conf);
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
long delete_row_ids[] = {100000, 100001, 100002}; long delete_row_ids[] = {100000, 100001, 100002};
unsigned long delete_timestamps[] = {0, 0, 0}; unsigned long delete_timestamps[] = {0, 0, 0};
@ -112,7 +112,7 @@ TEST(CApiTest, DeleteTest) {
TEST(CApiTest, SearchTest) { TEST(CApiTest, SearchTest) {
auto schema_tmp_conf = ""; auto schema_tmp_conf = "";
auto collection = NewCollection(schema_tmp_conf); auto collection = NewCollection(schema_tmp_conf);
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
std::vector<char> raw_data; std::vector<char> raw_data;
std::vector<uint64_t> timestamps; std::vector<uint64_t> timestamps;
@ -201,7 +201,7 @@ TEST(CApiTest, SearchTest) {
// TEST(CApiTest, BuildIndexTest) { // TEST(CApiTest, BuildIndexTest) {
// auto schema_tmp_conf = ""; // auto schema_tmp_conf = "";
// auto collection = NewCollection(schema_tmp_conf); // auto collection = NewCollection(schema_tmp_conf);
// auto segment = NewSegment(collection, 0, 1); // auto segment = NewSegment(collection, 0, Growing);
// //
// std::vector<char> raw_data; // std::vector<char> raw_data;
// std::vector<uint64_t> timestamps; // std::vector<uint64_t> timestamps;
@ -285,7 +285,7 @@ TEST(CApiTest, SearchTest) {
TEST(CApiTest, IsOpenedTest) { TEST(CApiTest, IsOpenedTest) {
auto schema_tmp_conf = ""; auto schema_tmp_conf = "";
auto collection = NewCollection(schema_tmp_conf); auto collection = NewCollection(schema_tmp_conf);
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
auto is_opened = IsOpened(segment); auto is_opened = IsOpened(segment);
assert(is_opened); assert(is_opened);
@ -297,7 +297,7 @@ TEST(CApiTest, IsOpenedTest) {
TEST(CApiTest, CloseTest) { TEST(CApiTest, CloseTest) {
auto schema_tmp_conf = ""; auto schema_tmp_conf = "";
auto collection = NewCollection(schema_tmp_conf); auto collection = NewCollection(schema_tmp_conf);
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
auto status = Close(segment); auto status = Close(segment);
assert(status == 0); assert(status == 0);
@ -309,7 +309,7 @@ TEST(CApiTest, CloseTest) {
TEST(CApiTest, GetMemoryUsageInBytesTest) { TEST(CApiTest, GetMemoryUsageInBytesTest) {
auto schema_tmp_conf = ""; auto schema_tmp_conf = "";
auto collection = NewCollection(schema_tmp_conf); auto collection = NewCollection(schema_tmp_conf);
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
auto old_memory_usage_size = GetMemoryUsageInBytes(segment); auto old_memory_usage_size = GetMemoryUsageInBytes(segment);
std::cout << "old_memory_usage_size = " << old_memory_usage_size << std::endl; std::cout << "old_memory_usage_size = " << old_memory_usage_size << std::endl;
@ -428,7 +428,7 @@ generate_index(
// TEST(CApiTest, TestSearchPreference) { // TEST(CApiTest, TestSearchPreference) {
// auto schema_tmp_conf = ""; // auto schema_tmp_conf = "";
// auto collection = NewCollection(schema_tmp_conf); // auto collection = NewCollection(schema_tmp_conf);
// auto segment = NewSegment(collection, 0, 1); // auto segment = NewSegment(collection, 0, Growing);
// //
// auto beg = chrono::high_resolution_clock::now(); // auto beg = chrono::high_resolution_clock::now();
// auto next = beg; // auto next = beg;
@ -547,7 +547,7 @@ generate_index(
TEST(CApiTest, GetDeletedCountTest) { TEST(CApiTest, GetDeletedCountTest) {
auto schema_tmp_conf = ""; auto schema_tmp_conf = "";
auto collection = NewCollection(schema_tmp_conf); auto collection = NewCollection(schema_tmp_conf);
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
long delete_row_ids[] = {100000, 100001, 100002}; long delete_row_ids[] = {100000, 100001, 100002};
unsigned long delete_timestamps[] = {0, 0, 0}; unsigned long delete_timestamps[] = {0, 0, 0};
@ -568,7 +568,7 @@ TEST(CApiTest, GetDeletedCountTest) {
TEST(CApiTest, GetRowCountTest) { TEST(CApiTest, GetRowCountTest) {
auto schema_tmp_conf = ""; auto schema_tmp_conf = "";
auto collection = NewCollection(schema_tmp_conf); auto collection = NewCollection(schema_tmp_conf);
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
int N = 10000; int N = 10000;
auto [raw_data, timestamps, uids] = generate_data(N); auto [raw_data, timestamps, uids] = generate_data(N);
@ -592,7 +592,7 @@ TEST(CApiTest, GetRowCountTest) {
// "\u003e\ncreate_time: 1600416765\nsegment_ids: 6873737669791618215\npartition_tags: \"default\"\n"; // "\u003e\ncreate_time: 1600416765\nsegment_ids: 6873737669791618215\npartition_tags: \"default\"\n";
// //
// auto collection = NewCollection(schema_string.data()); // auto collection = NewCollection(schema_string.data());
// auto segment = NewSegment(collection, 0, 1); // auto segment = NewSegment(collection, 0, Growing);
// DeleteCollection(collection); // DeleteCollection(collection);
// DeleteSegment(segment); // DeleteSegment(segment);
//} //}
@ -629,7 +629,7 @@ TEST(CApiTest, MergeInto) {
TEST(CApiTest, Reduce) { TEST(CApiTest, Reduce) {
auto schema_tmp_conf = ""; auto schema_tmp_conf = "";
auto collection = NewCollection(schema_tmp_conf); auto collection = NewCollection(schema_tmp_conf);
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
std::vector<char> raw_data; std::vector<char> raw_data;
std::vector<uint64_t> timestamps; std::vector<uint64_t> timestamps;
@ -845,7 +845,7 @@ TEST(CApiTest, UpdateSegmentIndex_Without_Predicate) {
std::string schema_string = generate_collection_shema("L2", "16", false); std::string schema_string = generate_collection_shema("L2", "16", false);
auto collection = NewCollection(schema_string.c_str()); auto collection = NewCollection(schema_string.c_str());
auto schema = ((segcore::Collection*)collection)->get_schema(); auto schema = ((segcore::Collection*)collection)->get_schema();
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
auto N = 1000 * 1000; auto N = 1000 * 1000;
auto dataset = DataGen(schema, N); auto dataset = DataGen(schema, N);
@ -970,7 +970,7 @@ TEST(CApiTest, UpdateSegmentIndex_With_float_Predicate_Range) {
std::string schema_string = generate_collection_shema("L2", "16", false); std::string schema_string = generate_collection_shema("L2", "16", false);
auto collection = NewCollection(schema_string.c_str()); auto collection = NewCollection(schema_string.c_str());
auto schema = ((segcore::Collection*)collection)->get_schema(); auto schema = ((segcore::Collection*)collection)->get_schema();
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
auto N = 1000 * 1000; auto N = 1000 * 1000;
auto dataset = DataGen(schema, N); auto dataset = DataGen(schema, N);
@ -1108,7 +1108,7 @@ TEST(CApiTest, UpdateSegmentIndex_With_float_Predicate_Term) {
std::string schema_string = generate_collection_shema("L2", "16", false); std::string schema_string = generate_collection_shema("L2", "16", false);
auto collection = NewCollection(schema_string.c_str()); auto collection = NewCollection(schema_string.c_str());
auto schema = ((segcore::Collection*)collection)->get_schema(); auto schema = ((segcore::Collection*)collection)->get_schema();
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
auto N = 1000 * 1000; auto N = 1000 * 1000;
auto dataset = DataGen(schema, N); auto dataset = DataGen(schema, N);
@ -1245,7 +1245,7 @@ TEST(CApiTest, UpdateSegmentIndex_With_binary_Predicate_Range) {
std::string schema_string = generate_collection_shema("JACCARD", "16", true); std::string schema_string = generate_collection_shema("JACCARD", "16", true);
auto collection = NewCollection(schema_string.c_str()); auto collection = NewCollection(schema_string.c_str());
auto schema = ((segcore::Collection*)collection)->get_schema(); auto schema = ((segcore::Collection*)collection)->get_schema();
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
auto N = 1000 * 1000; auto N = 1000 * 1000;
auto dataset = DataGen(schema, N); auto dataset = DataGen(schema, N);
@ -1384,7 +1384,7 @@ TEST(CApiTest, UpdateSegmentIndex_With_binary_Predicate_Term) {
std::string schema_string = generate_collection_shema("JACCARD", "16", true); std::string schema_string = generate_collection_shema("JACCARD", "16", true);
auto collection = NewCollection(schema_string.c_str()); auto collection = NewCollection(schema_string.c_str());
auto schema = ((segcore::Collection*)collection)->get_schema(); auto schema = ((segcore::Collection*)collection)->get_schema();
auto segment = NewSegment(collection, 0, 1); auto segment = NewSegment(collection, 0, Growing);
auto N = 1000 * 1000; auto N = 1000 * 1000;
auto dataset = DataGen(schema, N); auto dataset = DataGen(schema, N);

View File

@ -74,24 +74,23 @@ func (c *GrpcClient) HasCollection(in *milvuspb.HasCollectionRequest) (*milvuspb
func (c *GrpcClient) DescribeCollection(in *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error) { func (c *GrpcClient) DescribeCollection(in *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error) {
return c.grpcClient.DescribeCollection(context.Background(), in) return c.grpcClient.DescribeCollection(context.Background(), in)
} }
func (c *GrpcClient) GetCollectionStatistics(in *milvuspb.CollectionStatsRequest) (*milvuspb.CollectionStatsResponse, error) {
return c.grpcClient.GetCollectionStatistics(context.Background(), in)
}
func (c *GrpcClient) ShowCollections(in *milvuspb.ShowCollectionRequest) (*milvuspb.ShowCollectionResponse, error) { func (c *GrpcClient) ShowCollections(in *milvuspb.ShowCollectionRequest) (*milvuspb.ShowCollectionResponse, error) {
return c.grpcClient.ShowCollections(context.Background(), in) return c.grpcClient.ShowCollections(context.Background(), in)
} }
func (c *GrpcClient) CreatePartition(in *milvuspb.CreatePartitionRequest) (*commonpb.Status, error) { func (c *GrpcClient) CreatePartition(in *milvuspb.CreatePartitionRequest) (*commonpb.Status, error) {
return c.grpcClient.CreatePartition(context.Background(), in) return c.grpcClient.CreatePartition(context.Background(), in)
} }
func (c *GrpcClient) DropPartition(in *milvuspb.DropPartitionRequest) (*commonpb.Status, error) { func (c *GrpcClient) DropPartition(in *milvuspb.DropPartitionRequest) (*commonpb.Status, error) {
return c.grpcClient.DropPartition(context.Background(), in) return c.grpcClient.DropPartition(context.Background(), in)
} }
func (c *GrpcClient) HasPartition(in *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error) { func (c *GrpcClient) HasPartition(in *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error) {
return c.grpcClient.HasPartition(context.Background(), in) return c.grpcClient.HasPartition(context.Background(), in)
} }
func (c *GrpcClient) GetPartitionStatistics(in *milvuspb.PartitionStatsRequest) (*milvuspb.PartitionStatsResponse, error) {
return c.grpcClient.GetPartitionStatistics(context.Background(), in)
}
func (c *GrpcClient) ShowPartitions(in *milvuspb.ShowPartitionRequest) (*milvuspb.ShowPartitionResponse, error) { func (c *GrpcClient) ShowPartitions(in *milvuspb.ShowPartitionRequest) (*milvuspb.ShowPartitionResponse, error) {
return c.grpcClient.ShowPartitions(context.Background(), in) return c.grpcClient.ShowPartitions(context.Background(), in)
} }

View File

@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
cms "github.com/zilliztech/milvus-distributed/internal/masterservice" cms "github.com/zilliztech/milvus-distributed/internal/masterservice"
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
"github.com/zilliztech/milvus-distributed/internal/proto/etcdpb" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2"
"github.com/zilliztech/milvus-distributed/internal/proto/milvuspb" "github.com/zilliztech/milvus-distributed/internal/proto/milvuspb"
"github.com/zilliztech/milvus-distributed/internal/proto/schemapb" "github.com/zilliztech/milvus-distributed/internal/proto/schemapb"
"github.com/zilliztech/milvus-distributed/internal/util/typeutil" "github.com/zilliztech/milvus-distributed/internal/util/typeutil"
@ -33,9 +33,10 @@ func TestGrpcService(t *testing.T) {
cms.Params.TimeTickChannel = fmt.Sprintf("timeTick%d", randVal) cms.Params.TimeTickChannel = fmt.Sprintf("timeTick%d", randVal)
cms.Params.DdChannel = fmt.Sprintf("ddChannel%d", randVal) cms.Params.DdChannel = fmt.Sprintf("ddChannel%d", randVal)
cms.Params.StatisticsChannel = fmt.Sprintf("stateChannel%d", randVal) cms.Params.StatisticsChannel = fmt.Sprintf("stateChannel%d", randVal)
cms.Params.DataServiceSegmentChannel = fmt.Sprintf("segmentChannel%d", randVal)
cms.Params.MaxPartitionNum = 64 cms.Params.MaxPartitionNum = 64
cms.Params.DefaultPartitionTag = "_default" cms.Params.DefaultPartitionName = "_default"
t.Logf("master service port = %d", cms.Params.Port) t.Logf("master service port = %d", cms.Params.Port)
@ -44,6 +45,9 @@ func TestGrpcService(t *testing.T) {
core := svr.core.(*cms.Core) core := svr.core.(*cms.Core)
err = svr.Init(&cms.InitParams{ProxyTimeTickChannel: fmt.Sprintf("proxyTimeTick%d", randVal)})
assert.Nil(t, err)
core.ProxyTimeTickChan = make(chan typeutil.Timestamp, 8) core.ProxyTimeTickChan = make(chan typeutil.Timestamp, 8)
timeTickArray := make([]typeutil.Timestamp, 0, 16) timeTickArray := make([]typeutil.Timestamp, 0, 16)
@ -52,56 +56,34 @@ func TestGrpcService(t *testing.T) {
timeTickArray = append(timeTickArray, ts) timeTickArray = append(timeTickArray, ts)
return nil return nil
} }
createCollectionArray := make([]*cms.CreateCollectionReqTask, 0, 16) createCollectionArray := make([]*internalpb2.CreateCollectionRequest, 0, 16)
core.DdCreateCollectionReq = func(req *cms.CreateCollectionReqTask) error { core.DdCreateCollectionReq = func(req *internalpb2.CreateCollectionRequest) error {
t.Logf("Create Colllection %s", req.Req.CollectionName) t.Logf("Create Colllection %s", req.CollectionName)
createCollectionArray = append(createCollectionArray, req) createCollectionArray = append(createCollectionArray, req)
return nil return nil
} }
dropCollectionArray := make([]*cms.DropCollectionReqTask, 0, 16) dropCollectionArray := make([]*internalpb2.DropCollectionRequest, 0, 16)
core.DdDropCollectionReq = func(req *cms.DropCollectionReqTask) error { core.DdDropCollectionReq = func(req *internalpb2.DropCollectionRequest) error {
t.Logf("Drop Collection %s", req.Req.CollectionName) t.Logf("Drop Collection %s", req.CollectionName)
dropCollectionArray = append(dropCollectionArray, req) dropCollectionArray = append(dropCollectionArray, req)
return nil return nil
} }
createPartitionArray := make([]*cms.CreatePartitionReqTask, 0, 16) createPartitionArray := make([]*internalpb2.CreatePartitionRequest, 0, 16)
core.DdCreatePartitionReq = func(req *cms.CreatePartitionReqTask) error { core.DdCreatePartitionReq = func(req *internalpb2.CreatePartitionRequest) error {
t.Logf("Create Partition %s", req.Req.PartitionName) t.Logf("Create Partition %s", req.PartitionName)
createPartitionArray = append(createPartitionArray, req) createPartitionArray = append(createPartitionArray, req)
return nil return nil
} }
dropPartitionArray := make([]*cms.DropPartitionReqTask, 0, 16) dropPartitionArray := make([]*internalpb2.DropPartitionRequest, 0, 16)
core.DdDropPartitionReq = func(req *cms.DropPartitionReqTask) error { core.DdDropPartitionReq = func(req *internalpb2.DropPartitionRequest) error {
t.Logf("Drop Partition %s", req.Req.PartitionName) t.Logf("Drop Partition %s", req.PartitionName)
dropPartitionArray = append(dropPartitionArray, req) dropPartitionArray = append(dropPartitionArray, req)
return nil return nil
} }
core.GetSegmentMeta = func(id typeutil.UniqueID) (*etcdpb.SegmentMeta, error) {
return &etcdpb.SegmentMeta{
SegmentID: 20,
CollectionID: 10,
PartitionTag: "_default",
ChannelStart: 50,
ChannelEnd: 100,
OpenTime: 1000,
CloseTime: 2000,
NumRows: 16,
MemSize: 1024,
BinlogFilePaths: []*etcdpb.FieldBinlogFiles{
{
FieldID: 101,
BinlogFiles: []string{"/test/binlog/file"},
},
},
}, nil
}
err = svr.Init(&cms.InitParams{ProxyTimeTickChannel: fmt.Sprintf("proxyTimeTick%d", randVal)})
assert.Nil(t, err)
err = svr.Start() err = svr.Start()
assert.Nil(t, err) assert.Nil(t, err)
@ -151,8 +133,8 @@ func TestGrpcService(t *testing.T) {
assert.Nil(t, err) assert.Nil(t, err)
assert.Equal(t, len(createCollectionArray), 1) assert.Equal(t, len(createCollectionArray), 1)
assert.Equal(t, status.ErrorCode, commonpb.ErrorCode_SUCCESS) assert.Equal(t, status.ErrorCode, commonpb.ErrorCode_SUCCESS)
assert.Equal(t, createCollectionArray[0].Req.Base.MsgType, commonpb.MsgType_kCreateCollection) assert.Equal(t, createCollectionArray[0].Base.MsgType, commonpb.MsgType_kCreateCollection)
assert.Equal(t, createCollectionArray[0].Req.CollectionName, "testColl") assert.Equal(t, createCollectionArray[0].CollectionName, "testColl")
}) })
t.Run("has collection", func(t *testing.T) { t.Run("has collection", func(t *testing.T) {
@ -219,57 +201,6 @@ func TestGrpcService(t *testing.T) {
assert.Equal(t, rsp.Schema.Name, "testColl") assert.Equal(t, rsp.Schema.Name, "testColl")
}) })
t.Run("get collection statistics", func(t *testing.T) {
req := &milvuspb.CollectionStatsRequest{
Base: &commonpb.MsgBase{
MsgType: 0, //TODO,miss msg type
MsgID: 104,
Timestamp: 104,
SourceID: 104,
},
DbName: "testDb",
CollectionName: "testColl",
}
rsp, err := cli.GetCollectionStatistics(req)
assert.Nil(t, err)
assert.Equal(t, rsp.Status.ErrorCode, commonpb.ErrorCode_SUCCESS)
assert.Equal(t, len(rsp.Stats), 2)
assert.Equal(t, rsp.Stats[0].Key, "row_count")
assert.Equal(t, rsp.Stats[0].Value, "0")
assert.Equal(t, rsp.Stats[1].Key, "data_size")
assert.Equal(t, rsp.Stats[1].Value, "0")
collMeta, err := core.MetaTable.GetCollectionByName("testColl")
assert.Nil(t, err)
seg := &etcdpb.SegmentMeta{
SegmentID: 101,
CollectionID: collMeta.ID,
PartitionTag: cms.Params.DefaultPartitionTag,
}
err = core.MetaTable.AddSegment(seg)
assert.Nil(t, err)
req = &milvuspb.CollectionStatsRequest{
Base: &commonpb.MsgBase{
MsgType: 0, //TODO,miss msg type
MsgID: 105,
Timestamp: 105,
SourceID: 105,
},
DbName: "testDb",
CollectionName: "testColl",
}
rsp, err = cli.GetCollectionStatistics(req)
assert.Nil(t, err)
assert.Equal(t, rsp.Status.ErrorCode, commonpb.ErrorCode_SUCCESS)
assert.Equal(t, len(rsp.Stats), 2)
assert.Equal(t, rsp.Stats[0].Key, "row_count")
assert.Equal(t, rsp.Stats[0].Value, "16")
assert.Equal(t, rsp.Stats[1].Key, "data_size")
assert.Equal(t, rsp.Stats[1].Value, "1024")
})
t.Run("show collection", func(t *testing.T) { t.Run("show collection", func(t *testing.T) {
req := &milvuspb.ShowCollectionRequest{ req := &milvuspb.ShowCollectionRequest{
Base: &commonpb.MsgBase{ Base: &commonpb.MsgBase{
@ -305,7 +236,9 @@ func TestGrpcService(t *testing.T) {
collMeta, err := core.MetaTable.GetCollectionByName("testColl") collMeta, err := core.MetaTable.GetCollectionByName("testColl")
assert.Nil(t, err) assert.Nil(t, err)
assert.Equal(t, len(collMeta.PartitionIDs), 2) assert.Equal(t, len(collMeta.PartitionIDs), 2)
assert.Equal(t, collMeta.PartitionTags[1], "testPartition") partMeta, err := core.MetaTable.GetPartitionByID(collMeta.PartitionIDs[1])
assert.Nil(t, err)
assert.Equal(t, partMeta.PartitionName, "testPartition")
}) })
@ -327,28 +260,6 @@ func TestGrpcService(t *testing.T) {
assert.Equal(t, rsp.Value, true) assert.Equal(t, rsp.Value, true)
}) })
t.Run("get partition statistics", func(t *testing.T) {
req := &milvuspb.PartitionStatsRequest{
Base: &commonpb.MsgBase{
MsgType: 0, //TODO, msg type
MsgID: 109,
Timestamp: 109,
SourceID: 109,
},
DbName: "testDb",
CollectionName: "testColl",
PartitionName: cms.Params.DefaultPartitionTag,
}
rsp, err := cli.GetPartitionStatistics(req)
assert.Nil(t, err)
assert.Equal(t, rsp.Status.ErrorCode, commonpb.ErrorCode_SUCCESS)
assert.Equal(t, len(rsp.Stats), 2)
assert.Equal(t, rsp.Stats[0].Key, "row_count")
assert.Equal(t, rsp.Stats[0].Value, "16")
assert.Equal(t, rsp.Stats[1].Key, "data_size")
assert.Equal(t, rsp.Stats[1].Value, "1024")
})
t.Run("show partition", func(t *testing.T) { t.Run("show partition", func(t *testing.T) {
req := &milvuspb.ShowPartitionRequest{ req := &milvuspb.ShowPartitionRequest{
Base: &commonpb.MsgBase{ Base: &commonpb.MsgBase{
@ -384,7 +295,9 @@ func TestGrpcService(t *testing.T) {
collMeta, err := core.MetaTable.GetCollectionByName("testColl") collMeta, err := core.MetaTable.GetCollectionByName("testColl")
assert.Nil(t, err) assert.Nil(t, err)
assert.Equal(t, len(collMeta.PartitionIDs), 1) assert.Equal(t, len(collMeta.PartitionIDs), 1)
assert.Equal(t, collMeta.PartitionTags[0], cms.Params.DefaultPartitionTag) partMeta, err := core.MetaTable.GetPartitionByID(collMeta.PartitionIDs[0])
assert.Nil(t, err)
assert.Equal(t, partMeta.PartitionName, cms.Params.DefaultPartitionName)
}) })
t.Run("drop collection", func(t *testing.T) { t.Run("drop collection", func(t *testing.T) {
@ -403,8 +316,8 @@ func TestGrpcService(t *testing.T) {
assert.Nil(t, err) assert.Nil(t, err)
assert.Equal(t, len(dropCollectionArray), 1) assert.Equal(t, len(dropCollectionArray), 1)
assert.Equal(t, status.ErrorCode, commonpb.ErrorCode_SUCCESS) assert.Equal(t, status.ErrorCode, commonpb.ErrorCode_SUCCESS)
assert.Equal(t, dropCollectionArray[0].Req.Base.MsgType, commonpb.MsgType_kDropCollection) assert.Equal(t, dropCollectionArray[0].Base.MsgType, commonpb.MsgType_kDropCollection)
assert.Equal(t, dropCollectionArray[0].Req.CollectionName, "testColl") assert.Equal(t, dropCollectionArray[0].CollectionName, "testColl")
req = &milvuspb.DropCollectionRequest{ req = &milvuspb.DropCollectionRequest{
Base: &commonpb.MsgBase{ Base: &commonpb.MsgBase{

View File

@ -94,10 +94,6 @@ func (s *GrpcServer) DescribeCollection(ctx context.Context, in *milvuspb.Descri
return s.core.DescribeCollection(in) return s.core.DescribeCollection(in)
} }
func (s *GrpcServer) GetCollectionStatistics(ctx context.Context, in *milvuspb.CollectionStatsRequest) (*milvuspb.CollectionStatsResponse, error) {
return s.core.GetCollectionStatistics(in)
}
func (s *GrpcServer) ShowCollections(ctx context.Context, in *milvuspb.ShowCollectionRequest) (*milvuspb.ShowCollectionResponse, error) { func (s *GrpcServer) ShowCollections(ctx context.Context, in *milvuspb.ShowCollectionRequest) (*milvuspb.ShowCollectionResponse, error) {
return s.core.ShowCollections(in) return s.core.ShowCollections(in)
} }
@ -114,10 +110,6 @@ func (s *GrpcServer) HasPartition(ctx context.Context, in *milvuspb.HasPartition
return s.core.HasPartition(in) return s.core.HasPartition(in)
} }
func (s *GrpcServer) GetPartitionStatistics(ctx context.Context, in *milvuspb.PartitionStatsRequest) (*milvuspb.PartitionStatsResponse, error) {
return s.core.GetPartitionStatistics(in)
}
func (s *GrpcServer) ShowPartitions(ctx context.Context, in *milvuspb.ShowPartitionRequest) (*milvuspb.ShowPartitionResponse, error) { func (s *GrpcServer) ShowPartitions(ctx context.Context, in *milvuspb.ShowPartitionRequest) (*milvuspb.ShowPartitionResponse, error) {
return s.core.ShowPartitions(in) return s.core.ShowPartitions(in)
} }

View File

@ -10,8 +10,8 @@ import (
"github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/errors"
etcdkv "github.com/zilliztech/milvus-distributed/internal/kv/etcd" etcdkv "github.com/zilliztech/milvus-distributed/internal/kv/etcd"
ms "github.com/zilliztech/milvus-distributed/internal/msgstream"
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
"github.com/zilliztech/milvus-distributed/internal/proto/etcdpb"
"github.com/zilliztech/milvus-distributed/internal/proto/internalpb2" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2"
"github.com/zilliztech/milvus-distributed/internal/proto/masterpb" "github.com/zilliztech/milvus-distributed/internal/proto/masterpb"
"github.com/zilliztech/milvus-distributed/internal/proto/milvuspb" "github.com/zilliztech/milvus-distributed/internal/proto/milvuspb"
@ -26,7 +26,7 @@ import (
// datapb(data_service) // datapb(data_service)
// indexpb(index_service) // indexpb(index_service)
// milvuspb -> servicepb // milvuspb -> servicepb
// masterpb2 -> masterpb master_service) // masterpb2 -> masterpb (master_service)
type InitParams struct { type InitParams struct {
ProxyTimeTickChannel string ProxyTimeTickChannel string
@ -53,12 +53,10 @@ type Interface interface {
DropCollection(in *milvuspb.DropCollectionRequest) (*commonpb.Status, error) DropCollection(in *milvuspb.DropCollectionRequest) (*commonpb.Status, error)
HasCollection(in *milvuspb.HasCollectionRequest) (*milvuspb.BoolResponse, error) HasCollection(in *milvuspb.HasCollectionRequest) (*milvuspb.BoolResponse, error)
DescribeCollection(in *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error) DescribeCollection(in *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error)
GetCollectionStatistics(in *milvuspb.CollectionStatsRequest) (*milvuspb.CollectionStatsResponse, error)
ShowCollections(in *milvuspb.ShowCollectionRequest) (*milvuspb.ShowCollectionResponse, error) ShowCollections(in *milvuspb.ShowCollectionRequest) (*milvuspb.ShowCollectionResponse, error)
CreatePartition(in *milvuspb.CreatePartitionRequest) (*commonpb.Status, error) CreatePartition(in *milvuspb.CreatePartitionRequest) (*commonpb.Status, error)
DropPartition(in *milvuspb.DropPartitionRequest) (*commonpb.Status, error) DropPartition(in *milvuspb.DropPartitionRequest) (*commonpb.Status, error)
HasPartition(in *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error) HasPartition(in *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error)
GetPartitionStatistics(in *milvuspb.PartitionStatsRequest) (*milvuspb.PartitionStatsResponse, error)
ShowPartitions(in *milvuspb.ShowPartitionRequest) (*milvuspb.ShowPartitionResponse, error) ShowPartitions(in *milvuspb.ShowPartitionRequest) (*milvuspb.ShowPartitionResponse, error)
//index builder service //index builder service
@ -116,23 +114,23 @@ type Core struct {
kvBase *etcdkv.EtcdKV kvBase *etcdkv.EtcdKV
metaKV *etcdkv.EtcdKV metaKV *etcdkv.EtcdKV
//TODO, receive time tick from proxy service time tick channel //setMsgStreams, receive time tick from proxy service time tick channel
ProxyTimeTickChan <-chan typeutil.Timestamp ProxyTimeTickChan chan typeutil.Timestamp
//TODO, send time tick into dd channel and time tick channel //setMsgStreams, send time tick into dd channel and time tick channel
SendTimeTick func(t typeutil.Timestamp) error SendTimeTick func(t typeutil.Timestamp) error
//TODO, send create collection into dd channel //setMsgStreams, send create collection into dd channel
DdCreateCollectionReq func(req *CreateCollectionReqTask) error DdCreateCollectionReq func(req *internalpb2.CreateCollectionRequest) error
//TODO, send drop collection into dd channel, and notify the proxy to delete this collection //setMsgStreams, send drop collection into dd channel, and notify the proxy to delete this collection
DdDropCollectionReq func(req *DropCollectionReqTask) error DdDropCollectionReq func(req *internalpb2.DropCollectionRequest) error
//TODO, send create partition into dd channel //setMsgStreams, send create partition into dd channel
DdCreatePartitionReq func(req *CreatePartitionReqTask) error DdCreatePartitionReq func(req *internalpb2.CreatePartitionRequest) error
//TODO, send drop partition into dd channel //setMsgStreams, send drop partition into dd channel
DdDropPartitionReq func(req *DropPartitionReqTask) error DdDropPartitionReq func(req *internalpb2.DropPartitionRequest) error
//dd request scheduler //dd request scheduler
ddReqQueue chan reqTask //dd request will be push into this chan ddReqQueue chan reqTask //dd request will be push into this chan
@ -148,9 +146,6 @@ type Core struct {
initOnce sync.Once initOnce sync.Once
startOnce sync.Once startOnce sync.Once
isInit atomic.Value isInit atomic.Value
//TODO, get segment meta by segment id, from data service by grpc
GetSegmentMeta func(id typeutil.UniqueID) (*etcdpb.SegmentMeta, error)
} }
// --------------------- function -------------------------- // --------------------- function --------------------------
@ -193,9 +188,6 @@ func (c *Core) checkInit() error {
if c.ddReqQueue == nil { if c.ddReqQueue == nil {
return errors.Errorf("ddReqQueue is nil") return errors.Errorf("ddReqQueue is nil")
} }
if c.GetSegmentMeta == nil {
return errors.Errorf("GetSegmentMeta is nil")
}
if c.DdCreateCollectionReq == nil { if c.DdCreateCollectionReq == nil {
return errors.Errorf("DdCreateCollectionReq is nil") return errors.Errorf("DdCreateCollectionReq is nil")
} }
@ -261,6 +253,185 @@ func (c *Core) startTimeTickLoop() {
} }
} }
func (c *Core) setMsgStreams() error {
//proxy time tick stream,
proxyTimeTickStream := ms.NewPulsarMsgStream(c.ctx, 1024)
proxyTimeTickStream.SetPulsarClient(Params.PulsarAddress)
proxyTimeTickStream.CreatePulsarConsumers([]string{Params.ProxyTimeTickChannel}, Params.MsgChannelSubName, ms.NewUnmarshalDispatcher(), 1024)
proxyTimeTickStream.Start()
// master time tick channel
timeTickStream := ms.NewPulsarMsgStream(c.ctx, 1024)
timeTickStream.SetPulsarClient(Params.PulsarAddress)
timeTickStream.CreatePulsarProducers([]string{Params.TimeTickChannel})
// master dd channel
ddStream := ms.NewPulsarMsgStream(c.ctx, 1024)
ddStream.SetPulsarClient(Params.PulsarAddress)
ddStream.CreatePulsarProducers([]string{Params.DdChannel})
c.SendTimeTick = func(t typeutil.Timestamp) error {
msgPack := ms.MsgPack{}
baseMsg := ms.BaseMsg{
MsgCtx: nil,
BeginTimestamp: t,
EndTimestamp: t,
HashValues: []uint32{0},
}
timeTickResult := internalpb2.TimeTickMsg{
Base: &commonpb.MsgBase{
MsgType: commonpb.MsgType_kTimeTick,
MsgID: 0,
Timestamp: t,
SourceID: int64(Params.NodeID),
},
}
timeTickMsg := &ms.TimeTickMsg{
BaseMsg: baseMsg,
TimeTickMsg: timeTickResult,
}
msgPack.Msgs = append(msgPack.Msgs, timeTickMsg)
if err := timeTickStream.Broadcast(&msgPack); err != nil {
return err
}
if err := ddStream.Broadcast(&msgPack); err != nil {
return err
}
return nil
}
c.DdCreateCollectionReq = func(req *internalpb2.CreateCollectionRequest) error {
msgPack := ms.MsgPack{}
baseMsg := ms.BaseMsg{
BeginTimestamp: req.Base.Timestamp,
EndTimestamp: req.Base.Timestamp,
HashValues: []uint32{0},
}
collMsg := &ms.CreateCollectionMsg{
BaseMsg: baseMsg,
CreateCollectionRequest: *req,
}
msgPack.Msgs = append(msgPack.Msgs, collMsg)
if err := ddStream.Broadcast(&msgPack); err != nil {
return err
}
return nil
}
c.DdDropCollectionReq = func(req *internalpb2.DropCollectionRequest) error {
//TODO, notify proxy to delete this collection before send this msg into dd channel
msgPack := ms.MsgPack{}
baseMsg := ms.BaseMsg{
BeginTimestamp: req.Base.Timestamp,
EndTimestamp: req.Base.Timestamp,
HashValues: []uint32{0},
}
collMsg := &ms.DropCollectionMsg{
BaseMsg: baseMsg,
DropCollectionRequest: *req,
}
msgPack.Msgs = append(msgPack.Msgs, collMsg)
if err := ddStream.Broadcast(&msgPack); err != nil {
return err
}
return nil
}
c.DdCreatePartitionReq = func(req *internalpb2.CreatePartitionRequest) error {
msgPack := ms.MsgPack{}
baseMsg := ms.BaseMsg{
BeginTimestamp: req.Base.Timestamp,
EndTimestamp: req.Base.Timestamp,
HashValues: []uint32{0},
}
collMsg := &ms.CreatePartitionMsg{
BaseMsg: baseMsg,
CreatePartitionRequest: *req,
}
msgPack.Msgs = append(msgPack.Msgs, collMsg)
if err := ddStream.Broadcast(&msgPack); err != nil {
return err
}
return nil
}
c.DdDropPartitionReq = func(req *internalpb2.DropPartitionRequest) error {
msgPack := ms.MsgPack{}
baseMsg := ms.BaseMsg{
BeginTimestamp: req.Base.Timestamp,
EndTimestamp: req.Base.Timestamp,
HashValues: []uint32{0},
}
collMsg := &ms.DropPartitionMsg{
BaseMsg: baseMsg,
DropPartitionRequest: *req,
}
msgPack.Msgs = append(msgPack.Msgs, collMsg)
if err := ddStream.Broadcast(&msgPack); err != nil {
return err
}
return nil
}
// receive time tick from msg stream
go func() {
c.ProxyTimeTickChan = make(chan typeutil.Timestamp, 1024)
for {
select {
case <-c.ctx.Done():
return
case ttmsgs, ok := <-proxyTimeTickStream.Chan():
if !ok {
log.Printf("proxy time tick msg stream closed")
return
}
if len(ttmsgs.Msgs) > 0 {
for _, ttm := range ttmsgs.Msgs {
ttmsg, ok := ttm.(*ms.TimeTickMsg)
if !ok {
continue
}
c.ProxyTimeTickChan <- ttmsg.Base.Timestamp
}
}
}
}
}()
//segment channel, data service create segment,or data node flush segment will put msg in this channel
dataServiceStream := ms.NewPulsarMsgStream(c.ctx, 1024)
dataServiceStream.SetPulsarClient(Params.PulsarAddress)
dataServiceStream.CreatePulsarConsumers([]string{Params.DataServiceSegmentChannel}, Params.MsgChannelSubName, ms.NewUnmarshalDispatcher(), 1024)
dataServiceStream.Start()
// receive segment info from msg stream
go func() {
for {
select {
case <-c.ctx.Done():
return
case segMsg, ok := <-dataServiceStream.Chan():
if !ok {
log.Printf("data service segment msg closed")
}
if len(segMsg.Msgs) > 0 {
for _, segm := range segMsg.Msgs {
segInfoMsg, ok := segm.(*ms.SegmentInfoMsg)
if ok {
if err := c.MetaTable.AddSegment(segInfoMsg.Segment); err != nil {
log.Printf("create segment failed, segmentid = %d,colleciont id = %d, error = %s", segInfoMsg.Segment.SegmentID, segInfoMsg.Segment.CollectionID, err.Error())
}
}
//TODO, if data node flush
}
}
}
}
}()
return nil
}
func (c *Core) Init(params *InitParams) error { func (c *Core) Init(params *InitParams) error {
var initError error = nil var initError error = nil
c.initOnce.Do(func() { c.initOnce.Do(func() {
@ -284,6 +455,7 @@ func (c *Core) Init(params *InitParams) error {
return return
} }
c.ddReqQueue = make(chan reqTask, 1024) c.ddReqQueue = make(chan reqTask, 1024)
initError = c.setMsgStreams()
c.isInit.Store(true) c.isInit.Store(true)
}) })
return initError return initError
@ -458,36 +630,6 @@ func (c *Core) DescribeCollection(in *milvuspb.DescribeCollectionRequest) (*milv
return t.Rsp, nil return t.Rsp, nil
} }
func (c *Core) GetCollectionStatistics(in *milvuspb.CollectionStatsRequest) (*milvuspb.CollectionStatsResponse, error) {
t := &CollectionStatsReqTask{
baseReqTask: baseReqTask{
cv: make(chan error),
core: c,
},
Req: in,
Rsp: &milvuspb.CollectionStatsResponse{
Stats: nil,
Status: nil,
},
}
c.ddReqQueue <- t
err := t.WaitToFinish()
if err != nil {
return &milvuspb.CollectionStatsResponse{
Stats: nil,
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: "GetCollectionStatistics failed: " + err.Error(),
},
}, nil
}
t.Rsp.Status = &commonpb.Status{
ErrorCode: commonpb.ErrorCode_SUCCESS,
Reason: "",
}
return t.Rsp, nil
}
func (c *Core) ShowCollections(in *milvuspb.ShowCollectionRequest) (*milvuspb.ShowCollectionResponse, error) { func (c *Core) ShowCollections(in *milvuspb.ShowCollectionRequest) (*milvuspb.ShowCollectionResponse, error) {
t := &ShowCollectionReqTask{ t := &ShowCollectionReqTask{
baseReqTask: baseReqTask{ baseReqTask: baseReqTask{
@ -590,36 +732,6 @@ func (c *Core) HasPartition(in *milvuspb.HasPartitionRequest) (*milvuspb.BoolRes
}, nil }, nil
} }
func (c *Core) GetPartitionStatistics(in *milvuspb.PartitionStatsRequest) (*milvuspb.PartitionStatsResponse, error) {
t := &PartitionStatsReqTask{
baseReqTask: baseReqTask{
cv: make(chan error),
core: c,
},
Req: in,
Rsp: &milvuspb.PartitionStatsResponse{
Stats: nil,
Status: nil,
},
}
c.ddReqQueue <- t
err := t.WaitToFinish()
if err != nil {
return &milvuspb.PartitionStatsResponse{
Stats: nil,
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: "GetPartitionStatistics failed: " + err.Error(),
},
}, nil
}
t.Rsp.Status = &commonpb.Status{
ErrorCode: commonpb.ErrorCode_SUCCESS,
Reason: "",
}
return t.Rsp, nil
}
func (c *Core) ShowPartitions(in *milvuspb.ShowPartitionRequest) (*milvuspb.ShowPartitionResponse, error) { func (c *Core) ShowPartitions(in *milvuspb.ShowPartitionRequest) (*milvuspb.ShowPartitionResponse, error) {
t := &ShowPartitionReqTask{ t := &ShowPartitionReqTask{
baseReqTask: baseReqTask{ baseReqTask: baseReqTask{

View File

@ -1,32 +1,41 @@
package masterservice package masterservice
import ( import (
"fmt" "log"
"path"
"strconv" "strconv"
"sync" "sync"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/errors"
"github.com/zilliztech/milvus-distributed/internal/kv" "github.com/zilliztech/milvus-distributed/internal/kv"
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/datapb"
pb "github.com/zilliztech/milvus-distributed/internal/proto/etcdpb" pb "github.com/zilliztech/milvus-distributed/internal/proto/etcdpb"
"github.com/zilliztech/milvus-distributed/internal/proto/schemapb"
"github.com/zilliztech/milvus-distributed/internal/util/typeutil" "github.com/zilliztech/milvus-distributed/internal/util/typeutil"
) )
const (
TenantMetaPrefix = "tenant"
ProxyMetaPrefix = "proxy"
CollectionMetaPrefix = "collection"
PartitionMetaPrefix = "partition"
SegmentIndexMetaPrefix = "segment-index"
IndexMetaPrefix = "index"
)
type metaTable struct { type metaTable struct {
client kv.TxnBase // client of a reliable kv service, i.e. etcd client client kv.TxnBase // client of a reliable kv service, i.e. etcd client
tenantID2Meta map[typeutil.UniqueID]pb.TenantMeta // tenant id to tenant meta tenantID2Meta map[typeutil.UniqueID]pb.TenantMeta // tenant id to tenant meta
proxyID2Meta map[typeutil.UniqueID]pb.ProxyMeta // proxy id to proxy meta proxyID2Meta map[typeutil.UniqueID]pb.ProxyMeta // proxy id to proxy meta
collID2Meta map[typeutil.UniqueID]pb.CollectionMeta // collection id to collection meta collID2Meta map[typeutil.UniqueID]pb.CollectionInfo // collection id to collection meta,
collName2ID map[string]typeutil.UniqueID // collection name to collection id collName2ID map[string]typeutil.UniqueID // collection name to collection id
segID2Meta map[typeutil.UniqueID]pb.SegmentMeta // segment id to segment meta partitionID2Meta map[typeutil.UniqueID]pb.PartitionInfo //partition id -> partition meta
segID2IndexMetas map[typeutil.UniqueID][]pb.FieldIndexMeta // segment id to array of field index meta segID2IndexMeta map[typeutil.UniqueID]*map[typeutil.UniqueID]pb.SegmentIndexInfo // segment id -> index id -> segment index meta
indexID2Meta map[typeutil.UniqueID]pb.IndexInfo //index id ->index meta
tenantLock sync.RWMutex tenantLock sync.RWMutex
proxyLock sync.RWMutex proxyLock sync.RWMutex
ddLock sync.RWMutex ddLock sync.RWMutex
indexLock sync.RWMutex
} }
func NewMetaTable(kv kv.TxnBase) (*metaTable, error) { func NewMetaTable(kv kv.TxnBase) (*metaTable, error) {
@ -47,12 +56,13 @@ func (mt *metaTable) reloadFromKV() error {
mt.tenantID2Meta = make(map[typeutil.UniqueID]pb.TenantMeta) mt.tenantID2Meta = make(map[typeutil.UniqueID]pb.TenantMeta)
mt.proxyID2Meta = make(map[typeutil.UniqueID]pb.ProxyMeta) mt.proxyID2Meta = make(map[typeutil.UniqueID]pb.ProxyMeta)
mt.collID2Meta = make(map[typeutil.UniqueID]pb.CollectionMeta) mt.collID2Meta = make(map[typeutil.UniqueID]pb.CollectionInfo)
mt.collName2ID = make(map[string]typeutil.UniqueID) mt.collName2ID = make(map[string]typeutil.UniqueID)
mt.segID2Meta = make(map[typeutil.UniqueID]pb.SegmentMeta) mt.partitionID2Meta = make(map[typeutil.UniqueID]pb.PartitionInfo)
mt.segID2IndexMetas = make(map[typeutil.UniqueID][]pb.FieldIndexMeta) mt.segID2IndexMeta = make(map[typeutil.UniqueID]*map[typeutil.UniqueID]pb.SegmentIndexInfo)
mt.indexID2Meta = make(map[typeutil.UniqueID]pb.IndexInfo)
_, values, err := mt.client.LoadWithPrefix("tenant") _, values, err := mt.client.LoadWithPrefix(TenantMetaPrefix)
if err != nil { if err != nil {
return err return err
} }
@ -66,7 +76,7 @@ func (mt *metaTable) reloadFromKV() error {
mt.tenantID2Meta[tenantMeta.ID] = tenantMeta mt.tenantID2Meta[tenantMeta.ID] = tenantMeta
} }
_, values, err = mt.client.LoadWithPrefix("proxy") _, values, err = mt.client.LoadWithPrefix(ProxyMetaPrefix)
if err != nil { if err != nil {
return err return err
} }
@ -80,160 +90,93 @@ func (mt *metaTable) reloadFromKV() error {
mt.proxyID2Meta[proxyMeta.ID] = proxyMeta mt.proxyID2Meta[proxyMeta.ID] = proxyMeta
} }
_, values, err = mt.client.LoadWithPrefix("collection") _, values, err = mt.client.LoadWithPrefix(CollectionMetaPrefix)
if err != nil { if err != nil {
return err return err
} }
for _, value := range values { for _, value := range values {
collectionMeta := pb.CollectionMeta{} collectionInfo := pb.CollectionInfo{}
err = proto.UnmarshalText(value, &collectionMeta) err = proto.UnmarshalText(value, &collectionInfo)
if err != nil { if err != nil {
return err return err
} }
mt.collID2Meta[collectionMeta.ID] = collectionMeta mt.collID2Meta[collectionInfo.ID] = collectionInfo
mt.collName2ID[collectionMeta.Schema.Name] = collectionMeta.ID mt.collName2ID[collectionInfo.Schema.Name] = collectionInfo.ID
} }
_, values, err = mt.client.LoadWithPrefix("segment") _, values, err = mt.client.LoadWithPrefix(PartitionMetaPrefix)
if err != nil { if err != nil {
return err return err
} }
for _, value := range values { for _, value := range values {
segmentMeta := pb.SegmentMeta{} partitionInfo := pb.PartitionInfo{}
err = proto.UnmarshalText(value, &segmentMeta) err = proto.UnmarshalText(value, &partitionInfo)
if err != nil { if err != nil {
return err return err
} }
mt.segID2Meta[segmentMeta.SegmentID] = segmentMeta mt.partitionID2Meta[partitionInfo.PartitionID] = partitionInfo
} }
_, values, err = mt.client.LoadWithPrefix("indexmeta") _, values, err = mt.client.LoadWithPrefix(SegmentIndexMetaPrefix)
if err != nil { if err != nil {
return err return err
} }
for _, value := range values {
segmentIndexInfo := pb.SegmentIndexInfo{}
err = proto.UnmarshalText(value, &segmentIndexInfo)
if err != nil {
return err
}
idx, ok := mt.segID2IndexMeta[segmentIndexInfo.SegmentID]
if ok {
(*idx)[segmentIndexInfo.IndexID] = segmentIndexInfo
} else {
meta := make(map[typeutil.UniqueID]pb.SegmentIndexInfo)
meta[segmentIndexInfo.IndexID] = segmentIndexInfo
mt.segID2IndexMeta[segmentIndexInfo.SegmentID] = &meta
}
}
for _, v := range values { _, values, err = mt.client.LoadWithPrefix(IndexMetaPrefix)
indexMeta := pb.FieldIndexMeta{}
err = proto.UnmarshalText(v, &indexMeta)
if err != nil { if err != nil {
return err return err
} }
mt.segID2IndexMetas[indexMeta.SegmentID] = append(mt.segID2IndexMetas[indexMeta.SegmentID], indexMeta) for _, value := range values {
meta := pb.IndexInfo{}
err = proto.UnmarshalText(value, &meta)
if err != nil {
return err
} }
mt.indexID2Meta[meta.IndexID] = meta
}
return nil return nil
} }
// MetaTable.ddLock.Lock() before call this function func (mt *metaTable) AddCollection(coll *pb.CollectionInfo, part *pb.PartitionInfo) error {
func (mt *metaTable) saveCollectionMeta(coll *pb.CollectionMeta) error {
collBytes := proto.MarshalTextString(coll)
mt.collID2Meta[coll.ID] = *coll
mt.collName2ID[coll.Schema.Name] = coll.ID
return mt.client.Save("/collection/"+strconv.FormatInt(coll.ID, 10), collBytes)
}
// MetaTable.ddLock.Lock() before call this function
func (mt *metaTable) saveSegmentMeta(seg *pb.SegmentMeta) error {
segBytes := proto.MarshalTextString(seg)
mt.segID2Meta[seg.SegmentID] = *seg
return mt.client.Save("/segment/"+strconv.FormatInt(seg.SegmentID, 10), segBytes)
}
// MetaTable.ddLock.Lock() before call this function
func (mt *metaTable) saveCollectionAndDeleteSegmentsMeta(coll *pb.CollectionMeta, segIDs []typeutil.UniqueID) error {
segIDStrs := make([]string, 0, len(segIDs))
for _, segID := range segIDs {
segIDStrs = append(segIDStrs, "/segment/"+strconv.FormatInt(segID, 10))
}
kvs := make(map[string]string)
collStrs := proto.MarshalTextString(coll)
kvs["/collection/"+strconv.FormatInt(coll.ID, 10)] = collStrs
for _, segID := range segIDs {
_, ok := mt.segID2Meta[segID]
if ok {
delete(mt.segID2Meta, segID)
}
}
mt.collID2Meta[coll.ID] = *coll
return mt.client.MultiSaveAndRemove(kvs, segIDStrs)
}
// MetaTable.ddLock.Lock() before call this function
func (mt *metaTable) saveCollectionsAndSegmentsMeta(coll *pb.CollectionMeta, seg *pb.SegmentMeta) error {
kvs := make(map[string]string)
collBytes := proto.MarshalTextString(coll)
kvs["/collection/"+strconv.FormatInt(coll.ID, 10)] = collBytes
mt.collID2Meta[coll.ID] = *coll
mt.collName2ID[coll.Schema.Name] = coll.ID
segBytes := proto.MarshalTextString(seg)
kvs["/segment/"+strconv.FormatInt(seg.SegmentID, 10)] = segBytes
mt.segID2Meta[seg.SegmentID] = *seg
return mt.client.MultiSave(kvs)
}
// MetaTable.ddLock.Lock() before call this function
func (mt *metaTable) deleteCollectionsAndSegmentsMeta(collID typeutil.UniqueID, segIDs []typeutil.UniqueID) error {
collIDStr := "/collection/" + strconv.FormatInt(collID, 10)
totalIDStrs := make([]string, 0, 1+len(segIDs))
totalIDStrs = append(totalIDStrs, collIDStr)
for _, singleID := range segIDs {
totalIDStrs = append(totalIDStrs, "/segment/"+strconv.FormatInt(singleID, 10))
}
collMeta, ok := mt.collID2Meta[collID]
if ok {
delete(mt.collID2Meta, collID)
}
_, ok = mt.collName2ID[collMeta.Schema.Name]
if ok {
delete(mt.collName2ID, collMeta.Schema.Name)
}
for _, segID := range segIDs {
_, ok := mt.segID2Meta[segID]
if ok {
delete(mt.segID2Meta, segID)
}
}
return mt.client.MultiRemove(totalIDStrs)
}
func (mt *metaTable) AddCollection(coll *pb.CollectionMeta) error {
mt.ddLock.Lock() mt.ddLock.Lock()
defer mt.ddLock.Unlock() defer mt.ddLock.Unlock()
if len(coll.SegmentIDs) != 0 {
if len(part.SegmentIDs) != 0 {
return errors.Errorf("segment should be empty when creating collection") return errors.Errorf("segment should be empty when creating collection")
} }
if len(coll.PartitionTags) == 0 { if len(coll.PartitionIDs) != 0 {
coll.PartitionTags = append(coll.PartitionTags, Params.DefaultPartitionTag) return errors.Errorf("partitions should be empty when creating collection")
} }
_, ok := mt.collName2ID[coll.Schema.Name] coll.PartitionIDs = append(coll.PartitionIDs, part.PartitionID)
if ok { mt.collID2Meta[coll.ID] = *coll
return errors.Errorf("collection alread exists with name = " + coll.Schema.Name) mt.collName2ID[coll.Schema.Name] = coll.ID
} mt.partitionID2Meta[part.PartitionID] = *part
err := mt.saveCollectionMeta(coll)
k1 := path.Join(CollectionMetaPrefix, strconv.FormatInt(coll.ID, 10))
v1 := proto.MarshalTextString(coll)
k2 := path.Join(PartitionMetaPrefix, strconv.FormatInt(part.PartitionID, 10))
v2 := proto.MarshalTextString(part)
meta := map[string]string{k1: v1, k2: v2}
err := mt.client.MultiSave(meta)
if err != nil { if err != nil {
_ = mt.reloadFromKV() _ = mt.reloadFromKV()
return err return err
@ -250,18 +193,43 @@ func (mt *metaTable) DeleteCollection(collID typeutil.UniqueID) error {
return errors.Errorf("can't find collection. id = " + strconv.FormatInt(collID, 10)) return errors.Errorf("can't find collection. id = " + strconv.FormatInt(collID, 10))
} }
err := mt.deleteCollectionsAndSegmentsMeta(collID, collMeta.SegmentIDs) metaKeys := []string{path.Join(CollectionMetaPrefix, strconv.FormatInt(collID, 10))}
delete(mt.collID2Meta, collID)
delete(mt.collName2ID, collMeta.Schema.Name)
for _, partID := range collMeta.PartitionIDs {
metaKeys = append(metaKeys, path.Join(PartitionMetaPrefix, strconv.FormatInt(partID, 10)))
partMeta, ok := mt.partitionID2Meta[partID]
if !ok {
log.Printf("partition id = %d not exist", partID)
continue
}
delete(mt.partitionID2Meta, partID)
for _, segID := range partMeta.SegmentIDs {
segIndexMeta, ok := mt.segID2IndexMeta[segID]
if !ok {
log.Printf("segment id = %d not exist", segID)
continue
}
delete(mt.segID2IndexMeta, segID)
for indexID, segIdxMeta := range *segIndexMeta {
metaKeys = append(metaKeys, path.Join(SegmentIndexMetaPrefix, strconv.FormatInt(segID, 10), strconv.FormatInt(indexID, 10)))
indexMeta, ok := mt.indexID2Meta[segIdxMeta.IndexID]
if !ok {
log.Printf("index id = %d not exist", segIdxMeta.IndexID)
continue
}
delete(mt.indexID2Meta, segIdxMeta.IndexID)
metaKeys = append(metaKeys, path.Join(IndexMetaPrefix, strconv.FormatInt(indexMeta.IndexID, 10)))
}
}
}
err := mt.client.MultiRemove(metaKeys)
if err != nil { if err != nil {
_ = mt.reloadFromKV() _ = mt.reloadFromKV()
return err return err
} }
// remove index meta
for _, v := range collMeta.SegmentIDs {
if err := mt.removeSegmentIndexMeta(v); err != nil {
return err
}
}
return nil return nil
} }
@ -272,19 +240,19 @@ func (mt *metaTable) HasCollection(collID typeutil.UniqueID) bool {
return ok return ok
} }
func (mt *metaTable) GetCollectionByName(collectionName string) (*pb.CollectionMeta, error) { func (mt *metaTable) GetCollectionByName(collectionName string) (pb.CollectionInfo, error) {
mt.ddLock.RLock() mt.ddLock.RLock()
defer mt.ddLock.RUnlock() defer mt.ddLock.RUnlock()
vid, ok := mt.collName2ID[collectionName] vid, ok := mt.collName2ID[collectionName]
if !ok { if !ok {
return nil, errors.Errorf("can't find collection: " + collectionName) return pb.CollectionInfo{}, errors.Errorf("can't find collection: " + collectionName)
} }
col, ok := mt.collID2Meta[vid] col, ok := mt.collID2Meta[vid]
if !ok { if !ok {
return nil, errors.Errorf("can't find collection: " + collectionName) return pb.CollectionInfo{}, errors.Errorf("can't find collection: " + collectionName)
} }
return &col, nil return col, nil
} }
func (mt *metaTable) ListCollections() ([]string, error) { func (mt *metaTable) ListCollections() ([]string, error) {
@ -298,7 +266,7 @@ func (mt *metaTable) ListCollections() ([]string, error) {
return colls, nil return colls, nil
} }
func (mt *metaTable) AddPartition(collID typeutil.UniqueID, partitionTag string, partitionID typeutil.UniqueID) error { func (mt *metaTable) AddPartition(collID typeutil.UniqueID, partitionName string, partitionID typeutil.UniqueID) error {
mt.ddLock.Lock() mt.ddLock.Lock()
defer mt.ddLock.Unlock() defer mt.ddLock.Unlock()
coll, ok := mt.collID2Meta[collID] coll, ok := mt.collID2Meta[collID]
@ -307,18 +275,39 @@ func (mt *metaTable) AddPartition(collID typeutil.UniqueID, partitionTag string,
} }
// number of partition tags (except _default) should be limited to 4096 by default // number of partition tags (except _default) should be limited to 4096 by default
if int64(len(coll.PartitionTags)) > Params.MaxPartitionNum { if int64(len(coll.PartitionIDs)) > Params.MaxPartitionNum {
return errors.New("maximum partition's number should be limit to " + strconv.FormatInt(Params.MaxPartitionNum, 10)) return errors.New("maximum partition's number should be limit to " + strconv.FormatInt(Params.MaxPartitionNum, 10))
} }
for _, t := range coll.PartitionTags { for _, t := range coll.PartitionIDs {
if t == partitionTag { part, ok := mt.partitionID2Meta[t]
return errors.Errorf("partition already exists.") if !ok {
log.Printf("partition id = %d not exist", t)
continue
}
if part.PartitionName == partitionName {
return errors.Errorf("partition name = %s already exists", partitionName)
}
if part.PartitionID == partitionID {
return errors.Errorf("partition id = %d already exists", partitionID)
} }
} }
coll.PartitionTags = append(coll.PartitionTags, partitionTag) partMeta := pb.PartitionInfo{
PartitionName: partitionName,
PartitionID: partitionID,
SegmentIDs: make([]typeutil.UniqueID, 0, 16),
}
coll.PartitionIDs = append(coll.PartitionIDs, partitionID) coll.PartitionIDs = append(coll.PartitionIDs, partitionID)
mt.partitionID2Meta[partitionID] = partMeta
mt.collID2Meta[collID] = coll
k1 := path.Join(CollectionMetaPrefix, strconv.FormatInt(coll.ID, 10))
v1 := proto.MarshalTextString(&coll)
k2 := path.Join(PartitionMetaPrefix, strconv.FormatInt(partitionID, 10))
v2 := proto.MarshalTextString(&partMeta)
meta := map[string]string{k1: v1, k2: v2}
err := mt.client.MultiSave(meta)
err := mt.saveCollectionMeta(&coll)
if err != nil { if err != nil {
_ = mt.reloadFromKV() _ = mt.reloadFromKV()
return err return err
@ -326,394 +315,138 @@ func (mt *metaTable) AddPartition(collID typeutil.UniqueID, partitionTag string,
return nil return nil
} }
func (mt *metaTable) HasPartition(collID typeutil.UniqueID, tag string) bool { func (mt *metaTable) HasPartition(collID typeutil.UniqueID, partitionName string) bool {
mt.ddLock.RLock() mt.ddLock.RLock()
defer mt.ddLock.RUnlock() defer mt.ddLock.RUnlock()
col, ok := mt.collID2Meta[collID] col, ok := mt.collID2Meta[collID]
if !ok { if !ok {
return false return false
} }
for _, partitionTag := range col.PartitionTags { for _, partitionID := range col.PartitionIDs {
if partitionTag == tag { meta, ok := mt.partitionID2Meta[partitionID]
if ok {
if meta.PartitionName == partitionName {
return true return true
} }
} }
}
return false return false
} }
func (mt *metaTable) DeletePartition(collID typeutil.UniqueID, tag string) error { func (mt *metaTable) DeletePartition(collID typeutil.UniqueID, partitionName string) (typeutil.UniqueID, error) {
mt.ddLock.Lock() mt.ddLock.Lock()
defer mt.ddLock.Unlock() defer mt.ddLock.Unlock()
if tag == Params.DefaultPartitionTag { if partitionName == Params.DefaultPartitionName {
return errors.New("default partition cannot be deleted") return 0, errors.New("default partition cannot be deleted")
} }
collMeta, ok := mt.collID2Meta[collID] collMeta, ok := mt.collID2Meta[collID]
if !ok { if !ok {
return errors.Errorf("can't find collection. id = " + strconv.FormatInt(collID, 10)) return 0, errors.Errorf("can't find collection id = " + strconv.FormatInt(collID, 10))
} }
// check tag exists // check tag exists
exist := false exist := false
pt := make([]string, 0, len(collMeta.PartitionTags))
pd := make([]typeutil.UniqueID, 0, len(collMeta.PartitionIDs)) pd := make([]typeutil.UniqueID, 0, len(collMeta.PartitionIDs))
for i, t := range collMeta.PartitionTags { var partMeta pb.PartitionInfo
if t != tag { for _, t := range collMeta.PartitionIDs {
pt = append(pt, t) pm, ok := mt.partitionID2Meta[t]
pd = append(pd, collMeta.PartitionIDs[i]) if ok {
if pm.PartitionName != partitionName {
pd = append(pd, pm.PartitionID)
} else { } else {
partMeta = pm
exist = true exist = true
} }
}
} }
if !exist { if !exist {
return errors.New("partition " + tag + " does not exist") return 0, errors.New("partition " + partitionName + " does not exist")
} }
if len(pt) == len(collMeta.PartitionTags) { delete(mt.partitionID2Meta, partMeta.PartitionID)
return nil
}
toDeleteSeg := make([]typeutil.UniqueID, 0, len(collMeta.SegmentIDs))
seg := make([]typeutil.UniqueID, 0, len(collMeta.SegmentIDs))
for _, s := range collMeta.SegmentIDs {
sm, ok := mt.segID2Meta[s]
if !ok {
return errors.Errorf("DeletePartition:can't find segment id = %d", s)
}
if sm.PartitionTag != tag {
seg = append(seg, s)
} else {
toDeleteSeg = append(toDeleteSeg, s)
}
}
collMeta.PartitionTags = pt
collMeta.PartitionIDs = pd collMeta.PartitionIDs = pd
collMeta.SegmentIDs = seg mt.collID2Meta[collID] = collMeta
delMetaKeys := []string{path.Join(PartitionMetaPrefix, strconv.FormatInt(partMeta.PartitionID, 10))}
for _, segID := range partMeta.SegmentIDs {
segIndexMeta, ok := mt.segID2IndexMeta[segID]
if !ok {
log.Printf("segment id = %d not exist", segID)
continue
}
delete(mt.segID2IndexMeta, segID)
for indexID, segIdxMeta := range *segIndexMeta {
delMetaKeys = append(delMetaKeys, path.Join(SegmentIndexMetaPrefix, strconv.FormatInt(segID, 10), strconv.FormatInt(indexID, 10)))
indexMeta, ok := mt.indexID2Meta[segIdxMeta.IndexID]
if !ok {
log.Printf("index id = %d not exist", segIdxMeta.IndexID)
continue
}
delete(mt.indexID2Meta, segIdxMeta.IndexID)
delMetaKeys = append(delMetaKeys, path.Join(IndexMetaPrefix, strconv.FormatInt(indexMeta.IndexID, 10)))
}
}
collKV := map[string]string{path.Join(CollectionMetaPrefix, strconv.FormatInt(collID, 10)): proto.MarshalTextString(&collMeta)}
err := mt.client.MultiSaveAndRemove(collKV, delMetaKeys)
err := mt.saveCollectionAndDeleteSegmentsMeta(&collMeta, toDeleteSeg)
if err != nil { if err != nil {
_ = mt.reloadFromKV() _ = mt.reloadFromKV()
return err return 0, err
} }
return nil return partMeta.PartitionID, nil
} }
func (mt *metaTable) AddSegment(seg *pb.SegmentMeta) error { func (mt *metaTable) GetPartitionByID(partitionID typeutil.UniqueID) (pb.PartitionInfo, error) {
mt.ddLock.Lock() mt.ddLock.RLock()
defer mt.ddLock.Unlock() defer mt.ddLock.RUnlock()
collID := seg.CollectionID partMeta, ok := mt.partitionID2Meta[partitionID]
collMeta := mt.collID2Meta[collID] if !ok {
collMeta.SegmentIDs = append(collMeta.SegmentIDs, seg.SegmentID) return pb.PartitionInfo{}, errors.Errorf("partition id = %d not exist", partitionID)
err := mt.saveCollectionsAndSegmentsMeta(&collMeta, seg)
if err != nil {
_ = mt.reloadFromKV()
return err
} }
return nil return partMeta, nil
} }
func (mt *metaTable) UpdateSegment(seg *pb.SegmentMeta) error { func (mt *metaTable) AddSegment(seg *datapb.SegmentInfo) error {
mt.ddLock.Lock() mt.ddLock.Lock()
defer mt.ddLock.Unlock() defer mt.ddLock.Unlock()
collMeta, ok := mt.collID2Meta[seg.CollectionID]
collID := seg.CollectionID if !ok {
collMeta := mt.collID2Meta[collID] return errors.Errorf("can't find collection id = " + strconv.FormatInt(seg.CollectionID, 10))
isNewSegID := true }
for _, segID := range collMeta.SegmentIDs { partMeta, ok := mt.partitionID2Meta[seg.PartitionID]
if segID == seg.SegmentID { if !ok {
isNewSegID = false return errors.Errorf("can't find partition id = " + strconv.FormatInt(seg.PartitionID, 10))
}
exist := false
for _, partID := range collMeta.PartitionIDs {
if partID == seg.PartitionID {
exist = true
break break
} }
} }
if isNewSegID { if !exist {
collMeta.SegmentIDs = append(collMeta.SegmentIDs, seg.SegmentID) return errors.Errorf("partition id = %d, not belong to collection id = %d", seg.PartitionID, seg.CollectionID)
if err := mt.saveCollectionsAndSegmentsMeta(&collMeta, seg); err != nil {
_ = mt.reloadFromKV()
return err
} }
} else { exist = false
if err := mt.saveSegmentMeta(seg); err != nil { for _, segID := range partMeta.SegmentIDs {
_ = mt.reloadFromKV() if segID == seg.SegmentID {
return err exist = true
} }
} }
return nil if exist {
} return errors.Errorf("segment id = %d exist", seg.SegmentID)
func (mt *metaTable) GetSegmentByID(segID typeutil.UniqueID) (*pb.SegmentMeta, error) {
mt.ddLock.RLock()
defer mt.ddLock.RUnlock()
sm, ok := mt.segID2Meta[segID]
if !ok {
return nil, errors.Errorf("GetSegmentByID:can't find segment id = %d", segID)
} }
return &sm, nil partMeta.SegmentIDs = append(partMeta.SegmentIDs, seg.SegmentID)
} mt.partitionID2Meta[seg.PartitionID] = partMeta
err := mt.client.Save(path.Join(PartitionMetaPrefix, strconv.FormatInt(seg.PartitionID, 10)), proto.MarshalTextString(&partMeta))
func (mt *metaTable) DeleteSegment(segID typeutil.UniqueID) error {
mt.ddLock.Lock()
defer mt.ddLock.Unlock()
segMeta, ok := mt.segID2Meta[segID]
if !ok {
return errors.Errorf("DeleteSegment:can't find segment. id = " + strconv.FormatInt(segID, 10))
}
collMeta, ok := mt.collID2Meta[segMeta.CollectionID]
if !ok {
return errors.Errorf("can't find collection. id = " + strconv.FormatInt(segMeta.CollectionID, 10))
}
for i := 0; i < len(collMeta.SegmentIDs); i++ {
if collMeta.SegmentIDs[i] == segID {
collMeta.SegmentIDs = append(collMeta.SegmentIDs[:i], collMeta.SegmentIDs[i+1:]...)
}
}
err := mt.saveCollectionAndDeleteSegmentsMeta(&collMeta, []typeutil.UniqueID{segID})
if err != nil {
_ = mt.reloadFromKV()
return err
}
return mt.removeSegmentIndexMeta(segID)
}
func (mt *metaTable) CloseSegment(segID typeutil.UniqueID, closeTs typeutil.Timestamp) error {
mt.ddLock.Lock()
defer mt.ddLock.Unlock()
segMeta, ok := mt.segID2Meta[segID]
if !ok {
return errors.Errorf("CloseSegment:can't find segment id = " + strconv.FormatInt(segID, 10))
}
segMeta.CloseTime = closeTs
err := mt.saveSegmentMeta(&segMeta)
if err != nil { if err != nil {
_ = mt.reloadFromKV() _ = mt.reloadFromKV()
return err return err
} }
return nil return nil
} }
func (mt *metaTable) AddFieldIndexMeta(meta *pb.FieldIndexMeta) error {
mt.indexLock.Lock()
defer mt.indexLock.Unlock()
segID := meta.SegmentID
if _, ok := mt.segID2IndexMetas[segID]; !ok {
mt.segID2IndexMetas[segID] = make([]pb.FieldIndexMeta, 0)
}
for _, v := range mt.segID2IndexMetas[segID] {
if v.FieldID == meta.FieldID && typeutil.CompareIndexParams(v.IndexParams, meta.IndexParams) {
return fmt.Errorf("segment %d field id %d's index meta already exist", segID, meta.FieldID)
}
}
mt.segID2IndexMetas[segID] = append(mt.segID2IndexMetas[segID], *meta)
err := mt.saveFieldIndexMetaToEtcd(meta)
if err != nil {
_ = mt.reloadFromKV()
return err
}
return nil
}
func (mt *metaTable) saveFieldIndexMetaToEtcd(meta *pb.FieldIndexMeta) error {
key := "/indexmeta/" + strconv.FormatInt(meta.SegmentID, 10) + strconv.FormatInt(meta.FieldID, 10) + strconv.FormatInt(meta.IndexID, 10)
marshaledMeta := proto.MarshalTextString(meta)
return mt.client.Save(key, marshaledMeta)
}
func (mt *metaTable) DeleteFieldIndexMeta(segID typeutil.UniqueID, fieldID typeutil.UniqueID, indexParams []*commonpb.KeyValuePair) error {
mt.indexLock.Lock()
defer mt.indexLock.Unlock()
if _, ok := mt.segID2IndexMetas[segID]; !ok {
return fmt.Errorf("can not find index meta of segment %d", segID)
}
for i, v := range mt.segID2IndexMetas[segID] {
if v.FieldID == fieldID && typeutil.CompareIndexParams(v.IndexParams, indexParams) {
mt.segID2IndexMetas[segID] = append(mt.segID2IndexMetas[segID][:i], mt.segID2IndexMetas[segID][i+1:]...)
err := mt.deleteFieldIndexMetaToEtcd(segID, fieldID, v.IndexID)
if err != nil {
_ = mt.reloadFromKV()
return err
}
return nil
}
}
return fmt.Errorf("can not find index meta of field %d", fieldID)
}
func (mt *metaTable) deleteFieldIndexMetaToEtcd(segID typeutil.UniqueID, fieldID typeutil.UniqueID, indexID typeutil.UniqueID) error {
key := "/indexmeta/" + strconv.FormatInt(segID, 10) + strconv.FormatInt(fieldID, 10) + strconv.FormatInt(indexID, 10)
return mt.client.Remove(key)
}
func (mt *metaTable) HasFieldIndexMeta(segID typeutil.UniqueID, fieldID typeutil.UniqueID, indexParams []*commonpb.KeyValuePair) (bool, error) {
mt.indexLock.RLock()
defer mt.indexLock.RUnlock()
if _, ok := mt.segID2IndexMetas[segID]; !ok {
return false, nil
}
for _, v := range mt.segID2IndexMetas[segID] {
if v.FieldID == fieldID && typeutil.CompareIndexParams(v.IndexParams, indexParams) {
return true, nil
}
}
return false, nil
}
func (mt *metaTable) GetFieldIndexMeta(segID typeutil.UniqueID, fieldID typeutil.UniqueID, indexParams []*commonpb.KeyValuePair) (*pb.FieldIndexMeta, error) {
mt.indexLock.RLock()
defer mt.indexLock.RUnlock()
if _, ok := mt.segID2IndexMetas[segID]; !ok {
return nil, fmt.Errorf("can not find segment %d", segID)
}
for _, v := range mt.segID2IndexMetas[segID] {
if v.FieldID == fieldID && typeutil.CompareIndexParams(v.IndexParams, indexParams) {
return &v, nil
}
}
return nil, fmt.Errorf("can not find field %d", fieldID)
}
func (mt *metaTable) UpdateFieldIndexMeta(meta *pb.FieldIndexMeta) error {
mt.indexLock.Lock()
defer mt.indexLock.Unlock()
segID := meta.SegmentID
if _, ok := mt.segID2IndexMetas[segID]; !ok {
mt.segID2IndexMetas[segID] = make([]pb.FieldIndexMeta, 0)
}
for i, v := range mt.segID2IndexMetas[segID] {
if v.FieldID == meta.FieldID && typeutil.CompareIndexParams(v.IndexParams, meta.IndexParams) {
mt.segID2IndexMetas[segID][i] = *meta
err := mt.deleteFieldIndexMetaToEtcd(segID, v.FieldID, v.IndexID)
if err != nil {
_ = mt.reloadFromKV()
return err
}
err = mt.saveFieldIndexMetaToEtcd(meta)
if err != nil {
_ = mt.reloadFromKV()
return err
}
return nil
}
}
mt.segID2IndexMetas[segID] = append(mt.segID2IndexMetas[segID], *meta)
err := mt.saveFieldIndexMetaToEtcd(meta)
if err != nil {
_ = mt.reloadFromKV()
return err
}
return nil
}
func (mt *metaTable) removeSegmentIndexMeta(segID typeutil.UniqueID) error {
mt.indexLock.Lock()
defer mt.indexLock.Unlock()
delete(mt.segID2IndexMetas, segID)
keys, _, err := mt.client.LoadWithPrefix("indexmeta/" + strconv.FormatInt(segID, 10))
if err != nil {
_ = mt.reloadFromKV()
return err
}
if err = mt.client.MultiRemove(keys); err != nil {
_ = mt.reloadFromKV()
return err
}
return nil
}
func (mt *metaTable) GetFieldTypeParams(collID typeutil.UniqueID, fieldID typeutil.UniqueID) ([]*commonpb.KeyValuePair, error) {
mt.ddLock.RLock()
defer mt.ddLock.RUnlock()
if _, ok := mt.collID2Meta[collID]; !ok {
return nil, fmt.Errorf("can not find collection with id %d", collID)
}
for _, fieldSchema := range mt.collID2Meta[collID].Schema.Fields {
if fieldSchema.FieldID == fieldID {
return fieldSchema.TypeParams, nil
}
}
return nil, fmt.Errorf("can not find field %d in collection %d", fieldID, collID)
}
func (mt *metaTable) GetFieldIndexParams(collID typeutil.UniqueID, fieldID typeutil.UniqueID) ([]*commonpb.KeyValuePair, error) {
mt.ddLock.RLock()
defer mt.ddLock.RUnlock()
if _, ok := mt.collID2Meta[collID]; !ok {
return nil, fmt.Errorf("can not find collection with id %d", collID)
}
for _, fieldSchema := range mt.collID2Meta[collID].Schema.Fields {
if fieldSchema.FieldID == fieldID {
return fieldSchema.IndexParams, nil
}
}
return nil, fmt.Errorf("can not find field %d in collection %d", fieldID, collID)
}
func (mt *metaTable) UpdateFieldIndexParams(collName string, fieldName string, indexParams []*commonpb.KeyValuePair) error {
mt.ddLock.Lock()
defer mt.ddLock.Unlock()
vid, ok := mt.collName2ID[collName]
if !ok {
return errors.Errorf("can't find collection: " + collName)
}
meta, ok := mt.collID2Meta[vid]
if !ok {
return errors.Errorf("can't find collection: " + collName)
}
for _, fieldSchema := range meta.Schema.Fields {
if fieldSchema.Name == fieldName {
fieldSchema.IndexParams = indexParams
if err := mt.saveCollectionMeta(&meta); err != nil {
_ = mt.reloadFromKV()
return err
}
return nil
}
}
return fmt.Errorf("can not find field with id %s", fieldName)
}
func (mt *metaTable) IsIndexable(collID typeutil.UniqueID, fieldID typeutil.UniqueID) (bool, error) {
mt.ddLock.RLock()
defer mt.ddLock.RUnlock()
if _, ok := mt.collID2Meta[collID]; !ok {
return false, fmt.Errorf("can not find collection with id %d", collID)
}
for _, v := range mt.collID2Meta[collID].Schema.Fields {
// field is vector type and index params is not empty
if v.FieldID == fieldID && (v.DataType == schemapb.DataType_VECTOR_BINARY || v.DataType == schemapb.DataType_VECTOR_FLOAT) &&
len(v.IndexParams) != 0 {
return true, nil
}
}
// fieldID is not in schema(eg: timestamp) or not indexable
return false, nil
}

View File

@ -22,7 +22,8 @@ type ParamTable struct {
TimeTickChannel string TimeTickChannel string
DdChannel string DdChannel string
StatisticsChannel string StatisticsChannel string
DataServiceSegmentChannel string // data service create segment, or data node flush segment
MaxPartitionNum int64 MaxPartitionNum int64
DefaultPartitionTag string DefaultPartitionName string
} }

View File

@ -1,12 +1,11 @@
package masterservice package masterservice
import ( import (
"fmt"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/errors"
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
"github.com/zilliztech/milvus-distributed/internal/proto/etcdpb" "github.com/zilliztech/milvus-distributed/internal/proto/etcdpb"
"github.com/zilliztech/milvus-distributed/internal/proto/internalpb2"
"github.com/zilliztech/milvus-distributed/internal/proto/milvuspb" "github.com/zilliztech/milvus-distributed/internal/proto/milvuspb"
"github.com/zilliztech/milvus-distributed/internal/proto/schemapb" "github.com/zilliztech/milvus-distributed/internal/proto/schemapb"
"github.com/zilliztech/milvus-distributed/internal/util/typeutil" "github.com/zilliztech/milvus-distributed/internal/util/typeutil"
@ -91,19 +90,37 @@ func (t *CreateCollectionReqTask) Execute() error {
if err != nil { if err != nil {
return err return err
} }
coll := etcdpb.CollectionMeta{ collMeta := etcdpb.CollectionInfo{
ID: collID, ID: collID,
Schema: &schema, Schema: &schema,
CreateTime: collTs, CreateTime: collTs,
SegmentIDs: make([]typeutil.UniqueID, 0), PartitionIDs: make([]typeutil.UniqueID, 0, 16),
PartitionTags: []string{Params.DefaultPartitionTag},
PartitionIDs: []typeutil.UniqueID{partitionID},
} }
err = t.core.MetaTable.AddCollection(&coll) partMeta := etcdpb.PartitionInfo{
PartitionName: Params.DefaultPartitionName,
PartitionID: partitionID,
SegmentIDs: make([]typeutil.UniqueID, 0, 16),
}
err = t.core.MetaTable.AddCollection(&collMeta, &partMeta)
if err != nil { if err != nil {
return err return err
} }
err = t.core.DdCreateCollectionReq(t) schemaBytes, err := proto.Marshal(&schema)
if err != nil {
return err
}
ddReq := internalpb2.CreateCollectionRequest{
Base: t.Req.Base,
DbName: t.Req.DbName,
CollectionName: t.Req.CollectionName,
DbID: 0, //TODO,not used
CollectionID: collID,
Schema: schemaBytes,
}
err = t.core.DdCreateCollectionReq(&ddReq)
if err != nil { if err != nil {
return err return err
} }
@ -136,7 +153,15 @@ func (t *DropCollectionReqTask) Execute() error {
//data service should drop segments , which belong to this collection, from the segment manager //data service should drop segments , which belong to this collection, from the segment manager
err = t.core.DdDropCollectionReq(t) ddReq := internalpb2.DropCollectionRequest{
Base: t.Req.Base,
DbName: t.Req.DbName,
CollectionName: t.Req.CollectionName,
DbID: 0, //not used
CollectionID: collMeta.ID,
}
err = t.core.DdDropCollectionReq(&ddReq)
if err != nil { if err != nil {
return err return err
} }
@ -197,50 +222,6 @@ func (t *DescribeCollectionReqTask) Execute() error {
return nil return nil
} }
type CollectionStatsReqTask struct {
baseReqTask
Req *milvuspb.CollectionStatsRequest
Rsp *milvuspb.CollectionStatsResponse
}
func (t *CollectionStatsReqTask) Type() commonpb.MsgType {
return t.Req.Base.MsgType
}
func (t *CollectionStatsReqTask) Ts() (typeutil.Timestamp, error) {
return t.Req.Base.Timestamp, nil
}
//row_count
//data_size
func (t *CollectionStatsReqTask) Execute() error {
coll, err := t.core.MetaTable.GetCollectionByName(t.Req.CollectionName)
if err != nil {
return err
}
var rowCount int64 = 0
var dataSize int64 = 0
for _, seg := range coll.SegmentIDs {
m, e := t.core.GetSegmentMeta(seg)
if e != nil {
return e
}
rowCount += m.NumRows
dataSize += m.MemSize
}
t.Rsp.Stats = append(t.Rsp.Stats,
&commonpb.KeyValuePair{
Key: "row_count",
Value: fmt.Sprintf("%d", rowCount),
})
t.Rsp.Stats = append(t.Rsp.Stats,
&commonpb.KeyValuePair{
Key: "data_size",
Value: fmt.Sprintf("%d", dataSize),
})
return nil
}
type ShowCollectionReqTask struct { type ShowCollectionReqTask struct {
baseReqTask baseReqTask
Req *milvuspb.ShowCollectionRequest Req *milvuspb.ShowCollectionRequest
@ -291,7 +272,17 @@ func (t *CreatePartitionReqTask) Execute() error {
return err return err
} }
err = t.core.DdCreatePartitionReq(t) ddReq := internalpb2.CreatePartitionRequest{
Base: t.Req.Base,
DbName: t.Req.DbName,
CollectionName: t.Req.CollectionName,
PartitionName: t.Req.PartitionName,
DbID: 0, // todo, not used
CollectionID: collMeta.ID,
PartitionID: partitionID,
}
err = t.core.DdCreatePartitionReq(&ddReq)
if err != nil { if err != nil {
return err return err
} }
@ -317,12 +308,22 @@ func (t *DropPartitionReqTask) Execute() error {
if err != nil { if err != nil {
return err return err
} }
err = t.core.MetaTable.DeletePartition(coll.ID, t.Req.PartitionName) partID, err := t.core.MetaTable.DeletePartition(coll.ID, t.Req.PartitionName)
if err != nil { if err != nil {
return err return err
} }
err = t.core.DdDropPartitionReq(t) ddReq := internalpb2.DropPartitionRequest{
Base: t.Req.Base,
DbName: t.Req.DbName,
CollectionName: t.Req.CollectionName,
PartitionName: t.Req.PartitionName,
DbID: 0, //todo,not used
CollectionID: coll.ID,
PartitionID: partID,
}
err = t.core.DdDropPartitionReq(&ddReq)
if err != nil { if err != nil {
return err return err
} }
@ -352,50 +353,6 @@ func (t *HasPartitionReqTask) Execute() error {
return nil return nil
} }
type PartitionStatsReqTask struct {
baseReqTask
Req *milvuspb.PartitionStatsRequest
Rsp *milvuspb.PartitionStatsResponse
}
func (t *PartitionStatsReqTask) Type() commonpb.MsgType {
return t.Req.Base.MsgType
}
func (t *PartitionStatsReqTask) Ts() (typeutil.Timestamp, error) {
return t.Req.Base.Timestamp, nil
}
func (t *PartitionStatsReqTask) Execute() error {
coll, err := t.core.MetaTable.GetCollectionByName(t.Req.CollectionName)
if err != nil {
return err
}
var rowCount int64 = 0
var dataSize int64 = 0
for _, seg := range coll.SegmentIDs {
m, e := t.core.GetSegmentMeta(seg)
if e != nil {
return e
}
if m.PartitionTag == t.Req.PartitionName {
rowCount += m.NumRows
dataSize += m.MemSize
}
}
t.Rsp.Stats = append(t.Rsp.Stats,
&commonpb.KeyValuePair{
Key: "row_count",
Value: fmt.Sprintf("%d", rowCount),
})
t.Rsp.Stats = append(t.Rsp.Stats,
&commonpb.KeyValuePair{
Key: "data_size",
Value: fmt.Sprintf("%d", dataSize),
})
return nil
}
type ShowPartitionReqTask struct { type ShowPartitionReqTask struct {
baseReqTask baseReqTask
Req *milvuspb.ShowPartitionRequest Req *milvuspb.ShowPartitionRequest
@ -410,12 +367,18 @@ func (t *ShowPartitionReqTask) Ts() (typeutil.Timestamp, error) {
return t.Req.Base.Timestamp, nil return t.Req.Base.Timestamp, nil
} }
//TODO,list partition ids and partition tags
func (t *ShowPartitionReqTask) Execute() error { func (t *ShowPartitionReqTask) Execute() error {
coll, err := t.core.MetaTable.GetCollectionByName(t.Req.CollectionName) coll, err := t.core.MetaTable.GetCollectionByName(t.Req.CollectionName)
if err != nil { if err != nil {
return err return err
} }
t.Rsp.PartitionNames = append(t.Rsp.PartitionNames, coll.PartitionTags...) for _, partID := range coll.PartitionIDs {
partMeta, err := t.core.MetaTable.GetPartitionByID(partID)
if err != nil {
return err
}
t.Rsp.PartitionIDs = append(t.Rsp.PartitionIDs, partMeta.PartitionID)
t.Rsp.PartitionNames = append(t.Rsp.PartitionNames, partMeta.PartitionName)
}
return nil return nil
} }

View File

@ -5,6 +5,7 @@ import (
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
"github.com/zilliztech/milvus-distributed/internal/proto/datapb"
"github.com/zilliztech/milvus-distributed/internal/proto/internalpb2" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2"
) )
@ -558,3 +559,41 @@ func (lim *LoadIndexMsg) Unmarshal(input []byte) (TsMsg, error) {
return loadIndexMsg, nil return loadIndexMsg, nil
} }
/////////////////////////////////////////SegmentInfoMsg//////////////////////////////////////////
type SegmentInfoMsg struct {
BaseMsg
datapb.SegmentMsg
}
func (sim *SegmentInfoMsg) Type() MsgType {
return sim.Base.MsgType
}
func (sim *SegmentInfoMsg) GetMsgContext() context.Context {
return sim.MsgCtx
}
func (sim *SegmentInfoMsg) SetMsgContext(ctx context.Context) {
sim.MsgCtx = ctx
}
func (sim *SegmentInfoMsg) Marshal(input TsMsg) ([]byte, error) {
segInfoMsg := input.(*SegmentInfoMsg)
mb, err := proto.Marshal(&segInfoMsg.SegmentMsg)
if err != nil {
return nil, err
}
return mb, nil
}
func (sim *SegmentInfoMsg) Unmarshal(input []byte) (TsMsg, error) {
segMsg := datapb.SegmentMsg{}
err := proto.Unmarshal(input, &segMsg)
if err != nil {
return nil, err
}
return &SegmentInfoMsg{
SegmentMsg: segMsg,
}, nil
}

View File

@ -131,6 +131,11 @@ message SegmentInfo {
int64 mem_size=8; int64 mem_size=8;
} }
message SegmentMsg{
common.MsgBase base = 1;
SegmentInfo segment = 2;
}
service DataService { service DataService {
rpc RegisterNode(RegisterNodeRequest) returns (RegisterNodeResponse) {} rpc RegisterNode(RegisterNodeRequest) returns (RegisterNodeResponse) {}

View File

@ -1056,6 +1056,53 @@ func (m *SegmentInfo) GetMemSize() int64 {
return 0 return 0
} }
type SegmentMsg struct {
Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
Segment *SegmentInfo `protobuf:"bytes,2,opt,name=segment,proto3" json:"segment,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SegmentMsg) Reset() { *m = SegmentMsg{} }
func (m *SegmentMsg) String() string { return proto.CompactTextString(m) }
func (*SegmentMsg) ProtoMessage() {}
func (*SegmentMsg) Descriptor() ([]byte, []int) {
return fileDescriptor_3385cd32ad6cfe64, []int{17}
}
func (m *SegmentMsg) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SegmentMsg.Unmarshal(m, b)
}
func (m *SegmentMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SegmentMsg.Marshal(b, m, deterministic)
}
func (m *SegmentMsg) XXX_Merge(src proto.Message) {
xxx_messageInfo_SegmentMsg.Merge(m, src)
}
func (m *SegmentMsg) XXX_Size() int {
return xxx_messageInfo_SegmentMsg.Size(m)
}
func (m *SegmentMsg) XXX_DiscardUnknown() {
xxx_messageInfo_SegmentMsg.DiscardUnknown(m)
}
var xxx_messageInfo_SegmentMsg proto.InternalMessageInfo
func (m *SegmentMsg) GetBase() *commonpb.MsgBase {
if m != nil {
return m.Base
}
return nil
}
func (m *SegmentMsg) GetSegment() *SegmentInfo {
if m != nil {
return m.Segment
}
return nil
}
func init() { func init() {
proto.RegisterEnum("milvus.proto.data.SegmentState", SegmentState_name, SegmentState_value) proto.RegisterEnum("milvus.proto.data.SegmentState", SegmentState_name, SegmentState_value)
proto.RegisterType((*RegisterNodeRequest)(nil), "milvus.proto.data.RegisterNodeRequest") proto.RegisterType((*RegisterNodeRequest)(nil), "milvus.proto.data.RegisterNodeRequest")
@ -1075,84 +1122,87 @@ func init() {
proto.RegisterType((*WatchDmChannelRequest)(nil), "milvus.proto.data.WatchDmChannelRequest") proto.RegisterType((*WatchDmChannelRequest)(nil), "milvus.proto.data.WatchDmChannelRequest")
proto.RegisterType((*FlushSegRequest)(nil), "milvus.proto.data.FlushSegRequest") proto.RegisterType((*FlushSegRequest)(nil), "milvus.proto.data.FlushSegRequest")
proto.RegisterType((*SegmentInfo)(nil), "milvus.proto.data.SegmentInfo") proto.RegisterType((*SegmentInfo)(nil), "milvus.proto.data.SegmentInfo")
proto.RegisterType((*SegmentMsg)(nil), "milvus.proto.data.SegmentMsg")
} }
func init() { proto.RegisterFile("data_service.proto", fileDescriptor_3385cd32ad6cfe64) } func init() { proto.RegisterFile("data_service.proto", fileDescriptor_3385cd32ad6cfe64) }
var fileDescriptor_3385cd32ad6cfe64 = []byte{ var fileDescriptor_3385cd32ad6cfe64 = []byte{
// 1144 bytes of a gzipped FileDescriptorProto // 1169 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xdd, 0x6e, 0x1b, 0xc5, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xdd, 0x6e, 0x1b, 0xc5,
0x17, 0x8f, 0xbf, 0x12, 0xfb, 0xd8, 0xb1, 0xdd, 0x49, 0xfa, 0xff, 0xbb, 0x6e, 0x21, 0x61, 0xa5, 0x17, 0x8f, 0xbf, 0x12, 0xfb, 0xd8, 0xb1, 0x9d, 0x49, 0xfa, 0xff, 0xbb, 0x6e, 0x68, 0xc2, 0x4a,
0x36, 0x51, 0x05, 0x09, 0x4a, 0x55, 0xb8, 0x43, 0x34, 0xb8, 0x44, 0x16, 0x34, 0x8a, 0xc6, 0x48, 0x6d, 0xa2, 0x0a, 0x12, 0x94, 0xaa, 0xc0, 0x15, 0xa2, 0xc1, 0x25, 0xb2, 0x20, 0x51, 0x34, 0x46,
0x48, 0xe5, 0xc2, 0x5a, 0x7b, 0x4f, 0xd6, 0x23, 0xed, 0xce, 0x2c, 0x3b, 0xe3, 0x26, 0xca, 0x0d, 0x42, 0x2a, 0x17, 0xd6, 0xda, 0x7b, 0xb2, 0x1e, 0x69, 0x77, 0x66, 0xd9, 0x19, 0x37, 0x51, 0x6e,
0x3c, 0x40, 0x9f, 0x00, 0xee, 0xb9, 0xe4, 0x11, 0xe0, 0x15, 0x78, 0x24, 0xb4, 0x33, 0xeb, 0xf5, 0xe0, 0x01, 0xfa, 0x04, 0x70, 0xcf, 0x25, 0x8f, 0x00, 0xaf, 0xc0, 0x23, 0xa1, 0x9d, 0x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3c, 0x39, 0xc0, 0xa6, 0x6d, 0xda, 0xb0, 0x95, 0xd8, 0x4c, 0x7a, 0xf7, 0x60, 0xa9, 0x92, 0xec, 0xd4, 0x6d,
0x36, 0x77, 0x3f, 0x71, 0x98, 0x54, 0x21, 0x1b, 0x4d, 0x15, 0x3a, 0xc7, 0x33, 0x0d, 0xc7, 0x5a, 0xaf, 0xde, 0x1d, 0xd6, 0xda, 0xe9, 0x97, 0xaf, 0xbf, 0x70, 0x99, 0x1a, 0x8d, 0x07, 0x51, 0x79,
0xe1, 0x71, 0x64, 0x39, 0x18, 0x8d, 0x36, 0xf5, 0xe9, 0xd9, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1c, 0xdf, 0x32, 0xcf, 0x63, 0xb7, 0x0a, 0x87, 0xa3, 0x63, 0x73, 0xf7, 0x63, 0x87, 0x49, 0x15,
0x92, 0x26, 0x37, 0x78, 0x3a, 0x0e, 0x00, 0x00, 0xb2, 0xc1, 0x58, 0xa1, 0x73, 0x3c, 0xd1, 0x70, 0xac, 0x15, 0x1e, 0x47, 0x96, 0x83, 0xc1, 0x60,
0x5d, 0x9f, 0x9e, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x45, 0xdf, 0xe6, 0xdf, 0xb4, 0x0e, 0x00,
0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.

View File

@ -67,8 +67,6 @@ service MasterService {
*/ */
rpc DescribeCollection(milvus.DescribeCollectionRequest) returns (milvus.DescribeCollectionResponse) {} rpc DescribeCollection(milvus.DescribeCollectionRequest) returns (milvus.DescribeCollectionResponse) {}
rpc GetCollectionStatistics(milvus.CollectionStatsRequest) returns (milvus.CollectionStatsResponse) {}
/** /**
* @brief This method is used to list all collections. * @brief This method is used to list all collections.
* *
@ -97,8 +95,6 @@ service MasterService {
*/ */
rpc HasPartition(milvus.HasPartitionRequest) returns (milvus.BoolResponse) {} rpc HasPartition(milvus.HasPartitionRequest) returns (milvus.BoolResponse) {}
rpc GetPartitionStatistics(milvus.PartitionStatsRequest) returns (milvus.PartitionStatsResponse) {}
/** /**
* @brief This method is used to show partition information * @brief This method is used to show partition information
* *

View File

@ -242,55 +242,52 @@ func init() {
func init() { proto.RegisterFile("master.proto", fileDescriptor_f9c348dec43a6705) } func init() { proto.RegisterFile("master.proto", fileDescriptor_f9c348dec43a6705) }
var fileDescriptor_f9c348dec43a6705 = []byte{ var fileDescriptor_f9c348dec43a6705 = []byte{
// 756 bytes of a gzipped FileDescriptorProto // 714 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xfb, 0x6e, 0xd3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x5b, 0x4f, 0xdb, 0x3c,
0x14, 0xc6, 0x77, 0x63, 0x68, 0x67, 0xbd, 0x0c, 0x33, 0xc1, 0x14, 0x26, 0x36, 0x0a, 0x6c, 0xdd, 0x18, 0xc7, 0x39, 0xbd, 0xbc, 0xe2, 0xa1, 0x07, 0xe4, 0x71, 0x81, 0x32, 0x34, 0x58, 0xb7, 0x41,
0x85, 0x14, 0x6d, 0x2f, 0xc0, 0xba, 0xa0, 0xae, 0x12, 0x93, 0xa0, 0x2d, 0xa0, 0x81, 0xa6, 0x29, 0x39, 0x2c, 0x9d, 0xe0, 0x0b, 0x8c, 0x92, 0xa9, 0x54, 0x1a, 0xd2, 0xd6, 0x76, 0x9b, 0xd8, 0x84,
0x49, 0xad, 0xd6, 0x22, 0x89, 0x4b, 0x8e, 0xdb, 0xc1, 0x9e, 0x98, 0xc7, 0x40, 0xb9, 0x39, 0x49, 0x90, 0x93, 0x5a, 0xad, 0xb5, 0x24, 0xee, 0xe2, 0xa7, 0xb0, 0xf1, 0xd5, 0x77, 0x33, 0xe5, 0xe4,
0x97, 0x74, 0x41, 0xec, 0x4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04, 0x1b, 0xde, 0xf4, 0xff, 0xff, 0xcc, 0x29, 0xfa, 0xd0, 0x39, 0x0a, 0x00, 0x00,
0x19, 0x0a, 0x97, 0x19, 0x63, 0x41, 0xfb, 0x8d, 0xa8, 0x96, 0x0d, 0x5f, 0xb2, 0x11, 0x24, 0x62,
0x64, 0x18, 0xcb, 0xfe, 0xf8, 0xf8, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb7, 0xb2, 0x22, 0xf7,
0x26, 0x0b, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -333,7 +330,6 @@ type MasterServiceClient interface {
// //
// @return CollectionSchema // @return CollectionSchema
DescribeCollection(ctx context.Context, in *milvuspb.DescribeCollectionRequest, opts ...grpc.CallOption) (*milvuspb.DescribeCollectionResponse, error) DescribeCollection(ctx context.Context, in *milvuspb.DescribeCollectionRequest, opts ...grpc.CallOption) (*milvuspb.DescribeCollectionResponse, error)
GetCollectionStatistics(ctx context.Context, in *milvuspb.CollectionStatsRequest, opts ...grpc.CallOption) (*milvuspb.CollectionStatsResponse, error)
//* //*
// @brief This method is used to list all collections. // @brief This method is used to list all collections.
// //
@ -354,7 +350,6 @@ type MasterServiceClient interface {
// //
// @return BoolResponse // @return BoolResponse
HasPartition(ctx context.Context, in *milvuspb.HasPartitionRequest, opts ...grpc.CallOption) (*milvuspb.BoolResponse, error) HasPartition(ctx context.Context, in *milvuspb.HasPartitionRequest, opts ...grpc.CallOption) (*milvuspb.BoolResponse, error)
GetPartitionStatistics(ctx context.Context, in *milvuspb.PartitionStatsRequest, opts ...grpc.CallOption) (*milvuspb.PartitionStatsResponse, error)
//* //*
// @brief This method is used to show partition information // @brief This method is used to show partition information
// //
@ -421,15 +416,6 @@ func (c *masterServiceClient) DescribeCollection(ctx context.Context, in *milvus
return out, nil return out, nil
} }
func (c *masterServiceClient) GetCollectionStatistics(ctx context.Context, in *milvuspb.CollectionStatsRequest, opts ...grpc.CallOption) (*milvuspb.CollectionStatsResponse, error) {
out := new(milvuspb.CollectionStatsResponse)
err := c.cc.Invoke(ctx, "/milvus.proto.master.MasterService/GetCollectionStatistics", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *masterServiceClient) ShowCollections(ctx context.Context, in *milvuspb.ShowCollectionRequest, opts ...grpc.CallOption) (*milvuspb.ShowCollectionResponse, error) { func (c *masterServiceClient) ShowCollections(ctx context.Context, in *milvuspb.ShowCollectionRequest, opts ...grpc.CallOption) (*milvuspb.ShowCollectionResponse, error) {
out := new(milvuspb.ShowCollectionResponse) out := new(milvuspb.ShowCollectionResponse)
err := c.cc.Invoke(ctx, "/milvus.proto.master.MasterService/ShowCollections", in, out, opts...) err := c.cc.Invoke(ctx, "/milvus.proto.master.MasterService/ShowCollections", in, out, opts...)
@ -466,15 +452,6 @@ func (c *masterServiceClient) HasPartition(ctx context.Context, in *milvuspb.Has
return out, nil return out, nil
} }
func (c *masterServiceClient) GetPartitionStatistics(ctx context.Context, in *milvuspb.PartitionStatsRequest, opts ...grpc.CallOption) (*milvuspb.PartitionStatsResponse, error) {
out := new(milvuspb.PartitionStatsResponse)
err := c.cc.Invoke(ctx, "/milvus.proto.master.MasterService/GetPartitionStatistics", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *masterServiceClient) ShowPartitions(ctx context.Context, in *milvuspb.ShowPartitionRequest, opts ...grpc.CallOption) (*milvuspb.ShowPartitionResponse, error) { func (c *masterServiceClient) ShowPartitions(ctx context.Context, in *milvuspb.ShowPartitionRequest, opts ...grpc.CallOption) (*milvuspb.ShowPartitionResponse, error) {
out := new(milvuspb.ShowPartitionResponse) out := new(milvuspb.ShowPartitionResponse)
err := c.cc.Invoke(ctx, "/milvus.proto.master.MasterService/ShowPartitions", in, out, opts...) err := c.cc.Invoke(ctx, "/milvus.proto.master.MasterService/ShowPartitions", in, out, opts...)
@ -622,7 +599,6 @@ type MasterServiceServer interface {
// //
// @return CollectionSchema // @return CollectionSchema
DescribeCollection(context.Context, *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error) DescribeCollection(context.Context, *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error)
GetCollectionStatistics(context.Context, *milvuspb.CollectionStatsRequest) (*milvuspb.CollectionStatsResponse, error)
//* //*
// @brief This method is used to list all collections. // @brief This method is used to list all collections.
// //
@ -643,7 +619,6 @@ type MasterServiceServer interface {
// //
// @return BoolResponse // @return BoolResponse
HasPartition(context.Context, *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error) HasPartition(context.Context, *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error)
GetPartitionStatistics(context.Context, *milvuspb.PartitionStatsRequest) (*milvuspb.PartitionStatsResponse, error)
//* //*
// @brief This method is used to show partition information // @brief This method is used to show partition information
// //
@ -682,9 +657,6 @@ func (*UnimplementedMasterServiceServer) HasCollection(ctx context.Context, req
func (*UnimplementedMasterServiceServer) DescribeCollection(ctx context.Context, req *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error) { func (*UnimplementedMasterServiceServer) DescribeCollection(ctx context.Context, req *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DescribeCollection not implemented") return nil, status.Errorf(codes.Unimplemented, "method DescribeCollection not implemented")
} }
func (*UnimplementedMasterServiceServer) GetCollectionStatistics(ctx context.Context, req *milvuspb.CollectionStatsRequest) (*milvuspb.CollectionStatsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCollectionStatistics not implemented")
}
func (*UnimplementedMasterServiceServer) ShowCollections(ctx context.Context, req *milvuspb.ShowCollectionRequest) (*milvuspb.ShowCollectionResponse, error) { func (*UnimplementedMasterServiceServer) ShowCollections(ctx context.Context, req *milvuspb.ShowCollectionRequest) (*milvuspb.ShowCollectionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ShowCollections not implemented") return nil, status.Errorf(codes.Unimplemented, "method ShowCollections not implemented")
} }
@ -697,9 +669,6 @@ func (*UnimplementedMasterServiceServer) DropPartition(ctx context.Context, req
func (*UnimplementedMasterServiceServer) HasPartition(ctx context.Context, req *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error) { func (*UnimplementedMasterServiceServer) HasPartition(ctx context.Context, req *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method HasPartition not implemented") return nil, status.Errorf(codes.Unimplemented, "method HasPartition not implemented")
} }
func (*UnimplementedMasterServiceServer) GetPartitionStatistics(ctx context.Context, req *milvuspb.PartitionStatsRequest) (*milvuspb.PartitionStatsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPartitionStatistics not implemented")
}
func (*UnimplementedMasterServiceServer) ShowPartitions(ctx context.Context, req *milvuspb.ShowPartitionRequest) (*milvuspb.ShowPartitionResponse, error) { func (*UnimplementedMasterServiceServer) ShowPartitions(ctx context.Context, req *milvuspb.ShowPartitionRequest) (*milvuspb.ShowPartitionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ShowPartitions not implemented") return nil, status.Errorf(codes.Unimplemented, "method ShowPartitions not implemented")
} }
@ -816,24 +785,6 @@ func _MasterService_DescribeCollection_Handler(srv interface{}, ctx context.Cont
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _MasterService_GetCollectionStatistics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(milvuspb.CollectionStatsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MasterServiceServer).GetCollectionStatistics(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/milvus.proto.master.MasterService/GetCollectionStatistics",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MasterServiceServer).GetCollectionStatistics(ctx, req.(*milvuspb.CollectionStatsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _MasterService_ShowCollections_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _MasterService_ShowCollections_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(milvuspb.ShowCollectionRequest) in := new(milvuspb.ShowCollectionRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -906,24 +857,6 @@ func _MasterService_HasPartition_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _MasterService_GetPartitionStatistics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(milvuspb.PartitionStatsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MasterServiceServer).GetPartitionStatistics(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/milvus.proto.master.MasterService/GetPartitionStatistics",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MasterServiceServer).GetPartitionStatistics(ctx, req.(*milvuspb.PartitionStatsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _MasterService_ShowPartitions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _MasterService_ShowPartitions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(milvuspb.ShowPartitionRequest) in := new(milvuspb.ShowPartitionRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -1178,10 +1111,6 @@ var _MasterService_serviceDesc = grpc.ServiceDesc{
MethodName: "DescribeCollection", MethodName: "DescribeCollection",
Handler: _MasterService_DescribeCollection_Handler, Handler: _MasterService_DescribeCollection_Handler,
}, },
{
MethodName: "GetCollectionStatistics",
Handler: _MasterService_GetCollectionStatistics_Handler,
},
{ {
MethodName: "ShowCollections", MethodName: "ShowCollections",
Handler: _MasterService_ShowCollections_Handler, Handler: _MasterService_ShowCollections_Handler,
@ -1198,10 +1127,6 @@ var _MasterService_serviceDesc = grpc.ServiceDesc{
MethodName: "HasPartition", MethodName: "HasPartition",
Handler: _MasterService_HasPartition_Handler, Handler: _MasterService_HasPartition_Handler,
}, },
{
MethodName: "GetPartitionStatistics",
Handler: _MasterService_GetPartitionStatistics_Handler,
},
{ {
MethodName: "ShowPartitions", MethodName: "ShowPartitions",
Handler: _MasterService_ShowPartitions_Handler, Handler: _MasterService_ShowPartitions_Handler,

View File

@ -119,7 +119,7 @@ message LoadSegmentRequest {
common.MsgBase base = 1; common.MsgBase base = 1;
int64 dbID = 2; int64 dbID = 2;
int64 collectionID = 3; int64 collectionID = 3;
repeated int64 partitionIDs = 4; int64 partitionID = 4;
repeated int64 segmentIDs = 5; repeated int64 segmentIDs = 5;
repeated int64 fieldIDs = 6; repeated int64 fieldIDs = 6;
} }

View File

@ -973,7 +973,7 @@ type LoadSegmentRequest struct {
Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
DbID int64 `protobuf:"varint,2,opt,name=dbID,proto3" json:"dbID,omitempty"` DbID int64 `protobuf:"varint,2,opt,name=dbID,proto3" json:"dbID,omitempty"`
CollectionID int64 `protobuf:"varint,3,opt,name=collectionID,proto3" json:"collectionID,omitempty"` CollectionID int64 `protobuf:"varint,3,opt,name=collectionID,proto3" json:"collectionID,omitempty"`
PartitionIDs []int64 `protobuf:"varint,4,rep,packed,name=partitionIDs,proto3" json:"partitionIDs,omitempty"` PartitionID int64 `protobuf:"varint,4,opt,name=partitionID,proto3" json:"partitionID,omitempty"`
SegmentIDs []int64 `protobuf:"varint,5,rep,packed,name=segmentIDs,proto3" json:"segmentIDs,omitempty"` SegmentIDs []int64 `protobuf:"varint,5,rep,packed,name=segmentIDs,proto3" json:"segmentIDs,omitempty"`
FieldIDs []int64 `protobuf:"varint,6,rep,packed,name=fieldIDs,proto3" json:"fieldIDs,omitempty"` FieldIDs []int64 `protobuf:"varint,6,rep,packed,name=fieldIDs,proto3" json:"fieldIDs,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -1027,11 +1027,11 @@ func (m *LoadSegmentRequest) GetCollectionID() int64 {
return 0 return 0
} }
func (m *LoadSegmentRequest) GetPartitionIDs() []int64 { func (m *LoadSegmentRequest) GetPartitionID() int64 {
if m != nil { if m != nil {
return m.PartitionIDs return m.PartitionID
} }
return nil return 0
} }
func (m *LoadSegmentRequest) GetSegmentIDs() []int64 { func (m *LoadSegmentRequest) GetSegmentIDs() []int64 {
@ -1297,80 +1297,81 @@ func init() {
func init() { proto.RegisterFile("query_service.proto", fileDescriptor_5fcb6756dc1afb8d) } func init() { proto.RegisterFile("query_service.proto", fileDescriptor_5fcb6756dc1afb8d) }
var fileDescriptor_5fcb6756dc1afb8d = []byte{ var fileDescriptor_5fcb6756dc1afb8d = []byte{
// 1158 bytes of a gzipped FileDescriptorProto // 1170 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0x5d, 0x6f, 0x1b, 0x45, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x5d, 0x6f, 0x1b, 0x45,
0x17, 0xf6, 0xc6, 0x4e, 0xde, 0xfa, 0xc4, 0xb1, 0x9d, 0xc9, 0xa7, 0xf6, 0x45, 0xa8, 0x0c, 0x85, 0x17, 0xf6, 0xc6, 0x4e, 0xde, 0xfa, 0xc4, 0xb1, 0x9d, 0xc9, 0xa7, 0xf6, 0x45, 0x55, 0x19, 0x0a,
0xe6, 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6, 0x77, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x32, 0x8c, 0xda, 0xe9, 0x71, 0x62, 0x6f, 0xf4, 0x6f, 0xf6, 0x0d, 0xe1, 0x7a, 0x43, 0xb8, 0xee, 0x76, 0x3a,
0x07, 0xbf, 0x08, 0x15, 0x00, 0x00, 0x53, 0x62, 0x78, 0xf7, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x7e, 0x65, 0x42, 0x06, 0x15,
0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.

View File

@ -51,16 +51,18 @@ type collectionReplica interface {
addPartitionsByCollectionMeta(colMeta *etcdpb.CollectionMeta) error addPartitionsByCollectionMeta(colMeta *etcdpb.CollectionMeta) error
removePartitionsByCollectionMeta(colMeta *etcdpb.CollectionMeta) error removePartitionsByCollectionMeta(colMeta *etcdpb.CollectionMeta) error
getPartitionByTag(collectionID UniqueID, partitionTag string) (*Partition, error) getPartitionByTag(collectionID UniqueID, partitionTag string) (*Partition, error)
getPartitionByID(collectionID UniqueID, partitionID UniqueID) (*Partition, error)
hasPartition(collectionID UniqueID, partitionTag string) bool hasPartition(collectionID UniqueID, partitionTag string) bool
// segment // segment
getSegmentNum() int getSegmentNum() int
getSegmentStatistics() []*internalpb2.SegmentStats getSegmentStatistics() []*internalpb2.SegmentStats
addSegment(segmentID UniqueID, partitionTag string, collectionID UniqueID) error addSegment2(segmentID UniqueID, partitionTag string, collectionID UniqueID, segType segmentType) error
addSegment(segmentID UniqueID, partitionID UniqueID, collectionID UniqueID, segType segmentType) error
removeSegment(segmentID UniqueID) error removeSegment(segmentID UniqueID) error
getSegmentByID(segmentID UniqueID) (*Segment, error) getSegmentByID(segmentID UniqueID) (*Segment, error)
hasSegment(segmentID UniqueID) bool hasSegment(segmentID UniqueID) bool
getVecFieldIDsBySegmentID(segmentID UniqueID) ([]int64, error) getVecFieldsBySegmentID(segmentID UniqueID) (map[int64]string, error)
freeAll() freeAll()
} }
@ -288,6 +290,13 @@ func (colReplica *collectionReplicaImpl) getPartitionByTag(collectionID UniqueID
return colReplica.getPartitionByTagPrivate(collectionID, partitionTag) return colReplica.getPartitionByTagPrivate(collectionID, partitionTag)
} }
func (colReplica *collectionReplicaImpl) getPartitionByID(collectionID UniqueID, partitionID UniqueID) (*Partition, error) {
colReplica.mu.RLock()
defer colReplica.mu.RUnlock()
return colReplica.getPartitionByIDPrivate(collectionID, partitionID)
}
func (colReplica *collectionReplicaImpl) getPartitionByTagPrivate(collectionID UniqueID, partitionTag string) (*Partition, error) { func (colReplica *collectionReplicaImpl) getPartitionByTagPrivate(collectionID UniqueID, partitionTag string) (*Partition, error) {
collection, err := colReplica.getCollectionByIDPrivate(collectionID) collection, err := colReplica.getCollectionByIDPrivate(collectionID)
if err != nil { if err != nil {
@ -303,6 +312,21 @@ func (colReplica *collectionReplicaImpl) getPartitionByTagPrivate(collectionID U
return nil, errors.New("cannot find partition, tag = " + partitionTag) return nil, errors.New("cannot find partition, tag = " + partitionTag)
} }
func (colReplica *collectionReplicaImpl) getPartitionByIDPrivate(collectionID UniqueID, partitionID UniqueID) (*Partition, error) {
collection, err := colReplica.getCollectionByIDPrivate(collectionID)
if err != nil {
return nil, err
}
for _, p := range *collection.Partitions() {
if p.ID() == partitionID {
return p, nil
}
}
return nil, errors.New("cannot find partition, id = " + strconv.FormatInt(partitionID, 10))
}
func (colReplica *collectionReplicaImpl) hasPartition(collectionID UniqueID, partitionTag string) bool { func (colReplica *collectionReplicaImpl) hasPartition(collectionID UniqueID, partitionTag string) bool {
colReplica.mu.RLock() colReplica.mu.RLock()
defer colReplica.mu.RUnlock() defer colReplica.mu.RUnlock()
@ -355,7 +379,7 @@ func (colReplica *collectionReplicaImpl) getSegmentStatistics() []*internalpb2.S
return statisticData return statisticData
} }
func (colReplica *collectionReplicaImpl) addSegment(segmentID UniqueID, partitionTag string, collectionID UniqueID) error { func (colReplica *collectionReplicaImpl) addSegment2(segmentID UniqueID, partitionTag string, collectionID UniqueID, segType segmentType) error {
colReplica.mu.Lock() colReplica.mu.Lock()
defer colReplica.mu.Unlock() defer colReplica.mu.Unlock()
@ -369,7 +393,29 @@ func (colReplica *collectionReplicaImpl) addSegment(segmentID UniqueID, partitio
return err2 return err2
} }
var newSegment = newSegment(collection, segmentID, partitionTag, collectionID) var newSegment = newSegment2(collection, segmentID, partitionTag, collectionID, segType)
colReplica.segments[segmentID] = newSegment
*partition.Segments() = append(*partition.Segments(), newSegment)
return nil
}
func (colReplica *collectionReplicaImpl) addSegment(segmentID UniqueID, partitionID UniqueID, collectionID UniqueID, segType segmentType) error {
colReplica.mu.Lock()
defer colReplica.mu.Unlock()
collection, err := colReplica.getCollectionByIDPrivate(collectionID)
if err != nil {
return err
}
partition, err2 := colReplica.getPartitionByIDPrivate(collectionID, partitionID)
if err2 != nil {
return err2
}
var newSegment = newSegment(collection, segmentID, partitionID, collectionID, segType)
colReplica.segments[segmentID] = newSegment colReplica.segments[segmentID] = newSegment
*partition.Segments() = append(*partition.Segments(), newSegment) *partition.Segments() = append(*partition.Segments(), newSegment)
@ -430,7 +476,7 @@ func (colReplica *collectionReplicaImpl) hasSegment(segmentID UniqueID) bool {
return ok return ok
} }
func (colReplica *collectionReplicaImpl) getVecFieldIDsBySegmentID(segmentID UniqueID) ([]int64, error) { func (colReplica *collectionReplicaImpl) getVecFieldsBySegmentID(segmentID UniqueID) (map[int64]string, error) {
colReplica.mu.RLock() colReplica.mu.RLock()
defer colReplica.mu.RUnlock() defer colReplica.mu.RUnlock()
@ -443,16 +489,18 @@ func (colReplica *collectionReplicaImpl) getVecFieldIDsBySegmentID(segmentID Uni
return nil, err2 return nil, err2
} }
vecFields := make([]int64, 0) vecFields := make(map[int64]string)
for _, field := range col.Schema().Fields { for _, field := range col.Schema().Fields {
if field.DataType == schemapb.DataType_VECTOR_BINARY || field.DataType == schemapb.DataType_VECTOR_FLOAT { if field.DataType == schemapb.DataType_VECTOR_BINARY || field.DataType == schemapb.DataType_VECTOR_FLOAT {
vecFields = append(vecFields, field.FieldID) vecFields[field.FieldID] = field.Name
} }
} }
if len(vecFields) <= 0 { if len(vecFields) <= 0 {
return nil, errors.New("no vector field in segment " + strconv.FormatInt(segmentID, 10)) return nil, errors.New("no vector field in segment " + strconv.FormatInt(segmentID, 10))
} }
// return map[fieldID]fieldName
return vecFields, nil return vecFields, nil
} }

View File

@ -226,7 +226,7 @@ func TestCollectionReplica_addSegment(t *testing.T) {
const segmentNum = 3 const segmentNum = 3
tag := "default" tag := "default"
for i := 0; i < segmentNum; i++ { for i := 0; i < segmentNum; i++ {
err := node.replica.addSegment(UniqueID(i), tag, collectionID) err := node.replica.addSegment2(UniqueID(i), tag, collectionID, segTypeGrowing)
assert.NoError(t, err) assert.NoError(t, err)
targetSeg, err := node.replica.getSegmentByID(UniqueID(i)) targetSeg, err := node.replica.getSegmentByID(UniqueID(i))
assert.NoError(t, err) assert.NoError(t, err)
@ -246,7 +246,7 @@ func TestCollectionReplica_removeSegment(t *testing.T) {
tag := "default" tag := "default"
for i := 0; i < segmentNum; i++ { for i := 0; i < segmentNum; i++ {
err := node.replica.addSegment(UniqueID(i), tag, collectionID) err := node.replica.addSegment2(UniqueID(i), tag, collectionID, segTypeGrowing)
assert.NoError(t, err) assert.NoError(t, err)
targetSeg, err := node.replica.getSegmentByID(UniqueID(i)) targetSeg, err := node.replica.getSegmentByID(UniqueID(i))
assert.NoError(t, err) assert.NoError(t, err)
@ -268,7 +268,7 @@ func TestCollectionReplica_getSegmentByID(t *testing.T) {
tag := "default" tag := "default"
for i := 0; i < segmentNum; i++ { for i := 0; i < segmentNum; i++ {
err := node.replica.addSegment(UniqueID(i), tag, collectionID) err := node.replica.addSegment2(UniqueID(i), tag, collectionID, segTypeGrowing)
assert.NoError(t, err) assert.NoError(t, err)
targetSeg, err := node.replica.getSegmentByID(UniqueID(i)) targetSeg, err := node.replica.getSegmentByID(UniqueID(i))
assert.NoError(t, err) assert.NoError(t, err)
@ -288,7 +288,7 @@ func TestCollectionReplica_hasSegment(t *testing.T) {
tag := "default" tag := "default"
for i := 0; i < segmentNum; i++ { for i := 0; i < segmentNum; i++ {
err := node.replica.addSegment(UniqueID(i), tag, collectionID) err := node.replica.addSegment2(UniqueID(i), tag, collectionID, segTypeGrowing)
assert.NoError(t, err) assert.NoError(t, err)
targetSeg, err := node.replica.getSegmentByID(UniqueID(i)) targetSeg, err := node.replica.getSegmentByID(UniqueID(i))
assert.NoError(t, err) assert.NoError(t, err)

View File

@ -86,7 +86,7 @@ func (iNode *insertNode) Operate(in []*Msg) []*Msg {
log.Println(err) log.Println(err)
continue continue
} }
err = iNode.replica.addSegment(task.SegmentID, task.PartitionName, collection.ID()) err = iNode.replica.addSegment2(task.SegmentID, task.PartitionName, collection.ID(), segTypeGrowing)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
continue continue

View File

@ -160,7 +160,7 @@ func (mService *metaService) processSegmentCreate(id string, value string) {
// TODO: what if seg == nil? We need to notify master and return rpc request failed // TODO: what if seg == nil? We need to notify master and return rpc request failed
if seg != nil { if seg != nil {
err := mService.replica.addSegment(seg.SegmentID, seg.PartitionTag, seg.CollectionID) err := mService.replica.addSegment2(seg.SegmentID, seg.PartitionTag, seg.CollectionID, segTypeGrowing)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
return return

View File

@ -14,9 +14,14 @@ import "C"
type Partition struct { type Partition struct {
partitionTag string partitionTag string
id UniqueID
segments []*Segment segments []*Segment
} }
func (p *Partition) ID() UniqueID {
return p.id
}
func (p *Partition) Tag() string { func (p *Partition) Tag() string {
return (*p).partitionTag return (*p).partitionTag
} }

View File

@ -20,7 +20,7 @@ func TestPartition_Segments(t *testing.T) {
const segmentNum = 3 const segmentNum = 3
for i := 0; i < segmentNum; i++ { for i := 0; i < segmentNum; i++ {
err := node.replica.addSegment(UniqueID(i), targetPartition.partitionTag, collection.ID()) err := node.replica.addSegment2(UniqueID(i), targetPartition.partitionTag, collection.ID(), segTypeGrowing)
assert.NoError(t, err) assert.NoError(t, err)
} }

View File

@ -295,10 +295,27 @@ func (node *QueryNode) WatchDmChannels(in *queryPb.WatchDmChannelsRequest) (*com
func (node *QueryNode) LoadSegments(in *queryPb.LoadSegmentRequest) (*commonpb.Status, error) { func (node *QueryNode) LoadSegments(in *queryPb.LoadSegmentRequest) (*commonpb.Status, error) {
// TODO: support db // TODO: support db
partitionID := in.PartitionID
collectionID := in.CollectionID
fieldIDs := in.FieldIDs fieldIDs := in.FieldIDs
// TODO: interim solution
if len(fieldIDs) == 0 {
collection, err := node.replica.getCollectionByID(collectionID)
if err != nil {
status := &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
}
return status, err
}
fieldIDs = make([]int64, 0)
for _, field := range collection.Schema().Fields {
fieldIDs = append(fieldIDs, field.FieldID)
}
}
for _, segmentID := range in.SegmentIDs { for _, segmentID := range in.SegmentIDs {
indexID := UniqueID(0) // TODO: ??? indexID := UniqueID(0) // TODO: get index id from master
err := node.segManager.loadSegment(segmentID, &fieldIDs) err := node.segManager.loadSegment(segmentID, partitionID, collectionID, &fieldIDs)
if err != nil { if err != nil {
// TODO: return or continue? // TODO: return or continue?
status := &commonpb.Status{ status := &commonpb.Status{

View File

@ -110,7 +110,7 @@ func initTestMeta(t *testing.T, node *QueryNode, collectionName string, collecti
err = node.replica.addPartition(collection.ID(), collectionMeta.PartitionTags[0]) err = node.replica.addPartition(collection.ID(), collectionMeta.PartitionTags[0])
assert.NoError(t, err) assert.NoError(t, err)
err = node.replica.addSegment(segmentID, collectionMeta.PartitionTags[0], collectionID) err = node.replica.addSegment2(segmentID, collectionMeta.PartitionTags[0], collectionID, segTypeGrowing)
assert.NoError(t, err) assert.NoError(t, err)
} }

View File

@ -19,7 +19,7 @@ func TestReduce_AllFunc(t *testing.T) {
collectionMeta := genTestCollectionMeta(collectionName, collectionID, false) collectionMeta := genTestCollectionMeta(collectionName, collectionID, false)
collection := newCollection(collectionMeta.ID, collectionMeta.Schema) collection := newCollection(collectionMeta.ID, collectionMeta.Schema)
segment := newSegment(collection, segmentID, Params.DefaultPartitionTag, collectionID) segment := newSegment2(collection, segmentID, Params.DefaultPartitionTag, collectionID, segTypeGrowing)
const DIM = 16 const DIM = 16
var vec = [DIM]float32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} var vec = [DIM]float32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}

View File

@ -22,13 +22,21 @@ import (
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
) )
const (
segTypeInvalid = C.Invalid
segTypeGrowing = C.Growing
segTypeSealed = C.Sealed
)
type segmentType = C.SegmentType
type indexParam = map[string]string type indexParam = map[string]string
type Segment struct { type Segment struct {
segmentPtr C.CSegmentInterface segmentPtr C.CSegmentInterface
segmentType C.enum_SegmentType segmentType C.SegmentType
segmentID UniqueID segmentID UniqueID
partitionTag string // TODO: use partitionID partitionTag string // TODO: use partitionID
partitionID UniqueID
collectionID UniqueID collectionID UniqueID
lastMemSize int64 lastMemSize int64
lastRowCount int64 lastRowCount int64
@ -40,10 +48,15 @@ type Segment struct {
indexParam map[int64]indexParam indexParam map[int64]indexParam
} }
//-------------------------------------------------------------------------------------- common interfaces
func (s *Segment) ID() UniqueID { func (s *Segment) ID() UniqueID {
return s.segmentID return s.segmentID
} }
func (s *Segment) Type() segmentType {
return s.segmentType
}
func (s *Segment) SetRecentlyModified(modify bool) { func (s *Segment) SetRecentlyModified(modify bool) {
s.rmMutex.Lock() s.rmMutex.Lock()
defer s.rmMutex.Unlock() defer s.rmMutex.Unlock()
@ -56,17 +69,13 @@ func (s *Segment) GetRecentlyModified() bool {
return s.recentlyModified return s.recentlyModified
} }
//-------------------------------------------------------------------------------------- constructor and destructor func newSegment2(collection *Collection, segmentID int64, partitionTag string, collectionID UniqueID, segType segmentType) *Segment {
func newSegment(collection *Collection, segmentID int64, partitionTag string, collectionID UniqueID) *Segment {
/* /*
CSegmentInterface CSegmentInterface
NewSegment(CCollection collection, uint64_t segment_id, SegmentType seg_type); NewSegment(CCollection collection, uint64_t segment_id, SegmentType seg_type);
*/ */
initIndexParam := make(map[int64]indexParam) initIndexParam := make(map[int64]indexParam)
// TODO: replace by param segmentPtr := C.NewSegment(collection.collectionPtr, C.ulong(segmentID), segType)
//var segmentType C.enum_SegmentType = C.Growing
var segmentType C.int = 1
segmentPtr := C.NewSegment(collection.collectionPtr, C.ulong(segmentID), segmentType)
var newSegment = &Segment{ var newSegment = &Segment{
segmentPtr: segmentPtr, segmentPtr: segmentPtr,
segmentID: segmentID, segmentID: segmentID,
@ -78,6 +87,24 @@ func newSegment(collection *Collection, segmentID int64, partitionTag string, co
return newSegment return newSegment
} }
func newSegment(collection *Collection, segmentID int64, partitionID UniqueID, collectionID UniqueID, segType segmentType) *Segment {
/*
CSegmentInterface
NewSegment(CCollection collection, uint64_t segment_id, SegmentType seg_type);
*/
initIndexParam := make(map[int64]indexParam)
segmentPtr := C.NewSegment(collection.collectionPtr, C.ulong(segmentID), segType)
var newSegment = &Segment{
segmentPtr: segmentPtr,
segmentID: segmentID,
partitionID: partitionID,
collectionID: collectionID,
indexParam: initIndexParam,
}
return newSegment
}
func deleteSegment(segment *Segment) { func deleteSegment(segment *Segment) {
/* /*
void void
@ -87,7 +114,6 @@ func deleteSegment(segment *Segment) {
C.DeleteSegment(cPtr) C.DeleteSegment(cPtr)
} }
//-------------------------------------------------------------------------------------- stats functions
func (s *Segment) getRowCount() int64 { func (s *Segment) getRowCount() int64 {
/* /*
long int long int
@ -116,108 +142,6 @@ func (s *Segment) getMemSize() int64 {
return int64(memoryUsageInBytes) return int64(memoryUsageInBytes)
} }
//-------------------------------------------------------------------------------------- preDm functions
func (s *Segment) segmentPreInsert(numOfRecords int) int64 {
/*
long int
PreInsert(CSegmentInterface c_segment, long int size);
*/
var offset = C.PreInsert(s.segmentPtr, C.long(int64(numOfRecords)))
return int64(offset)
}
func (s *Segment) segmentPreDelete(numOfRecords int) int64 {
/*
long int
PreDelete(CSegmentInterface c_segment, long int size);
*/
var offset = C.PreDelete(s.segmentPtr, C.long(int64(numOfRecords)))
return int64(offset)
}
//-------------------------------------------------------------------------------------- dm & search functions
func (s *Segment) segmentInsert(offset int64, entityIDs *[]UniqueID, timestamps *[]Timestamp, records *[]*commonpb.Blob) error {
/*
CStatus
Insert(CSegmentInterface c_segment,
long int reserved_offset,
signed long int size,
const long* primary_keys,
const unsigned long* timestamps,
void* raw_data,
int sizeof_per_row,
signed long int count);
*/
// Blobs to one big blob
var numOfRow = len(*entityIDs)
var sizeofPerRow = len((*records)[0].Value)
assert.Equal(nil, numOfRow, len(*records))
var rawData = make([]byte, numOfRow*sizeofPerRow)
var copyOffset = 0
for i := 0; i < len(*records); i++ {
copy(rawData[copyOffset:], (*records)[i].Value)
copyOffset += sizeofPerRow
}
var cOffset = C.long(offset)
var cNumOfRows = C.long(numOfRow)
var cEntityIdsPtr = (*C.long)(&(*entityIDs)[0])
var cTimestampsPtr = (*C.ulong)(&(*timestamps)[0])
var cSizeofPerRow = C.int(sizeofPerRow)
var cRawDataVoidPtr = unsafe.Pointer(&rawData[0])
var status = C.Insert(s.segmentPtr,
cOffset,
cNumOfRows,
cEntityIdsPtr,
cTimestampsPtr,
cRawDataVoidPtr,
cSizeofPerRow,
cNumOfRows)
errorCode := status.error_code
if errorCode != 0 {
errorMsg := C.GoString(status.error_msg)
defer C.free(unsafe.Pointer(status.error_msg))
return errors.New("Insert failed, C runtime error detected, error code = " + strconv.Itoa(int(errorCode)) + ", error msg = " + errorMsg)
}
s.SetRecentlyModified(true)
return nil
}
func (s *Segment) segmentDelete(offset int64, entityIDs *[]UniqueID, timestamps *[]Timestamp) error {
/*
CStatus
Delete(CSegmentInterface c_segment,
long int reserved_offset,
long size,
const long* primary_keys,
const unsigned long* timestamps);
*/
var cOffset = C.long(offset)
var cSize = C.long(len(*entityIDs))
var cEntityIdsPtr = (*C.long)(&(*entityIDs)[0])
var cTimestampsPtr = (*C.ulong)(&(*timestamps)[0])
var status = C.Delete(s.segmentPtr, cOffset, cSize, cEntityIdsPtr, cTimestampsPtr)
errorCode := status.error_code
if errorCode != 0 {
errorMsg := C.GoString(status.error_msg)
defer C.free(unsafe.Pointer(status.error_msg))
return errors.New("Delete failed, C runtime error detected, error code = " + strconv.Itoa(int(errorCode)) + ", error msg = " + errorMsg)
}
return nil
}
func (s *Segment) segmentSearch(plan *Plan, func (s *Segment) segmentSearch(plan *Plan,
placeHolderGroups []*PlaceholderGroup, placeHolderGroups []*PlaceholderGroup,
timestamp []Timestamp) (*SearchResult, error) { timestamp []Timestamp) (*SearchResult, error) {
@ -318,3 +242,138 @@ func (s *Segment) matchIndexParam(fieldID int64, indexParamKv []*commonpb.KeyVal
} }
return paramSize == matchCount return paramSize == matchCount
} }
//-------------------------------------------------------------------------------------- interfaces for growing segment
func (s *Segment) segmentPreInsert(numOfRecords int) int64 {
/*
long int
PreInsert(CSegmentInterface c_segment, long int size);
*/
var offset = C.PreInsert(s.segmentPtr, C.long(int64(numOfRecords)))
return int64(offset)
}
func (s *Segment) segmentPreDelete(numOfRecords int) int64 {
/*
long int
PreDelete(CSegmentInterface c_segment, long int size);
*/
var offset = C.PreDelete(s.segmentPtr, C.long(int64(numOfRecords)))
return int64(offset)
}
func (s *Segment) segmentInsert(offset int64, entityIDs *[]UniqueID, timestamps *[]Timestamp, records *[]*commonpb.Blob) error {
/*
CStatus
Insert(CSegmentInterface c_segment,
long int reserved_offset,
signed long int size,
const long* primary_keys,
const unsigned long* timestamps,
void* raw_data,
int sizeof_per_row,
signed long int count);
*/
// Blobs to one big blob
var numOfRow = len(*entityIDs)
var sizeofPerRow = len((*records)[0].Value)
assert.Equal(nil, numOfRow, len(*records))
var rawData = make([]byte, numOfRow*sizeofPerRow)
var copyOffset = 0
for i := 0; i < len(*records); i++ {
copy(rawData[copyOffset:], (*records)[i].Value)
copyOffset += sizeofPerRow
}
var cOffset = C.long(offset)
var cNumOfRows = C.long(numOfRow)
var cEntityIdsPtr = (*C.long)(&(*entityIDs)[0])
var cTimestampsPtr = (*C.ulong)(&(*timestamps)[0])
var cSizeofPerRow = C.int(sizeofPerRow)
var cRawDataVoidPtr = unsafe.Pointer(&rawData[0])
var status = C.Insert(s.segmentPtr,
cOffset,
cNumOfRows,
cEntityIdsPtr,
cTimestampsPtr,
cRawDataVoidPtr,
cSizeofPerRow,
cNumOfRows)
errorCode := status.error_code
if errorCode != 0 {
errorMsg := C.GoString(status.error_msg)
defer C.free(unsafe.Pointer(status.error_msg))
return errors.New("Insert failed, C runtime error detected, error code = " + strconv.Itoa(int(errorCode)) + ", error msg = " + errorMsg)
}
s.SetRecentlyModified(true)
return nil
}
func (s *Segment) segmentDelete(offset int64, entityIDs *[]UniqueID, timestamps *[]Timestamp) error {
/*
CStatus
Delete(CSegmentInterface c_segment,
long int reserved_offset,
long size,
const long* primary_keys,
const unsigned long* timestamps);
*/
var cOffset = C.long(offset)
var cSize = C.long(len(*entityIDs))
var cEntityIdsPtr = (*C.long)(&(*entityIDs)[0])
var cTimestampsPtr = (*C.ulong)(&(*timestamps)[0])
var status = C.Delete(s.segmentPtr, cOffset, cSize, cEntityIdsPtr, cTimestampsPtr)
errorCode := status.error_code
if errorCode != 0 {
errorMsg := C.GoString(status.error_msg)
defer C.free(unsafe.Pointer(status.error_msg))
return errors.New("Delete failed, C runtime error detected, error code = " + strconv.Itoa(int(errorCode)) + ", error msg = " + errorMsg)
}
return nil
}
//-------------------------------------------------------------------------------------- interfaces for sealed segment
func (s *Segment) segmentLoadFieldData(fieldID int64, rowCount int, data unsafe.Pointer) error {
/*
CStatus
LoadFieldData(CSegmentInterface c_segment, CLoadFieldDataInfo load_field_data_info);
*/
if s.segmentType != segTypeSealed {
return errors.New("illegal segment type when loading field data")
}
/*
struct CLoadFieldDataInfo {
int64_t field_id;
void* blob;
int64_t row_count;
};
*/
loadInfo := C.CLoadFieldDataInfo{
field_id: C.int64_t(fieldID),
blob: data,
row_count: C.int64_t(rowCount),
}
var status = C.LoadFieldData(s.segmentPtr, loadInfo)
errorCode := status.error_code
if errorCode != 0 {
errorMsg := C.GoString(status.error_msg)
defer C.free(unsafe.Pointer(status.error_msg))
return errors.New("LoadFieldData failed, C runtime error detected, error code = " + strconv.Itoa(int(errorCode)) + ", error msg = " + errorMsg)
}
return nil
}

View File

@ -3,7 +3,7 @@ package querynode
import ( import (
"context" "context"
"errors" "errors"
"fmt" "unsafe"
"github.com/zilliztech/milvus-distributed/internal/kv" "github.com/zilliztech/milvus-distributed/internal/kv"
miniokv "github.com/zilliztech/milvus-distributed/internal/kv/minio" miniokv "github.com/zilliztech/milvus-distributed/internal/kv/minio"
@ -58,7 +58,7 @@ func newSegmentManager(ctx context.Context, replica collectionReplica, loadIndex
} }
} }
func (s *segmentManager) loadSegment(segmentID UniqueID, fieldIDs *[]int64) error { func (s *segmentManager) loadSegment(segmentID UniqueID, partitionID UniqueID, collectionID UniqueID, fieldIDs *[]int64) error {
insertBinlogPathRequest := &datapb.InsertBinlogPathRequest{ insertBinlogPathRequest := &datapb.InsertBinlogPathRequest{
SegmentID: segmentID, SegmentID: segmentID,
} }
@ -72,6 +72,12 @@ func (s *segmentManager) loadSegment(segmentID UniqueID, fieldIDs *[]int64) erro
return errors.New("illegal InsertBinlogPathsResponse") return errors.New("illegal InsertBinlogPathsResponse")
} }
// create segment
err = s.replica.addSegment(segmentID, partitionID, collectionID, segTypeSealed)
if err != nil {
return err
}
containsFunc := func(s []int64, e int64) bool { containsFunc := func(s []int64, e int64) bool {
for _, a := range s { for _, a := range s {
if a == e { if a == e {
@ -110,26 +116,34 @@ func (s *segmentManager) loadSegment(segmentID UniqueID, fieldIDs *[]int64) erro
} }
for _, value := range insertData.Data { for _, value := range insertData.Data {
var numRows int
var data interface{}
switch fieldData := value.(type) { switch fieldData := value.(type) {
case storage.BoolFieldData: case storage.BoolFieldData:
numRows := fieldData.NumRows numRows = fieldData.NumRows
data := fieldData.Data data = fieldData.Data
fmt.Println(numRows, data, fieldID)
// TODO: s.replica.addSegment()
case storage.Int8FieldData: case storage.Int8FieldData:
// TODO: s.replica.addSegment() numRows = fieldData.NumRows
data = fieldData.Data
case storage.Int16FieldData: case storage.Int16FieldData:
// TODO: s.replica.addSegment() numRows = fieldData.NumRows
data = fieldData.Data
case storage.Int32FieldData: case storage.Int32FieldData:
// TODO: s.replica.addSegment() numRows = fieldData.NumRows
data = fieldData.Data
case storage.Int64FieldData: case storage.Int64FieldData:
// TODO: s.replica.addSegment() numRows = fieldData.NumRows
data = fieldData.Data
case storage.FloatFieldData: case storage.FloatFieldData:
// TODO: s.replica.addSegment() numRows = fieldData.NumRows
data = fieldData.Data
case storage.DoubleFieldData: case storage.DoubleFieldData:
// TODO: s.replica.addSegment() numRows = fieldData.NumRows
data = fieldData.Data
case storage.StringFieldData: case storage.StringFieldData:
// TODO: s.replica.addSegment() numRows = fieldData.NumRows
data = fieldData.Data
case storage.FloatVectorFieldData: case storage.FloatVectorFieldData:
// segment to be loaded doesn't need vector field, // segment to be loaded doesn't need vector field,
// so we ignore the type of vector field data // so we ignore the type of vector field data
@ -139,6 +153,17 @@ func (s *segmentManager) loadSegment(segmentID UniqueID, fieldIDs *[]int64) erro
default: default:
return errors.New("unexpected field data type") return errors.New("unexpected field data type")
} }
segment, err := s.replica.getSegmentByID(segmentID)
if err != nil {
// TODO: return or continue?
return err
}
err = segment.segmentLoadFieldData(fieldID, numRows, unsafe.Pointer(&data))
if err != nil {
// TODO: return or continue?
return err
}
} }
} }
@ -153,23 +178,17 @@ func (s *segmentManager) loadIndex(segmentID UniqueID, indexID UniqueID) error {
if err != nil || pathResponse.Status.ErrorCode != commonpb.ErrorCode_SUCCESS { if err != nil || pathResponse.Status.ErrorCode != commonpb.ErrorCode_SUCCESS {
return err return err
} }
targetSegment, err := s.replica.getSegmentByID(segmentID)
if err != nil {
return err
}
// get vector field ids from schema to load index // get vector field ids from schema to load index
vecFieldIDs, err := s.replica.getVecFieldIDsBySegmentID(segmentID) vecFieldIDs, err := s.replica.getVecFieldsBySegmentID(segmentID)
if err != nil { if err != nil {
return err return err
} }
for _, vecFieldID := range vecFieldIDs { for id, name := range vecFieldIDs {
targetIndexParam, ok := targetSegment.indexParam[vecFieldID] var targetIndexParam indexParam
if !ok { // TODO: get index param from master
return errors.New(fmt.Sprint("cannot found index params in segment ", segmentID, " with field = ", vecFieldID))
}
// non-blocking send // non-blocking send
go s.sendLoadIndex(pathResponse.IndexFilePaths, segmentID, vecFieldID, "", targetIndexParam) go s.sendLoadIndex(pathResponse.IndexFilePaths, segmentID, id, name, targetIndexParam)
} }
return nil return nil

View File

@ -24,7 +24,7 @@ func TestSegment_newSegment(t *testing.T) {
assert.Equal(t, collection.ID(), collectionID) assert.Equal(t, collection.ID(), collectionID)
segmentID := UniqueID(0) segmentID := UniqueID(0)
segment := newSegment(collection, segmentID, Params.DefaultPartitionTag, collectionID) segment := newSegment2(collection, segmentID, Params.DefaultPartitionTag, collectionID, segTypeGrowing)
assert.Equal(t, segmentID, segment.segmentID) assert.Equal(t, segmentID, segment.segmentID)
deleteSegment(segment) deleteSegment(segment)
deleteCollection(collection) deleteCollection(collection)
@ -40,7 +40,7 @@ func TestSegment_deleteSegment(t *testing.T) {
assert.Equal(t, collection.ID(), collectionID) assert.Equal(t, collection.ID(), collectionID)
segmentID := UniqueID(0) segmentID := UniqueID(0)
segment := newSegment(collection, segmentID, Params.DefaultPartitionTag, collectionID) segment := newSegment2(collection, segmentID, Params.DefaultPartitionTag, collectionID, segTypeGrowing)
assert.Equal(t, segmentID, segment.segmentID) assert.Equal(t, segmentID, segment.segmentID)
deleteSegment(segment) deleteSegment(segment)
@ -58,7 +58,7 @@ func TestSegment_getRowCount(t *testing.T) {
assert.Equal(t, collection.ID(), collectionID) assert.Equal(t, collection.ID(), collectionID)
segmentID := UniqueID(0) segmentID := UniqueID(0)
segment := newSegment(collection, segmentID, Params.DefaultPartitionTag, collectionID) segment := newSegment2(collection, segmentID, Params.DefaultPartitionTag, collectionID, segTypeGrowing)
assert.Equal(t, segmentID, segment.segmentID) assert.Equal(t, segmentID, segment.segmentID)
ids := []int64{1, 2, 3} ids := []int64{1, 2, 3}
@ -107,7 +107,7 @@ func TestSegment_getDeletedCount(t *testing.T) {
assert.Equal(t, collection.ID(), collectionID) assert.Equal(t, collection.ID(), collectionID)
segmentID := UniqueID(0) segmentID := UniqueID(0)
segment := newSegment(collection, segmentID, Params.DefaultPartitionTag, collectionID) segment := newSegment2(collection, segmentID, Params.DefaultPartitionTag, collectionID, segTypeGrowing)
assert.Equal(t, segmentID, segment.segmentID) assert.Equal(t, segmentID, segment.segmentID)
ids := []int64{1, 2, 3} ids := []int64{1, 2, 3}
@ -162,7 +162,7 @@ func TestSegment_getMemSize(t *testing.T) {
assert.Equal(t, collection.ID(), collectionID) assert.Equal(t, collection.ID(), collectionID)
segmentID := UniqueID(0) segmentID := UniqueID(0)
segment := newSegment(collection, segmentID, Params.DefaultPartitionTag, collectionID) segment := newSegment2(collection, segmentID, Params.DefaultPartitionTag, collectionID, segTypeGrowing)
assert.Equal(t, segmentID, segment.segmentID) assert.Equal(t, segmentID, segment.segmentID)
ids := []int64{1, 2, 3} ids := []int64{1, 2, 3}
@ -211,7 +211,7 @@ func TestSegment_segmentInsert(t *testing.T) {
assert.Equal(t, collection.Name(), collectionName) assert.Equal(t, collection.Name(), collectionName)
assert.Equal(t, collection.ID(), collectionID) assert.Equal(t, collection.ID(), collectionID)
segmentID := UniqueID(0) segmentID := UniqueID(0)
segment := newSegment(collection, segmentID, Params.DefaultPartitionTag, collectionID) segment := newSegment2(collection, segmentID, Params.DefaultPartitionTag, collectionID, segTypeGrowing)
assert.Equal(t, segmentID, segment.segmentID) assert.Equal(t, segmentID, segment.segmentID)
ids := []int64{1, 2, 3} ids := []int64{1, 2, 3}
@ -256,7 +256,7 @@ func TestSegment_segmentDelete(t *testing.T) {
assert.Equal(t, collection.ID(), collectionID) assert.Equal(t, collection.ID(), collectionID)
segmentID := UniqueID(0) segmentID := UniqueID(0)
segment := newSegment(collection, segmentID, Params.DefaultPartitionTag, collectionID) segment := newSegment2(collection, segmentID, Params.DefaultPartitionTag, collectionID, segTypeGrowing)
assert.Equal(t, segmentID, segment.segmentID) assert.Equal(t, segmentID, segment.segmentID)
ids := []int64{1, 2, 3} ids := []int64{1, 2, 3}
@ -307,7 +307,7 @@ func TestSegment_segmentSearch(t *testing.T) {
assert.Equal(t, collection.ID(), collectionID) assert.Equal(t, collection.ID(), collectionID)
segmentID := UniqueID(0) segmentID := UniqueID(0)
segment := newSegment(collection, segmentID, Params.DefaultPartitionTag, collectionID) segment := newSegment2(collection, segmentID, Params.DefaultPartitionTag, collectionID, segTypeGrowing)
assert.Equal(t, segmentID, segment.segmentID) assert.Equal(t, segmentID, segment.segmentID)
ids := []int64{1, 2, 3} ids := []int64{1, 2, 3}
@ -390,7 +390,7 @@ func TestSegment_segmentPreInsert(t *testing.T) {
assert.Equal(t, collection.ID(), collectionID) assert.Equal(t, collection.ID(), collectionID)
segmentID := UniqueID(0) segmentID := UniqueID(0)
segment := newSegment(collection, segmentID, Params.DefaultPartitionTag, collectionID) segment := newSegment2(collection, segmentID, Params.DefaultPartitionTag, collectionID, segTypeGrowing)
assert.Equal(t, segmentID, segment.segmentID) assert.Equal(t, segmentID, segment.segmentID)
const DIM = 16 const DIM = 16
@ -430,7 +430,7 @@ func TestSegment_segmentPreDelete(t *testing.T) {
assert.Equal(t, collection.ID(), collectionID) assert.Equal(t, collection.ID(), collectionID)
segmentID := UniqueID(0) segmentID := UniqueID(0)
segment := newSegment(collection, segmentID, Params.DefaultPartitionTag, collectionID) segment := newSegment2(collection, segmentID, Params.DefaultPartitionTag, collectionID, segTypeGrowing)
assert.Equal(t, segmentID, segment.segmentID) assert.Equal(t, segmentID, segment.segmentID)
ids := []int64{1, 2, 3} ids := []int64{1, 2, 3}