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
d8ae847c
Commit
d8ae847c
authored
Aug 09, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3024e434
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
3 deletions
+57
-3
go/neo/server/master.go
go/neo/server/master.go
+9
-3
go/xcommon/xcontext/xcontext.go
go/xcommon/xcontext/xcontext.go
+48
-0
No files found.
go/neo/server/master.go
View file @
d8ae847c
...
...
@@ -262,6 +262,12 @@ func (m *Master) recovery(ctx context.Context) (err error) {
//defer xerr.Context(&err, "master: recovery")
defer
m
.
errctx
(
&
err
,
"recovery"
)
my
.
Context
(
&
ctx
,
"recovery"
)
defer
xerr
.
Context
(
&
err
,
ctx
)
xcontext
.
Running
(
&
ctx
,
"recovery"
)
defer
xerr
.
Context
(
&
err
,
ctx
)
m
.
setClusterState
(
neo
.
ClusterRecovering
)
rctx
,
rcancel
:=
context
.
WithCancel
(
ctx
)
defer
rcancel
()
...
...
@@ -323,15 +329,15 @@ loop:
// ptid ↑ and if so we should take partition table from there
case
r
:=
<-
recovery
:
if
r
.
err
!=
nil
{
m
.
logf
(
"%v"
,
r
.
err
)
logf
(
ctx
,
"%v"
,
r
.
err
)
if
!
xcontext
.
Canceled
(
errors
.
Cause
(
r
.
err
))
{
m
.
logf
(
"%v: closing link"
,
r
.
node
.
Link
)
logf
(
ctx
,
"%v: closing link"
,
r
.
node
.
Link
)
// close stor link / update .nodeTab
err
:=
r
.
node
.
Link
.
Close
()
if
err
!=
nil
{
m
.
logf
(
"master: %v
\n
"
,
r
.
node
.
Link
)
logf
(
ctx
,
"master: %v"
,
err
)
}
m
.
nodeTab
.
SetNodeState
(
r
.
node
,
DOWN
)
...
...
go/xcommon/xcontext/xcontext.go
View file @
d8ae847c
...
...
@@ -135,3 +135,51 @@ func Canceled(err error) bool {
return
false
}
// ---- operational stack ----
// Operation provides text representing currently running operation
type
Operation
struct
{
Parent
*
operation
Name
string
}
// String returns string representing whole operational stack
func
(
o
*
Operation
)
String
()
string
{
if
o
==
nil
{
return
""
}
prefix
:=
Parent
.
String
()
if
prefix
!=
""
{
prefix
+=
": "
}
return
prefix
+
o
.
Name
}
type
opKey
struct
{}
func
PushOp
(
ctxp
*
context
.
Context
,
name
string
)
{
*
ctxp
=
context
.
WithValue
(
&
Operation
{
Parent
:
CurrentOp
(
*
ctxp
),
Name
:
name
})
}
// CurrentOp returns current operation represented by context.
// if there is no current operation - it returns nil.
func
CurrentOp
(
ctx
Context
)
*
Operation
{
op
:=
ctx
.
Value
(
opKey
)
if
op
==
nil
{
return
nil
}
return
op
.
(
*
Operation
)
}
// XXX place
func
Logf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
s
:=
CurrentOp
(
ctx
)
.
String
()
if
s
!=
""
{
s
+=
": "
}
s
+=
fmt
.
Sprintf
(
format
,
argv
...
)
log
.
Log
(
s
)
}
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