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
644bcd6a
Commit
644bcd6a
authored
Oct 08, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
aa0288ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
162 deletions
+2
-162
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+2
-162
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
644bcd6a
...
@@ -432,6 +432,7 @@ func (δBtail *ΔBtail) rebuildAll() (err error) {
...
@@ -432,6 +432,7 @@ func (δBtail *ΔBtail) rebuildAll() (err error) {
return
nil
return
nil
}
}
/* XXX kill
// rebuild1IfNeeded rebuilds ΔBtail for single root if that root needs rebuilding.
// rebuild1IfNeeded rebuilds ΔBtail for single root if that root needs rebuilding.
func (δBtail *ΔBtail) rebuild1IfNeeded(root zodb.Oid) error {
func (δBtail *ΔBtail) rebuild1IfNeeded(root zodb.Oid) error {
// XXX locking
// XXX locking
...
@@ -443,6 +444,7 @@ func (δBtail *ΔBtail) rebuild1IfNeeded(root zodb.Oid) error {
...
@@ -443,6 +444,7 @@ func (δBtail *ΔBtail) rebuild1IfNeeded(root zodb.Oid) error {
delete(δBtail.trackNewRoots, root)
delete(δBtail.trackNewRoots, root)
return δBtail.rebuild1(root)
return δBtail.rebuild1(root)
}
}
*/
// vδTSnapForTrackedKey returns vδT snapshot for root that takes into account at least all previous Track requests related to key.
// vδTSnapForTrackedKey returns vδT snapshot for root that takes into account at least all previous Track requests related to key.
func
(
δBtail
*
ΔBtail
)
vδTSnapForTrackedKey
(
root
zodb
.
Oid
,
key
Key
)
(
vδT
[]
ΔTree
,
err
error
)
{
func
(
δBtail
*
ΔBtail
)
vδTSnapForTrackedKey
(
root
zodb
.
Oid
,
key
Key
)
(
vδT
[]
ΔTree
,
err
error
)
{
...
@@ -579,168 +581,6 @@ func (δTtail *_ΔTtail) _runRebuildJob(root zodb.Oid, δBtail *ΔBtail) (err er
...
@@ -579,168 +581,6 @@ func (δTtail *_ΔTtail) _runRebuildJob(root zodb.Oid, δBtail *ΔBtail) (err er
}
}
/*
// vδTSnapForTracked returns vδT snapshot for root that takes into account all previous Track requests.
func (δBtail *ΔBtail) vδTSnapForTracked(root zodb.Oid) (vδT []ΔTree, err error) {
// XXX δBtail.lock
δTtail := δBtail.byRoot[root] // must be there
/ * XXX check .trackNewRoots ?
_, ok := δBtail.trackNewRoots[root]
if !ok {
// XXX δBtail.unlock
return nil
}
* /
if !δTtail.ktrackNew.Has(key) {
// key ∉ ktrackNew
job, inJobs := δTtail.krebuildJobs.Get_(key)
if !inJobs {
// key ∉ krebuildJobs -> it should be already in trackSet
vδT = δTtail.vδT
// XXX δBtail.unlock
return vδT, nil
}
// rebuild for root[key] is in progress -> wait for corresponding job to complete
// XXX δBtail.unlock
<-job.ready
if job.err == nil {
// XXX δBtail.lock
vδT = δTtail.vδT
// XXX δBtail.unlock
}
return vδT, job.err
}
// key ∈ ktrackNew -> this goroutine becomes responsible to start rebuilding vδT for it
// lauch rebuild job for all keys queued in ktrackNew so far
job := &_RebuildJob{ready: make(chan struct{})}
trackNew := δTtail.trackNew
rebuildKeys := δTtail.ktrackNew
δTtail.trackNew = blib.PPTreeSubSet{}
δTtail.ktrackNew = blib.RangedKeySet{}
// krebuildJobs += rebuildKeys
for _, r := range rebuildKeys.AllRanges() {
// XXX assert !krebuildJobs.IntersectsRange(e.KeyRange)
δTtail.krebuildJobs.SetRange(r, job)
}
delete(δBtail.trackNewRoots, root)
// XXX δBtail.unlock
vδTnew, δtrackSet, err := vδTBuild(root, trackNew, δBtail.δZtail, δBtail.db)
// XXX δBtail.lock
// krebuildJobs -= rebuildKeys
for _, r := range rebuildKeys.AllRanges() {
// XXX assert krebuildJobs[r] == job
δTtail.krebuildJobs.DelRange(r)
}
// merge rebuild result
if err != nil {
// XXX comment about RCU snapshot
δTtail.vδT = vδTClone(δTtail.vδT)
δrevSet := vδTMergeInplace(&δTtail.vδT, vδTnew)
δBtail.trackSet.UnionInplace(δtrackSet)
δBtail.vδBroots_Update(root, δrevSet)
}
// we are done
job.err = err
close(job.ready)
// XXX δBtail.unlock
return job.err
}
*/
// rebuild1KeyIfNeeded rebuilds ΔBtail for single root if that root[key] needs rebuilding.
func
(
δBtail
*
ΔBtail
)
rebuild1KeyIfNeeded
(
root
zodb
.
Oid
,
key
Key
)
error
{
// XXX δBtail.lock
_
,
ok
:=
δBtail
.
trackNewRoots
[
root
]
if
!
ok
{
// XXX δBtail.unlock
return
nil
}
// XXX move -> ΔTtail.rebuild1KeyIfNeeded?
δTtail
:=
δBtail
.
byRoot
[
root
]
// must be there
// XXX δTtail.lock
// _, inNew := δTtail.ktrackNew.Get_(key)
inNew
:=
δTtail
.
ktrackNew
.
Has
(
key
)
if
!
inNew
{
// key ∉ ktrackNew
job
,
inJobs
:=
δTtail
.
krebuildJobs
.
Get_
(
key
)
if
!
inJobs
{
// key ∉ krebuildJobs -> it should be already in trackSet
// XXX δTtail.unlock
// XXX δBtail.unlock
return
nil
}
// rebuild for root[key] is in progress -> wait for corresponding job to complete
// XXX δTtail.unlock
// XXX δBtail.unlock
<-
job
.
ready
return
job
.
err
}
// key ∈ ktrackNew -> this goroutine becomes responsible to start rebuilding vδT for it
// lauch rebuild job for all keys queued in ktrackNew so far
job
:=
&
_RebuildJob
{
ready
:
make
(
chan
struct
{})}
/*
trackNewSet := blib.PPTreeSubSet{} // trackNew corresponding to ktrackNew
rebuildKeys := blib.RangedKeySet{} // keys(ktrackNew)
for _, e := range δTtail.ktrackNew.AllRanges() {
trackNewSet.AddPath(e.Value)
rebuildKeys.AddRange(e.KeyRange)
}
*/
trackNew
:=
δTtail
.
trackNew
rebuildKeys
:=
δTtail
.
ktrackNew
δTtail
.
trackNew
=
blib
.
PPTreeSubSet
{}
δTtail
.
ktrackNew
=
blib
.
RangedKeySet
{}
// krebuildJobs += rebuildKeys
for
_
,
r
:=
range
rebuildKeys
.
AllRanges
()
{
// XXX assert !krebuildJobs.IntersectsRange(e.KeyRange)
δTtail
.
krebuildJobs
.
SetRange
(
r
,
job
)
}
delete
(
δBtail
.
trackNewRoots
,
root
)
// XXX δTtail.unlock
// XXX δBtail.unlock
// XXX δTtail.rebuild(for trackNew) -> err
_
=
trackNew
// XXX δBtail.lock ? (to update vδBroots)
// XXX δTtail.lock
// XXX merge rebuild result
// krebuildJobs -= rebuildKeys
for
_
,
r
:=
range
rebuildKeys
.
AllRanges
()
{
// XXX assert krebuildJobs[r] == job
δTtail
.
krebuildJobs
.
DelRange
(
r
)
}
// we are done
job
.
err
=
nil
// XXX stub
close
(
job
.
ready
)
// XXX unlock
return
job
.
err
}
// rebuild1 rebuilds ΔBtail for single root.
// rebuild1 rebuilds ΔBtail for single root.
func
(
δBtail
*
ΔBtail
)
rebuild1
(
root
zodb
.
Oid
)
error
{
func
(
δBtail
*
ΔBtail
)
rebuild1
(
root
zodb
.
Oid
)
error
{
// XXX locking
// XXX locking
...
...
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