Commit df1df655 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 1e55d36b
......@@ -156,7 +156,7 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func(
return xio.WithCloseOnRetCancel(ctx, mlink, func() (err error) {
if accept.YourNID != s.MyNID {
log.Infof(ctx, "master %s told us to be %s", accept.MyNID, accept.YourNID)
node.UpdateState(func(s *xneo.State) {
node.modifyState(func(s *xneo.State) {
s.MyNID = accept.YourNID
})
}
......@@ -179,7 +179,7 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func(
// partTab (not to S and secondary M(?))
// https://lab.nexedi.com/nexedi/neoppod/blob/v1.12-69-gd98205d0/neo/master/handlers/__init__.py#L60-67
pt := node.State.PartTab
var pt *xneo.PartitionTable
if !(node.Type == proto.STORAGE) {
mpt := proto.SendPartitionTable{}
_, err = mlink.Expect1(&mpt)
......@@ -193,7 +193,9 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func(
// update cluster state
node.updateState(func(s *xneo.State) {
err = s.updateNodeTab(ctx, &mnt) // the only err is cmdShutdown
node.State.PartTab = pt
if pt != nil {
node.State.PartTab = pt
}
if err == nil {
// keep mlink=nil on shutdown so that
// .operational does not change to y.
......@@ -309,7 +311,7 @@ func (node *_MasteredNode) recvδstate(ctx context.Context, msg proto.Msg) (δpt
// updateOperational calls δf under .opMu and updates .operational from current state.
// After .opMu unlock it also notifies those who was waiting for .operational to become y.
func (node *_MasteredNode) updateOperational(δf func()) {
func (node *_MasteredNode) modifyState(δf func(s */*_Mastered*/State)) {
var opready chan struct{}
node.opMu.Lock()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment