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
80bdf7e4
Commit
80bdf7e4
authored
Aug 26, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
66359658
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
wcfs/δbtail.go
wcfs/δbtail.go
+15
-6
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+1
-2
No files found.
wcfs/δbtail.go
View file @
80bdf7e4
...
@@ -98,8 +98,9 @@ type Key = int64
...
@@ -98,8 +98,9 @@ type Key = int64
const
KeyMax
Key
=
math
.
MaxInt64
const
KeyMax
Key
=
math
.
MaxInt64
const
KeyMin
Key
=
math
.
MinInt64
const
KeyMin
Key
=
math
.
MinInt64
type
Value
=
zodb
.
Oid
// assumes value is persistent reference
// value is assumed to be persistent reference.
// deletion is represented as VDEL
// deletion is represented as VDEL.
type
Value
=
zodb
.
Oid
const
VDEL
=
zodb
.
InvalidOid
const
VDEL
=
zodb
.
InvalidOid
...
@@ -162,7 +163,7 @@ type ΔBtail struct {
...
@@ -162,7 +163,7 @@ type ΔBtail struct {
// includes all changed objects, not only tracked ones.
// includes all changed objects, not only tracked ones.
δZtail
*
zodb
.
ΔTail
δZtail
*
zodb
.
ΔTail
// XXX vvv keys
keys ∈ tracked -> keys ∈ kadj[tracket
] ?
// XXX vvv keys
∈ tracked -> keys ∈ kadj[tracked
] ?
// δRtail []ΔRoots // which BTree were changed; Noted only by keys ∈ tracket subset
// δRtail []ΔRoots // which BTree were changed; Noted only by keys ∈ tracket subset
byRoot
map
[
zodb
.
Oid
]
*
ΔTtail
// {} root -> [] k/v change history; only for keys ∈ tracket subset
byRoot
map
[
zodb
.
Oid
]
*
ΔTtail
// {} root -> [] k/v change history; only for keys ∈ tracket subset
...
@@ -172,6 +173,7 @@ type ΔBtail struct {
...
@@ -172,6 +173,7 @@ type ΔBtail struct {
// tracked nodes index: node -> parent + accessed holes under this node XXX -> holeIdx
// tracked nodes index: node -> parent + accessed holes under this node XXX -> holeIdx
// we only allow single parent/root case and report "tree corrupt" otherwise.
// we only allow single parent/root case and report "tree corrupt" otherwise.
// trackIdx describes @head state
// trackIdx describes @head state
// XXX -> parentIdx
trackIdx
map
[
zodb
.
Oid
]
nodeTrack
trackIdx
map
[
zodb
.
Oid
]
nodeTrack
// XXX tracked holes
// XXX tracked holes
...
@@ -185,8 +187,10 @@ type ΔBtail struct {
...
@@ -185,8 +187,10 @@ type ΔBtail struct {
// nodeTrack represents tracking information about a node.
// nodeTrack represents tracking information about a node.
type
nodeTrack
struct
{
type
nodeTrack
struct
{
parent
zodb
.
Oid
// parent node | InvalidOid for root
parent
zodb
.
Oid
// parent node | InvalidOid for root
/*
holes SetKey // missing keys tracked under this node; nil for !leaf
holes SetKey // missing keys tracked under this node; nil for !leaf
// XXX move holes into separate ΔBtail..holeIdx
// XXX move holes into separate ΔBtail..holeIdx
*/
}
}
// treeSetKey represents ordered set of keys.
// treeSetKey represents ordered set of keys.
...
@@ -310,15 +314,17 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
...
@@ -310,15 +314,17 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
parent
:=
zodb
.
InvalidOid
parent
:=
zodb
.
InvalidOid
var
track
nodeTrack
var
track
nodeTrack
var
oldTrack
bool
var
oldTrack
bool
for
i
,
node
:=
range
path
{
for
_
,
node
:=
range
path
{
oid
:=
node
.
POid
()
oid
:=
node
.
POid
()
// XXX check for InvalidOid (e.g. T/B1:a with bucket not having its own oid.
// XXX check for InvalidOid (e.g. T/B1:a with bucket not having its own oid.
track
,
oldTrack
=
δBtail
.
trackIdx
[
oid
]
track
,
oldTrack
=
δBtail
.
trackIdx
[
oid
]
if
!
oldTrack
{
if
!
oldTrack
{
track
=
nodeTrack
{
parent
:
parent
}
track
=
nodeTrack
{
parent
:
parent
}
/*
if i == l-1 { // leaf
if i == l-1 { // leaf
track.holes = SetKey{}
track.holes = SetKey{}
}
}
*/
δBtail
.
trackIdx
[
oid
]
=
track
δBtail
.
trackIdx
[
oid
]
=
track
// XXX .trackNew += oid
// XXX .trackNew += oid
}
}
...
@@ -335,11 +341,13 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
...
@@ -335,11 +341,13 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
// remember missing keys in track of leaf node (bucket or top-level ø tree)
// remember missing keys in track of leaf node (bucket or top-level ø tree)
if
!
keyPresent
{
if
!
keyPresent
{
δBtail
.
holeIdx
.
Add
(
key
)
δBtail
.
holeIdx
.
Add
(
key
)
track
.
holes
.
Add
(
key
)
//
track.holes.Add(key)
}
else
{
}
else
{
/*
if track.holes.Has(key) {
if track.holes.Has(key) {
panicf("[%v] was previously requested to be tracked as ø", key)
panicf("[%v] was previously requested to be tracked as ø", key)
}
}
*/
if
δBtail
.
holeIdx
.
Has
(
key
)
{
if
δBtail
.
holeIdx
.
Has
(
key
)
{
panicf
(
"[%v] was previously requested to be tracked as ø"
,
key
)
panicf
(
"[%v] was previously requested to be tracked as ø"
,
key
)
}
}
...
@@ -1263,7 +1271,8 @@ func (rn nodeInRange) String() string {
...
@@ -1263,7 +1271,8 @@ func (rn nodeInRange) String() string {
}
}
func
(
track
nodeTrack
)
String
()
string
{
func
(
track
nodeTrack
)
String
()
string
{
return
fmt
.
Sprintf
(
"{p%s h%s}"
,
track
.
parent
,
track
.
holes
)
//return fmt.Sprintf("{p%s h%s}", track.parent, track.holes)
return
fmt
.
Sprintf
(
"{p%s}"
,
track
.
parent
)
}
}
...
...
wcfs/δbtail_test.go
View file @
80bdf7e4
...
@@ -543,8 +543,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
...
@@ -543,8 +543,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
emsg
+=
strings
.
Join
(
badv
,
"
\n
"
)
emsg
+=
strings
.
Join
(
badv
,
"
\n
"
)
emsg
+=
"
\n
"
emsg
+=
"
\n
"
//t.Error(emsg)
t
.
Error
(
emsg
)
t
.
Fatal
(
emsg
)
}
}
}()
}()
...
...
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