[Checkins] SVN: zodbupdate/trunk/ Add an option to pack storage at the end.

Sylvain Viollon sylvain at infrae.com
Wed Jun 23 04:06:02 EDT 2010


Log message for revision 113777:
  Add an option to pack storage at the end.
  Update README.txt.
  
  

Changed:
  U   zodbupdate/trunk/README.txt
  U   zodbupdate/trunk/src/zodbupdate/main.py

-=-
Modified: zodbupdate/trunk/README.txt
===================================================================
--- zodbupdate/trunk/README.txt	2010-06-23 06:33:33 UTC (rev 113776)
+++ zodbupdate/trunk/README.txt	2010-06-23 08:06:02 UTC (rev 113777)
@@ -16,6 +16,8 @@
 
 Having run this tool, you are then free to delete the old code.
 
+.. contents::
+
 Usage
 =====
 
@@ -83,3 +85,40 @@
 
     renames = {'mypackage.mymodule ClassName':
                'otherpackage.othermodule OtherClass'}
+
+As soon as you have rules defined, you can already remove the old
+import location.
+
+
+Packing
+-------
+
+The option ``--pack`` will pack the storage on success. (You tell your
+users to use that option. If they never pack their storage, it is a good
+occasion).
+
+
+Problems and solutions
+----------------------
+
+Your Data.fs has POSKey errors
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you call `zodbupdate` with ``-f`` and the path to your Data.fs,
+records triggering those errors will be ignored.
+
+
+Your Data.fs is old and have been created with Zope 2 and you get strange errors
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Some special support for an old record format got removed from Python
+2.6. Running `zodbupdate` with the Python pickler (``-p Python``) will
+load those records and fix them.
+
+This will fix your Data.fs.
+
+You have an another error
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+We recommand to run zodbupdate with ``-v -d -p Python`` to get the
+maximum of information.

Modified: zodbupdate/trunk/src/zodbupdate/main.py
===================================================================
--- zodbupdate/trunk/src/zodbupdate/main.py	2010-06-23 06:33:33 UTC (rev 113776)
+++ zodbupdate/trunk/src/zodbupdate/main.py	2010-06-23 08:06:02 UTC (rev 113777)
@@ -12,13 +12,15 @@
 #
 ##############################################################################
 
+import ZODB.FileStorage
 import ZODB.config
-import ZODB.FileStorage
+import ZODB.serialize
 import logging
 import optparse
 import pkg_resources
 import pprint
 import sys
+import time
 import zodbupdate.update
 import zodbupdate.utils
 
@@ -52,8 +54,12 @@
 parser.add_option(
     "-p", "--pickler", default="C",
     help="chooser unpickler implementation C or Python (default C)")
+parser.add_option(
+    "--pack", action="store_true", dest="pack",
+    help="pack the storage when done. use in conjunction of -c if you have blobs storage")
 
 
+
 class DuplicateFilter(object):
 
     def __init__(self):
@@ -134,5 +140,8 @@
         f = open(options.save_renames, 'w')
         f.write('renames = %s' % pprint.pformat(rename_rules))
         f.close()
+    if options.pack:
+        print 'Packing storage ...'
+        storage.pack(time.time(), ZODB.serialize.referencesf)
     storage.close()
 



More information about the checkins mailing list