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
4f3bd5d6
Commit
4f3bd5d6
authored
Oct 08, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5c3a3efc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+11
-15
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
4f3bd5d6
...
@@ -467,7 +467,7 @@ func (δBtail *ΔBtail) vδTSnapForTrackedKey(root zodb.Oid, key Key) (vδT []Δ
...
@@ -467,7 +467,7 @@ func (δBtail *ΔBtail) vδTSnapForTrackedKey(root zodb.Oid, key Key) (vδT []Δ
// key ∈ ktrackNew -> this goroutine becomes responsible to start rebuilding vδT for it
// key ∈ ktrackNew -> this goroutine becomes responsible to start rebuilding vδT for it
// run rebuild job for all keys queued in ktrackNew so far
// run rebuild job for all keys queued in ktrackNew so far
err
=
δTtail
.
_r
unRebuildJob
(
root
,
δBtail
)
err
=
δTtail
.
_r
ebuild
(
root
,
δBtail
)
if
err
==
nil
{
if
err
==
nil
{
vδT
=
δTtail
.
vδT
vδT
=
δTtail
.
vδT
}
}
...
@@ -505,7 +505,7 @@ func (δBtail *ΔBtail) vδTSnapForTracked(root zodb.Oid) (vδT []ΔTree, err er
...
@@ -505,7 +505,7 @@ func (δBtail *ΔBtail) vδTSnapForTracked(root zodb.Oid) (vδT []ΔTree, err er
// run new rebuild job if there are not-yet-handled Track requests
// run new rebuild job if there are not-yet-handled Track requests
var
errJob
error
var
errJob
error
if
!
δTtail
.
ktrackNew
.
Empty
()
{
if
!
δTtail
.
ktrackNew
.
Empty
()
{
errJob
=
δTtail
.
_r
unRebuildJob
(
root
,
δBtail
)
errJob
=
δTtail
.
_r
ebuild
(
root
,
δBtail
)
}
}
// wait for previous jobs to complete as well
// wait for previous jobs to complete as well
...
@@ -525,17 +525,15 @@ func (δBtail *ΔBtail) vδTSnapForTracked(root zodb.Oid) (vδT []ΔTree, err er
...
@@ -525,17 +525,15 @@ func (δBtail *ΔBtail) vδTSnapForTracked(root zodb.Oid) (vδT []ΔTree, err er
return
vδT
,
nil
return
vδT
,
nil
}
}
// _r
unRebuildJob
runs rebuild job for current .ktrackNew/.trackNew
// _r
ebuild
runs rebuild job for current .ktrackNew/.trackNew
//
//
// must be called with δBtail.mu locked.
// must be called with δBtail.mu locked.
// returns with δBtail.mu locked.
// returns with δBtail.mu locked.
//
func
(
δTtail
*
_ΔTtail
)
_rebuild
(
root
zodb
.
Oid
,
δBtail
*
ΔBtail
)
(
err
error
)
{
// XXX naming -> _rebuild1 ?
return
δTtail
.
__rebuild
(
root
,
δBtail
,
/*releaseLock=*/
true
)
func
(
δTtail
*
_ΔTtail
)
_runRebuildJob
(
root
zodb
.
Oid
,
δBtail
*
ΔBtail
)
(
err
error
)
{
return
δTtail
.
__runRebuildJob
(
root
,
δBtail
,
/*releaseLock=*/
true
)
}
}
func
(
δTtail
*
_ΔTtail
)
__r
unRebuildJob
(
root
zodb
.
Oid
,
δBtail
*
ΔBtail
,
releaseLock
bool
)
(
err
error
)
{
func
(
δTtail
*
_ΔTtail
)
__r
ebuild
(
root
zodb
.
Oid
,
δBtail
*
ΔBtail
,
releaseLock
bool
)
(
err
error
)
{
// XXX errctx
defer
xerr
.
Contextf
(
&
err
,
"ΔBtail._rebuild root<%s>"
,
root
)
job
:=
&
_RebuildJob
{
ready
:
make
(
chan
struct
{})}
job
:=
&
_RebuildJob
{
ready
:
make
(
chan
struct
{})}
trackNew
:=
δTtail
.
trackNew
trackNew
:=
δTtail
.
trackNew
...
@@ -730,12 +728,12 @@ func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err e
...
@@ -730,12 +728,12 @@ func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err e
// _rebuildAll rebuilds ΔBtail taking all trackNew requests into account.
// _rebuildAll rebuilds ΔBtail taking all trackNew requests into account.
func
(
δBtail
*
ΔBtail
)
_rebuildAll
()
(
err
error
)
{
func
(
δBtail
*
ΔBtail
)
_rebuildAll
()
(
err
error
)
{
defer
xerr
.
Context
(
&
err
,
"ΔBtail
_rebuildAll"
)
defer
xerr
.
Context
(
&
err
,
"ΔBtail
.
_rebuildAll"
)
tracefΔBtail
(
"
\n
RebuildAll @%s..@%s trackNewRoots: %s
\n
"
,
δBtail
.
Tail
(),
δBtail
.
Head
(),
δBtail
.
trackNewRoots
)
tracefΔBtail
(
"
\n
RebuildAll @%s..@%s trackNewRoots: %s
\n
"
,
δBtail
.
Tail
(),
δBtail
.
Head
(),
δBtail
.
trackNewRoots
)
for
root
:=
range
δBtail
.
trackNewRoots
{
for
root
:=
range
δBtail
.
trackNewRoots
{
δTtail
:=
δBtail
.
byRoot
[
root
]
// must be there
δTtail
:=
δBtail
.
byRoot
[
root
]
// must be there
err
=
δTtail
.
__r
unRebuildJob
(
root
,
δBtail
,
/*releaseLock=*/
false
)
err
=
δTtail
.
__r
ebuild
(
root
,
δBtail
,
/*releaseLock=*/
false
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -852,7 +850,7 @@ func (δTtail *_ΔTtail) _forgetPast(revCut zodb.Tid) {
...
@@ -852,7 +850,7 @@ func (δTtail *_ΔTtail) _forgetPast(revCut zodb.Tid) {
// key must be tracked
// key must be tracked
// at must ∈ (tail, head]
// at must ∈ (tail, head]
func
(
δBtail
*
ΔBtail
)
GetAt
(
root
zodb
.
Oid
,
key
Key
,
at
zodb
.
Tid
)
(
value
Value
,
rev
zodb
.
Tid
,
valueExact
,
revExact
bool
,
err
error
)
{
func
(
δBtail
*
ΔBtail
)
GetAt
(
root
zodb
.
Oid
,
key
Key
,
at
zodb
.
Tid
)
(
value
Value
,
rev
zodb
.
Tid
,
valueExact
,
revExact
bool
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"
δ
Btail: root<%s>: get %d @%s"
,
root
,
key
,
at
)
defer
xerr
.
Contextf
(
&
err
,
"
Δ
Btail: root<%s>: get %d @%s"
,
root
,
key
,
at
)
if
traceΔBtail
{
if
traceΔBtail
{
tracefΔBtail
(
"
\n
Get root<%s>[%s] @%s
\n
"
,
root
,
kstr
(
key
),
at
)
tracefΔBtail
(
"
\n
Get root<%s>[%s] @%s
\n
"
,
root
,
kstr
(
key
),
at
)
...
@@ -1172,7 +1170,7 @@ func vδTMerge1Inplace(pvδT *[]ΔTree, δT ΔTree) (newRevEntry bool) {
...
@@ -1172,7 +1170,7 @@ func vδTMerge1Inplace(pvδT *[]ΔTree, δT ΔTree) (newRevEntry bool) {
// widenTrackNew widens trackNew to cover δtkeycov.
// widenTrackNew widens trackNew to cover δtkeycov.
func
widenTrackNew
(
trackNew
blib
.
PPTreeSubSet
,
δtkeycov
*
blib
.
RangedKeySet
,
root
zodb
.
Oid
,
at
zodb
.
Tid
,
db
*
zodb
.
DB
)
(
err
error
)
{
func
widenTrackNew
(
trackNew
blib
.
PPTreeSubSet
,
δtkeycov
*
blib
.
RangedKeySet
,
root
zodb
.
Oid
,
at
zodb
.
Tid
,
db
*
zodb
.
DB
)
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"widenTrackNew
tree
<%s> @%s +%s"
,
root
,
at
,
δtkeycov
)
defer
xerr
.
Contextf
(
&
err
,
"widenTrackNew
root
<%s> @%s +%s"
,
root
,
at
,
δtkeycov
)
debugfΔBtail
(
"
\n
widenTrackNew %s @%s +%s"
,
root
,
at
,
δtkeycov
)
debugfΔBtail
(
"
\n
widenTrackNew %s @%s +%s"
,
root
,
at
,
δtkeycov
)
txn
,
ctx
:=
transaction
.
New
(
context
.
TODO
())
// TODO - merge in cancel via ctx arg
txn
,
ctx
:=
transaction
.
New
(
context
.
TODO
())
// TODO - merge in cancel via ctx arg
...
@@ -1206,10 +1204,8 @@ func widenTrackNew(trackNew blib.PPTreeSubSet, δtkeycov *blib.RangedKeySet, roo
...
@@ -1206,10 +1204,8 @@ func widenTrackNew(trackNew blib.PPTreeSubSet, δtkeycov *blib.RangedKeySet, roo
}
}
// ----------------------------------------
// ----------------------------------------
// ΔZtail returns raw ZODB changes accumulated in δBtail so far.
// ΔZtail returns raw ZODB changes accumulated in δBtail so far.
//
//
// the caller must not modify returned δZtail.
// the caller must not modify returned δZtail.
...
...
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