Add nil check (#6832)

* add nil check

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>

* use grpc functions

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>

* use grpc functions

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>

* fix indexCoord crash

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
bigsheeper 2021-07-29 20:11:23 +08:00 committed by GitHub
parent fe91ec3cb5
commit 7307332fab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -55,8 +55,8 @@ func (mService *metaService) getCollectionSchema(ctx context.Context, collID Uni
}
response, err := mService.rootCoord.DescribeCollection(ctx, req)
if response.Status.ErrorCode != commonpb.ErrorCode_Success {
return nil, fmt.Errorf("Describe collection %v from rootcoord wrong: %s", collID, err.Error())
if response.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success {
return nil, fmt.Errorf("Describe collection %v from rootcoord wrong: %s", collID, response.GetStatus().GetReason())
}
if err != nil {

View File

@ -18,6 +18,8 @@ import (
"path"
"golang.org/x/exp/mmap"
"github.com/milvus-io/milvus/internal/log"
)
type LocalChunkManager struct {
@ -80,7 +82,14 @@ func (lcm *LocalChunkManager) Read(key string) ([]byte, error) {
func (lcm *LocalChunkManager) ReadAt(key string, p []byte, off int64) (n int, err error) {
path := path.Join(lcm.localPath, key)
at, err := mmap.Open(path)
defer at.Close()
defer func() {
if at != nil {
err = at.Close()
if err != nil {
log.Error(err.Error())
}
}
}()
if err != nil {
return 0, err
}