Fix data node

Signed-off-by: neza2017 <yefu.chen@zilliz.com>
pull/4973/head^2
neza2017 2021-02-01 11:44:02 +08:00 committed by yefu.chen
parent 675426ea07
commit 3f45cfd6e8
1 changed files with 5 additions and 2 deletions

View File

@ -56,6 +56,7 @@ type (
DataNode struct {
ctx context.Context
cancel context.CancelFunc
NodeID UniqueID
Role string
State internalpb2.StateCode
@ -77,8 +78,10 @@ type (
func NewDataNode(ctx context.Context) *DataNode {
Params.Init()
ctx2, cancel2 := context.WithCancel(ctx)
node := &DataNode{
ctx: ctx,
ctx: ctx2,
cancel: cancel2,
NodeID: Params.NodeID, // GOOSE TODO How to init
Role: typeutil.DataNodeRole,
State: internalpb2.StateCode_INITIALIZING,
@ -216,7 +219,7 @@ func (node *DataNode) FlushSegments(in *datapb.FlushSegRequest) error {
}
func (node *DataNode) Stop() error {
<-node.ctx.Done()
node.cancel()
// close services
if node.dataSyncService != nil {