mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
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:
parent
fe91ec3cb5
commit
7307332fab
@ -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 {
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user