Commit 61df0040 authored by Tim Peters's avatar Tim Peters

By popular demand, FileStorage.pack() no longer propagates a

    FileStorageError:  The database has already been packed to a
    later time or no changes have been made since the last pack

exception.  Instead that message is logged (at INFO level), and
the pack attempt simply returns then (no pack is performed).

Incidentally, this should repair frequent reports of failure in the
new checkPackLotsWhileWriting test.  On non-Windows systems, it
seems that the worker thread often didn't get enough cycles to commit
a change between the main thread's attempts to run pack() (and so
the exception above got raised then).
parent 85a14d2b
...@@ -22,6 +22,13 @@ for the pack attempt to raise a spurious ...@@ -22,6 +22,13 @@ for the pack attempt to raise a spurious
exception. This did no damage to the database, or to the transaction exception. This did no damage to the database, or to the transaction
in progress, but no pack was performed then. in progress, but no pack was performed then.
By popular demand, FileStorage.pack() no longer propagates a
FileStorageError: The database has already been packed to a
later time or no changes have been made since the last pack
exception. Instead that message is logged (at INFO level), and
the pack attempt simply returns then (no pack is performed).
ZEO ZEO
--- ---
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Storage implementation using a log written to a single file. """Storage implementation using a log written to a single file.
$Revision: 1.11 $ $Revision: 1.12 $
""" """
import base64 import base64
...@@ -46,7 +46,7 @@ except ImportError: ...@@ -46,7 +46,7 @@ except ImportError:
def fsIndex(): def fsIndex():
return {} return {}
from zLOG import LOG, BLATHER, WARNING, ERROR, PANIC from zLOG import LOG, BLATHER, INFO, WARNING, ERROR, PANIC
t32 = 1L << 32 t32 = 1L << 32
...@@ -55,6 +55,9 @@ packed_version = "FS21" ...@@ -55,6 +55,9 @@ packed_version = "FS21"
def blather(message, *data): def blather(message, *data):
LOG('ZODB FS', BLATHER, "%s blather: %s\n" % (packed_version, LOG('ZODB FS', BLATHER, "%s blather: %s\n" % (packed_version,
message % data)) message % data))
def info(message, *data):
LOG('ZODB FS', INFO, "%s info: %s\n" % (packed_version,
message % data))
def warn(message, *data): def warn(message, *data):
LOG('ZODB FS', WARNING, "%s warn: %s\n" % (packed_version, LOG('ZODB FS', WARNING, "%s warn: %s\n" % (packed_version,
...@@ -96,6 +99,10 @@ class FileStorageQuotaError(FileStorageError, ...@@ -96,6 +99,10 @@ class FileStorageQuotaError(FileStorageError,
POSException.StorageSystemError): POSException.StorageSystemError):
"""File storage quota exceeded.""" """File storage quota exceeded."""
# Intended to be raised only in fspack.py, and ignored here.
class RedundantPackWarning(FileStorageError):
pass
class TempFormatter(FileStorageFormatter): class TempFormatter(FileStorageFormatter):
"""Helper class used to read formatted FileStorage data.""" """Helper class used to read formatted FileStorage data."""
...@@ -1329,7 +1336,11 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -1329,7 +1336,11 @@ class FileStorage(BaseStorage.BaseStorage,
self._commit_lock_release, self._commit_lock_release,
current_size) current_size)
try: try:
opos = p.pack() opos = None
try:
opos = p.pack()
except RedundantPackWarning, detail:
info(str(detail))
if opos is None: if opos is None:
return return
oldpath = self._file_name + ".old" oldpath = self._file_name + ".old"
......
...@@ -273,8 +273,8 @@ class GC(FileStorageFormatter): ...@@ -273,8 +273,8 @@ class GC(FileStorageFormatter):
if th.status == 'p': if th.status == 'p':
# Delay import to cope with circular imports. # Delay import to cope with circular imports.
# XXX put exceptions in a separate module # XXX put exceptions in a separate module
from ZODB.FileStorage.FileStorage import FileStorageError from ZODB.FileStorage.FileStorage import RedundantPackWarning
raise FileStorageError( raise RedundantPackWarning(
"The database has already been packed to a later time" "The database has already been packed to a later time"
" or no changes have been made since the last pack") " or no changes have been made since the last pack")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment