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( ...@@ -156,7 +156,7 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func(
return xio.WithCloseOnRetCancel(ctx, mlink, func() (err error) { return xio.WithCloseOnRetCancel(ctx, mlink, func() (err error) {
if accept.YourNID != s.MyNID { if accept.YourNID != s.MyNID {
log.Infof(ctx, "master %s told us to be %s", accept.MyNID, accept.YourNID) 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 s.MyNID = accept.YourNID
}) })
} }
...@@ -179,7 +179,7 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func( ...@@ -179,7 +179,7 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func(
// partTab (not to S and secondary M(?)) // 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 // 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) { if !(node.Type == proto.STORAGE) {
mpt := proto.SendPartitionTable{} mpt := proto.SendPartitionTable{}
_, err = mlink.Expect1(&mpt) _, err = mlink.Expect1(&mpt)
...@@ -193,7 +193,9 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func( ...@@ -193,7 +193,9 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func(
// update cluster state // update cluster state
node.updateState(func(s *xneo.State) { node.updateState(func(s *xneo.State) {
err = s.updateNodeTab(ctx, &mnt) // the only err is cmdShutdown err = s.updateNodeTab(ctx, &mnt) // the only err is cmdShutdown
node.State.PartTab = pt if pt != nil {
node.State.PartTab = pt
}
if err == nil { if err == nil {
// keep mlink=nil on shutdown so that // keep mlink=nil on shutdown so that
// .operational does not change to y. // .operational does not change to y.
...@@ -309,7 +311,7 @@ func (node *_MasteredNode) recvδstate(ctx context.Context, msg proto.Msg) (δpt ...@@ -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. // 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. // 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{} var opready chan struct{}
node.opMu.Lock() 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