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
88cf426b
Commit
88cf426b
authored
Feb 09, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bfd30ffa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
41 deletions
+20
-41
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+20
-41
No files found.
go/neo/server/cluster_test.go
View file @
88cf426b
...
@@ -47,7 +47,7 @@ import (
...
@@ -47,7 +47,7 @@ import (
"lab.nexedi.com/kirr/go123/exc"
"lab.nexedi.com/kirr/go123/exc"
"lab.nexedi.com/kirr/go123/tracing"
"lab.nexedi.com/kirr/go123/tracing"
//
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/go123/xnet/pipenet"
"lab.nexedi.com/kirr/go123/xnet/pipenet"
...
@@ -222,6 +222,9 @@ func (r *EventRouter) Route(event interface{}) (dst *tsync.SyncChan) {
...
@@ -222,6 +222,9 @@ func (r *EventRouter) Route(event interface{}) (dst *tsync.SyncChan) {
break
// link not branched
break
// link not branched
}
}
// now as we ldst.a corresponds to who was dialer and ldst.b
// corresponds to who was listener, we can route by ConnID.
// (see neo.newNodeLink for details)
if
ev
.
ConnID
%
2
==
1
{
if
ev
.
ConnID
%
2
==
1
{
dst
=
ldst
.
a
dst
=
ldst
.
a
}
else
{
}
else
{
...
@@ -406,33 +409,16 @@ func TestMasterStorage(t *testing.T) {
...
@@ -406,33 +409,16 @@ func TestMasterStorage(t *testing.T) {
return
a
return
a
}
}
// // shortcut for net tx event
// // XXX -> NetTx ?
// nettx := func(src, dst, pkt string) *xnet.TraceTx {
// return &xnet.TraceTx{Src: xaddr(src), Dst: xaddr(dst), Pkt: []byte(pkt)}
// }
// shortcut for net connect event
// shortcut for net connect event
// XXX -> NetConnect ?
//netconnect := func(src, dst, dialed string) *xnet.TraceConnect {
// return &xnet.TraceConnect{Src: xaddr(src), Dst: xaddr(dst), Dialed: dialed}
//}
netconnect
:=
func
(
src
,
dst
,
dialed
string
)
*
eventNetConnect
{
netconnect
:=
func
(
src
,
dst
,
dialed
string
)
*
eventNetConnect
{
return
&
eventNetConnect
{
Src
:
src
,
Dst
:
dst
,
Dialed
:
dialed
}
return
&
eventNetConnect
{
Src
:
src
,
Dst
:
dst
,
Dialed
:
dialed
}
}
}
//netlisten := func(laddr string) *xnet.TraceListen {
// return &xnet.TraceListen{Laddr: xaddr(laddr)}
//}
netlisten
:=
func
(
laddr
string
)
*
eventNetListen
{
netlisten
:=
func
(
laddr
string
)
*
eventNetListen
{
return
&
eventNetListen
{
Laddr
:
laddr
}
return
&
eventNetListen
{
Laddr
:
laddr
}
}
}
// shortcut for net tx event over nodelink connection
// shortcut for net tx event over nodelink connection
//conntx := func(src, dst string, connid uint32, msg neo.Msg) *eventNeoSend {
// return &eventNeoSend{Src: xaddr(src), Dst: xaddr(dst), ConnID: connid, Msg: msg}
//}
conntx
:=
func
(
src
,
dst
string
,
connid
uint32
,
msg
neo
.
Msg
)
*
eventNeoSend
{
conntx
:=
func
(
src
,
dst
string
,
connid
uint32
,
msg
neo
.
Msg
)
*
eventNeoSend
{
return
&
eventNeoSend
{
Src
:
src
,
Dst
:
dst
,
ConnID
:
connid
,
Msg
:
msg
}
return
&
eventNeoSend
{
Src
:
src
,
Dst
:
dst
,
ConnID
:
connid
,
Msg
:
msg
}
}
}
...
@@ -449,13 +435,6 @@ func TestMasterStorage(t *testing.T) {
...
@@ -449,13 +435,6 @@ func TestMasterStorage(t *testing.T) {
}
}
// shortcut for nodetab change
// shortcut for nodetab change
// node := func(x *neo.NodeApp, laddr string, typ neo.NodeType, num int32, state neo.NodeState, idtime neo.IdTime) *eventNodeTab {
// return &eventNodeTab{
// NodeTab: unsafe.Pointer(x.NodeTab),
// NodeInfo: nodei(laddr, typ, num, state, idtime),
// }
// }
node
:=
func
(
where
string
,
laddr
string
,
typ
neo
.
NodeType
,
num
int32
,
state
neo
.
NodeState
,
idtime
neo
.
IdTime
)
*
eventNodeTab
{
node
:=
func
(
where
string
,
laddr
string
,
typ
neo
.
NodeType
,
num
int32
,
state
neo
.
NodeState
,
idtime
neo
.
IdTime
)
*
eventNodeTab
{
return
&
eventNodeTab
{
return
&
eventNodeTab
{
Where
:
where
,
Where
:
where
,
...
@@ -537,7 +516,6 @@ func TestMasterStorage(t *testing.T) {
...
@@ -537,7 +516,6 @@ func TestMasterStorage(t *testing.T) {
IdTime
:
neo
.
IdTimeNone
,
IdTime
:
neo
.
IdTimeNone
,
}))
}))
// XXX try chaning order ^ v
tM
.
Expect
(
node
(
"m"
,
"s:1"
,
neo
.
STORAGE
,
1
,
neo
.
PENDING
,
0.01
))
tM
.
Expect
(
node
(
"m"
,
"s:1"
,
neo
.
STORAGE
,
1
,
neo
.
PENDING
,
0.01
))
tSM
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
1
,
&
neo
.
AcceptIdentification
{
tSM
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
1
,
&
neo
.
AcceptIdentification
{
...
@@ -570,12 +548,7 @@ func TestMasterStorage(t *testing.T) {
...
@@ -570,12 +548,7 @@ func TestMasterStorage(t *testing.T) {
// <<< trace <<<
// <<< trace <<<
_
=
Mcancel
_
=
Scancel
return
}
/*
// M <- start cmd
// M <- start cmd
wg
:=
&
errgroup
.
Group
{}
wg
:=
&
errgroup
.
Group
{}
gox
(
wg
,
func
()
{
gox
(
wg
,
func
()
{
...
@@ -583,31 +556,31 @@ func TestMasterStorage(t *testing.T) {
...
@@ -583,31 +556,31 @@ func TestMasterStorage(t *testing.T) {
exc
.
Raiseif
(
err
)
exc
.
Raiseif
(
err
)
})
})
t
c.Expect(node(M.node
, "s:1", neo.STORAGE, 1, neo.RUNNING, 0.01))
t
M
.
Expect
(
node
(
"m"
,
"s:1"
,
neo
.
STORAGE
,
1
,
neo
.
RUNNING
,
0.01
))
xwait
(
wg
)
xwait
(
wg
)
// XXX M.partTab <- S1
// XXX M.partTab <- S1
// M starts verification
// M starts verification
t
c.Expect(clusterState(&M.node.ClusterState
, neo.ClusterVerifying))
t
M
.
Expect
(
clusterState
(
"m"
,
neo
.
ClusterVerifying
))
t
c
.Expect(conntx("m:2", "s:2", 4, &neo.SendPartitionTable{
t
MS
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
4
,
&
neo
.
SendPartitionTable
{
PTid
:
1
,
PTid
:
1
,
RowList
:
[]
neo
.
RowInfo
{
RowList
:
[]
neo
.
RowInfo
{
{
0
,
[]
neo
.
CellInfo
{{
neo
.
UUID
(
neo
.
STORAGE
,
1
),
neo
.
UP_TO_DATE
}}},
{
0
,
[]
neo
.
CellInfo
{{
neo
.
UUID
(
neo
.
STORAGE
,
1
),
neo
.
UP_TO_DATE
}}},
},
},
}))
}))
t
c
.Expect(conntx("m:2", "s:2", 6, &neo.LockedTransactions{}))
t
MS
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
6
,
&
neo
.
LockedTransactions
{}))
t
c
.Expect(conntx("s:2", "m:2", 6, &neo.AnswerLockedTransactions{
t
MS
.
Expect
(
conntx
(
"s:2"
,
"m:2"
,
6
,
&
neo
.
AnswerLockedTransactions
{
TidDict
:
nil
,
// map[zodb.Tid]zodb.Tid{},
TidDict
:
nil
,
// map[zodb.Tid]zodb.Tid{},
}))
}))
lastOid
,
err1
:=
zstor
.
LastOid
(
bg
)
lastOid
,
err1
:=
zstor
.
LastOid
(
bg
)
lastTid
,
err2
:=
zstor
.
LastTid
(
bg
)
lastTid
,
err2
:=
zstor
.
LastTid
(
bg
)
exc
.
Raiseif
(
xerr
.
Merge
(
err1
,
err2
))
exc
.
Raiseif
(
xerr
.
Merge
(
err1
,
err2
))
t
c
.Expect(conntx("m:2", "s:2", 8, &neo.LastIDs{}))
t
MS
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
8
,
&
neo
.
LastIDs
{}))
t
c
.Expect(conntx("s:2", "m:2", 8, &neo.AnswerLastIDs{
t
MS
.
Expect
(
conntx
(
"s:2"
,
"m:2"
,
8
,
&
neo
.
AnswerLastIDs
{
LastOid
:
lastOid
,
LastOid
:
lastOid
,
LastTid
:
lastTid
,
LastTid
:
lastTid
,
}))
}))
...
@@ -620,13 +593,19 @@ func TestMasterStorage(t *testing.T) {
...
@@ -620,13 +593,19 @@ func TestMasterStorage(t *testing.T) {
// TODO M.Stop() while verify
// TODO M.Stop() while verify
// verification ok; M start service
// verification ok; M start service
t
c.Expect(clusterState(&M.node.ClusterState
, neo.ClusterRunning))
t
M
.
Expect
(
clusterState
(
"m"
,
neo
.
ClusterRunning
))
// TODO ^^^ should be sent to S
// TODO ^^^ should be sent to S
t
c
.Expect(conntx("m:2", "s:2", 10, &neo.StartOperation{Backup: false}))
t
MS
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
10
,
&
neo
.
StartOperation
{
Backup
:
false
}))
t
c
.Expect(conntx("s:2", "m:2", 10, &neo.NotifyReady{}))
t
MS
.
Expect
(
conntx
(
"s:2"
,
"m:2"
,
10
,
&
neo
.
NotifyReady
{}))
_
=
Mcancel
_
=
Scancel
return
}
/*
// TODO S leave while service
// TODO S leave while service
// TODO S join while service
// TODO S join while service
// TODO M.Stop while service
// TODO M.Stop while service
...
...
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