Skip to content

Commit

Permalink
fix the creation failure when the db meta has been recycled and the c…
Browse files Browse the repository at this point in the history
…ollection is existed

Signed-off-by: SimFG <[email protected]>
  • Loading branch information
SimFG committed Nov 26, 2024
1 parent 29bd79b commit c92f709
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/reader/etcd_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,13 @@ func (e *EtcdOp) GetDatabaseInfoForCollection(ctx context.Context, id int64) mod
}

// it will update all database info and this collection info
_ = retry.Do(ctx, func() error {
name := e.getCollectionNameByID(ctx, id)
if name == "" {
return errors.Newf("not found the collection %d", id)
name := e.getCollectionNameByID(ctx, id)
if name == "" {
log.Info("not found the collection name, maybe the db or collection has benn deleted", zap.Int64("collection_id", id))
return model.DatabaseInfo{
Dropped: true,
}
return nil
}, e.retryOptions...)
}

dbID, _ = e.collectionID2DBID.Load(id)
dbName, _ = e.dbID2Name.Load(dbID)
Expand Down
3 changes: 3 additions & 0 deletions core/reader/replicate_channel_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,9 @@ func (r *replicateChannelHandler) updateTargetPartitionInfo(collectionID int64,

func (r *replicateChannelHandler) getPartitionInfoForMilvus(ctx context.Context, collectionName string, collectionID int64) (*model.CollectionInfo, error) {
sourceDBInfo := r.metaOp.GetDatabaseInfoForCollection(ctx, collectionID)
if sourceDBInfo.Dropped {
return nil, errors.New("the database has been dropped")
}
partitionInfo, err := r.targetClient.GetPartitionInfo(ctx, collectionName, sourceDBInfo.Name)
if err != nil {
return nil, err
Expand Down

0 comments on commit c92f709

Please sign in to comment.