Commit c354a136 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 7930f2f7
......@@ -180,19 +180,18 @@ func (c *Client) talkMaster(ctx context.Context) (err error) {
}
func (c *Client) talkMaster1(ctx context.Context) (err error) {
// XXX dup from Server.talkMaster1
// XXX put logging into Dial?
log.Info(ctx, "connecting ...")
// XXX dup from Server.talkMaster1 ?
mlink, accept, err := c.node.Dial(ctx, neo.MASTER, c.node.MasterAddr)
if err != nil {
// FIXME it is not only identification - e.g. ECONNREFUSED
log.Info(ctx, "identification rejected") // XXX ok here? (err is logged above)
return err
}
_ = accept // XXX
log.Info(ctx, "identification accepted")
// XXX -> node.Dial ?
if accept.YourUUID != c.node.MyInfo.UUID {
log.Infof(ctx, "master told us to have uuid=%v", accept.YourUUID)
c.node.MyInfo.UUID = accept.YourUUID
}
// set c.mlink and notify waiters
c.mlinkMu.Lock()
......
......@@ -35,6 +35,8 @@ import (
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/neo/go/xcommon/log"
"lab.nexedi.com/kirr/neo/go/xcommon/task"
//"lab.nexedi.com/kirr/neo/go/xcommon/xio"
"lab.nexedi.com/kirr/neo/go/xcommon/xnet"
"lab.nexedi.com/kirr/neo/go/zodb"
......@@ -100,6 +102,8 @@ func NewNodeApp(net xnet.Networker, typ NodeType, clusterName, masterAddr, serve
// Dial does not update .NodeTab or its node entries in any way.
// For establishing links to peers present in .NodeTab use Node.Dial.
func (app *NodeApp) Dial(ctx context.Context, peerType NodeType, addr string) (_ *NodeLink, _ *AcceptIdentification, err error) {
defer task.Runningf(&ctx, "dial %v (%v)", addr, peerType)(&err)
link, err := DialLink(ctx, app.Net, addr)
if err != nil {
return nil, nil, err
......@@ -152,6 +156,7 @@ func (app *NodeApp) Dial(ctx context.Context, peerType NodeType, addr string) (_
// XXX accept.YourUUID // XXX M can tell us to change UUID -> take in effect
// XXX accept.NumPartitions, ... wrt app.node.PartTab
log.Info(ctx, "identification accepted")
return link, accept, nil
}
......
......@@ -157,17 +157,11 @@ func (stor *Storage) talkMaster(ctx context.Context) (err error) {
// it returns error describing why such cycle had to finish
// XXX distinguish between temporary problems and non-temporary ones?
func (stor *Storage) talkMaster1(ctx context.Context) (err error) {
// XXX dup in Client.talkMaster1
// XXX put logging into Dial?
log.Info(ctx, "connecting ...")
mlink, accept, err := stor.node.Dial(ctx, neo.MASTER, stor.node.MasterAddr)
if err != nil {
// FIXME it is not only identification - e.g. ECONNREFUSED
log.Info(ctx, "identification rejected") // XXX ok here? (err is logged above)
return err
}
log.Info(ctx, "identification accepted")
defer xio.CloseWhenDone(ctx, mlink)()
// XXX add master UUID -> nodeTab ? or master will notify us with it himself ?
......
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