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
67f98d72
Commit
67f98d72
authored
Aug 21, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
534b777c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+1
-1
go/neo/server/master.go
go/neo/server/master.go
+19
-19
No files found.
go/neo/server/cluster_test.go
View file @
67f98d72
...
...
@@ -334,7 +334,7 @@ func TestMasterStorage(t *testing.T) {
// TODO ^^^ should be sent to S
tc
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
1
,
&
neo
.
StartOperation
{
Backup
:
false
}))
tc
.
Expect
(
conntx
(
"s:2"
,
"m:2"
,
1
,
&
neo
.
NotifyReady
{})
tc
.
Expect
(
conntx
(
"s:2"
,
"m:2"
,
1
,
&
neo
.
NotifyReady
{})
)
// TODO S leave while service
...
...
go/neo/server/master.go
View file @
67f98d72
...
...
@@ -26,6 +26,7 @@ import (
"fmt"
// "math"
"sync"
"time"
"github.com/pkg/errors"
...
...
@@ -759,9 +760,9 @@ func storCtlVerify(ctx context.Context, stor *neo.Node, pt *neo.PartitionTable,
//
// TODO also plan data movement on new storage nodes appearing
//
nodeServiced
is the error returned after service-phase node handling is finished
type
nodeServiced
{
node
*
neoNode
//
serviceDone
is the error returned after service-phase node handling is finished
type
serviceDone
struct
{
node
*
neo
.
Node
err
error
}
...
...
@@ -777,7 +778,7 @@ func (m *Master) service(ctx context.Context) (err error) {
ctx
,
cancel
:=
context
.
WithCancel
(
ctx
)
defer
cancel
()
service
:=
make
(
service
d
:=
make
(
chan
serviceDone
)
wg
:=
&
sync
.
WaitGroup
{}
// spawn per-storage service driver
...
...
@@ -786,7 +787,7 @@ func (m *Master) service(ctx context.Context) (err error) {
wg
.
Add
(
1
)
go
func
()
{
defer
wg
.
Done
()
storCtlService
(
ctx
,
stor
,
service
)
storCtlService
(
ctx
,
stor
,
service
d
)
}()
}
}
...
...
@@ -807,18 +808,18 @@ loop:
go
func
()
{
defer
wg
.
Done
()
err
=
accept
(
n
.
conn
,
resp
)
err
=
m
.
accept
(
ctx
,
n
.
conn
,
resp
)
if
err
!=
nil
{
service
<-
nodeServic
e
{
node
:
node
,
err
:
err
}
service
d
<-
serviceDon
e
{
node
:
node
,
err
:
err
}
return
}
switch
node
.
Type
{
case
neo
.
STORAGE
:
storCtlService
(
ctx
,
node
,
service
)
storCtlService
(
ctx
,
node
,
service
d
)
//case neo.CLIENT:
// serveClient(ctx, node, service)
// serveClient(ctx, node, service
d
)
// XXX ADMIN
}
...
...
@@ -857,16 +858,14 @@ loop:
// storCtlService drives a storage node during cluster service state
// XXX text
func
storCtlService
(
ctx
context
.
Context
,
stor
*
neo
.
Node
,
srv
chan
serviceErr
)
{
/*
var err error
defer func() {
if err == nil {
return
}
func
storCtlService
(
ctx
context
.
Context
,
stor
*
neo
.
Node
,
done
chan
serviceDone
)
{
err
:=
storCtlService1
(
ctx
,
stor
)
done
<-
serviceDone
{
node
:
stor
,
err
:
err
}
}
func
storCtlService1
(
ctx
context
.
Context
,
stor
*
neo
.
Node
)
(
err
error
)
{
defer
runningf
(
&
ctx
,
"%s: stor service"
,
stor
.
Link
.
RemoteAddr
())(
&
err
)
// on error provide feedback to main driver
*/
conn
:=
stor
.
Conn
// XXX send nodeTab ?
...
...
@@ -888,7 +887,8 @@ func storCtlService(ctx context.Context, stor *neo.Node, srv chan serviceErr) {
case
<-
ctx
.
Done
()
:
// XXX also send StopOperation?
break
loop
// XXX close link?
return
ctx
.
Err
()
// XXX ok?
}
}
}
...
...
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