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
b98706ad
Commit
b98706ad
authored
Oct 12, 2021
by
Kirill Smelkov
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X Track should be nop if keycov/path is already in krebuildJobs
parent
2370caa6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
16 deletions
+32
-16
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+32
-16
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
b98706ad
...
...
@@ -248,8 +248,9 @@ type _ΔTtail struct {
// _RebuildJob represents currently in-progress vδT rebuilding job.
type
_RebuildJob
struct
{
ready
chan
struct
{}
// closed when job completes
err
error
trackNew
blib
.
PPTreeSubSet
// rebuilding for this trackNew
ready
chan
struct
{}
// closed when job completes
err
error
}
// _ΔBroots represents roots-only part of ΔB.
...
...
@@ -437,35 +438,49 @@ func (δBtail *ΔBtail) track(path []zodb.Oid, keycov KeyRange) {
}
root
:=
path
[
0
]
// nothing to do if keycov is already tracked
leaf
:=
path
[
len
(
path
)
-
1
]
if
δBtail
.
trackSet
.
Has
(
leaf
)
{
tracefΔBtail
(
"->T: nop
\n
"
)
path_
:=
δBtail
.
trackSet
.
Path
(
leaf
)
// assertSamePathToLeaf asserts that T.Path(leaf) == path.
assertSamePathToLeaf
:=
func
(
T
blib
.
PPTreeSubSet
,
Tname
string
)
{
path_
:=
T
.
Path
(
leaf
)
if
!
pathEqual
(
path
,
path_
)
{
panicf
(
"BUG: keycov %s is already
tracked via path=%v
\n
track requests path=%v"
,
keycov
,
path_
,
path
)
panicf
(
"BUG: keycov %s is already
in %s via path=%v
\n
track requests path=%v"
,
keycov
,
Tname
,
path_
,
path
)
}
}
// nothing to do if keycov is already tracked
if
δBtail
.
trackSet
.
Has
(
leaf
)
{
tracefΔBtail
(
"->T: nop (already in trackSet)
\n
"
)
assertSamePathToLeaf
(
δBtail
.
trackSet
,
"trackSet"
)
return
}
// queue path into trackNew, if not there already
δTtail
,
ok
:=
δBtail
.
byRoot
[
root
]
if
!
ok
{
δTtail
=
newΔTtail
()
δBtail
.
byRoot
[
root
]
=
δTtail
}
if
δTtail
.
trackNew
.
Has
(
leaf
)
{
tracefΔBtail
(
"->T: nop
\n
"
)
path_
:=
δTtail
.
trackNew
.
Path
(
leaf
)
if
!
pathEqual
(
path
,
path_
)
{
panicf
(
"BUG: keycov %s is already in trackNew via path=%v
\n
track requests path=%v"
,
keycov
,
path_
,
path
)
// nothing to do if keycov is already queued to be tracked in trackNew or krebuildJobs
inJobs
:=
δTtail
.
krebuildJobs
.
IntersectsRange
(
keycov
)
if
inJobs
{
tracefΔBtail
(
"->T: nop (already in krebuildJobs)
\n
"
)
job
,
r
,
ok
:=
δTtail
.
krebuildJobs
.
Get_
(
keycov
.
Lo
)
if
!
(
ok
&&
r
==
keycov
)
{
panicf
(
"BUG: keycov is present in krebuildJobs only partly
\n
keycov: %s
\n
krebuildJobs: %v"
,
keycov
,
δTtail
.
krebuildJobs
)
}
assertSamePathToLeaf
(
job
.
trackNew
,
"job.trackNew"
)
return
}
// XXX also check if keycov ∈ krebuildJobs
if
δTtail
.
trackNew
.
Has
(
leaf
)
{
tracefΔBtail
(
"->T: nop (already in trackNew)
\n
"
)
assertSamePathToLeaf
(
δTtail
.
trackNew
,
"trackNew"
)
return
}
// keycov not in trackSet/trackNew/krebuildJobs -> queue it into trackNew
δBtail
.
trackNewRoots
.
Add
(
root
)
δTtail
.
trackNew
.
AddPath
(
path
)
δTtail
.
ktrackNew
.
AddRange
(
keycov
)
...
...
@@ -577,13 +592,14 @@ func (δTtail *_ΔTtail) _rebuild(root zodb.Oid, δBtail *ΔBtail) (err error) {
}
func
(
δTtail
*
_ΔTtail
)
__rebuild
(
root
zodb
.
Oid
,
δBtail
*
ΔBtail
,
releaseLock
bool
)
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"ΔBtail._rebuild root<%s>"
,
root
)
job
:=
&
_RebuildJob
{
ready
:
make
(
chan
struct
{})}
trackNew
:=
δTtail
.
trackNew
ktrackNew
:=
δTtail
.
ktrackNew
δTtail
.
trackNew
=
blib
.
PPTreeSubSet
{}
δTtail
.
ktrackNew
=
blib
.
RangedKeySet
{}
job
:=
&
_RebuildJob
{
trackNew
:
trackNew
,
ready
:
make
(
chan
struct
{})}
// krebuildJobs += ktrackNew
for
_
,
r
:=
range
ktrackNew
.
AllRanges
()
{
// assert krebuildJobs ^ r = ø
...
...
Kirill Smelkov
@kirr
mentioned in commit
305d897b
·
Oct 27, 2021
mentioned in commit
305d897b
mentioned in commit 305d897b15ac0866de464de36b34c1fe1de90a63
Toggle commit list
Kirill Smelkov
@kirr
mentioned in commit
2ab4be93
·
Oct 28, 2021
mentioned in commit
2ab4be93
mentioned in commit 2ab4be938541c61bf881216bdffc5376241ccc30
Toggle commit list
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