Fix restore redrop enormous dup collections (#26030)

Signed-off-by: yangxuan <xuan.yang@zilliz.com>
pull/26321/head
XuanYang-cn 2023-08-11 18:41:31 +08:00 committed by GitHub
parent 42cb5d12ae
commit 035b4363ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1363 additions and 118 deletions

View File

@ -294,21 +294,23 @@ rpm: install
@QA_RPATHS="$$[ 0x001|0x0002|0x0020 ]" rpmbuild -ba ./build/rpm/milvus.spec
mock-proxy:
mockery --name=ProxyComponent --dir=$(PWD)/internal/types --output=$(PWD)/internal/mocks --filename=mock_proxy.go --structname=Proxy --with-expecter
$(PWD)/bin/mockery --name=ProxyComponent --dir=$(PWD)/internal/types --output=$(PWD)/internal/mocks --filename=mock_proxy.go --structname=Proxy --with-expecter
mock-datanode:
mockery --name=DataNode --dir=$(PWD)/internal/types --output=$(PWD)/internal/mocks --filename=mock_datanode.go --with-expecter
$(PWD)/bin/mockery --name=DataNode --dir=$(PWD)/internal/types --output=$(PWD)/internal/mocks --filename=mock_datanode.go --with-expecter
mock-rootcoord:
mockery --name=RootCoord --dir=$(PWD)/internal/types --output=$(PWD)/internal/mocks --filename=mock_rootcoord.go --with-expecter
$(PWD)/bin/mockery --name=RootCoord --dir=$(PWD)/internal/types --output=$(PWD)/internal/mocks --filename=mock_rootcoord.go --with-expecter
$(PWD)/bin/mockery --name=GarbageCollector --dir=$(PWD)/internal/rootcoord --output=$(PWD)/internal/rootcoord/mocks --filename=GarbageCollector.go --with-expecter --outpkg=mockrootcoord
$(PWD)/bin/mockery --name=IMetaTable --dir=$(PWD)/internal/rootcoord --output=$(PWD)/internal/rootcoord/mocks --filename=IMetaTable.go --with-expecter --outpkg=mockrootcoord
mock-datacoord:
mockery --name=DataCoord --dir=$(PWD)/internal/types --output=$(PWD)/internal/mocks --filename=mock_datacoord.go --with-expecter
$(PWD)/bin/mockery --name=DataCoord --dir=$(PWD)/internal/types --output=$(PWD)/internal/mocks --filename=mock_datacoord.go --with-expecter
mock-indexcoord:
mockery --name=IndexCoord --dir=$(PWD)/internal/types --output=$(PWD)/internal/mocks --filename=mock_indexcoord.go --with-expecter
$(PWD)/bin/mockery --name=IndexCoord --dir=$(PWD)/internal/types --output=$(PWD)/internal/mocks --filename=mock_indexcoord.go --with-expecter
mock-tnx-kv:
mockery --name=TxnKV --dir=$(PWD)/internal/kv --output=$(PWD)/internal/kv/mocks --filename=TxnKV.go --with-expecter
$(PWD)/bin/mockery --name=TxnKV --dir=$(PWD)/internal/kv --output=$(PWD)/internal/kv/mocks --filename=TxnKV.go --with-expecter
ci-ut: build-cpp-with-coverage generated-proto-go-without-cpp codecov-cpp clean-compile codecov-go

View File

@ -60,8 +60,8 @@ type RootCoord_AllocID_Call struct {
}
// AllocID is a helper method to define mock.On call
// - ctx context.Context
// - req *rootcoordpb.AllocIDRequest
// - ctx context.Context
// - req *rootcoordpb.AllocIDRequest
func (_e *RootCoord_Expecter) AllocID(ctx interface{}, req interface{}) *RootCoord_AllocID_Call {
return &RootCoord_AllocID_Call{Call: _e.mock.On("AllocID", ctx, req)}
}
@ -107,8 +107,8 @@ type RootCoord_AllocTimestamp_Call struct {
}
// AllocTimestamp is a helper method to define mock.On call
// - ctx context.Context
// - req *rootcoordpb.AllocTimestampRequest
// - ctx context.Context
// - req *rootcoordpb.AllocTimestampRequest
func (_e *RootCoord_Expecter) AllocTimestamp(ctx interface{}, req interface{}) *RootCoord_AllocTimestamp_Call {
return &RootCoord_AllocTimestamp_Call{Call: _e.mock.On("AllocTimestamp", ctx, req)}
}
@ -154,8 +154,8 @@ type RootCoord_AlterAlias_Call struct {
}
// AlterAlias is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.AlterAliasRequest
// - ctx context.Context
// - req *milvuspb.AlterAliasRequest
func (_e *RootCoord_Expecter) AlterAlias(ctx interface{}, req interface{}) *RootCoord_AlterAlias_Call {
return &RootCoord_AlterAlias_Call{Call: _e.mock.On("AlterAlias", ctx, req)}
}
@ -201,8 +201,8 @@ type RootCoord_AlterCollection_Call struct {
}
// AlterCollection is a helper method to define mock.On call
// - ctx context.Context
// - request *milvuspb.AlterCollectionRequest
// - ctx context.Context
// - request *milvuspb.AlterCollectionRequest
func (_e *RootCoord_Expecter) AlterCollection(ctx interface{}, request interface{}) *RootCoord_AlterCollection_Call {
return &RootCoord_AlterCollection_Call{Call: _e.mock.On("AlterCollection", ctx, request)}
}
@ -248,8 +248,8 @@ type RootCoord_CheckHealth_Call struct {
}
// CheckHealth is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.CheckHealthRequest
// - ctx context.Context
// - req *milvuspb.CheckHealthRequest
func (_e *RootCoord_Expecter) CheckHealth(ctx interface{}, req interface{}) *RootCoord_CheckHealth_Call {
return &RootCoord_CheckHealth_Call{Call: _e.mock.On("CheckHealth", ctx, req)}
}
@ -295,8 +295,8 @@ type RootCoord_CreateAlias_Call struct {
}
// CreateAlias is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.CreateAliasRequest
// - ctx context.Context
// - req *milvuspb.CreateAliasRequest
func (_e *RootCoord_Expecter) CreateAlias(ctx interface{}, req interface{}) *RootCoord_CreateAlias_Call {
return &RootCoord_CreateAlias_Call{Call: _e.mock.On("CreateAlias", ctx, req)}
}
@ -342,8 +342,8 @@ type RootCoord_CreateCollection_Call struct {
}
// CreateCollection is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.CreateCollectionRequest
// - ctx context.Context
// - req *milvuspb.CreateCollectionRequest
func (_e *RootCoord_Expecter) CreateCollection(ctx interface{}, req interface{}) *RootCoord_CreateCollection_Call {
return &RootCoord_CreateCollection_Call{Call: _e.mock.On("CreateCollection", ctx, req)}
}
@ -389,8 +389,8 @@ type RootCoord_CreateCredential_Call struct {
}
// CreateCredential is a helper method to define mock.On call
// - ctx context.Context
// - req *internalpb.CredentialInfo
// - ctx context.Context
// - req *internalpb.CredentialInfo
func (_e *RootCoord_Expecter) CreateCredential(ctx interface{}, req interface{}) *RootCoord_CreateCredential_Call {
return &RootCoord_CreateCredential_Call{Call: _e.mock.On("CreateCredential", ctx, req)}
}
@ -436,8 +436,8 @@ type RootCoord_CreateDatabase_Call struct {
}
// CreateDatabase is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.CreateDatabaseRequest
// - ctx context.Context
// - req *milvuspb.CreateDatabaseRequest
func (_e *RootCoord_Expecter) CreateDatabase(ctx interface{}, req interface{}) *RootCoord_CreateDatabase_Call {
return &RootCoord_CreateDatabase_Call{Call: _e.mock.On("CreateDatabase", ctx, req)}
}
@ -483,8 +483,8 @@ type RootCoord_CreatePartition_Call struct {
}
// CreatePartition is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.CreatePartitionRequest
// - ctx context.Context
// - req *milvuspb.CreatePartitionRequest
func (_e *RootCoord_Expecter) CreatePartition(ctx interface{}, req interface{}) *RootCoord_CreatePartition_Call {
return &RootCoord_CreatePartition_Call{Call: _e.mock.On("CreatePartition", ctx, req)}
}
@ -530,8 +530,8 @@ type RootCoord_CreateRole_Call struct {
}
// CreateRole is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.CreateRoleRequest
// - ctx context.Context
// - req *milvuspb.CreateRoleRequest
func (_e *RootCoord_Expecter) CreateRole(ctx interface{}, req interface{}) *RootCoord_CreateRole_Call {
return &RootCoord_CreateRole_Call{Call: _e.mock.On("CreateRole", ctx, req)}
}
@ -577,8 +577,8 @@ type RootCoord_DeleteCredential_Call struct {
}
// DeleteCredential is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.DeleteCredentialRequest
// - ctx context.Context
// - req *milvuspb.DeleteCredentialRequest
func (_e *RootCoord_Expecter) DeleteCredential(ctx interface{}, req interface{}) *RootCoord_DeleteCredential_Call {
return &RootCoord_DeleteCredential_Call{Call: _e.mock.On("DeleteCredential", ctx, req)}
}
@ -624,8 +624,8 @@ type RootCoord_DescribeCollection_Call struct {
}
// DescribeCollection is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.DescribeCollectionRequest
// - ctx context.Context
// - req *milvuspb.DescribeCollectionRequest
func (_e *RootCoord_Expecter) DescribeCollection(ctx interface{}, req interface{}) *RootCoord_DescribeCollection_Call {
return &RootCoord_DescribeCollection_Call{Call: _e.mock.On("DescribeCollection", ctx, req)}
}
@ -671,8 +671,8 @@ type RootCoord_DescribeCollectionInternal_Call struct {
}
// DescribeCollectionInternal is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.DescribeCollectionRequest
// - ctx context.Context
// - req *milvuspb.DescribeCollectionRequest
func (_e *RootCoord_Expecter) DescribeCollectionInternal(ctx interface{}, req interface{}) *RootCoord_DescribeCollectionInternal_Call {
return &RootCoord_DescribeCollectionInternal_Call{Call: _e.mock.On("DescribeCollectionInternal", ctx, req)}
}
@ -718,8 +718,8 @@ type RootCoord_DropAlias_Call struct {
}
// DropAlias is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.DropAliasRequest
// - ctx context.Context
// - req *milvuspb.DropAliasRequest
func (_e *RootCoord_Expecter) DropAlias(ctx interface{}, req interface{}) *RootCoord_DropAlias_Call {
return &RootCoord_DropAlias_Call{Call: _e.mock.On("DropAlias", ctx, req)}
}
@ -765,8 +765,8 @@ type RootCoord_DropCollection_Call struct {
}
// DropCollection is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.DropCollectionRequest
// - ctx context.Context
// - req *milvuspb.DropCollectionRequest
func (_e *RootCoord_Expecter) DropCollection(ctx interface{}, req interface{}) *RootCoord_DropCollection_Call {
return &RootCoord_DropCollection_Call{Call: _e.mock.On("DropCollection", ctx, req)}
}
@ -812,8 +812,8 @@ type RootCoord_DropDatabase_Call struct {
}
// DropDatabase is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.DropDatabaseRequest
// - ctx context.Context
// - req *milvuspb.DropDatabaseRequest
func (_e *RootCoord_Expecter) DropDatabase(ctx interface{}, req interface{}) *RootCoord_DropDatabase_Call {
return &RootCoord_DropDatabase_Call{Call: _e.mock.On("DropDatabase", ctx, req)}
}
@ -859,8 +859,8 @@ type RootCoord_DropPartition_Call struct {
}
// DropPartition is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.DropPartitionRequest
// - ctx context.Context
// - req *milvuspb.DropPartitionRequest
func (_e *RootCoord_Expecter) DropPartition(ctx interface{}, req interface{}) *RootCoord_DropPartition_Call {
return &RootCoord_DropPartition_Call{Call: _e.mock.On("DropPartition", ctx, req)}
}
@ -906,8 +906,8 @@ type RootCoord_DropRole_Call struct {
}
// DropRole is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.DropRoleRequest
// - ctx context.Context
// - req *milvuspb.DropRoleRequest
func (_e *RootCoord_Expecter) DropRole(ctx interface{}, req interface{}) *RootCoord_DropRole_Call {
return &RootCoord_DropRole_Call{Call: _e.mock.On("DropRole", ctx, req)}
}
@ -953,7 +953,7 @@ type RootCoord_GetComponentStates_Call struct {
}
// GetComponentStates is a helper method to define mock.On call
// - ctx context.Context
// - ctx context.Context
func (_e *RootCoord_Expecter) GetComponentStates(ctx interface{}) *RootCoord_GetComponentStates_Call {
return &RootCoord_GetComponentStates_Call{Call: _e.mock.On("GetComponentStates", ctx)}
}
@ -999,8 +999,8 @@ type RootCoord_GetCredential_Call struct {
}
// GetCredential is a helper method to define mock.On call
// - ctx context.Context
// - req *rootcoordpb.GetCredentialRequest
// - ctx context.Context
// - req *rootcoordpb.GetCredentialRequest
func (_e *RootCoord_Expecter) GetCredential(ctx interface{}, req interface{}) *RootCoord_GetCredential_Call {
return &RootCoord_GetCredential_Call{Call: _e.mock.On("GetCredential", ctx, req)}
}
@ -1046,8 +1046,8 @@ type RootCoord_GetImportState_Call struct {
}
// GetImportState is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.GetImportStateRequest
// - ctx context.Context
// - req *milvuspb.GetImportStateRequest
func (_e *RootCoord_Expecter) GetImportState(ctx interface{}, req interface{}) *RootCoord_GetImportState_Call {
return &RootCoord_GetImportState_Call{Call: _e.mock.On("GetImportState", ctx, req)}
}
@ -1093,8 +1093,8 @@ type RootCoord_GetMetrics_Call struct {
}
// GetMetrics is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.GetMetricsRequest
// - ctx context.Context
// - req *milvuspb.GetMetricsRequest
func (_e *RootCoord_Expecter) GetMetrics(ctx interface{}, req interface{}) *RootCoord_GetMetrics_Call {
return &RootCoord_GetMetrics_Call{Call: _e.mock.On("GetMetrics", ctx, req)}
}
@ -1140,7 +1140,7 @@ type RootCoord_GetStatisticsChannel_Call struct {
}
// GetStatisticsChannel is a helper method to define mock.On call
// - ctx context.Context
// - ctx context.Context
func (_e *RootCoord_Expecter) GetStatisticsChannel(ctx interface{}) *RootCoord_GetStatisticsChannel_Call {
return &RootCoord_GetStatisticsChannel_Call{Call: _e.mock.On("GetStatisticsChannel", ctx)}
}
@ -1186,7 +1186,7 @@ type RootCoord_GetTimeTickChannel_Call struct {
}
// GetTimeTickChannel is a helper method to define mock.On call
// - ctx context.Context
// - ctx context.Context
func (_e *RootCoord_Expecter) GetTimeTickChannel(ctx interface{}) *RootCoord_GetTimeTickChannel_Call {
return &RootCoord_GetTimeTickChannel_Call{Call: _e.mock.On("GetTimeTickChannel", ctx)}
}
@ -1232,8 +1232,8 @@ type RootCoord_HasCollection_Call struct {
}
// HasCollection is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.HasCollectionRequest
// - ctx context.Context
// - req *milvuspb.HasCollectionRequest
func (_e *RootCoord_Expecter) HasCollection(ctx interface{}, req interface{}) *RootCoord_HasCollection_Call {
return &RootCoord_HasCollection_Call{Call: _e.mock.On("HasCollection", ctx, req)}
}
@ -1279,8 +1279,8 @@ type RootCoord_HasPartition_Call struct {
}
// HasPartition is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.HasPartitionRequest
// - ctx context.Context
// - req *milvuspb.HasPartitionRequest
func (_e *RootCoord_Expecter) HasPartition(ctx interface{}, req interface{}) *RootCoord_HasPartition_Call {
return &RootCoord_HasPartition_Call{Call: _e.mock.On("HasPartition", ctx, req)}
}
@ -1326,8 +1326,8 @@ type RootCoord_Import_Call struct {
}
// Import is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.ImportRequest
// - ctx context.Context
// - req *milvuspb.ImportRequest
func (_e *RootCoord_Expecter) Import(ctx interface{}, req interface{}) *RootCoord_Import_Call {
return &RootCoord_Import_Call{Call: _e.mock.On("Import", ctx, req)}
}
@ -1409,8 +1409,8 @@ type RootCoord_InvalidateCollectionMetaCache_Call struct {
}
// InvalidateCollectionMetaCache is a helper method to define mock.On call
// - ctx context.Context
// - request *proxypb.InvalidateCollMetaCacheRequest
// - ctx context.Context
// - request *proxypb.InvalidateCollMetaCacheRequest
func (_e *RootCoord_Expecter) InvalidateCollectionMetaCache(ctx interface{}, request interface{}) *RootCoord_InvalidateCollectionMetaCache_Call {
return &RootCoord_InvalidateCollectionMetaCache_Call{Call: _e.mock.On("InvalidateCollectionMetaCache", ctx, request)}
}
@ -1456,8 +1456,8 @@ type RootCoord_ListCredUsers_Call struct {
}
// ListCredUsers is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.ListCredUsersRequest
// - ctx context.Context
// - req *milvuspb.ListCredUsersRequest
func (_e *RootCoord_Expecter) ListCredUsers(ctx interface{}, req interface{}) *RootCoord_ListCredUsers_Call {
return &RootCoord_ListCredUsers_Call{Call: _e.mock.On("ListCredUsers", ctx, req)}
}
@ -1503,8 +1503,8 @@ type RootCoord_ListDatabases_Call struct {
}
// ListDatabases is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.ListDatabasesRequest
// - ctx context.Context
// - req *milvuspb.ListDatabasesRequest
func (_e *RootCoord_Expecter) ListDatabases(ctx interface{}, req interface{}) *RootCoord_ListDatabases_Call {
return &RootCoord_ListDatabases_Call{Call: _e.mock.On("ListDatabases", ctx, req)}
}
@ -1550,8 +1550,8 @@ type RootCoord_ListImportTasks_Call struct {
}
// ListImportTasks is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.ListImportTasksRequest
// - ctx context.Context
// - req *milvuspb.ListImportTasksRequest
func (_e *RootCoord_Expecter) ListImportTasks(ctx interface{}, req interface{}) *RootCoord_ListImportTasks_Call {
return &RootCoord_ListImportTasks_Call{Call: _e.mock.On("ListImportTasks", ctx, req)}
}
@ -1597,8 +1597,8 @@ type RootCoord_ListPolicy_Call struct {
}
// ListPolicy is a helper method to define mock.On call
// - ctx context.Context
// - in *internalpb.ListPolicyRequest
// - ctx context.Context
// - in *internalpb.ListPolicyRequest
func (_e *RootCoord_Expecter) ListPolicy(ctx interface{}, in interface{}) *RootCoord_ListPolicy_Call {
return &RootCoord_ListPolicy_Call{Call: _e.mock.On("ListPolicy", ctx, in)}
}
@ -1644,8 +1644,8 @@ type RootCoord_OperatePrivilege_Call struct {
}
// OperatePrivilege is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.OperatePrivilegeRequest
// - ctx context.Context
// - req *milvuspb.OperatePrivilegeRequest
func (_e *RootCoord_Expecter) OperatePrivilege(ctx interface{}, req interface{}) *RootCoord_OperatePrivilege_Call {
return &RootCoord_OperatePrivilege_Call{Call: _e.mock.On("OperatePrivilege", ctx, req)}
}
@ -1691,8 +1691,8 @@ type RootCoord_OperateUserRole_Call struct {
}
// OperateUserRole is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.OperateUserRoleRequest
// - ctx context.Context
// - req *milvuspb.OperateUserRoleRequest
func (_e *RootCoord_Expecter) OperateUserRole(ctx interface{}, req interface{}) *RootCoord_OperateUserRole_Call {
return &RootCoord_OperateUserRole_Call{Call: _e.mock.On("OperateUserRole", ctx, req)}
}
@ -1774,8 +1774,8 @@ type RootCoord_RenameCollection_Call struct {
}
// RenameCollection is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.RenameCollectionRequest
// - ctx context.Context
// - req *milvuspb.RenameCollectionRequest
func (_e *RootCoord_Expecter) RenameCollection(ctx interface{}, req interface{}) *RootCoord_RenameCollection_Call {
return &RootCoord_RenameCollection_Call{Call: _e.mock.On("RenameCollection", ctx, req)}
}
@ -1821,8 +1821,8 @@ type RootCoord_ReportImport_Call struct {
}
// ReportImport is a helper method to define mock.On call
// - ctx context.Context
// - req *rootcoordpb.ImportResult
// - ctx context.Context
// - req *rootcoordpb.ImportResult
func (_e *RootCoord_Expecter) ReportImport(ctx interface{}, req interface{}) *RootCoord_ReportImport_Call {
return &RootCoord_ReportImport_Call{Call: _e.mock.On("ReportImport", ctx, req)}
}
@ -1868,8 +1868,8 @@ type RootCoord_SelectGrant_Call struct {
}
// SelectGrant is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.SelectGrantRequest
// - ctx context.Context
// - req *milvuspb.SelectGrantRequest
func (_e *RootCoord_Expecter) SelectGrant(ctx interface{}, req interface{}) *RootCoord_SelectGrant_Call {
return &RootCoord_SelectGrant_Call{Call: _e.mock.On("SelectGrant", ctx, req)}
}
@ -1915,8 +1915,8 @@ type RootCoord_SelectRole_Call struct {
}
// SelectRole is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.SelectRoleRequest
// - ctx context.Context
// - req *milvuspb.SelectRoleRequest
func (_e *RootCoord_Expecter) SelectRole(ctx interface{}, req interface{}) *RootCoord_SelectRole_Call {
return &RootCoord_SelectRole_Call{Call: _e.mock.On("SelectRole", ctx, req)}
}
@ -1962,8 +1962,8 @@ type RootCoord_SelectUser_Call struct {
}
// SelectUser is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.SelectUserRequest
// - ctx context.Context
// - req *milvuspb.SelectUserRequest
func (_e *RootCoord_Expecter) SelectUser(ctx interface{}, req interface{}) *RootCoord_SelectUser_Call {
return &RootCoord_SelectUser_Call{Call: _e.mock.On("SelectUser", ctx, req)}
}
@ -2009,8 +2009,8 @@ type RootCoord_ShowCollections_Call struct {
}
// ShowCollections is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.ShowCollectionsRequest
// - ctx context.Context
// - req *milvuspb.ShowCollectionsRequest
func (_e *RootCoord_Expecter) ShowCollections(ctx interface{}, req interface{}) *RootCoord_ShowCollections_Call {
return &RootCoord_ShowCollections_Call{Call: _e.mock.On("ShowCollections", ctx, req)}
}
@ -2056,8 +2056,8 @@ type RootCoord_ShowConfigurations_Call struct {
}
// ShowConfigurations is a helper method to define mock.On call
// - ctx context.Context
// - req *internalpb.ShowConfigurationsRequest
// - ctx context.Context
// - req *internalpb.ShowConfigurationsRequest
func (_e *RootCoord_Expecter) ShowConfigurations(ctx interface{}, req interface{}) *RootCoord_ShowConfigurations_Call {
return &RootCoord_ShowConfigurations_Call{Call: _e.mock.On("ShowConfigurations", ctx, req)}
}
@ -2103,8 +2103,8 @@ type RootCoord_ShowPartitions_Call struct {
}
// ShowPartitions is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.ShowPartitionsRequest
// - ctx context.Context
// - req *milvuspb.ShowPartitionsRequest
func (_e *RootCoord_Expecter) ShowPartitions(ctx interface{}, req interface{}) *RootCoord_ShowPartitions_Call {
return &RootCoord_ShowPartitions_Call{Call: _e.mock.On("ShowPartitions", ctx, req)}
}
@ -2150,8 +2150,8 @@ type RootCoord_ShowPartitionsInternal_Call struct {
}
// ShowPartitionsInternal is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.ShowPartitionsRequest
// - ctx context.Context
// - req *milvuspb.ShowPartitionsRequest
func (_e *RootCoord_Expecter) ShowPartitionsInternal(ctx interface{}, req interface{}) *RootCoord_ShowPartitionsInternal_Call {
return &RootCoord_ShowPartitionsInternal_Call{Call: _e.mock.On("ShowPartitionsInternal", ctx, req)}
}
@ -2197,8 +2197,8 @@ type RootCoord_ShowSegments_Call struct {
}
// ShowSegments is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.ShowSegmentsRequest
// - ctx context.Context
// - req *milvuspb.ShowSegmentsRequest
func (_e *RootCoord_Expecter) ShowSegments(ctx interface{}, req interface{}) *RootCoord_ShowSegments_Call {
return &RootCoord_ShowSegments_Call{Call: _e.mock.On("ShowSegments", ctx, req)}
}
@ -2316,8 +2316,8 @@ type RootCoord_UpdateChannelTimeTick_Call struct {
}
// UpdateChannelTimeTick is a helper method to define mock.On call
// - ctx context.Context
// - req *internalpb.ChannelTimeTickMsg
// - ctx context.Context
// - req *internalpb.ChannelTimeTickMsg
func (_e *RootCoord_Expecter) UpdateChannelTimeTick(ctx interface{}, req interface{}) *RootCoord_UpdateChannelTimeTick_Call {
return &RootCoord_UpdateChannelTimeTick_Call{Call: _e.mock.On("UpdateChannelTimeTick", ctx, req)}
}
@ -2363,8 +2363,8 @@ type RootCoord_UpdateCredential_Call struct {
}
// UpdateCredential is a helper method to define mock.On call
// - ctx context.Context
// - req *internalpb.CredentialInfo
// - ctx context.Context
// - req *internalpb.CredentialInfo
func (_e *RootCoord_Expecter) UpdateCredential(ctx interface{}, req interface{}) *RootCoord_UpdateCredential_Call {
return &RootCoord_UpdateCredential_Call{Call: _e.mock.On("UpdateCredential", ctx, req)}
}

View File

@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery v2.16.0. DO NOT EDIT.
package mockrootcoord
@ -14,6 +14,14 @@ type GarbageCollector struct {
mock.Mock
}
type GarbageCollector_Expecter struct {
mock *mock.Mock
}
func (_m *GarbageCollector) EXPECT() *GarbageCollector_Expecter {
return &GarbageCollector_Expecter{mock: &_m.Mock}
}
// GcCollectionData provides a mock function with given fields: ctx, coll
func (_m *GarbageCollector) GcCollectionData(ctx context.Context, coll *model.Collection) (uint64, error) {
ret := _m.Called(ctx, coll)
@ -35,6 +43,30 @@ func (_m *GarbageCollector) GcCollectionData(ctx context.Context, coll *model.Co
return r0, r1
}
// GarbageCollector_GcCollectionData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GcCollectionData'
type GarbageCollector_GcCollectionData_Call struct {
*mock.Call
}
// GcCollectionData is a helper method to define mock.On call
// - ctx context.Context
// - coll *model.Collection
func (_e *GarbageCollector_Expecter) GcCollectionData(ctx interface{}, coll interface{}) *GarbageCollector_GcCollectionData_Call {
return &GarbageCollector_GcCollectionData_Call{Call: _e.mock.On("GcCollectionData", ctx, coll)}
}
func (_c *GarbageCollector_GcCollectionData_Call) Run(run func(ctx context.Context, coll *model.Collection)) *GarbageCollector_GcCollectionData_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*model.Collection))
})
return _c
}
func (_c *GarbageCollector_GcCollectionData_Call) Return(ddlTs uint64, err error) *GarbageCollector_GcCollectionData_Call {
_c.Call.Return(ddlTs, err)
return _c
}
// GcPartitionData provides a mock function with given fields: ctx, pChannels, partition
func (_m *GarbageCollector) GcPartitionData(ctx context.Context, pChannels []string, partition *model.Partition) (uint64, error) {
ret := _m.Called(ctx, pChannels, partition)
@ -56,14 +88,89 @@ func (_m *GarbageCollector) GcPartitionData(ctx context.Context, pChannels []str
return r0, r1
}
// GarbageCollector_GcPartitionData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GcPartitionData'
type GarbageCollector_GcPartitionData_Call struct {
*mock.Call
}
// GcPartitionData is a helper method to define mock.On call
// - ctx context.Context
// - pChannels []string
// - partition *model.Partition
func (_e *GarbageCollector_Expecter) GcPartitionData(ctx interface{}, pChannels interface{}, partition interface{}) *GarbageCollector_GcPartitionData_Call {
return &GarbageCollector_GcPartitionData_Call{Call: _e.mock.On("GcPartitionData", ctx, pChannels, partition)}
}
func (_c *GarbageCollector_GcPartitionData_Call) Run(run func(ctx context.Context, pChannels []string, partition *model.Partition)) *GarbageCollector_GcPartitionData_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].([]string), args[2].(*model.Partition))
})
return _c
}
func (_c *GarbageCollector_GcPartitionData_Call) Return(ddlTs uint64, err error) *GarbageCollector_GcPartitionData_Call {
_c.Call.Return(ddlTs, err)
return _c
}
// ReDropCollection provides a mock function with given fields: collMeta, ts
func (_m *GarbageCollector) ReDropCollection(collMeta *model.Collection, ts uint64) {
_m.Called(collMeta, ts)
}
// ReDropPartition provides a mock function with given fields: pChannels, partition, ts
// GarbageCollector_ReDropCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReDropCollection'
type GarbageCollector_ReDropCollection_Call struct {
*mock.Call
}
// ReDropCollection is a helper method to define mock.On call
// - collMeta *model.Collection
// - ts uint64
func (_e *GarbageCollector_Expecter) ReDropCollection(collMeta interface{}, ts interface{}) *GarbageCollector_ReDropCollection_Call {
return &GarbageCollector_ReDropCollection_Call{Call: _e.mock.On("ReDropCollection", collMeta, ts)}
}
func (_c *GarbageCollector_ReDropCollection_Call) Run(run func(collMeta *model.Collection, ts uint64)) *GarbageCollector_ReDropCollection_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Collection), args[1].(uint64))
})
return _c
}
func (_c *GarbageCollector_ReDropCollection_Call) Return() *GarbageCollector_ReDropCollection_Call {
_c.Call.Return()
return _c
}
// ReDropPartition provides a mock function with given fields: dbID, pChannels, partition, ts
func (_m *GarbageCollector) ReDropPartition(dbID int64, pChannels []string, partition *model.Partition, ts uint64) {
_m.Called(pChannels, partition, ts)
_m.Called(dbID, pChannels, partition, ts)
}
// GarbageCollector_ReDropPartition_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReDropPartition'
type GarbageCollector_ReDropPartition_Call struct {
*mock.Call
}
// ReDropPartition is a helper method to define mock.On call
// - dbID int64
// - pChannels []string
// - partition *model.Partition
// - ts uint64
func (_e *GarbageCollector_Expecter) ReDropPartition(dbID interface{}, pChannels interface{}, partition interface{}, ts interface{}) *GarbageCollector_ReDropPartition_Call {
return &GarbageCollector_ReDropPartition_Call{Call: _e.mock.On("ReDropPartition", dbID, pChannels, partition, ts)}
}
func (_c *GarbageCollector_ReDropPartition_Call) Run(run func(dbID int64, pChannels []string, partition *model.Partition, ts uint64)) *GarbageCollector_ReDropPartition_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int64), args[1].([]string), args[2].(*model.Partition), args[3].(uint64))
})
return _c
}
func (_c *GarbageCollector_ReDropPartition_Call) Return() *GarbageCollector_ReDropPartition_Call {
_c.Call.Return()
return _c
}
// RemoveCreatingCollection provides a mock function with given fields: collMeta
@ -71,6 +178,29 @@ func (_m *GarbageCollector) RemoveCreatingCollection(collMeta *model.Collection)
_m.Called(collMeta)
}
// GarbageCollector_RemoveCreatingCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveCreatingCollection'
type GarbageCollector_RemoveCreatingCollection_Call struct {
*mock.Call
}
// RemoveCreatingCollection is a helper method to define mock.On call
// - collMeta *model.Collection
func (_e *GarbageCollector_Expecter) RemoveCreatingCollection(collMeta interface{}) *GarbageCollector_RemoveCreatingCollection_Call {
return &GarbageCollector_RemoveCreatingCollection_Call{Call: _e.mock.On("RemoveCreatingCollection", collMeta)}
}
func (_c *GarbageCollector_RemoveCreatingCollection_Call) Run(run func(collMeta *model.Collection)) *GarbageCollector_RemoveCreatingCollection_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Collection))
})
return _c
}
func (_c *GarbageCollector_RemoveCreatingCollection_Call) Return() *GarbageCollector_RemoveCreatingCollection_Call {
_c.Call.Return()
return _c
}
type mockConstructorTestingTNewGarbageCollector interface {
mock.TestingT
Cleanup(func())

File diff suppressed because it is too large Load Diff

View File

@ -619,26 +619,25 @@ func (c *Core) restore(ctx context.Context) error {
return err
}
for _, coll := range colls {
for _, part := range coll.Partitions {
ts, err := c.tsoAllocator.GenerateTSO(1)
if err != nil {
return err
}
if coll.Available() {
ts, err := c.tsoAllocator.GenerateTSO(1)
if err != nil {
return err
}
if coll.Available() {
for _, part := range coll.Partitions {
switch part.State {
case pb.PartitionState_PartitionDropping:
go c.garbageCollector.ReDropPartition(coll.DBID, coll.PhysicalChannelNames, part.Clone(), ts)
default:
}
} else {
switch coll.State {
case pb.CollectionState_CollectionDropping:
go c.garbageCollector.ReDropCollection(coll.Clone(), ts)
case pb.CollectionState_CollectionCreating:
go c.garbageCollector.RemoveCreatingCollection(coll.Clone())
default:
}
}
} else {
switch coll.State {
case pb.CollectionState_CollectionDropping:
go c.garbageCollector.ReDropCollection(coll.Clone(), ts)
case pb.CollectionState_CollectionCreating:
go c.garbageCollector.RemoveCreatingCollection(coll.Clone())
default:
}
}
}

View File

@ -26,6 +26,10 @@ import (
"time"
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
@ -38,6 +42,7 @@ import (
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/proxypb"
"github.com/milvus-io/milvus/internal/proto/rootcoordpb"
mockrootcoord "github.com/milvus-io/milvus/internal/rootcoord/mocks"
"github.com/milvus-io/milvus/internal/util/dependency"
"github.com/milvus-io/milvus/internal/util/etcd"
"github.com/milvus-io/milvus/internal/util/funcutil"
@ -45,9 +50,6 @@ import (
"github.com/milvus-io/milvus/internal/util/metricsinfo"
"github.com/milvus-io/milvus/internal/util/sessionutil"
"github.com/milvus-io/milvus/internal/util/typeutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
func TestRootCoord_CreateDatabase(t *testing.T) {
@ -2035,3 +2037,95 @@ func TestCore_Stop(t *testing.T) {
assert.Equal(t, commonpb.StateCode_Abnormal, code)
})
}
type RootCoordSuite struct {
suite.Suite
}
func (s *RootCoordSuite) TestRestore() {
meta := mockrootcoord.NewIMetaTable(s.T())
gc := mockrootcoord.NewGarbageCollector(s.T())
finishCh := make(chan struct{}, 3)
gc.EXPECT().ReDropPartition(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Once().
Run(func(args mock.Arguments) {
finishCh <- struct{}{}
})
gc.EXPECT().ReDropCollection(mock.Anything, mock.Anything).Once().
Run(func(args mock.Arguments) {
finishCh <- struct{}{}
})
gc.EXPECT().RemoveCreatingCollection(mock.Anything).Once().
Run(func(args mock.Arguments) {
finishCh <- struct{}{}
})
meta.EXPECT().ListDatabases(mock.Anything, mock.Anything).
Return([]*model.Database{
{Name: "available_colls_db"},
{Name: "not_available_colls_db"}}, nil)
meta.EXPECT().ListCollections(mock.Anything, "available_colls_db", mock.Anything, false).
Return([]*model.Collection{
{
DBID: 1,
State: etcdpb.CollectionState_CollectionCreated, // available collection
PhysicalChannelNames: []string{"ch1"},
Partitions: []*model.Partition{
{State: etcdpb.PartitionState_PartitionDropping},
{State: etcdpb.PartitionState_PartitionDropped}, // ignored
},
},
}, nil)
meta.EXPECT().ListCollections(mock.Anything, "not_available_colls_db", mock.Anything, false).
Return([]*model.Collection{
{
DBID: 1,
State: etcdpb.CollectionState_CollectionDropping, // not available collection
PhysicalChannelNames: []string{"ch1"},
Partitions: []*model.Partition{
{State: etcdpb.PartitionState_PartitionDropping},
{State: etcdpb.PartitionState_PartitionCreating},
{State: etcdpb.PartitionState_PartitionDropped},
},
},
{
DBID: 1,
State: etcdpb.CollectionState_CollectionCreating, // not available collection
PhysicalChannelNames: []string{"ch1"},
Partitions: []*model.Partition{
{State: etcdpb.PartitionState_PartitionDropping},
{State: etcdpb.PartitionState_PartitionCreating},
{State: etcdpb.PartitionState_PartitionDropped},
},
},
{
DBID: 1,
State: etcdpb.CollectionState_CollectionDropped, // ignored
PhysicalChannelNames: []string{"ch1"},
Partitions: []*model.Partition{
{State: etcdpb.PartitionState_PartitionDropping},
{State: etcdpb.PartitionState_PartitionCreating},
{State: etcdpb.PartitionState_PartitionDropped},
},
},
}, nil)
tsoAllocator := newMockTsoAllocator()
tsoAllocator.GenerateTSOF = func(count uint32) (uint64, error) {
return 100, nil
}
core := newTestCore(
withGarbageCollector(gc),
withTsoAllocator(tsoAllocator),
withMeta(meta))
core.restore(context.Background())
for i := 0; i < 3; i++ {
<-finishCh
}
}
func TestRootCoordSuite(t *testing.T) {
suite.Run(t, new(RootCoordSuite))
}