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
efb911ab
Commit
efb911ab
authored
Feb 12, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
fc9a51ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
36 deletions
+31
-36
go/neo/master.go
go/neo/master.go
+31
-36
No files found.
go/neo/master.go
View file @
efb911ab
...
...
@@ -388,9 +388,8 @@ func (m *Master) recovery(ctx context.Context) (err error) {
wg
:=
&
sync
.
WaitGroup
{}
//trace:event traceMasterStartReady(m *Master, ready bool)
readyToStart
:=
false
readyToStart
:=
false
// whether cluster currently can be operational or not
updateReadyToStart
:=
func
()
{
// update indicator whether cluster currently can be operational or not
var
ready
bool
if
m
.
node
.
State
.
PartTab
.
PTid
==
0
{
// new cluster - allow startup if we have some storages passed
...
...
@@ -416,16 +415,35 @@ func (m *Master) recovery(ctx context.Context) (err error) {
// XXX set cluster state = RECOVERY
// XXX down clients
// goStorCtlRecovery spawns recovery task on a storage.
goStorCtlRecovery
:=
func
(
stor
*
_MasteredPeer
)
{
inprogress
++
// XXX wg.Add(1) + defer wg.Done() ?
stor
.
wg
.
Go
(
func
(
peerCtx
context
.
Context
)
error
{
ctx
,
cancel
:=
xxcontext
.
Merge
/*Cancel*/
(
ctx
,
peerCtx
)
defer
cancel
()
var
pt
*
xneo
.
PartitionTable
err
:=
stor
.
run
(
ctx
,
func
(
...
)
{
pt
,
err
=
storCtlRecovery
(
...
)
})
ack
:=
make
(
chan
struct
{})
recoveryq
<-
storRecovery
{
stor
:
stor
,
partTab
:
pt
,
err
:
err
,
ack
:
ack
}
<-
ack
// canceled recovery does not mean we should down the storage node
if
xcontext
.
Canceled
(
err
)
{
err
=
nil
}
return
err
})
}
// start recovery on all storages we are currently in touch with
for
_
,
stor
:=
range
m
.
node
.
State
.
NodeTab
.
StorageList
()
{
if
stor
.
State
>
proto
.
DOWN
{
// XXX state cmp ok ? XXX or stor.Link != nil ?
inprogress
++
wg
.
Add
(
1
)
go
func
()
{
defer
wg
.
Done
()
storCtlRecovery
(
ctx
,
stor
,
recoveryq
)
// XXX acj
}()
for
_
,
peer
:=
range
m
.
peerTab
{
if
peer
.
node
.
Type
==
proto
.
STORAGE
{
goStorCtlRecovery
(
peer
)
}
}
...
...
@@ -486,31 +504,10 @@ loop:
}
// S -> start recovery
if
peer
.
node
.
Type
!
=
proto
.
STORAGE
{
break
if
peer
.
node
.
Type
=
=
proto
.
STORAGE
{
goStorCtlRecovery
(
peer
)
}
// XXX wg.Add(1) + defer wg.Done() ?
peer
.
wg
.
Go
(
func
(
peerCtx
context
.
Context
)
error
{
ctx
,
cancel
:=
xxcontext
.
Merge
/*Cancel*/
(
ctx
,
peerCtx
)
defer
cancel
()
var
pt
*
xneo
.
PartitionTable
err
:=
peer
.
run
(
ctx
,
func
(
...
)
{
pt
,
err
=
storCtlRecovery
(
...
)
})
ack
:=
make
(
chan
struct
{})
recoveryq
<-
storRecovery
{
stor
:
peer
,
partTab
:
pt
,
err
:
err
,
ack
:
ack
}
<-
ack
// canceled recovery does not mean we should down the peer
if
xcontext
.
Canceled
(
err
)
{
err
=
nil
}
return
err
})
// a storage node came through recovery - let's see whether
// ptid ↑ and if so we should take partition table from there
case
r
:=
<-
recoveryq
:
...
...
@@ -530,8 +527,6 @@ loop:
}
updateReadyToStart
()
}
}
...
...
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