[Checkins] SVN: relstorage/trunk/relstorage/adapters/mover.py No need to use a counter to load all rows here.

Martijn Pieters mj at zopatista.com
Tue Jun 14 07:09:14 EDT 2011


Log message for revision 121925:
  No need to use a counter to load all rows here.
  
  Because we no longer are in danger of loading all the data into memory, we can just loop over the chunk rows in order here. We still use .fetch_one() so we can access the current blob object for each row.

Changed:
  U   relstorage/trunk/relstorage/adapters/mover.py

-=-
Modified: relstorage/trunk/relstorage/adapters/mover.py
===================================================================
--- relstorage/trunk/relstorage/adapters/mover.py	2011-06-13 21:49:29 UTC (rev 121924)
+++ relstorage/trunk/relstorage/adapters/mover.py	2011-06-14 11:09:14 UTC (rev 121925)
@@ -1050,18 +1050,17 @@
         FROM blob_chunk
         WHERE zoid = :1
             AND tid = :2
-            AND chunk_num = :3
+        ORDER BY chunk_num
         """
 
         f = None
         bytes = 0
-        chunk_num = 0
         # XXX Current versions of cx_Oracle only support offsets up
         # to sys.maxint or 4GB, whichever comes first.
         maxsize = min(sys.maxint, 1<<32)
         try:
+            cursor.execute(stmt, (oid, tid))
             while True:
-                cursor.execute(stmt, (oid, tid, chunk_num))
                 try:
                     blob, = cursor.fetchone()
                 except TypeError:
@@ -1091,7 +1090,6 @@
                             break
                     else:
                         break
-                chunk_num += 1
         except:
             if f is not None:
                 f.close()



More information about the checkins mailing list