Fix data race in querycoordv2 (#19240)

Signed-off-by: sunby <bingyi.sun@zilliz.com>

Signed-off-by: sunby <bingyi.sun@zilliz.com>
Co-authored-by: sunby <bingyi.sun@zilliz.com>
This commit is contained in:
Bingyi Sun 2022-09-20 15:54:49 +08:00 committed by GitHub
parent 50ea4eeef1
commit 77aee8cb65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,14 +63,6 @@ func (node *MockQueryNode) Start() error {
err = node.server.Serve(lis)
}()
// Regiser
node.session.Init(typeutil.QueryNodeRole, node.addr, false, true)
node.ID = node.session.ServerID
node.session.Register()
log.Debug("mock QueryNode started",
zap.Int64("nodeID", node.ID),
zap.String("nodeAddr", node.addr))
successStatus := &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
}
@ -103,6 +95,14 @@ func (node *MockQueryNode) Start() error {
node.segmentVersion[segment.GetSegmentID()] = req.GetVersion()
}).Return(successStatus, nil).Maybe()
// Regiser
node.session.Init(typeutil.QueryNodeRole, node.addr, false, true)
node.ID = node.session.ServerID
node.session.Register()
log.Debug("mock QueryNode started",
zap.Int64("nodeID", node.ID),
zap.String("nodeAddr", node.addr))
return err
}