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