Commit ea6a66e4 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b83afcab
......@@ -35,12 +35,11 @@ cpdef enum:
MCL_FUTURE = mman.MCL_FUTURE
MCL_ONFAULT = mman.MCL_ONFAULT
# XXX there is no mman.MADV_{NORMAL,RANDOM} -> use POSIX_... as workaround
MADV_NORMAL = mman.POSIX_MADV_NORMAL
MADV_RANDOM = mman.POSIX_MADV_RANDOM
MADV_SEQUENTIAL = mman.POSIX_MADV_SEQUENTIAL
MADV_WILLNEED = mman.POSIX_MADV_WILLNEED
MADV_DONTNEED = mman.POSIX_MADV_DONTNEED
MADV_NORMAL = mman.MADV_NORMAL
MADV_RANDOM = mman.MADV_RANDOM
MADV_SEQUENTIAL = mman.MADV_SEQUENTIAL
MADV_WILLNEED = mman.MADV_WILLNEED
MADV_DONTNEED = mman.MADV_DONTNEED
# incore returns bytearray vector indicating whether page of mem is in core or not.
#
......@@ -136,8 +135,7 @@ def advise(const unsigned char[::1] mem not None, int advice):
cdef const void *addr = &mem[0]
cdef size_t size = mem.shape[0]
# XXX using posix_madvise, not madvise
cdef err = mman.posix_madvise(<void *>addr, size, advice)
cdef err = mman.madvise(<void *>addr, size, advice)
if err:
PyErr_SetFromErrno(OSError)
......
......@@ -1534,6 +1534,32 @@ def test_wcfs_remmap_on_pin():
f._assertBlk(2, 'hello', {wl: {2:at1}}, pinfunc=_) # NOTE not world
# verify that pin message is not sent for the same blk@at the second time, if
# it was already sent once.
@func
def test_wcfs_no_pin_twice():
t = tDB(); zf = t.zfile
defer(t.close)
f = t.open(zf)
at1 = t.commit(zf, {2:'c1'})
at2 = t.commit(zf, {2:'c2'})
wl = t.openwatch()
w = wl.watch(zf, at1, {})
f.assertCache([0,0,0])
f.assertBlk(2, 'c2', {wl: {2:at1}})
f.assertCache([0,0,1])
assert w.pinned == {2:at1}
# drop file[blk] from cache, access again -> no pin message sent the second time
print('\n\n\n\n\nABCDEF\n\n\n')
mm.advise(f._blk(2), mm.MADV_DONTNEED)
f.assertCache([0,0,0])
# XXX
# verify watching for 2 files over single watch link.
@func
def test_wcfs_watch_2files():
......@@ -1578,8 +1604,6 @@ def test_wcfs_watch_2files():
# XXX drop file[blk] from cache, access again -> no pin message sent the second time
# XXX watch with @at > head - must wait for head to become >= at
# XXX no reply to pin - killed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment