mirror of https://github.com/milvus-io/milvus.git
parent
9b0ecbdca7
commit
babf4e37e4
|
@ -523,6 +523,11 @@ func dropPartition(collMeta *pb.CollectionInfo, partitionID typeutil.UniqueID) {
|
|||
|
||||
func (kc *Catalog) DropPartition(ctx context.Context, dbID int64, collectionID typeutil.UniqueID, partitionID typeutil.UniqueID, ts typeutil.Timestamp) error {
|
||||
collMeta, err := kc.loadCollection(ctx, dbID, collectionID, ts)
|
||||
if errors.Is(err, merr.ErrCollectionNotFound) {
|
||||
// collection's gc happened before partition's.
|
||||
return nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -666,10 +666,9 @@ func TestCatalog_DropPartitionV2(t *testing.T) {
|
|||
t.Run("failed to load collection", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
snapshot := kv.NewMockSnapshotKV()
|
||||
snapshot.LoadFunc = func(key string, ts typeutil.Timestamp) (string, error) {
|
||||
return "", errors.New("mock")
|
||||
}
|
||||
snapshot := mocks.NewSnapShotKV(t)
|
||||
snapshot.On("Load",
|
||||
mock.Anything, mock.Anything).Return("not in codec format", nil)
|
||||
|
||||
kc := Catalog{Snapshot: snapshot}
|
||||
|
||||
|
@ -677,6 +676,19 @@ func TestCatalog_DropPartitionV2(t *testing.T) {
|
|||
assert.Error(t, err)
|
||||
})
|
||||
|
||||
t.Run("failed to load collection, no key found", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
snapshot := mocks.NewSnapShotKV(t)
|
||||
snapshot.On("Load",
|
||||
mock.Anything, mock.Anything).Return("", merr.WrapErrIoKeyNotFound("partition"))
|
||||
|
||||
kc := Catalog{Snapshot: snapshot}
|
||||
|
||||
err := kc.DropPartition(ctx, 0, 100, 101, 0)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("partition version after 210", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
|
|
Loading…
Reference in New Issue