[Checkins] SVN: relstorage/trunk/relstorage/tests/ Added a test to verify batching is not likely to overfill SQL database buffers
Shane Hathaway
shane at hathawaymix.org
Sat Oct 17 23:51:49 EDT 2009
Log message for revision 105124:
Added a test to verify batching is not likely to overfill SQL database buffers
Changed:
U relstorage/trunk/relstorage/tests/comparison.ods
U relstorage/trunk/relstorage/tests/reltestbase.py
-=-
Modified: relstorage/trunk/relstorage/tests/comparison.ods
===================================================================
(Binary files differ)
Modified: relstorage/trunk/relstorage/tests/reltestbase.py
===================================================================
--- relstorage/trunk/relstorage/tests/reltestbase.py 2009-10-18 03:36:21 UTC (rev 105123)
+++ relstorage/trunk/relstorage/tests/reltestbase.py 2009-10-18 03:51:48 UTC (rev 105124)
@@ -205,6 +205,35 @@
self.assertEqual(len(got), len(data))
self.assertEqual(got, data)
+ def check16MObject(self):
+ # Store 16 * 1024 * 1024 bytes in an object, then retrieve it
+ data = 'a 16 byte string' * (1024 * 1024)
+ oid = self._storage.new_oid()
+ self._dostoreNP(oid, data=data)
+ got, serialno = self._storage.load(oid, '')
+ self.assertEqual(len(got), len(data))
+ self.assertEqual(got, data)
+
+ def check99X1900Objects(self):
+ # Store 99 objects each with 1900 bytes. This is intended
+ # to exercise possible buffer overfilling that the batching
+ # code might cause.
+ import transaction
+ data = '0123456789012345678' * 100
+ t = transaction.Transaction()
+ self._storage.tpc_begin(t)
+ oids = []
+ for i in range(99):
+ oid = self._storage.new_oid()
+ self._storage.store(oid, '\0'*8, data, '', t)
+ oids.append(oid)
+ self._storage.tpc_vote(t)
+ self._storage.tpc_finish(t)
+ for oid in oids:
+ got, serialno = self._storage.load(oid, '')
+ self.assertEqual(len(got), len(data))
+ self.assertEqual(got, data)
+
def checkPreventOIDOverlap(self):
# Store an object with a particular OID, then verify that
# OID is not reused.
@@ -215,15 +244,6 @@
self.assert_(oid1 < oid2, 'old OID %r should be less than new OID %r'
% (oid1, oid2))
- def check16MObject(self):
- # Store 16 * 1024 * 1024 bytes in an object, then retrieve it
- data = 'a 16 byte string' * (1024 * 1024)
- oid = self._storage.new_oid()
- self._dostoreNP(oid, data=data)
- got, serialno = self._storage.load(oid, '')
- self.assertEqual(len(got), len(data))
- self.assertEqual(got, data)
-
def checkUseCache(self):
# Store an object, cache it, then retrieve it from the cache
self._storage._options.cache_servers = 'x:1 y:2'
More information about the checkins
mailing list