Refactor release collection warn message

Signed-off-by: xige-16 <xi.ge@zilliz.com>
This commit is contained in:
xige-16 2021-02-25 18:26:11 +08:00 committed by yefu.chen
parent bf75c2fbb4
commit 650bf1d993
2 changed files with 14 additions and 6 deletions

View File

@ -1,6 +1,8 @@
package queryservice
import (
"strconv"
"github.com/zilliztech/milvus-distributed/internal/errors"
"github.com/zilliztech/milvus-distributed/internal/proto/querypb"
"github.com/zilliztech/milvus-distributed/internal/proto/schemapb"
@ -212,7 +214,9 @@ func (mp *metaReplicaImpl) releaseCollection(dbID UniqueID, collectionID UniqueI
}
}
}
return errors.New("releaseCollection: can't find dbID or collectionID")
errorStr := "releaseCollection: can't find dbID or collectionID " + strconv.FormatInt(collectionID, 10)
return errors.New(errorStr)
}
func (mp *metaReplicaImpl) releasePartition(dbID UniqueID, collectionID UniqueID, partitionID UniqueID) error {
@ -226,7 +230,9 @@ func (mp *metaReplicaImpl) releasePartition(dbID UniqueID, collectionID UniqueID
}
}
}
return errors.New("releasePartition: can't find dbID or collectionID or partitionID")
errorStr := "releasePartition: can't find dbID or collectionID or partitionID " + strconv.FormatInt(partitionID, 10)
return errors.New(errorStr)
}
func (mp *metaReplicaImpl) addDmChannels(dbID UniqueID, collectionID UniqueID, channels2NodeID map[string]int64) error {

View File

@ -282,21 +282,23 @@ func (qs *QueryService) ReleaseCollection(req *querypb.ReleaseCollectionRequest)
fmt.Println("release collection start, collectionID = ", collectionID)
_, err := qs.replica.getCollectionByID(dbID, collectionID)
if err != nil {
fmt.Println("release collection end, query service don't have the log of collection ", collectionID)
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
}, err
ErrorCode: commonpb.ErrorCode_SUCCESS,
}, nil
}
for _, node := range qs.queryNodes {
for nodeID, node := range qs.queryNodes {
status, err := node.ReleaseCollection(req)
if err != nil {
fmt.Println("release collection end, node ", nodeID, " occur error")
return status, err
}
}
err = qs.replica.releaseCollection(dbID, collectionID)
if err != nil {
fmt.Println("release collection end, query service release replica error")
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),