Commit 358cd09c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 95df0951
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
// clients, that had requested it (separately to each client), about the // clients, that had requested it (separately to each client), about the
// changes: // changes:
// //
// S: 2 pin <bigfileX> #<blk> @<rev_max> XXX 2-> 2*k (multiple pins in parallel) // S: <2·k> pin <bigfileX> #<blk> @<rev_max>
// //
// and waits until all clients confirm that changed file block can be updated // and waits until all clients confirm that changed file block can be updated
// in global OS cache. // in global OS cache.
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
// //
// and must send ack back to the server when it is done: // and must send ack back to the server when it is done:
// //
// C: 2 ack // C: <2·k> ack
// //
// The server sends pin notifications only for file blocks, that are known to // The server sends pin notifications only for file blocks, that are known to
// be potentially changed after client's <at>, and <rev_max> describes the // be potentially changed after client's <at>, and <rev_max> describes the
......
...@@ -129,6 +129,9 @@ class tDB: ...@@ -129,6 +129,9 @@ class tDB:
t.head = None t.head = None
t._headv = [] t._headv = []
# number of commits made so far
t.ncommit = 0
# fh(.wcfs/zhead) + history of zhead read from there # fh(.wcfs/zhead) + history of zhead read from there
t._wc_zheadfh = open(t.wc.mountpoint + "/.wcfs/zhead") t._wc_zheadfh = open(t.wc.mountpoint + "/.wcfs/zhead")
t._wc_zheadv = [] t._wc_zheadv = []
...@@ -164,6 +167,7 @@ class tDB: ...@@ -164,6 +167,7 @@ class tDB:
data += b'\0'*(zf.blksize - len(data)) # trailing \0 data += b'\0'*(zf.blksize - len(data)) # trailing \0
vma = zfh.mmap(blk, 1) vma = zfh.mmap(blk, 1)
memcpy(vma, data) memcpy(vma, data)
print(' δ f<%s>\t%s' % (h(zf._p_oid), sorted(zfDelta.keys())))
t._changed = {} t._changed = {}
# NOTE there is no clean way to retrieve tid of just committed transaction # NOTE there is no clean way to retrieve tid of just committed transaction
...@@ -173,7 +177,8 @@ class tDB: ...@@ -173,7 +177,8 @@ class tDB:
transaction.commit() transaction.commit()
head = last._p_serial head = last._p_serial
#print('commit -> %s' % h(head)) t.ncommit += 1
print('commit -> @%s\t# @at%d' % (h(head), t.ncommit))
t.head = head t.head = head
t._headv.append(head) t._headv.append(head)
return head return head
...@@ -533,6 +538,9 @@ def test_wcfs(): ...@@ -533,6 +538,9 @@ def test_wcfs():
t.stat(nonfile) t.stat(nonfile)
assert exc.value.errno == EINVAL assert exc.value.errno == EINVAL
# reset ncommit so that atX in the code correspond with debug output
t.ncommit = 0
# >>> file initially empty # >>> file initially empty
f = t.open(zf) f = t.open(zf)
f.assertCache([]) f.assertCache([])
...@@ -612,8 +620,8 @@ def test_wcfs(): ...@@ -612,8 +620,8 @@ def test_wcfs():
@func @func
def _(): def _():
defer(done.close) defer(done.close)
pinv = w.expectPin([(zf, 2, at1), (zf, 3, at1)]) pinv = w.expectPin([(zf, 2, at1), (zf, 3, at2)])
#pinv = w.expectPin({zf: [(2, at1), (3, at1)]}) XXX <- this way better? (sugar) #pinv = w.expectPin({zf: [(2, at1), (3, at2)]}) XXX <- this way better? (sugar)
for p in pinv: for p in pinv:
p.ack() p.ack()
go(_) go(_)
......
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