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
e8804bd5
Commit
e8804bd5
authored
Oct 13, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8316aa92
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+13
-6
No files found.
wcfs/internal/zdata/δftail.go
View file @
e8804bd5
...
@@ -67,6 +67,7 @@ import (
...
@@ -67,6 +67,7 @@ import (
"context"
"context"
"fmt"
"fmt"
"sort"
"sort"
"sync"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/neo/go/transaction"
"lab.nexedi.com/kirr/neo/go/transaction"
...
@@ -137,7 +138,11 @@ type ΔFtail struct {
...
@@ -137,7 +138,11 @@ type ΔFtail struct {
// ΔFtail merges ΔBtail with history of ZBlk
// ΔFtail merges ΔBtail with history of ZBlk
δBtail
*
xbtree
.
ΔBtail
δBtail
*
xbtree
.
ΔBtail
// XXX mu sync.Mutex + comment
// mu protects ΔFtail data _and_ all _ΔFileTail data for all files.
//
// NOTE: even though this lock is global, since ... XXX
// working with retrieved vδE snapshot(?) does not need to hold the lock.
mu
sync
.
Mutex
byFile
map
[
zodb
.
Oid
]
*
_ΔFileTail
// file -> vδf tail
byFile
map
[
zodb
.
Oid
]
*
_ΔFileTail
// file -> vδf tail
filesByRoot
map
[
zodb
.
Oid
]
setOid
// tree-root -> {} ZBigFile<oid> as of @head
filesByRoot
map
[
zodb
.
Oid
]
setOid
// tree-root -> {} ZBigFile<oid> as of @head
...
@@ -324,7 +329,7 @@ func (δFtail *ΔFtail) rebuild1IfNeeded(foid zodb.Oid) (vδE []_ΔFileEpoch, he
...
@@ -324,7 +329,7 @@ func (δFtail *ΔFtail) rebuild1IfNeeded(foid zodb.Oid) (vδE []_ΔFileEpoch, he
δBtail
:=
δFtail
.
δBtail
δBtail
:=
δFtail
.
δBtail
err
=
δftail
.
_rebuild1
(
foid
,
δBtail
.
ΔZtail
(),
δBtail
.
DB
())
err
=
δftail
.
_rebuild1
(
foid
,
δBtail
.
ΔZtail
(),
δBtail
.
DB
())
}
}
return
δftail
,
err
return
δftail
.
vδE
,
δftail
.
root
,
err
}
}
// _rebuild1 rebuilds vδE.
// _rebuild1 rebuilds vδE.
...
@@ -542,7 +547,7 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
...
@@ -542,7 +547,7 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
// TODO keep index which file changed epoch where (similarly to ΔBtail),
// TODO keep index which file changed epoch where (similarly to ΔBtail),
// and, instead of scanning all files, trim vδE only on files that is really necessary.
// and, instead of scanning all files, trim vδE only on files that is really necessary.
for
_
,
δftail
:=
range
δFtail
.
byFile
{
for
_
,
δftail
:=
range
δFtail
.
byFile
{
δftail
.
forgetPast
(
revCut
)
δftail
.
_
forgetPast
(
revCut
)
}
}
}
}
...
@@ -844,13 +849,14 @@ func (δFtail *ΔFtail) _BlkRevAt(ctx context.Context, zfile *ZBigFile, blk int6
...
@@ -844,13 +849,14 @@ func (δFtail *ΔFtail) _BlkRevAt(ctx context.Context, zfile *ZBigFile, blk int6
// XXX locking
// XXX locking
δftail
,
err
:=
δFtail
.
rebuild1IfNeeded
(
foid
)
// δftail, err := δFtail.rebuild1IfNeeded(foid)
vδE
,
headRoot
,
err
:=
δFtail
.
rebuild1IfNeeded
(
foid
)
if
err
!=
nil
{
if
err
!=
nil
{
return
zodb
.
InvalidTid
,
false
,
err
return
zodb
.
InvalidTid
,
false
,
err
}
}
// find epoch that covers at and associated blktab root/object
// find epoch that covers at and associated blktab root/object
vδE
:=
δftail
.
vδE
//
vδE := δftail.vδE
//fmt.Printf(" vδE: %v\n", vδE)
//fmt.Printf(" vδE: %v\n", vδE)
l
:=
len
(
vδE
)
l
:=
len
(
vδE
)
i
:=
sort
.
Search
(
l
,
func
(
i
int
)
bool
{
i
:=
sort
.
Search
(
l
,
func
(
i
int
)
bool
{
...
@@ -862,7 +868,8 @@ func (δFtail *ΔFtail) _BlkRevAt(ctx context.Context, zfile *ZBigFile, blk int6
...
@@ -862,7 +868,8 @@ func (δFtail *ΔFtail) _BlkRevAt(ctx context.Context, zfile *ZBigFile, blk int6
// root
// root
var
root
zodb
.
Oid
var
root
zodb
.
Oid
if
i
==
l
{
if
i
==
l
{
root
=
δftail
.
root
// root = δftail.root
root
=
headRoot
}
else
{
}
else
{
root
=
vδE
[
i
]
.
oldRoot
root
=
vδE
[
i
]
.
oldRoot
}
}
...
...
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