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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
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
Hide 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 (
//"reflect"
"sync"
"testing"
//
"unsafe"
"unsafe"
"golang.org/x/sync/errgroup"
//"github.com/kylelemons/godebug/pretty"
"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/zodb"
...
...
@@ -447,17 +447,24 @@ func TestMasterStorage(t *testing.T) {
Mhost
:=
xnet
.
NetTrace
(
net
.
Host
(
"m"
),
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
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
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
)
tS
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cS
)
// tC := tsync.NewEventChecker(t, dispatch, cC)
tMS
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cMS
)
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
(
"s"
,
cS
)
...
...
@@ -476,6 +483,8 @@ func TestMasterStorage(t *testing.T) {
gwg
:=
&
errgroup
.
Group
{}
// ----------------------------------------
// start master
Mclock
:=
&
vclock
{}
M
.
monotime
=
Mclock
.
monotime
...
...
@@ -494,7 +503,7 @@ func TestMasterStorage(t *testing.T) {
exc
.
Raiseif
(
err
)
})
//
>>> trace >>>
//
trace
// M starts listening
tM
.
Expect
(
netlisten
(
"m:1"
))
...
...
@@ -546,8 +555,8 @@ func TestMasterStorage(t *testing.T) {
// M ready to start: new cluster, no in-progress S recovery
tM
.
Expect
(
masterStartReady
(
"m"
,
true
))
// <<< trace <<<
// ----------------------------------------
// M <- start cmd
wg
:=
&
errgroup
.
Group
{}
...
...
@@ -556,6 +565,8 @@ func TestMasterStorage(t *testing.T) {
exc
.
Raiseif
(
err
)
})
// trace
tM
.
Expect
(
node
(
"m"
,
"s:1"
,
neo
.
STORAGE
,
1
,
neo
.
RUNNING
,
0.01
))
xwait
(
wg
)
...
...
@@ -599,23 +610,25 @@ func TestMasterStorage(t *testing.T) {
tMS
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
10
,
&
neo
.
StartOperation
{
Backup
:
false
}))
tMS
.
Expect
(
conntx
(
"s:2"
,
"m:2"
,
10
,
&
neo
.
NotifyReady
{}))
_
=
Mcancel
_
=
Scancel
return
}
/*
// TODO S leave while service
// TODO S join while service
// TODO M.Stop while service
// ----------------------------------------
// XXX try creating clint from the beginning
// create client
C
:=
client
.
NewClient
(
"abc1"
,
"m:1"
,
Chost
)
Cnode
:=
*
(
**
neo
.
NodeApp
)(
unsafe
.
Pointer
(
C
))
// XXX hack, fragile
tracer
.
RegisterNode
(
Cnode
,
"c"
)
// trace
// C connects M
t
c
.Expect(netconnect("c:1", "m:3", "m:1"))
t
c
.Expect(conntx("c:1", "m:3", 1, &neo.RequestIdentification{
t
CM
.
Expect
(
netconnect
(
"c:1"
,
"m:3"
,
"m:1"
))
t
CM
.
Expect
(
conntx
(
"c:1"
,
"m:3"
,
1
,
&
neo
.
RequestIdentification
{
NodeType
:
neo
.
CLIENT
,
UUID
:
0
,
Address
:
xnaddr
(
""
),
...
...
@@ -623,9 +636,9 @@ func TestMasterStorage(t *testing.T) {
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
,
MyUUID
:
neo
.
UUID
(
neo
.
MASTER
,
1
),
NumPartitions
:
1
,
...
...
@@ -635,8 +648,8 @@ func TestMasterStorage(t *testing.T) {
// C asks M about PT
// 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
c
.Expect(conntx("m:3", "c:1", 3, &neo.AnswerPartitionTable{
t
CM
.
Expect
(
conntx
(
"c:1"
,
"m:3"
,
3
,
&
neo
.
AskPartitionTable
{}))
t
CM
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
3
,
&
neo
.
AnswerPartitionTable
{
PTid
:
1
,
RowList
:
[]
neo
.
RowInfo
{
{
0
,
[]
neo
.
CellInfo
{{
neo
.
UUID
(
neo
.
STORAGE
,
1
),
neo
.
UP_TO_DATE
}}},
...
...
@@ -645,7 +658,7 @@ func TestMasterStorage(t *testing.T) {
// C <- M NotifyNodeInformation C1,M1,S1
// 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 ?
NodeList
:
[]
neo
.
NodeInfo
{
nodei
(
"m:1"
,
neo
.
MASTER
,
1
,
neo
.
RUNNING
,
neo
.
IdTimeNone
),
...
...
@@ -654,10 +667,9 @@ func TestMasterStorage(t *testing.T) {
},
}))
Cnode := *(**neo.NodeApp)(unsafe.Pointer(C)) // XXX hack, fragile
tc.Expect(node(Cnode, "m:1", neo.MASTER, 1, neo.RUNNING, neo.IdTimeNone))
tc.Expect(node(Cnode, "s:1", neo.STORAGE, 1, neo.RUNNING, 0.01))
tc.Expect(node(Cnode, "", neo.CLIENT, 1, neo.RUNNING, 0.02))
tMC
.
Expect
(
node
(
"c"
,
"m:1"
,
neo
.
MASTER
,
1
,
neo
.
RUNNING
,
neo
.
IdTimeNone
))
tMC
.
Expect
(
node
(
"c"
,
"s:1"
,
neo
.
STORAGE
,
1
,
neo
.
RUNNING
,
0.01
))
tMC
.
Expect
(
node
(
"c"
,
""
,
neo
.
CLIENT
,
1
,
neo
.
RUNNING
,
0.02
))
// 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) {
}
})
t
c
.Expect(conntx("c:1", "m:3", 5, &neo.LastTransaction{}))
t
c
.Expect(conntx("m:3", "c:1", 5, &neo.AnswerLastTransaction{
t
CM
.
Expect
(
conntx
(
"c:1"
,
"m:3"
,
5
,
&
neo
.
LastTransaction
{}))
t
CM
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
5
,
&
neo
.
AnswerLastTransaction
{
Tid
:
lastTid
,
}))
xwait
(
wg
)
_
=
Mcancel
_
=
Scancel
return
}
/*
// C starts loading first object ...
wg = &errgroup.Group{}
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