diff --git a/cluster/calcium/node.go b/cluster/calcium/node.go index b994b21e..af2f7d99 100644 --- a/cluster/calcium/node.go +++ b/cluster/calcium/node.go @@ -87,7 +87,12 @@ func (c *Calcium) RemoveNode(ctx context.Context, nodename string) error { return utils.Txn(ctx, // if: remove node metadata func(ctx context.Context) error { - return c.store.RemoveNode(ctx, node) + if err := c.store.RemoveNode(ctx, node); err != nil { + return err + } + // remove node status, we don't care the result + _ = c.store.SetNodeStatus(ctx, node, -1) + return nil }, // then: remove node resource metadata func(ctx context.Context) error { diff --git a/cluster/calcium/node_test.go b/cluster/calcium/node_test.go index ccb2dcc1..1fde82c3 100644 --- a/cluster/calcium/node_test.go +++ b/cluster/calcium/node_test.go @@ -95,6 +95,7 @@ func TestRemoveNode(t *testing.T) { // success store.On("RemoveNode", mock.Anything, mock.Anything).Return(nil) + store.On("SetNodeStatus", mock.Anything, mock.Anything, int64(-1)).Return(nil) rmgr := c.rmgr.(*resourcemocks.Manager) rmgr.On("RemoveNode", mock.Anything, mock.Anything).Return(nil) assert.NoError(t, c.RemoveNode(ctx, name))