Hi,

Could you give the attached patch for Jessie's S3QL a try? It should
allow to upgrade from wheezy file systems.

(Try it with a test file system first)

Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«
diff --git a/src/s3ql/adm.py b/src/s3ql/adm.py
--- a/src/s3ql/adm.py
+++ b/src/s3ql/adm.py
@@ -305,7 +305,10 @@
         raise QuietError()
 
     # Check revision
-    if param['revision'] < CURRENT_FS_REV-1:
+    if param['revision'] >= CURRENT_FS_REV:
+        print('File system already at most-recent revision')
+        return
+    elif param['revision'] not in (16,20):
         print(textwrap.dedent('''
             File system revision too old to upgrade!
 
@@ -316,10 +319,6 @@
         print(get_old_rev_msg(param['revision'] + 1, 's3qladm'))
         raise QuietError()
 
-    elif param['revision'] >= CURRENT_FS_REV:
-        print('File system already at most-recent revision')
-        return
-
     print(textwrap.dedent('''
         I am about to update the file system to the newest revision.
         You will not be able to access the file system with any older version
@@ -337,6 +336,22 @@
     if sys.stdin.readline().strip().lower() != 'yes':
         raise QuietError()
 
+    if param['revision'] == 16:
+        log.info('Upgrading from revision 16 to 20...')
+        # For this upgrade, we need to recreate the sqlite database from the
+        # metadata dump, because some SQLite types have changed
+        log.info('Discarding cached metadata to trigger database rebuild.')
+        db = None
+        
+        # Keep backup of local metadata (just in case...)
+        if os.path.exists(cachepath + '.params'):
+            assert os.path.exists(cachepath + '.db')
+            if (os.path.exists(cachepath + '.db.bak') or
+                os.path.exists(cachepath + '.params.bak')):
+                raise QuietError('Metadata backup already exists, did something go wrong?')
+            os.rename(cachepath + '.db', cachepath + '.db.bak')
+            os.rename(cachepath + '.params', cachepath + '.params.bak')
+
     if not db:
         # Need to download metadata
         with tempfile.TemporaryFile() as tmpfh:
@@ -352,7 +367,7 @@
             tmpfh.seek(0)
             db = restore_metadata(tmpfh, cachepath + '.db')
 
-    log.info('Upgrading from revision %d to %d...', param['revision'], CURRENT_FS_REV)
+    log.info('Upgrading from revision 20 to %d...', CURRENT_FS_REV)
 
     param['revision'] = CURRENT_FS_REV
     param['last-modified'] = time.time()
@@ -402,9 +417,8 @@
     print(textwrap.dedent('''\
         File system upgrade complete.
 
-        It is strongly recommended to run the s3ql_verify command with the
-        --data option as soon as possible. This is necessary to ensure that the
-        upgrade to the next (2.11) S3QL release will run smoothly.'''))
+        It is strongly recommended to run the new s3ql_verify command with the
+        --data option at least once and as soon as possible.'''))
 
 # This should be used on the *next* fs revision update to ensure that all
 # objects conform to newest standards, so we can drop the legacy routines from

Reply via email to