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
bf411aa9
Commit
bf411aa9
authored
Sep 13, 2021
by
Kirill Smelkov
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X zdata: Deduplicate zfile loading
parent
aac37c11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
33 deletions
+27
-33
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+27
-33
No files found.
wcfs/internal/zdata/δftail_test.go
View file @
bf411aa9
...
...
@@ -234,26 +234,15 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
txn
.
Abort
()
}()
zconn
,
err
:=
t
.
DB
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{
At
:
t
.
Head
()
.
At
,
NoPool
:
true
});
X
(
err
)
xzroot
,
err
:=
zconn
.
Get
(
ctx
,
0
);
X
(
err
)
zroot
:=
xzroot
.
(
*
zodb
.
Map
)
err
=
zroot
.
PActivate
(
ctx
);
X
(
err
)
zfile
:=
zroot
.
Data
[
"treegen/file"
]
.
(
*
ZBigFile
)
zroot
.
PDeactivate
()
zfile
,
blksize
:=
t
.
XLoadZFile
(
ctx
,
zconn
)
foid
:=
zfile
.
POid
()
err
=
zfile
.
PActivate
(
ctx
);
X
(
err
)
blksize
:=
zfile
.
blksize
blktabOid
:=
zfile
.
blktab
.
POid
()
if
blktabOid
!=
t
.
Root
()
{
t
.
Fatalf
(
"BUG: zfile.blktab (%s) != treeroot (%s)"
,
blktabOid
,
t
.
Root
())
}
zfile
.
PDeactivate
()
// update vδf + co for t1
vδf
=
append
(
vδf
,
&
ΔFile
{
Rev
:
t1
.
At
,
Epoch
:
true
})
vδE
=
append
(
vδE
,
_ΔFileEpoch
{
Rev
:
t1
.
At
,
oldRoot
:
zodb
.
InvalidOid
,
newRoot
:
blktabOid
,
newRoot
:
t
.
Root
()
,
newBlkSize
:
blksize
,
oldTrackSetZBlk
:
nil
,
})
...
...
@@ -421,13 +410,13 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
if
newEpoch
{
δE
:=
_ΔFileEpoch
{
Rev
:
commit
.
At
}
if
delfile
{
δE
.
oldRoot
=
blktabOid
δE
.
oldRoot
=
t
.
Root
()
δE
.
newRoot
=
zodb
.
InvalidOid
δE
.
newBlkSize
=
-
1
// XXX oldBlkSize ?
}
else
{
δE
.
oldRoot
=
zodb
.
InvalidOid
δE
.
newRoot
=
blktabOid
δE
.
newRoot
=
t
.
Root
()
δE
.
newBlkSize
=
blksize
// XXX oldBlkSize ?
}
...
...
@@ -478,8 +467,8 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
for
oid
,
zt
:=
range
δFtail
.
trackSetZBlk
{
zblki
:=
commit
.
ZBlkTab
[
oid
]
for
root
,
blocks
:=
range
zt
.
inroot
{
if
root
!=
blktabOid
{
t
.
Errorf
(
".trackSetZBlk: zblk %s points to unexpected blktab %s"
,
zblki
.
Name
,
blktabOid
)
if
root
!=
t
.
Root
()
{
t
.
Errorf
(
".trackSetZBlk: zblk %s points to unexpected blktab %s"
,
zblki
.
Name
,
t
.
Root
()
)
continue
}
...
...
@@ -515,7 +504,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
// verify δftail.root
δftail
:=
δFtail
.
byFile
[
foid
]
rootOK
:=
blktabOid
rootOK
:=
t
.
Root
()
if
delfile
{
rootOK
=
zodb
.
InvalidOid
}
...
...
@@ -627,25 +616,12 @@ func TestΔFtailSliceUntrackedUniform(t_ *testing.T) {
// load zfile via root['treegen/file']
// XXX dup
txn
,
ctx
:=
transaction
.
New
(
context
.
Background
())
defer
func
()
{
txn
.
Abort
()
}()
zconn
,
err
:=
t
.
DB
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{
At
:
t
.
Head
()
.
At
,
NoPool
:
true
});
X
(
err
)
xzroot
,
err
:=
zconn
.
Get
(
ctx
,
0
);
X
(
err
)
zroot
:=
xzroot
.
(
*
zodb
.
Map
)
err
=
zroot
.
PActivate
(
ctx
);
X
(
err
)
zfile
:=
zroot
.
Data
[
"treegen/file"
]
.
(
*
ZBigFile
)
zroot
.
PDeactivate
()
// foid := zfile.POid()
err
=
zfile
.
PActivate
(
ctx
);
X
(
err
)
// blksize := zfile.blksize
blktabOid
:=
zfile
.
blktab
.
POid
()
if
blktabOid
!=
t
.
Root
()
{
t
.
Fatalf
(
"BUG: zfile.blktab (%s) != treeroot (%s)"
,
blktabOid
,
t
.
Root
())
}
zfile
.
PDeactivate
()
zconn
,
err
:=
t
.
DB
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{
At
:
t
.
Head
()
.
At
});
X
(
err
)
zfile
,
_
:=
t
.
XLoadZFile
(
ctx
,
zconn
)
// XXX dup
xtrackBlk
:=
func
(
blk
int64
)
{
...
...
@@ -721,6 +697,24 @@ func newT(t *testing.T) *T {
return
&
T
{
xbtreetest
.
NewT
(
t
)}
}
// XLoadZFile loads zfile from root["treegen/file"]@head.
func
(
t
*
T
)
XLoadZFile
(
ctx
context
.
Context
,
zconn
*
zodb
.
Connection
)
(
zfile
*
ZBigFile
,
blksize
int64
)
{
X
:=
exc
.
Raiseif
xzroot
,
err
:=
zconn
.
Get
(
ctx
,
0
);
X
(
err
)
zroot
:=
xzroot
.
(
*
zodb
.
Map
)
err
=
zroot
.
PActivate
(
ctx
);
X
(
err
)
zfile
=
zroot
.
Data
[
"treegen/file"
]
.
(
*
ZBigFile
)
zroot
.
PDeactivate
()
err
=
zfile
.
PActivate
(
ctx
);
X
(
err
)
blksize
=
zfile
.
blksize
blktabOid
:=
zfile
.
blktab
.
POid
()
if
blktabOid
!=
t
.
Root
()
{
t
.
Fatalf
(
"BUG: zfile.blktab (%s) != treeroot (%s)"
,
blktabOid
,
t
.
Root
())
}
zfile
.
PDeactivate
()
return
zfile
,
blksize
}
// δfstr/vδfstr convert δf/vδf to string taking symbolic at into account.
func
(
t
*
T
)
δfstr
(
δf
*
ΔFile
)
string
{
s
:=
fmt
.
Sprintf
(
"@%s·%s"
,
t
.
AtSymb
(
δf
.
Rev
),
δf
.
Blocks
)
...
...
Kirill Smelkov
@kirr
mentioned in commit
23d8da82
·
Oct 27, 2021
mentioned in commit
23d8da82
mentioned in commit 23d8da82b89134b00ae8dafeb0a5c7348dd8b4fe
Toggle commit list
Kirill Smelkov
@kirr
mentioned in commit
f980471f
·
Oct 28, 2021
mentioned in commit
f980471f
mentioned in commit f980471f6bd466f7da6fbe6753a7a14b1d3c8151
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