[server] portable dump format supports now ZIP64 extensions by default (closes #1912535)

ZIP files can use the ZIP64 extensions when the zipfile is larger than 2 GB. zipfile will raise an exception when the ZIP file would require ZIP64 extensions.

Note: ZIP64 extensions are disabled by default in stdlib because the default zip and unzip commands on Unix (the InfoZIP utilities) don?t support these extensions.

authorSylvain Th?nault <sylvain.thenault@logilab.fr>
changesetd9607ae447d2
branchstable
phasepublic
hiddenno
parent revision#18a366267612 [repo] use smarter query to check asource presence on startup (closes #1922099)
child revision#cc8670be7b2e [debian] fix init script dependencies (closes #1921729)
files modified by this revision
server/sources/native.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1315928542 -7200
# Tue Sep 13 17:42:22 2011 +0200
# Branch stable
# Node ID d9607ae447d2a55f43ac850c21a6b8980ccb522e
# Parent 18a366267612dff662dc78f104772686b4a38444
[server] portable dump format supports now ZIP64 extensions by default (closes #1912535)

ZIP files can use the ZIP64 extensions when the zipfile is larger than 2 GB.
zipfile will raise an exception when the ZIP file would require ZIP64 extensions.

Note: ZIP64 extensions are disabled by default in stdlib because the default
zip and unzip commands on Unix (the InfoZIP utilities) don’t support these
extensions.

diff --git a/server/sources/native.py b/server/sources/native.py
@@ -1649,11 +1649,11 @@
1 
2      def get_connection(self):
3          return self._source.get_connection()
4 
5      def backup(self, backupfile):
6 -        archive=zipfile.ZipFile(backupfile, 'w')
7 +        archive=zipfile.ZipFile(backupfile, 'w', allowZip64=True)
8          self.cnx = self.get_connection()
9          try:
10              self.cursor = self.cnx.cursor()
11              self.cursor.arraysize=100
12              self.logger.info('writing metadata')
@@ -1745,11 +1745,11 @@
13 
14      def _serialize(self, name, columns, rows):
15          return dumps((name, columns, rows), pickle.HIGHEST_PROTOCOL)
16 
17      def restore(self, backupfile):
18 -        archive = zipfile.ZipFile(backupfile, 'r')
19 +        archive = zipfile.ZipFile(backupfile, 'r', allowZip64=True)
20          self.cnx = self.get_connection()
21          self.cursor = self.cnx.cursor()
22          sequences, tables, table_chunks = self.read_metadata(archive, backupfile)
23          for seq in sequences:
24              self.logger.info('restoring sequence %s', seq)