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
6199789e
Commit
6199789e
authored
Feb 13, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
98197abb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
26 deletions
+36
-26
go/neo/cluster_test.go
go/neo/cluster_test.go
+36
-26
No files found.
go/neo/cluster_test.go
View file @
6199789e
...
...
@@ -23,9 +23,9 @@ package neo
//go:generate gotrace gen .
import
(
//
"bytes"
"bytes"
"context"
//
"crypto/sha1"
"crypto/sha1"
//"io"
"net"
//"reflect"
...
...
@@ -34,13 +34,12 @@ import (
"golang.org/x/sync/errgroup"
//
"github.com/kylelemons/godebug/pretty"
"github.com/kylelemons/godebug/pretty"
"lab.nexedi.com/kirr/neo/go/neo/neonet"
"lab.nexedi.com/kirr/neo/go/neo/proto"
//"lab.nexedi.com/kirr/neo/go/neo/internal/common"
//
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/xcommon/xtracing/tsync"
...
...
@@ -491,6 +490,7 @@ func TestMasterStorage(t *testing.T) {
cSM
:=
tsync
.
NewSyncChan
(
"s-m"
)
// trace of events with cause root being s -> m send
cMC
:=
tsync
.
NewSyncChan
(
"m-c"
)
// ----//---- m -> c
cCM
:=
tsync
.
NewSyncChan
(
"c-m"
)
// ----//---- c -> m
cCS
:=
tsync
.
NewSyncChan
(
"c-s"
)
// ----//---- c -> s
tM
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cM
)
tS
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cS
)
...
...
@@ -499,12 +499,14 @@ func TestMasterStorage(t *testing.T) {
tSM
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cSM
)
tMC
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cMC
)
tCM
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cCM
)
// XXX C-S
tCS
:=
tsync
.
NewEventChecker
(
t
,
dispatch
,
cCS
)
rt
.
BranchNode
(
"m"
,
cM
)
rt
.
BranchNode
(
"s"
,
cS
)
rt
.
BranchLink
(
"s-m"
,
cSM
,
cMS
)
rt
.
BranchLink
(
"c-m"
,
cCM
,
cMC
)
rt
.
BranchLink
(
"c-s"
,
cCS
,
rt
.
defaultq
/* S never pushes to C */
)
rt
.
BranchState
(
"s"
,
cMS
)
// state on S is controlled by M
rt
.
BranchState
(
"c"
,
cMC
)
// state on C is controlled by M
...
...
@@ -715,6 +717,8 @@ func TestMasterStorage(t *testing.T) {
tMC
.
Expect
(
node
(
"c"
,
""
,
proto
.
CLIENT
,
1
,
proto
.
RUNNING
,
0.02
))
// ----------------------------------------
// C asks M about last tid XXX better master sends it itself on new client connected
wg
=
&
errgroup
.
Group
{}
gox
(
wg
,
func
()
{
...
...
@@ -731,15 +735,9 @@ func TestMasterStorage(t *testing.T) {
Tid
:
lastTid
,
}))
xwait
(
wg
)
_
=
Mcancel
_
=
Scancel
_
=
Ccancel
return
}
// ----------------------------------------
/*
// C starts loading first object ...
wg
=
&
errgroup
.
Group
{}
xid1
:=
zodb
.
Xid
{
Oid
:
1
,
At
:
zodb
.
TidMax
}
...
...
@@ -755,40 +753,52 @@ func TestMasterStorage(t *testing.T) {
}
})
// trace
// ... -> connects to S
t
c
.Expect(netconnect("c:2", "s:3", "s:1"))
t
c.Expect(conntx("c:2", "s:3", 1, &ne
o.RequestIdentification{
NodeType:
ne
o.CLIENT,
UUID:
neo.UUID(ne
o.CLIENT, 1),
t
CS
.
Expect
(
netconnect
(
"c:2"
,
"s:3"
,
"s:1"
))
t
CS
.
Expect
(
conntx
(
"c:2"
,
"s:3"
,
1
,
&
prot
o
.
RequestIdentification
{
NodeType
:
prot
o
.
CLIENT
,
UUID
:
proto
.
UUID
(
prot
o
.
CLIENT
,
1
),
Address
:
xnaddr
(
""
),
ClusterName
:
"abc1"
,
IdTime
:
0.02
,
}))
t
c.Expect(conntx("s:3", "c:2", 1, &ne
o.AcceptIdentification{
NodeType:
ne
o.STORAGE,
MyUUID:
neo.UUID(ne
o.STORAGE, 1),
t
CS
.
Expect
(
conntx
(
"s:3"
,
"c:2"
,
1
,
&
prot
o
.
AcceptIdentification
{
NodeType
:
prot
o
.
STORAGE
,
MyUUID
:
proto
.
UUID
(
prot
o
.
STORAGE
,
1
),
NumPartitions
:
1
,
NumReplicas
:
1
,
YourUUID:
neo.UUID(ne
o.CLIENT, 1),
YourUUID
:
proto
.
UUID
(
prot
o
.
CLIENT
,
1
),
}))
// ... -> GetObject(xid1)
t
c.Expect(conntx("c:2", "s:3", 3, &ne
o.GetObject{
t
CS
.
Expect
(
conntx
(
"c:2"
,
"s:3"
,
3
,
&
prot
o
.
GetObject
{
Oid
:
xid1
.
Oid
,
Tid:
common.A
t2Before(xid1.At),
Serial:
ne
o.INVALID_TID,
Tid
:
a
t2Before
(
xid1
.
At
),
Serial
:
prot
o
.
INVALID_TID
,
}))
t
c.Expect(conntx("s:3", "c:2", 3, &ne
o.AnswerObject{
t
CS
.
Expect
(
conntx
(
"s:3"
,
"c:2"
,
3
,
&
prot
o
.
AnswerObject
{
Oid
:
xid1
.
Oid
,
Serial
:
serial1
,
NextSerial:
ne
o.INVALID_TID,
NextSerial
:
prot
o
.
INVALID_TID
,
Compression
:
false
,
Data
:
buf1
,
DataSerial
:
0
,
// XXX
Checksum
:
sha1
.
Sum
(
buf1
.
Data
),
}))
xwait
(
wg
)
_
=
Mcancel
_
=
Scancel
_
=
Ccancel
return
}
/*
xwait(wg)
// verify NextSerial is properly returned in AnswerObject via trace-loading prev. revision of obj1
...
...
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