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
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
Stefane Fermigier
neo
Commits
a2ce1f4e
Commit
a2ce1f4e
authored
Feb 09, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
88cf426b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
25 deletions
+43
-25
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+43
-25
No files found.
go/neo/server/cluster_test.go
View file @
a2ce1f4e
...
@@ -31,14 +31,14 @@ import (
...
@@ -31,14 +31,14 @@ import (
//"reflect"
//"reflect"
"sync"
"sync"
"testing"
"testing"
//
"unsafe"
"unsafe"
"golang.org/x/sync/errgroup"
"golang.org/x/sync/errgroup"
//"github.com/kylelemons/godebug/pretty"
//"github.com/kylelemons/godebug/pretty"
"lab.nexedi.com/kirr/neo/go/neo"
"lab.nexedi.com/kirr/neo/go/neo"
//
"lab.nexedi.com/kirr/neo/go/neo/client"
"lab.nexedi.com/kirr/neo/go/neo/client"
//"lab.nexedi.com/kirr/neo/go/neo/internal/common"
//"lab.nexedi.com/kirr/neo/go/neo/internal/common"
//"lab.nexedi.com/kirr/neo/go/zodb"
//"lab.nexedi.com/kirr/neo/go/zodb"
...
@@ -447,17 +447,24 @@ func TestMasterStorage(t *testing.T) {
...
@@ -447,17 +447,24 @@ func TestMasterStorage(t *testing.T) {
Mhost
:=
xnet
.
NetTrace
(
net
.
Host
(
"m"
),
tracer
)
Mhost
:=
xnet
.
NetTrace
(
net
.
Host
(
"m"
),
tracer
)
Shost
:=
xnet
.
NetTrace
(
net
.
Host
(
"s"
),
tracer
)
Shost
:=
xnet
.
NetTrace
(
net
.
Host
(
"s"
),
tracer
)
//
Chost := xnet.NetTrace(net.Host("c"), tracer)
Chost
:=
xnet
.
NetTrace
(
net
.
Host
(
"c"
),
tracer
)
cM
:=
tsync
.
NewSyncChan
(
"m.main"
)
// trace of events local to M
cM
:=
tsync
.
NewSyncChan
(
"m.main"
)
// trace of events local to M
cS
:=
tsync
.
NewSyncChan
(
"s.main"
)
// trace of events local to S XXX with cause root also on S
cS
:=
tsync
.
NewSyncChan
(
"s.main"
)
// trace of events local to S XXX with cause root also on S
// cC := tsync.NewSyncChan("c.main")
cMS
:=
tsync
.
NewSyncChan
(
"m-s"
)
// trace of events with cause root being m -> s send
cMS
:=
tsync
.
NewSyncChan
(
"m-s"
)
// trace of events with cause root being m -> s send
cSM
:=
tsync
.
NewSyncChan
(
"s-m"
)
// trace of events with cause root being s -> m send
cSM
:=
tsync
.
NewSyncChan
(
"s-m"
)
// trace of events with cause root being s -> m send
cMC
:=
tsync
.
NewSyncChan
(
"m-c"
)
cCM
:=
tsync
.
NewSyncChan
(
"c-m"
)
tM
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cM
)
tM
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cM
)
tS
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cS
)
tS
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cS
)
// tC := tsync.NewEventChecker(t, dispatch, cC)
tMS
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cMS
)
tMS
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cMS
)
tSM
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cSM
)
tSM
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cSM
)
tMC
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cMC
)
tCM
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cCM
)
// XXX C-S
rt
.
BranchNode
(
"m"
,
cM
)
rt
.
BranchNode
(
"m"
,
cM
)
rt
.
BranchNode
(
"s"
,
cS
)
rt
.
BranchNode
(
"s"
,
cS
)
...
@@ -476,6 +483,8 @@ func TestMasterStorage(t *testing.T) {
...
@@ -476,6 +483,8 @@ func TestMasterStorage(t *testing.T) {
gwg
:=
&
errgroup
.
Group
{}
gwg
:=
&
errgroup
.
Group
{}
// ----------------------------------------
// start master
// start master
Mclock
:=
&
vclock
{}
Mclock
:=
&
vclock
{}
M
.
monotime
=
Mclock
.
monotime
M
.
monotime
=
Mclock
.
monotime
...
@@ -494,7 +503,7 @@ func TestMasterStorage(t *testing.T) {
...
@@ -494,7 +503,7 @@ func TestMasterStorage(t *testing.T) {
exc
.
Raiseif
(
err
)
exc
.
Raiseif
(
err
)
})
})
//
>>> trace >>>
//
trace
// M starts listening
// M starts listening
tM
.
Expect
(
netlisten
(
"m:1"
))
tM
.
Expect
(
netlisten
(
"m:1"
))
...
@@ -546,8 +555,8 @@ func TestMasterStorage(t *testing.T) {
...
@@ -546,8 +555,8 @@ func TestMasterStorage(t *testing.T) {
// M ready to start: new cluster, no in-progress S recovery
// M ready to start: new cluster, no in-progress S recovery
tM
.
Expect
(
masterStartReady
(
"m"
,
true
))
tM
.
Expect
(
masterStartReady
(
"m"
,
true
))
// <<< trace <<<
// ----------------------------------------
// M <- start cmd
// M <- start cmd
wg
:=
&
errgroup
.
Group
{}
wg
:=
&
errgroup
.
Group
{}
...
@@ -556,6 +565,8 @@ func TestMasterStorage(t *testing.T) {
...
@@ -556,6 +565,8 @@ func TestMasterStorage(t *testing.T) {
exc
.
Raiseif
(
err
)
exc
.
Raiseif
(
err
)
})
})
// trace
tM
.
Expect
(
node
(
"m"
,
"s:1"
,
neo
.
STORAGE
,
1
,
neo
.
RUNNING
,
0.01
))
tM
.
Expect
(
node
(
"m"
,
"s:1"
,
neo
.
STORAGE
,
1
,
neo
.
RUNNING
,
0.01
))
xwait
(
wg
)
xwait
(
wg
)
...
@@ -599,23 +610,25 @@ func TestMasterStorage(t *testing.T) {
...
@@ -599,23 +610,25 @@ func TestMasterStorage(t *testing.T) {
tMS
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
10
,
&
neo
.
StartOperation
{
Backup
:
false
}))
tMS
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
10
,
&
neo
.
StartOperation
{
Backup
:
false
}))
tMS
.
Expect
(
conntx
(
"s:2"
,
"m:2"
,
10
,
&
neo
.
NotifyReady
{}))
tMS
.
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
// ----------------------------------------
// XXX try creating clint from the beginning
// create client
// create client
C
:=
client
.
NewClient
(
"abc1"
,
"m:1"
,
Chost
)
C
:=
client
.
NewClient
(
"abc1"
,
"m:1"
,
Chost
)
Cnode
:=
*
(
**
neo
.
NodeApp
)(
unsafe
.
Pointer
(
C
))
// XXX hack, fragile
tracer
.
RegisterNode
(
Cnode
,
"c"
)
// trace
// C connects M
// C connects M
t
c
.Expect(netconnect("c:1", "m:3", "m:1"))
t
CM
.
Expect
(
netconnect
(
"c:1"
,
"m:3"
,
"m:1"
))
t
c
.Expect(conntx("c:1", "m:3", 1, &neo.RequestIdentification{
t
CM
.
Expect
(
conntx
(
"c:1"
,
"m:3"
,
1
,
&
neo
.
RequestIdentification
{
NodeType
:
neo
.
CLIENT
,
NodeType
:
neo
.
CLIENT
,
UUID
:
0
,
UUID
:
0
,
Address
:
xnaddr
(
""
),
Address
:
xnaddr
(
""
),
...
@@ -623,9 +636,9 @@ func TestMasterStorage(t *testing.T) {
...
@@ -623,9 +636,9 @@ func TestMasterStorage(t *testing.T) {
IdTime
:
neo
.
IdTimeNone
,
IdTime
:
neo
.
IdTimeNone
,
}))
}))
t
c.Expect(node(M.node
, "", neo.CLIENT, 1, neo.RUNNING, 0.02))
t
M
.
Expect
(
node
(
"m"
,
""
,
neo
.
CLIENT
,
1
,
neo
.
RUNNING
,
0.02
))
t
c
.Expect(conntx("m:3", "c:1", 1, &neo.AcceptIdentification{
t
CM
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
1
,
&
neo
.
AcceptIdentification
{
NodeType
:
neo
.
MASTER
,
NodeType
:
neo
.
MASTER
,
MyUUID
:
neo
.
UUID
(
neo
.
MASTER
,
1
),
MyUUID
:
neo
.
UUID
(
neo
.
MASTER
,
1
),
NumPartitions
:
1
,
NumPartitions
:
1
,
...
@@ -635,8 +648,8 @@ func TestMasterStorage(t *testing.T) {
...
@@ -635,8 +648,8 @@ func TestMasterStorage(t *testing.T) {
// C asks M about PT
// C asks M about PT
// FIXME this might come in parallel with vvv "C <- M NotifyNodeInformation C1,M1,S1"
// FIXME this might come in parallel with vvv "C <- M NotifyNodeInformation C1,M1,S1"
t
c
.Expect(conntx("c:1", "m:3", 3, &neo.AskPartitionTable{}))
t
CM
.
Expect
(
conntx
(
"c:1"
,
"m:3"
,
3
,
&
neo
.
AskPartitionTable
{}))
t
c
.Expect(conntx("m:3", "c:1", 3, &neo.AnswerPartitionTable{
t
CM
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
3
,
&
neo
.
AnswerPartitionTable
{
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
}}},
...
@@ -645,7 +658,7 @@ func TestMasterStorage(t *testing.T) {
...
@@ -645,7 +658,7 @@ func TestMasterStorage(t *testing.T) {
// C <- M NotifyNodeInformation C1,M1,S1
// C <- M NotifyNodeInformation C1,M1,S1
// FIXME this might come in parallel with ^^^ "C asks M about PT"
// FIXME this might come in parallel with ^^^ "C asks M about PT"
t
c
.Expect(conntx("m:3", "c:1", 0, &neo.NotifyNodeInformation{
t
MC
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
0
,
&
neo
.
NotifyNodeInformation
{
IdTime
:
neo
.
IdTimeNone
,
// XXX ?
IdTime
:
neo
.
IdTimeNone
,
// XXX ?
NodeList
:
[]
neo
.
NodeInfo
{
NodeList
:
[]
neo
.
NodeInfo
{
nodei
(
"m:1"
,
neo
.
MASTER
,
1
,
neo
.
RUNNING
,
neo
.
IdTimeNone
),
nodei
(
"m:1"
,
neo
.
MASTER
,
1
,
neo
.
RUNNING
,
neo
.
IdTimeNone
),
...
@@ -654,10 +667,9 @@ func TestMasterStorage(t *testing.T) {
...
@@ -654,10 +667,9 @@ func TestMasterStorage(t *testing.T) {
},
},
}))
}))
Cnode := *(**neo.NodeApp)(unsafe.Pointer(C)) // XXX hack, fragile
tMC
.
Expect
(
node
(
"c"
,
"m:1"
,
neo
.
MASTER
,
1
,
neo
.
RUNNING
,
neo
.
IdTimeNone
))
tc.Expect(node(Cnode, "m:1", neo.MASTER, 1, neo.RUNNING, neo.IdTimeNone))
tMC
.
Expect
(
node
(
"c"
,
"s:1"
,
neo
.
STORAGE
,
1
,
neo
.
RUNNING
,
0.01
))
tc.Expect(node(Cnode, "s:1", neo.STORAGE, 1, neo.RUNNING, 0.01))
tMC
.
Expect
(
node
(
"c"
,
""
,
neo
.
CLIENT
,
1
,
neo
.
RUNNING
,
0.02
))
tc.Expect(node(Cnode, "", neo.CLIENT, 1, neo.RUNNING, 0.02))
// C asks M about last tid XXX better master sends it itself on new client connected
// C asks M about last tid XXX better master sends it itself on new client connected
...
@@ -671,13 +683,19 @@ func TestMasterStorage(t *testing.T) {
...
@@ -671,13 +683,19 @@ func TestMasterStorage(t *testing.T) {
}
}
})
})
t
c
.Expect(conntx("c:1", "m:3", 5, &neo.LastTransaction{}))
t
CM
.
Expect
(
conntx
(
"c:1"
,
"m:3"
,
5
,
&
neo
.
LastTransaction
{}))
t
c
.Expect(conntx("m:3", "c:1", 5, &neo.AnswerLastTransaction{
t
CM
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
5
,
&
neo
.
AnswerLastTransaction
{
Tid
:
lastTid
,
Tid
:
lastTid
,
}))
}))
xwait
(
wg
)
xwait
(
wg
)
_
=
Mcancel
_
=
Scancel
return
}
/*
// C starts loading first object ...
// C starts loading first object ...
wg = &errgroup.Group{}
wg = &errgroup.Group{}
xid1 := zodb.Xid{Oid: 1, At: zodb.TidMax}
xid1 := zodb.Xid{Oid: 1, At: zodb.TidMax}
...
...
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