Commit 8366ba1d authored by Jim Fulton's avatar Jim Fulton

Merge remote-tracking branch 'origin/asyncio' into ClientDisconnected-is-transient

parents 98ac50eb a07f8af3
...@@ -180,12 +180,10 @@ Which is a short-hand for:: ...@@ -180,12 +180,10 @@ Which is a short-hand for::
connection = db.open() connection = db.open()
If you exit the Python process, the storage exits as well, as it's run If you exit the Python process, the storage exits as well, as it's run
in an in-process thread. It will leave behind it's configuration and in an in-process thread.
log file. This provides a handy way to get a configuration example.
You shut down the server more cleanly by calling the stop function You shut down the server more cleanly by calling the stop function
returned by the ``ZEO.server`` function. This will remove the returned by the ``ZEO.server`` function.
temporary configuration file.
To have data stored persistently, you can specify a file-storage path To have data stored persistently, you can specify a file-storage path
name using a ``path`` parameter. If you want blob support, you can name using a ``path`` parameter. If you want blob support, you can
......
...@@ -43,13 +43,14 @@ from ZEO.Exceptions import AuthError ...@@ -43,13 +43,14 @@ from ZEO.Exceptions import AuthError
from .monitor import StorageStats, StatsServer from .monitor import StorageStats, StatsServer
from .zrpc.connection import ManagedServerConnection, Delay, MTDelay, Result from .zrpc.connection import ManagedServerConnection, Delay, MTDelay, Result
from .zrpc.server import Dispatcher from .zrpc.server import Dispatcher
from ZODB.ConflictResolution import ResolvedSerial
from ZODB.loglevels import BLATHER from ZODB.loglevels import BLATHER
from ZODB.POSException import StorageError, StorageTransactionError from ZODB.POSException import StorageError, StorageTransactionError
from ZODB.POSException import TransactionError, ReadOnlyError, ConflictError from ZODB.POSException import TransactionError, ReadOnlyError, ConflictError
from ZODB.serialize import referencesf from ZODB.serialize import referencesf
from ZODB.utils import oid_repr, p64, u64, z64 from ZODB.utils import oid_repr, p64, u64, z64
ResolvedSerial = b'rs'
logger = logging.getLogger('ZEO.StorageServer') logger = logging.getLogger('ZEO.StorageServer')
def log(message, level=logging.INFO, label='', exc_info=False): def log(message, level=logging.INFO, label='', exc_info=False):
......
...@@ -139,6 +139,7 @@ def runner(config, qin, qout, timeout=None, ...@@ -139,6 +139,7 @@ def runner(config, qin, qout, timeout=None,
) )
thread.setDaemon(True) thread.setDaemon(True)
thread.start() thread.start()
os.remove(config)
try: try:
qin.get(timeout=timeout) # wait for shutdown qin.get(timeout=timeout) # wait for shutdown
...@@ -181,7 +182,6 @@ def stop_runner(thread, config, qin, qout, stop_timeout=9, pid=None): ...@@ -181,7 +182,6 @@ def stop_runner(thread, config, qin, qout, stop_timeout=9, pid=None):
gc.collect() gc.collect()
thread.join(stop_timeout) thread.join(stop_timeout)
os.remove(config)
def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False, def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False,
path='Data.fs', protocol=None, blob_dir=None, path='Data.fs', protocol=None, blob_dir=None,
......
...@@ -25,6 +25,22 @@ Now, let's create some client storages that connect to these: ...@@ -25,6 +25,22 @@ Now, let's create some client storages that connect to these:
>>> import os, ZEO, ZODB.blob, ZODB.POSException, transaction >>> import os, ZEO, ZODB.blob, ZODB.POSException, transaction
>>> db0 = ZEO.DB(port0, blob_dir='cb0') >>> db0 = ZEO.DB(port0, blob_dir='cb0')
XXX Work around a ZEO4 server bug (that was fixed in the ZEO5 server)
which prevents sending invalidations, and thus tids for transactions
that only add objects. This doesn't matter for ZODB4/ZEO4 but does
for ZODB5/ZEO5, with it's greater reliance on MVCC. This mainly
affects creation of the database root object, which is typically the
only transaction that only adds objects. Exacerbating this further is
that previously, databases didn't really use MVCC when checking for
the root object, but now they do because they go through a connection.
>>> with db0.transaction() as conn:
... conn.root.work_around_zeo4_server_bug = 1
>>> with db0.transaction() as conn:
... del conn.root.work_around_zeo4_server_bug
>>> db1 = ZEO.DB(addr1, blob_dir='cb1') >>> db1 = ZEO.DB(addr1, blob_dir='cb1')
>>> tm1 = transaction.TransactionManager() >>> tm1 = transaction.TransactionManager()
>>> c1 = db1.open(transaction_manager=tm1) >>> c1 = db1.open(transaction_manager=tm1)
......
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