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
926408d3
Commit
926408d3
authored
Oct 18, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1476e602
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
7 deletions
+34
-7
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+34
-7
No files found.
wcfs/internal/zdata/δftail.go
View file @
926408d3
...
@@ -325,7 +325,7 @@ func (δFtail *ΔFtail) rebuild1IfNeeded(foid zodb.Oid) (vδE []_ΔFileEpoch, he
...
@@ -325,7 +325,7 @@ func (δFtail *ΔFtail) rebuild1IfNeeded(foid zodb.Oid) (vδE []_ΔFileEpoch, he
// vδE needs to be built
// vδE needs to be built
job
:=
δftail
.
rebuildJob
job
:=
δftail
.
rebuildJob
// rebuild is currently in-progress -> wait for corrsponding job to complete
// rebuild is currently in-progress -> wait for corr
e
sponding job to complete
if
job
!=
nil
{
if
job
!=
nil
{
δFtail
.
mu
.
Unlock
()
δFtail
.
mu
.
Unlock
()
<-
job
.
ready
<-
job
.
ready
...
@@ -362,7 +362,7 @@ func (δFtail *ΔFtail) rebuild1IfNeeded(foid zodb.Oid) (vδE []_ΔFileEpoch, he
...
@@ -362,7 +362,7 @@ func (δFtail *ΔFtail) rebuild1IfNeeded(foid zodb.Oid) (vδE []_ΔFileEpoch, he
// _rebuildAll rebuilds vδE for all files from ftrackNew requests.
// _rebuildAll rebuilds vδE for all files from ftrackNew requests.
//
//
// must be calledwith δFtail.mu locked.
// must be called
with δFtail.mu locked.
func
(
δFtail
*
ΔFtail
)
_rebuildAll
()
(
err
error
)
{
func
(
δFtail
*
ΔFtail
)
_rebuildAll
()
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"ΔFtail rebuildAll"
)
defer
xerr
.
Contextf
(
&
err
,
"ΔFtail rebuildAll"
)
...
@@ -619,7 +619,7 @@ func (δftail *_ΔFileTail) _forgetPast(revCut zodb.Tid) {
...
@@ -619,7 +619,7 @@ func (δftail *_ΔFileTail) _forgetPast(revCut zodb.Tid) {
// func (δFtail *ΔFtail) SliceByRev(lo, hi zodb.Tid) /*readonly*/ []ΔF
// func (δFtail *ΔFtail) SliceByRev(lo, hi zodb.Tid) /*readonly*/ []ΔF
// _ZinblkOverlay is used by SliceByFileRev.
// _ZinblkOverlay is used by SliceByFileRev.
// It combines
s
read-only Zinblk base with read-write adjustment.
// It combines read-only Zinblk base with read-write adjustment.
// It provides the following operations:
// It provides the following operations:
//
//
// - Get(zblk) -> {blk},
// - Get(zblk) -> {blk},
...
@@ -627,7 +627,7 @@ func (δftail *_ΔFileTail) _forgetPast(revCut zodb.Tid) {
...
@@ -627,7 +627,7 @@ func (δftail *_ΔFileTail) _forgetPast(revCut zodb.Tid) {
// - DelBlk(zblk, blk)
// - DelBlk(zblk, blk)
type
_ZinblkOverlay
struct
{
type
_ZinblkOverlay
struct
{
Base
map
[
zodb
.
Oid
]
setI64
// taken from _RootTrack.Zinblk or _ΔFileEpoch.oldZinblk
Base
map
[
zodb
.
Oid
]
setI64
// taken from _RootTrack.Zinblk or _ΔFileEpoch.oldZinblk
Adj
map
[
zodb
.
Oid
]
setI64
// adjust
ement over base; blk<0 reresents whit
out
Adj
map
[
zodb
.
Oid
]
setI64
// adjust
ment over base; blk<0 represents white
out
}
}
// SliceByFileRev returns history of file changes in (lo, hi] range.
// SliceByFileRev returns history of file changes in (lo, hi] range.
...
@@ -724,10 +724,37 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
...
@@ -724,10 +724,37 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
// head
// head
root
=
headRoot
root
=
headRoot
head
=
δFtail
.
Head
()
head
=
δFtail
.
Head
()
rt
,
ok
:=
δFtail
.
byRoot
[
root
]
// XXX locking
// take atomic Zinblk snapshot that covers vδZ
//
// - the reason we take snapshot is because simultaneous Track requests might
// change Zinblk concurrently, and without snapshotting this might result
// in changes to a block being not uniformly present in result (some
// revision indicates change to that block, while another one - where the
// block is too actually changed - does not indicate change to that block).
//
// - the reason we limit snapshot to vδZ is to reduce amount of under-lock
// copying, because original Zinblk is potentially very large.
ZinblkSnap
:=
map
[
zodb
.
Oid
]
setI64
{}
δZAllOid
:=
setOid
{}
for
_
,
δZ
:=
range
vδZ
{
for
_
,
oid
:=
range
δZ
.
Changev
{
δZAllOid
.
Add
(
oid
)
}
}
δFtail
.
mu
.
Lock
()
rt
,
ok
:=
δFtail
.
byRoot
[
root
]
if
ok
{
for
oid
:=
range
δZAllOid
{
inblk
,
ok
:=
rt
.
Zinblk
[
oid
]
if
ok
{
if
ok
{
Zinblk
.
Base
=
rt
.
Zinblk
ZinblkSnap
[
oid
]
=
inblk
.
Clone
()
}
}
}
}
δFtail
.
mu
.
Unlock
()
Zinblk
.
Base
=
ZinblkSnap
}
else
{
}
else
{
δE
:=
vδE
[
ie
+
1
]
δE
:=
vδE
[
ie
+
1
]
root
=
δE
.
oldRoot
root
=
δE
.
oldRoot
...
@@ -1044,7 +1071,7 @@ func (δFtail *ΔFtail) _BlkRevAt(ctx context.Context, zfile *ZBigFile, blk int6
...
@@ -1044,7 +1071,7 @@ func (δFtail *ΔFtail) _BlkRevAt(ctx context.Context, zfile *ZBigFile, blk int6
}
}
// ---- vδEBuild (rebuild core) ----
// ---- vδEBuild (
vδE
rebuild core) ----
// vδEBuild builds vδE for file from vδZ.
// vδEBuild builds vδE for file from vδZ.
func
vδEBuild
(
foid
zodb
.
Oid
,
δZtail
*
zodb
.
ΔTail
,
db
*
zodb
.
DB
)
(
vδE
[]
_ΔFileEpoch
,
err
error
)
{
func
vδEBuild
(
foid
zodb
.
Oid
,
δZtail
*
zodb
.
ΔTail
,
db
*
zodb
.
DB
)
(
vδE
[]
_ΔFileEpoch
,
err
error
)
{
...
...
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