Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
f70489a3
Commit
f70489a3
authored
Feb 12, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e744ca3e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
go/neo/master.go
go/neo/master.go
+16
-15
No files found.
go/neo/master.go
View file @
f70489a3
...
...
@@ -661,6 +661,7 @@ func (m *Master) verify(ctx context.Context) (err error) {
err
:=
stor
.
run
(
ctx
,
func
()
error
{
var
err
error
lastOid
,
lastTid
,
err
=
storCtlVerify
(
ctx
,
stor
,
m
.
node
.
State
.
PartTab
)
return
err
})
ack
:=
make
(
chan
struct
{})
...
...
@@ -1242,8 +1243,8 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
log
.
Infof
(
ctx
,
"%s: rejecting: %s"
,
subj
,
err
)
m
.
mainWG
.
Go
(
func
(
ctx
context
.
Context
)
error
{
// XXX close link on ctx cancel?
idR
eq
.
Reply
(
err
)
idReq
.
Link
.
Close
()
n
.
r
eq
.
Reply
(
err
)
n
.
req
.
Link
()
.
Close
()
// XXX log err (if any)
return
nil
// not to cancel main by a failing reject
})
...
...
@@ -1274,10 +1275,10 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
Addr
:
n
.
idReq
.
Address
,
NID
:
nid
,
State
:
nodeState
,
IdTime
:
proto
.
IdTime
(
m
.
timeMono
()),
IdTime
:
proto
.
IdTime
(
m
.
x
timeMono
()),
}
node
=
m
.
updateNodeTab
(
ctx
,
nodeInfo
)
node
:
=
m
.
updateNodeTab
(
ctx
,
nodeInfo
)
node
.
SetLink
(
n
.
req
.
Link
())
...
...
@@ -1305,26 +1306,26 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
// accept sends acceptance to just identified peer, sends nodeTab and partTab
// and spawns task to proxy their updates to the peer. XXX
// XXX +ctx?
func
(
m
*
Master
)
__accept
(
p
*
_MasteredPeer
,
idReq
*
neonet
.
Request
)
error
{
func
(
m
*
Master
)
__accept
(
p
eer
*
_MasteredPeer
,
idReq
*
neonet
.
Request
)
error
{
// XXX errctx?
err
:=
idReq
.
Reply
(
p
.
accept
)
err
:=
idReq
.
Reply
(
p
eer
.
accept
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"send accept: %w"
,
err
)
}
// XXX idReq close?
// send initial state snapshot to accepted node
link
:=
p
.
peer
.
Link
()
// XXX -> idReq.Link() instead?
link
:=
p
eer
.
node
.
Link
()
// XXX -> idReq.Link() instead?
// nodeTab
err
=
link
.
Send1
(
&
p
.
state0
.
NodeTab
)
err
=
link
.
Send1
(
&
p
eer
.
state0
.
NodeTab
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"send nodeTab: %w"
,
err
)
}
// partTab (not to S until cluster is RUNNING)
if
!
(
peer
.
Type
==
proto
.
STORAGE
&&
state0
.
Code
!=
proto
.
ClusterRunning
)
{
err
=
link
.
Send1
(
&
p
.
state0
.
PartTab
)
if
!
(
peer
.
node
.
Type
==
proto
.
STORAGE
&&
peer
.
state0
.
Code
!=
proto
.
ClusterRunning
)
{
err
=
link
.
Send1
(
&
p
eer
.
state0
.
PartTab
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"send partTab: %w"
,
err
)
}
...
...
@@ -1334,8 +1335,8 @@ func (m *Master) __accept(p *_MasteredPeer, idReq *neonet.Request) error {
// TODO indicate that initial phase of accept is done
p
.
wg
.
Go
(
p
.
notify
)
// main -> peer δnodeTab/δpartTab/δcluterState to proxy to peer link
m
.
mainWG
.
Go
(
p
.
waitAll
)
// main <- peer "peer (should be) disconnected"
p
eer
.
wg
.
Go
(
peer
.
notify
)
// main -> peer δnodeTab/δpartTab/δcluterState to proxy to peer link
m
.
mainWG
.
Go
(
p
eer
.
waitAll
)
// main <- peer "peer (should be) disconnected"
return
nil
}
...
...
@@ -1346,7 +1347,7 @@ func (p *_MasteredPeer) notify(ctx context.Context) (err error) {
stateCode
:=
p
.
state0
.
Code
// XXX vvv right?
return
x
xcontext
.
WithCloseOnErrCancel
(
ctx
,
link
,
func
()
error
{
return
x
context
.
WithCloseOnErrCancel
(
ctx
,
p
.
node
.
Link
()
,
func
()
error
{
for
{
var
δstate
_ΔClusterState
...
...
@@ -1371,7 +1372,7 @@ func (p *_MasteredPeer) notify(ctx context.Context) (err error) {
case
*
_ΔPartTab
:
// don't send δpartTab to S unless cluster is RUNNING
if
p
eer
.
Type
==
proto
.
STORAGE
&&
stateCode
!=
proto
.
ClusterRunning
{
if
p
.
node
.
Type
==
proto
.
STORAGE
&&
stateCode
!=
proto
.
ClusterRunning
{
continue
}
msg
=
&
proto
.
NotifyPartitionChanges
{
...
...
@@ -1392,7 +1393,7 @@ func (p *_MasteredPeer) notify(ctx context.Context) (err error) {
panic
(
"bug"
)
}
err
:=
link
.
Send1
(
msg
)
err
:=
p
.
node
.
Link
()
.
Send1
(
msg
)
if
err
!=
nil
{
return
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment