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
d372fde8
Commit
d372fde8
authored
Jun 19, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7c96cf5a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
20 deletions
+19
-20
wcfs/wcfs.go
wcfs/wcfs.go
+5
-4
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+14
-16
No files found.
wcfs/wcfs.go
View file @
d372fde8
...
...
@@ -420,6 +420,7 @@ package main
// XXX describe locking
//
// head.zconnMu write by handleδZ; read by read
// -> rlockZHead() + lockZHead() ?
// ...
// XXX locking: test with -race (many bugs are reported)
...
...
@@ -1438,8 +1439,8 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
f
:=
w
.
file
// register w to f here early, so that READs going in parallel to us
// preparing and processing initial pins, also send pins for read
// blocks. If we don't, we can miss to send pin for a freshly read
// preparing and processing initial pins, also send pins
to w
for read
// blocks. If we don't, we can miss to send pin
to w
for a freshly read
// block which could have revision > w.at: XXX test
//
// 1 3 2 4
...
...
@@ -1456,7 +1457,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// pin for #3.
//
// NOTE for `unpin blk` head we can be sure there won't be simultaneous
// `pin blk` request, because:
// `pin blk` request, because:
XXX recheck
//
// - unpin means blk was previously pinned,
// - blk was pinned means it is tracked by δFtail,
...
...
@@ -1464,7 +1465,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// there is indeed no blk change in that region,
// - which means that δblk with rev > w.at might be only > head,
// - but such δblk are processed with zhead wlocked and we keep zhead
// rlocked during pin setup.
XXX rlock zhead
// rlocked during pin setup.
XXX rlock zhead during setupWatch
//
// δ δ
// ----x----.------------]----x----
...
...
wcfs/wcfs_test.py
View file @
d372fde8
...
...
@@ -178,9 +178,7 @@ class tDB:
# committed: (tail, head] + δF history
t
.
tail
=
t
.
root
.
_p_jar
.
db
().
storage
.
lastTransaction
()
t
.
head
=
None
# XXX -> property = dFtail[-1].rev ?
t
.
_headv
=
[]
# XXX -> just use dFtail[·].rev ?
t
.
dFtail
=
[]
# of DF
t
.
dFtail
=
[]
# of DF; head = dFtail[-1].rev
# when ZBigFile(s) blocks were last accessed via wcfs.
# this is updated only explicitly via ._blkaccess() .
...
...
@@ -194,6 +192,10 @@ class tDB:
t
.
_files
=
set
()
t
.
_wlinks
=
set
()
@
property
def
head
(
t
):
return
t
.
dFtail
[
-
1
].
rev
# close closes test database as well as all tracked files, watch links and wcfs.
def
close
(
t
):
for
tf
in
t
.
_files
.
copy
():
...
...
@@ -253,8 +255,6 @@ class tDB:
transaction
.
commit
()
head
=
last
.
_p_serial
t
.
head
=
head
t
.
_headv
.
append
(
head
)
print
(
'
\
n
M: commit -> %s'
%
t
.
hat
(
head
))
for
zf
,
zfDelta
in
t
.
_changed
.
items
():
...
...
@@ -279,14 +279,14 @@ class tDB:
# _wcsync makes sure wcfs is synchronized to latest committed transaction.
def
_wcsync
(
t
):
while
len
(
t
.
_wc_zheadv
)
<
len
(
t
.
_headv
):
while
len
(
t
.
_wc_zheadv
)
<
len
(
t
.
dFtail
):
l
=
t
.
_wc_zheadfh
.
readline
()
#print('> zhead read: %r' % l)
l
=
l
.
rstrip
(
'
\
n
'
)
wchead
=
fromhex
(
l
)
i
=
len
(
t
.
_wc_zheadv
)
if
wchead
!=
t
.
_headv
[
i
]
:
raise
RuntimeError
(
"wcsync #%d: wczhead (%s) != zhead (%s)"
%
(
i
,
h
(
wchead
),
h
(
t
.
_headv
[
i
]
)))
if
wchead
!=
t
.
dFtail
[
i
].
rev
:
raise
RuntimeError
(
"wcsync #%d: wczhead (%s) != zhead (%s)"
%
(
i
,
h
(
wchead
),
h
(
t
.
dFtail
[
i
].
rev
)))
t
.
_wc_zheadv
.
append
(
wchead
)
# head/at = last txn of whole db
...
...
@@ -357,7 +357,7 @@ class tDB:
if
len
(
blkhistoryat
)
==
0
:
# blk did not existed @at # XXX verify whether file was existing at all
data
=
b''
rev
=
t
.
_headv
[
0
]
# was hole - at0 XXX -> pin to z64
rev
=
t
.
dFtail
[
0
].
rev
# was hole - at0 XXX -> pin to z64
else
:
_
=
blkhistoryat
[
-
1
]
data
=
_
.
ddata
[
blk
]
...
...
@@ -911,7 +911,7 @@ def _pinAt(t, zf, at): # -> pin = {} blk -> rev
# history of blk changes <= at
blkhistoryat
=
[
_
.
rev
for
_
in
vdf
if
blk
in
_
.
ddata
and
_
.
rev
<=
at
]
if
len
(
blkhistoryat
)
==
0
:
pinrev
=
t
.
_headv
[
0
]
# was hole - at0 XXX -> pin to z64?
pinrev
=
t
.
dFtail
[
0
].
rev
# was hole - at0 XXX -> pin to z64?
else
:
pinrev
=
blkhistoryat
[
-
1
]
assert
pinrev
<=
at
...
...
@@ -1471,12 +1471,10 @@ def test_tidtime_notrough():
# @at2 (03cf7850500b5f66)
@
func
(
tDB
)
def
hat
(
t
,
at
):
try
:
i
=
t
.
_headv
.
index
(
at
)
except
ValueError
:
return
"@"
+
h
(
at
)
for
i
,
dF
in
enumerate
(
t
.
dFtail
):
if
dF
.
rev
==
at
:
return
"@at%d (%s)"
%
(
i
,
h
(
at
))
return
"@"
+
h
(
at
)
# zfiles returns ZBigFiles that were ever changed under t.
...
...
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