Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
1b4ec3ff
Commit
1b4ec3ff
authored
Aug 10, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9f4acd8d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
15 deletions
+23
-15
go/neo/server/master.go
go/neo/server/master.go
+11
-14
go/neo/server/storage.go
go/neo/server/storage.go
+1
-1
go/neo/server/util.go
go/neo/server/util.go
+11
-0
No files found.
go/neo/server/master.go
View file @
1b4ec3ff
...
@@ -153,7 +153,7 @@ func (m *Master) Run(ctx context.Context) (err error) {
...
@@ -153,7 +153,7 @@ func (m *Master) Run(ctx context.Context) (err error) {
return
err
// XXX err ctx
return
err
// XXX err ctx
}
}
defer
running
(
&
ctx
,
"master(%v)"
,
l
.
Addr
())(
&
err
)
defer
running
f
(
&
ctx
,
"master(%v)"
,
l
.
Addr
())(
&
err
)
log
.
Info
(
ctx
,
"serving ..."
)
log
.
Info
(
ctx
,
"serving ..."
)
m
.
node
.
MasterAddr
=
l
.
Addr
()
.
String
()
m
.
node
.
MasterAddr
=
l
.
Addr
()
.
String
()
...
@@ -179,7 +179,7 @@ func (m *Master) Run(ctx context.Context) (err error) {
...
@@ -179,7 +179,7 @@ func (m *Master) Run(ctx context.Context) (err error) {
case
<-
serveCtx
.
Done
()
:
case
<-
serveCtx
.
Done
()
:
// shutdown
// shutdown
conn
.
Link
()
.
Close
()
// XXX log err ?
lclose
(
serveCtx
,
conn
.
Link
())
return
return
}
}
}
}
...
@@ -189,7 +189,7 @@ func (m *Master) Run(ctx context.Context) (err error) {
...
@@ -189,7 +189,7 @@ func (m *Master) Run(ctx context.Context) (err error) {
err
=
m
.
runMain
(
ctx
)
err
=
m
.
runMain
(
ctx
)
serveCancel
()
serveCancel
()
l
.
Close
()
// XXX log err ?
l
close
(
ctx
,
l
)
wg
.
Wait
()
wg
.
Wait
()
return
err
return
err
...
@@ -299,10 +299,10 @@ loop:
...
@@ -299,10 +299,10 @@ loop:
return
return
}
}
err
:=
m
.
accept
(
n
.
conn
,
resp
)
err
:=
m
.
accept
(
ctx
,
n
.
conn
,
resp
)
if
err
!=
nil
{
if
err
!=
nil
{
// XXX move this m.nodeLeave <- to accept() ?
// XXX move this m.nodeLeave <- to accept() ?
recovery
<-
storRecovery
{
node
:
node
,
err
:
err
}
recovery
<-
storRecovery
{
stor
:
node
,
err
:
err
}
return
return
}
}
...
@@ -327,15 +327,12 @@ loop:
...
@@ -327,15 +327,12 @@ loop:
log
.
Error
(
ctx
,
r
.
err
)
log
.
Error
(
ctx
,
r
.
err
)
if
!
xcontext
.
Canceled
(
errors
.
Cause
(
r
.
err
))
{
if
!
xcontext
.
Canceled
(
errors
.
Cause
(
r
.
err
))
{
log
.
Infof
(
ctx
,
"%v: closing link"
,
r
.
node
.
Link
)
log
.
Infof
(
ctx
,
"%v: closing link"
,
r
.
stor
.
Link
)
// close stor link / update .nodeTab
// close stor link / update .nodeTab
err
:=
r
.
node
.
Link
.
Close
()
lclose
(
ctx
,
r
.
stor
.
Link
)
if
err
!=
nil
{
log
.
Error
(
ctx
,
err
)
}
m
.
nodeTab
.
SetNodeState
(
r
.
node
,
neo
.
DOWN
)
m
.
nodeTab
.
SetNodeState
(
r
.
stor
,
neo
.
DOWN
)
}
}
}
else
{
}
else
{
...
@@ -418,7 +415,7 @@ func storCtlRecovery(ctx context.Context, stor *neo.Node, res chan storRecovery)
...
@@ -418,7 +415,7 @@ func storCtlRecovery(ctx context.Context, stor *neo.Node, res chan storRecovery)
}
}
// on error provide feedback to storRecovery chan
// on error provide feedback to storRecovery chan
res
<-
storRecovery
{
node
:
stor
,
err
:
err
}
res
<-
storRecovery
{
stor
:
stor
,
err
:
err
}
}()
}()
defer
runningf
(
&
ctx
,
"%s: stor recovery"
,
stor
.
Link
)(
&
err
)
defer
runningf
(
&
ctx
,
"%s: stor recovery"
,
stor
.
Link
)(
&
err
)
...
@@ -463,7 +460,7 @@ func storCtlRecovery(ctx context.Context, stor *neo.Node, res chan storRecovery)
...
@@ -463,7 +460,7 @@ func storCtlRecovery(ctx context.Context, stor *neo.Node, res chan storRecovery)
}
}
}
}
res
<-
storRecovery
{
node
:
stor
,
partTab
:
pt
}
res
<-
storRecovery
{
stor
:
stor
,
partTab
:
pt
}
}
}
...
@@ -923,7 +920,7 @@ func (m *Master) reject(ctx context.Context, conn *neo.Conn, resp neo.Msg) {
...
@@ -923,7 +920,7 @@ func (m *Master) reject(ctx context.Context, conn *neo.Conn, resp neo.Msg) {
// accept sends acceptive identification response and closes conn
// accept sends acceptive identification response and closes conn
// XXX if problem -> .nodeLeave
// XXX if problem -> .nodeLeave
// XXX spawn ping goroutine from here?
// XXX spawn ping goroutine from here?
func
(
m
*
Master
)
accept
(
conn
*
neo
.
Conn
,
resp
neo
.
Msg
)
error
{
func
(
m
*
Master
)
accept
(
c
tx
context
.
Context
,
c
onn
*
neo
.
Conn
,
resp
neo
.
Msg
)
error
{
// XXX cancel on ctx
// XXX cancel on ctx
err1
:=
conn
.
Send
(
resp
)
err1
:=
conn
.
Send
(
resp
)
err2
:=
conn
.
Close
()
err2
:=
conn
.
Close
()
...
...
go/neo/server/storage.go
View file @
1b4ec3ff
...
@@ -118,7 +118,7 @@ func (stor *Storage) Run(ctx context.Context) error {
...
@@ -118,7 +118,7 @@ func (stor *Storage) Run(ctx context.Context) error {
case
<-
serveCtx
.
Done
()
:
case
<-
serveCtx
.
Done
()
:
// shutdown
// shutdown
conn
.
Link
()
.
Close
()
// XXX log err ?
lclose
(
serveCtx
,
conn
.
Link
())
return
return
}
}
}
}
...
...
go/neo/server/util.go
View file @
1b4ec3ff
...
@@ -23,6 +23,7 @@ package server
...
@@ -23,6 +23,7 @@ package server
import
(
import
(
"context"
"context"
"fmt"
"fmt"
"io"
"lab.nexedi.com/kirr/neo/go/xcommon/task"
"lab.nexedi.com/kirr/neo/go/xcommon/task"
"lab.nexedi.com/kirr/neo/go/xcommon/log"
"lab.nexedi.com/kirr/neo/go/xcommon/log"
...
@@ -67,3 +68,13 @@ func _running(ctxp *context.Context, name string) func(*error) {
...
@@ -67,3 +68,13 @@ func _running(ctxp *context.Context, name string) func(*error) {
task
.
ErrContext
(
errp
,
ctx
)
task
.
ErrContext
(
errp
,
ctx
)
}
}
}
}
// lclose closes c and logs closing error if there was any.
// the error is otherwise ignored
func
lclose
(
ctx
context
.
Context
,
c
io
.
Closer
)
{
err
:=
c
.
Close
()
if
err
!=
nil
{
log
.
Error
(
ctx
,
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