[Checkins] SVN: relstorage/branches/1.1/relstorage/ updated the
mysql adapter to match the pack changes
Shane Hathaway
shane at hathawaymix.org
Fri Apr 11 17:00:34 EDT 2008
Log message for revision 85259:
updated the mysql adapter to match the pack changes
Changed:
U relstorage/branches/1.1/relstorage/adapters/mysql.py
U relstorage/branches/1.1/relstorage/relstorage.py
U relstorage/branches/1.1/relstorage/tests/packstresstest.py
-=-
Modified: relstorage/branches/1.1/relstorage/adapters/mysql.py
===================================================================
--- relstorage/branches/1.1/relstorage/adapters/mysql.py 2008-04-11 20:33:39 UTC (rev 85258)
+++ relstorage/branches/1.1/relstorage/adapters/mysql.py 2008-04-11 21:00:34 UTC (rev 85259)
@@ -75,6 +75,7 @@
CREATE TABLE transaction (
tid BIGINT NOT NULL PRIMARY KEY,
packed BOOLEAN NOT NULL DEFAULT FALSE,
+ empty BOOLEAN NOT NULL DEFAULT FALSE,
username BLOB NOT NULL,
description BLOB NOT NULL,
extension BLOB
@@ -122,11 +123,9 @@
CREATE TABLE object_ref (
zoid BIGINT NOT NULL,
tid BIGINT NOT NULL,
- to_zoid BIGINT NOT NULL
+ to_zoid BIGINT NOT NULL,
+ PRIMARY KEY (tid, zoid, to_zoid)
) ENGINE = MyISAM;
- CREATE INDEX object_ref_from ON object_ref (zoid);
- CREATE INDEX object_ref_tid ON object_ref (tid);
- CREATE INDEX object_ref_to ON object_ref (to_zoid);
-- The object_refs_added table tracks whether object_refs has
-- been populated for all states in a given transaction.
@@ -154,6 +153,19 @@
keep_tid BIGINT
) ENGINE = MyISAM;
CREATE INDEX pack_object_keep_zoid ON pack_object (keep, zoid);
+
+ -- Temporary state during packing: the list of object states to pack.
+ CREATE TABLE pack_state (
+ tid BIGINT NOT NULL,
+ zoid BIGINT NOT NULL,
+ PRIMARY KEY (tid, zoid)
+ ) ENGINE = MyISAM;
+
+ -- Temporary state during packing: the list of transactions that
+ -- have at least one object state to pack.
+ CREATE TABLE pack_state_tid (
+ tid BIGINT NOT NULL PRIMARY KEY
+ ) ENGINE = MyISAM;
"""
self._run_script(cursor, stmt)
Modified: relstorage/branches/1.1/relstorage/relstorage.py
===================================================================
--- relstorage/branches/1.1/relstorage/relstorage.py 2008-04-11 20:33:39 UTC (rev 85258)
+++ relstorage/branches/1.1/relstorage/relstorage.py 2008-04-11 21:00:34 UTC (rev 85259)
@@ -33,7 +33,7 @@
# Set the RELSTORAGE_ABORT_EARLY environment variable when debugging
# a failure revealed by the ZODB test suite. The test suite often fails
# to call tpc_abort in the event of an error, leading to deadlocks.
-# The variable causes RelStorage to abort failed transactions
+# This variable causes RelStorage to abort failed transactions
# early rather than wait for an explicit abort.
abort_early = os.environ.get('RELSTORAGE_ABORT_EARLY')
Modified: relstorage/branches/1.1/relstorage/tests/packstresstest.py
===================================================================
--- relstorage/branches/1.1/relstorage/tests/packstresstest.py 2008-04-11 20:33:39 UTC (rev 85258)
+++ relstorage/branches/1.1/relstorage/tests/packstresstest.py 2008-04-11 21:00:34 UTC (rev 85259)
@@ -2,7 +2,6 @@
import logging
from ZODB.DB import DB
-from relstorage.adapters.postgresql import PostgreSQLAdapter
from relstorage.relstorage import RelStorage
import transaction
from persistent.mapping import PersistentMapping
@@ -11,7 +10,13 @@
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
-a = PostgreSQLAdapter(dsn="dbname='packtest'")
+if 1:
+ from relstorage.adapters.mysql import MySQLAdapter
+ a = MySQLAdapter(db='packtest')
+else:
+ from relstorage.adapters.postgresql import PostgreSQLAdapter
+ a = PostgreSQLAdapter(dsn="dbname='packtest'")
+
s = RelStorage(a)
d = DB(s)
c = d.open()
@@ -19,7 +24,7 @@
print 'size:'
print d.getSize()
-if 0:
+if 1:
print 'initializing...'
container = PersistentMapping()
c.root()['container'] = container
More information about the Checkins
mailing list