[Checkins] SVN: relstorage/branches/1.4.0-fastimport/relstorage/ More logging during zodbconvert as it is frustrating to not know if anything is happening during actions that can take a long time.

Maurits van Rees m.van.rees at zestsoftware.nl
Thu Jan 6 08:44:32 EST 2011


Log message for revision 119419:
  More logging during zodbconvert as it is frustrating to not know if anything is happening during actions that can take a long time.

Changed:
  U   relstorage/branches/1.4.0-fastimport/relstorage/adapters/schema.py
  U   relstorage/branches/1.4.0-fastimport/relstorage/zodbconvert.py

-=-
Modified: relstorage/branches/1.4.0-fastimport/relstorage/adapters/schema.py
===================================================================
--- relstorage/branches/1.4.0-fastimport/relstorage/adapters/schema.py	2011-01-06 12:48:21 UTC (rev 119418)
+++ relstorage/branches/1.4.0-fastimport/relstorage/adapters/schema.py	2011-01-06 13:44:31 UTC (rev 119419)
@@ -13,12 +13,15 @@
 ##############################################################################
 """Database schema installers
 """
+import logging
 from relstorage.adapters.interfaces import ISchemaInstaller
 from ZODB.POSException import StorageError
 from zope.interface import implements
 import re
 import time
 
+log = logging.getLogger("relstorage")
+
 relstorage_op_version = '1.4'
 
 history_preserving_schema = """
@@ -711,14 +714,20 @@
             existent = set(self.list_tables(cursor))
             todo = list(self.all_tables)
             todo.reverse()
+            log.info("Checking tables: %r", todo)
             for table in todo:
+                log.info("Considering table %s", table)
                 if table.startswith('temp_'):
                     continue
                 if table in existent:
+                    log.info("Deleting table %s...", table)
                     cursor.execute("DELETE FROM %s" % table)
+            log.info("Done deleting tables.")
             script = filter_script(self.init_script, self.database_name)
             if script:
+                log.info("Running init script.")
                 self.runner.run_script(cursor, script)
+                log.info("Done running init script.")
         self.connmanager.open_and_call(callback)
 
     def drop_all(self):

Modified: relstorage/branches/1.4.0-fastimport/relstorage/zodbconvert.py
===================================================================
--- relstorage/branches/1.4.0-fastimport/relstorage/zodbconvert.py	2011-01-06 12:48:21 UTC (rev 119418)
+++ relstorage/branches/1.4.0-fastimport/relstorage/zodbconvert.py	2011-01-06 13:44:31 UTC (rev 119419)
@@ -101,12 +101,14 @@
 
     else:
         if options.clear:
+            log.info("Clearing old data...")
             if hasattr(destination, 'zap_all'):
                 destination.zap_all()
             else:
                 msg = ("Error: no API is known for clearing this type "
                        "of storage. Use another method.")
                 sys.exit(msg)
+            log.info("Done clearing old data.")
 
         if storage_has_data(destination):
             msg = "Error: the destination storage has data.  Try --clear."
@@ -115,7 +117,11 @@
         copy_args = [source]
         if issubclass(destination.__class__, RelStorage):
             copy_args.append(options.single_transaction)
+        log.info("Started copying transactions...")
+        log.info("This will take long...")
         num_txns, size, elapsed = destination.copyTransactionsFrom(*copy_args)
+        log.info("Done copying transactions.")
+        log.info("Closing up...")
 
         try:
             source.close()



More information about the checkins mailing list