mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +08:00
fix: Close client before remove worker client (#41253)
issue: #41252 --------- Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
This commit is contained in:
parent
3963fc818f
commit
bc11feae74
@ -2356,8 +2356,11 @@ func newTestServer(t *testing.T, opts ...Option) *Server {
|
|||||||
svr.SetEtcdClient(etcdCli)
|
svr.SetEtcdClient(etcdCli)
|
||||||
svr.SetTiKVClient(globalTestTikv)
|
svr.SetTiKVClient(globalTestTikv)
|
||||||
|
|
||||||
|
dm := mocks.NewMockDataNodeClient(t)
|
||||||
|
dm.EXPECT().Close().Return(nil).Maybe()
|
||||||
|
|
||||||
svr.dataNodeCreator = func(ctx context.Context, addr string, nodeID int64) (types.DataNodeClient, error) {
|
svr.dataNodeCreator = func(ctx context.Context, addr string, nodeID int64) (types.DataNodeClient, error) {
|
||||||
return mocks.NewMockDataNodeClient(t), nil
|
return dm, nil
|
||||||
}
|
}
|
||||||
svr.mixCoordCreator = func(ctx context.Context) (types.MixCoord, error) {
|
svr.mixCoordCreator = func(ctx context.Context) (types.MixCoord, error) {
|
||||||
return newMockMixCoord(), nil
|
return newMockMixCoord(), nil
|
||||||
|
|||||||
@ -90,7 +90,12 @@ func (nm *IndexNodeManager) RemoveNode(nodeID typeutil.UniqueID) {
|
|||||||
log.Ctx(nm.ctx).Debug("remove IndexNode", zap.Int64("nodeID", nodeID))
|
log.Ctx(nm.ctx).Debug("remove IndexNode", zap.Int64("nodeID", nodeID))
|
||||||
nm.lock.Lock()
|
nm.lock.Lock()
|
||||||
defer nm.lock.Unlock()
|
defer nm.lock.Unlock()
|
||||||
delete(nm.nodeClients, nodeID)
|
if in, ok := nm.nodeClients[nodeID]; ok {
|
||||||
|
if err := in.Close(); err != nil {
|
||||||
|
log.Warn("Failed to close client connection", zap.Error(err))
|
||||||
|
}
|
||||||
|
delete(nm.nodeClients, nodeID)
|
||||||
|
}
|
||||||
delete(nm.stoppingNodes, nodeID)
|
delete(nm.stoppingNodes, nodeID)
|
||||||
metrics.IndexNodeNum.WithLabelValues().Set(float64(len(nm.nodeClients)))
|
metrics.IndexNodeNum.WithLabelValues().Set(float64(len(nm.nodeClients)))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user