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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
wendelin.core
Commits
fcf7b564
Commit
fcf7b564
authored
Feb 04, 2024
by
Levin Zimmermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! Fix test_wcfs_crash_old_data
parent
4fb98300
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
8 deletions
+32
-8
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+32
-8
No files found.
wcfs/wcfs_test.py
View file @
fcf7b564
...
@@ -31,7 +31,7 @@ from __future__ import print_function, absolute_import
...
@@ -31,7 +31,7 @@ from __future__ import print_function, absolute_import
from
wendelin.lib.testing
import
getTestDB
from
wendelin.lib.testing
import
getTestDB
from
wendelin.lib.zodb
import
dbclose
,
zstor_2zurl
from
wendelin.lib.zodb
import
dbclose
,
zstor_2zurl
from
wendelin.lib.mem
import
memcpy
from
wendelin.lib.mem
import
memcpy
from
wendelin.bigfile.file_zodb
import
ZBigFile
from
wendelin.bigfile.file_zodb
import
ZBigFile
,
ZBlk_fmt_write
,
_ZBlk_auto
,
ZBlk_fmt_registry
from
wendelin.bigfile.tests.test_filezodb
import
blksize
from
wendelin.bigfile.tests.test_filezodb
import
blksize
from
wendelin
import
wcfs
from
wendelin
import
wcfs
...
@@ -55,6 +55,10 @@ from wendelin.wcfs.internal.wcfs_test import _tWCFS, read_exfault_nogil, Segment
...
@@ -55,6 +55,10 @@ from wendelin.wcfs.internal.wcfs_test import _tWCFS, read_exfault_nogil, Segment
from
wendelin.wcfs.client._wcfs
import
_tpywlinkwrite
as
_twlinkwrite
from
wendelin.wcfs.client._wcfs
import
_tpywlinkwrite
as
_twlinkwrite
from
wendelin.wcfs
import
_is_mountpoint
as
is_mountpoint
,
_procwait
as
procwait
,
_ready
as
ready
,
_rmdir_ifexists
as
rmdir_ifexists
from
wendelin.wcfs
import
_is_mountpoint
as
is_mountpoint
,
_procwait
as
procwait
,
_ready
as
ready
,
_rmdir_ifexists
as
rmdir_ifexists
# Some tests behave different, depending on if we use ZBlk heuristic or not,
# because the heuristic doesn't only change the explicitly declared
# blocks, but also changes adjacent blocks sometimes.
IS_ZBLK_FMT_AUTO
=
ZBlk_fmt_registry
[
ZBlk_fmt_write
]
==
_ZBlk_auto
# setup:
# setup:
# - create test database, compute zurl and mountpoint for wcfs
# - create test database, compute zurl and mountpoint for wcfs
...
@@ -416,6 +420,9 @@ class tDB(tWCFS):
...
@@ -416,6 +420,9 @@ class tDB(tWCFS):
t
.
tail
=
t
.
root
.
_p_jar
.
db
().
storage
.
lastTransaction
()
t
.
tail
=
t
.
root
.
_p_jar
.
db
().
storage
.
lastTransaction
()
t
.
dFtail
=
[]
# of DF; head = dFtail[-1].rev
t
.
dFtail
=
[]
# of DF; head = dFtail[-1].rev
# a set of a blocks that were already changed
t
.
changed_blk_set
=
set
([])
# ID of the thread which created tDB
# ID of the thread which created tDB
# ( transaction plays dirty games with threading.local and we have to
# ( transaction plays dirty games with threading.local and we have to
# check the thread is the same when .root is used )
# check the thread is the same when .root is used )
...
@@ -485,6 +492,15 @@ class tDB(tWCFS):
...
@@ -485,6 +492,15 @@ class tDB(tWCFS):
data
=
b
(
data
)
data
=
b
(
data
)
assert
len
(
data
)
<=
zf
.
blksize
assert
len
(
data
)
<=
zf
.
blksize
zfDelta
[
blk
]
=
data
zfDelta
[
blk
]
=
data
# If this is the first change of a block and we have
# zblk format 'auto', the previous block is changed
# to ZBlk0 in case it isn't ZBlk0 already.
if
IS_ZBLK_FMT_AUTO
and
blk
not
in
t
.
changed_blk_set
:
previous_blk
=
blk
-
1
if
previous_blk
in
t
.
changed_blk_set
:
blkdata
,
_
=
t
.
_blkDataAt
(
zf
,
previous_blk
,
t
.
head
)
zfDelta
[
previous_blk
]
=
blkdata
t
.
changed_blk_set
.
add
(
blk
)
# commit commits transaction and makes sure wcfs is synchronized to it.
# commit commits transaction and makes sure wcfs is synchronized to it.
#
#
...
@@ -967,11 +983,9 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
...
@@ -967,11 +983,9 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
#print('-> %s' % t.hpin(pin))
#print('-> %s' % t.hpin(pin))
# {} blk -> at that have to be pinned.
# {} blk -> at that have to be pinned.
#if pinok is not None:
if
pinok
is
not
None
:
# assert pin == pinok, "computed vs explicit pinok"
assert
pin
==
pinok
,
"computed vs explicit pinok"
#pinok = pin
pinok
=
pin
if
not
pinok
:
pinok
=
pin
print
(
'# pinok: %s'
%
t
.
hpin
(
pinok
))
print
(
'# pinok: %s'
%
t
.
hpin
(
pinok
))
# send watch request and check that we receive pins for tracked (previously
# send watch request and check that we receive pins for tracked (previously
...
@@ -981,7 +995,7 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
...
@@ -981,7 +995,7 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
w
.
at
=
at
w
.
at
=
at
# `watch ... -> at_i -> at_j` must be the same as `watch ø -> at_j`
# `watch ... -> at_i -> at_j` must be the same as `watch ø -> at_j`
#
assert w.pinned == t._pinnedAt(zf, at)
assert
w
.
pinned
==
t
.
_pinnedAt
(
zf
,
at
)
return
w
return
w
...
@@ -1859,7 +1873,17 @@ def test_wcfs_crash_old_data():
...
@@ -1859,7 +1873,17 @@ def test_wcfs_crash_old_data():
# wcfs was crashing in setting up watch because of "1" and "2" from above, and
# wcfs was crashing in setting up watch because of "1" and "2" from above, and
# 3. setupWatch was calling ΔFtail.BlkRevAt without putting zhead's transaction into ctx.
# 3. setupWatch was calling ΔFtail.BlkRevAt without putting zhead's transaction into ctx.
wl2
=
t
.
openwatch
()
wl2
=
t
.
openwatch
()
wl2
.
watch
(
zf
,
at2
,
{
0
:
at2
})
if
IS_ZBLK_FMT_AUTO
:
# at2 is first commit of blk 1: heuristic
# switches blk 1 to ZBlk0: therefore it's
# a different state than at 'at1' and needs
# to be pinned to 'at2'.
pinok
=
{
0
:
at2
}
else
:
# ZBlk0/ZBlk1 only change explicitly declared blocks:
# the last data change of block 1 was at 'at1'.
pinok
=
{
0
:
at1
}
wl2
.
watch
(
zf
,
at2
,
pinok
)
# ---- misc ---
# ---- misc ---
...
...
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