Commit 00f6abf3 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 e15aeeca
......@@ -22,6 +22,13 @@ for the pack attempt to raise a spurious
exception. This did no damage to the database, or to the transaction
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
---
......
......@@ -13,7 +13,7 @@
##############################################################################
"""Storage implementation using a log written to a single file.
$Revision: 1.11 $
$Revision: 1.12 $
"""
import base64
......@@ -46,7 +46,7 @@ except ImportError:
def fsIndex():
return {}
from zLOG import LOG, BLATHER, WARNING, ERROR, PANIC
from zLOG import LOG, BLATHER, INFO, WARNING, ERROR, PANIC
t32 = 1L << 32
......@@ -55,6 +55,9 @@ packed_version = "FS21"
def blather(message, *data):
LOG('ZODB FS', BLATHER, "%s blather: %s\n" % (packed_version,
message % data))
def info(message, *data):
LOG('ZODB FS', INFO, "%s info: %s\n" % (packed_version,
message % data))
def warn(message, *data):
LOG('ZODB FS', WARNING, "%s warn: %s\n" % (packed_version,
......@@ -96,6 +99,10 @@ class FileStorageQuotaError(FileStorageError,
POSException.StorageSystemError):
"""File storage quota exceeded."""
# Intended to be raised only in fspack.py, and ignored here.
class RedundantPackWarning(FileStorageError):
pass
class TempFormatter(FileStorageFormatter):
"""Helper class used to read formatted FileStorage data."""
......@@ -1329,7 +1336,11 @@ class FileStorage(BaseStorage.BaseStorage,
self._commit_lock_release,
current_size)
try:
opos = p.pack()
opos = None
try:
opos = p.pack()
except RedundantPackWarning, detail:
info(str(detail))
if opos is None:
return
oldpath = self._file_name + ".old"
......
......@@ -273,8 +273,8 @@ class GC(FileStorageFormatter):
if th.status == 'p':
# Delay import to cope with circular imports.
# XXX put exceptions in a separate module
from ZODB.FileStorage.FileStorage import FileStorageError
raise FileStorageError(
from ZODB.FileStorage.FileStorage import RedundantPackWarning
raise RedundantPackWarning(
"The database has already been packed to a later time"
" 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