Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
2a1df513
Commit
2a1df513
authored
Jun 17, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1926b828
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
23 deletions
+26
-23
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+26
-23
No files found.
wcfs/δbtail_test.go
View file @
2a1df513
...
@@ -496,11 +496,26 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
...
@@ -496,11 +496,26 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
X
:=
exc
.
Raiseif
X
:=
exc
.
Raiseif
assert
:=
require
.
New
(
t
)
assert
:=
require
.
New
(
t
)
tracked
:=
initialTrackedKeys
.
Elements
()
var
kadjTracked
SetKey
=
nil
sort
.
Slice
(
tracked
,
func
(
i
,
j
int
)
bool
{
var
δT
map
[
Key
]
string
=
nil
return
tracked
[
i
]
<
tracked
[
j
]
})
var
badv
[]
string
//fmt.Println("verify1", tracked)
badf
:=
func
(
format
string
,
argv
...
interface
{})
{
badv
=
append
(
badv
,
fmt
.
Sprintf
(
format
,
argv
...
))
}
defer
func
()
{
if
badv
!=
nil
{
emsg
:=
fmt
.
Sprintf
(
"%s ; tracked=%v :
\n\n
"
,
subj
,
initialTrackedKeys
)
emsg
+=
fmt
.
Sprintf
(
"d12: %v
\n
δT: %v
\n\n
"
,
d12
,
δT
)
emsg
+=
fmt
.
Sprintf
(
"kadj[Tracked]: %v
\n
kadj: %v
\n\n
"
,
kadjTracked
,
kadj
)
emsg
+=
strings
.
Join
(
badv
,
"
\n
"
)
emsg
+=
"
\n
"
t
.
Error
(
emsg
)
//t.Fatal(emsg)
}
}()
txn
,
ctx
:=
transaction
.
New
(
context
.
Background
())
txn
,
ctx
:=
transaction
.
New
(
context
.
Background
())
defer
txn
.
Abort
()
defer
txn
.
Abort
()
...
@@ -512,7 +527,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
...
@@ -512,7 +527,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
xtree
,
err
:=
zconn
.
Get
(
ctx
,
treeRoot
);
X
(
err
)
xtree
,
err
:=
zconn
.
Get
(
ctx
,
treeRoot
);
X
(
err
)
ztree
:=
xtree
.
(
*
Tree
)
ztree
:=
xtree
.
(
*
Tree
)
kadjTracked
:=
SetKey
{}
// kadj[Tracked] (all keys adjacent to tracked
)
kadjTracked
=
SetKey
{}
// kadj[Tracked] (all keys adjacent to tracked keys
)
for
k
:=
range
initialTrackedKeys
{
for
k
:=
range
initialTrackedKeys
{
path
:=
[]
Node
{}
path
:=
[]
Node
{}
_
,
_
,
err
=
ztree
.
VGet
(
ctx
,
k
,
func
(
node
Node
)
{
_
,
_
,
err
=
ztree
.
VGet
(
ctx
,
k
,
func
(
node
Node
)
{
...
@@ -538,7 +553,8 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
...
@@ -538,7 +553,8 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
}
}
trackedNotInKadj
.
Del
(
kInf
)
trackedNotInKadj
.
Del
(
kInf
)
if
len
(
trackedNotInKadj
)
>
0
{
if
len
(
trackedNotInKadj
)
>
0
{
panic
(
fmt
.
Sprintf
(
"BUG: %s: Tracked ∉ kadj[Tracked]"
,
subj
))
// XXX more details?
badf
(
"BUG: Tracked ∉ kadj[Tracked] ; extra=%v"
,
trackedNotInKadj
)
return
}
}
// k ∈ d12
// k ∈ d12
...
@@ -558,6 +574,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
...
@@ -558,6 +574,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
//if len(d12) == 0 && len(initialTrackedKeys) == 0 {
//if len(d12) == 0 && len(initialTrackedKeys) == 0 {
if
len
(
initialTrackedKeys
)
==
0
{
if
len
(
initialTrackedKeys
)
==
0
{
//if len(inδTOK) == 0 { XXX <- should be correct
assert
.
Equal
(
len
(
δB
.
ByRoot
),
0
)
assert
.
Equal
(
len
(
δB
.
ByRoot
),
0
)
return
return
}
}
...
@@ -570,16 +587,11 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
...
@@ -570,16 +587,11 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
assert
.
Equal
(
roots
,
[]
zodb
.
Oid
{
treeRoot
})
assert
.
Equal
(
roots
,
[]
zodb
.
Oid
{
treeRoot
})
δToid
:=
δB
.
ByRoot
[
treeRoot
]
// {} k -> oid
δToid
:=
δB
.
ByRoot
[
treeRoot
]
// {} k -> oid
δT
:
=
XGetKV
(
db
,
at2
,
δToid
)
// {} k -> ZBlk(oid).data
δT
=
XGetKV
(
db
,
at2
,
δToid
)
// {} k -> ZBlk(oid).data
//fmt.Println("d12:", d12)
//fmt.Println("d12:", d12)
//fmt.Println("δT: ", δT)
//fmt.Println("δT: ", δT)
var
badv
[]
string
badf
:=
func
(
format
string
,
argv
...
interface
{})
{
badv
=
append
(
badv
,
fmt
.
Sprintf
(
format
,
argv
...
))
}
// δT must be subset of d12.
// δT must be subset of d12.
// changed keys, that are
// changed keys, that are
// - in tracked set -> must be present in δT
// - in tracked set -> must be present in δT
...
@@ -614,15 +626,6 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
...
@@ -614,15 +626,6 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
}
}
}
}
if
badv
!=
nil
{
emsg
:=
fmt
.
Sprintf
(
"%s ; tracked=%v : δT is wrong:
\n\n
"
,
subj
,
tracked
)
emsg
+=
fmt
.
Sprintf
(
"d12: %v
\n
δT: %v
\n\n
"
,
d12
,
δT
)
emsg
+=
fmt
.
Sprintf
(
"kadj[Tracked]: %v
\n
kadj: %v
\n\n
"
,
kadjTracked
,
kadj
)
emsg
+=
strings
.
Join
(
badv
,
"
\n
"
)
emsg
+=
"
\n
"
t
.
Error
(
emsg
)
//t.Fatal(emsg)
}
}
}
...
@@ -1070,7 +1073,7 @@ func xkvFlatten(xkv RBucketSet) map[Key]string {
...
@@ -1070,7 +1073,7 @@ func xkvFlatten(xkv RBucketSet) map[Key]string {
}
}
// easies debugging
// easies debugging
.
func
(
ks
SetKey
)
String
()
string
{
func
(
ks
SetKey
)
String
()
string
{
keyv
:=
ks
.
Elements
()
keyv
:=
ks
.
Elements
()
sort
.
Slice
(
keyv
,
func
(
i
,
j
int
)
bool
{
sort
.
Slice
(
keyv
,
func
(
i
,
j
int
)
bool
{
...
...
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