Use merr to prevent datanode panic (#28121)

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
yihao.dai 2023-11-04 00:58:21 +08:00 committed by GitHub
parent 501cba90ce
commit 8d080383b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,6 @@ package datanode
import (
"context"
"fmt"
"math"
"path"
"sync"
@ -201,7 +200,7 @@ func (c *ChannelMeta) getCollectionAndPartitionID(segID UniqueID) (collID, parti
if seg, ok := c.segments[segID]; ok && seg.isValid() {
return seg.collectionID, seg.partitionID, nil
}
return 0, 0, fmt.Errorf("cannot find segment, id = %d", segID)
return 0, 0, merr.WrapErrSegmentNotFound(segID)
}
func (c *ChannelMeta) getChannelName() string {
@ -640,7 +639,7 @@ func (c *ChannelMeta) getSegmentStatisticsUpdates(segID UniqueID) (*commonpb.Seg
return &commonpb.SegmentStats{SegmentID: segID, NumRows: seg.numRows}, nil
}
return nil, fmt.Errorf("error, there's no segment %d", segID)
return nil, merr.WrapErrSegmentNotFound(segID)
}
func (c *ChannelMeta) getCollectionID() UniqueID {