Commit 38ef55f0 authored by Jim Fulton's avatar Jim Fulton

Call readCurrent for internal nodes when making updates.

parent 6a2b9187
...@@ -639,6 +639,10 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value, ...@@ -639,6 +639,10 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
BTREE_SEARCH(min, self, key, goto Error); BTREE_SEARCH(min, self, key, goto Error);
d = self->data + min; d = self->data + min;
#ifdef PERSISTENT
PER_READCURRENT(self, goto Error);
#endif
if (SameType_Check(self, d->child)) if (SameType_Check(self, d->child))
status = _BTree_set(BTREE(d->child), keyarg, value, unique, noval); status = _BTree_set(BTREE(d->child), keyarg, value, unique, noval);
else { else {
......
...@@ -146,6 +146,49 @@ class Base(TestCase): ...@@ -146,6 +146,49 @@ class Base(TestCase):
self.assertEqual(list(t.keys(0, 2, excludemin=True, excludemax=True)), self.assertEqual(list(t.keys(0, 2, excludemin=True, excludemax=True)),
[1]) [1])
def testUpdatesDoReadChecksOnInternalNodes(self):
t = self.t
if not hasattr(t, '_firstbucket'):
return
self._populate(t, 1000)
store = MappingStorage()
db = DB(store)
conn = db.open()
conn.root.t = t
transaction.commit()
read = []
def readCurrent(ob):
read.append(ob)
conn.__class__.readCurrent(conn, ob)
return 1
conn.readCurrent = readCurrent
try:
add = t.add
remove = t.remove
except AttributeError:
def add(i):
t[i] = i
def remove(i):
del t[i]
# Modifying a thing
remove(100)
self.assert_(t in read)
del read[:]
add(100)
self.assert_(t in read)
del read[:]
transaction.abort()
conn.cacheMinimize()
# list(t)
# self.assert_(100 in t)
# self.assert_(not read)
class MappingBase(Base): class MappingBase(Base):
""" Tests common to mappings (buckets, btrees) """ """ Tests common to mappings (buckets, btrees) """
......
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