Commit 0b9a39dd authored by Christian Theune's avatar Christian Theune

Explain checkIteratorGCSpanTransactions a bit.

parent 46ec36db
...@@ -45,11 +45,14 @@ class IterationTests: ...@@ -45,11 +45,14 @@ class IterationTests:
self.assertRaises(KeyError, self._storage._server.iterator_next, iid) self.assertRaises(KeyError, self._storage._server.iterator_next, iid)
def checkIteratorGCSpanTransactions(self): def checkIteratorGCSpanTransactions(self):
# Keep a hard reference to the iterator so it won't be automatically
# garbage collected at the transaction boundary.
iterator = self._storage.iterator() iterator = self._storage.iterator()
t = transaction.Transaction() t = transaction.Transaction()
self._storage.tpc_begin(t) self._storage.tpc_begin(t)
self._storage.tpc_vote(t) self._storage.tpc_vote(t)
self._storage.tpc_finish(t) self._storage.tpc_finish(t)
# As the iterator was not garbage collected, we can still use it.
self.assertEquals([], list(iterator)) self.assertEquals([], list(iterator))
def checkIteratorGCStorageCommitting(self): def checkIteratorGCStorageCommitting(self):
...@@ -100,6 +103,7 @@ class IterationTests: ...@@ -100,6 +103,7 @@ class IterationTests:
self.assertRaises(StopIteration, iter1.next) self.assertRaises(StopIteration, iter1.next)
self.assertRaises(StopIteration, iter2.next) self.assertRaises(StopIteration, iter2.next)
def iterator_sane_after_reconnect(): def iterator_sane_after_reconnect():
r"""Make sure that iterators are invalidated on disconnect. r"""Make sure that iterators are invalidated on disconnect.
......
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