[Checkins] SVN: relstorage/trunk/ Use the database name as the cache-prefix by default. This

Shane Hathaway shane at hathawaymix.org
Fri Sep 30 16:41:23 EST 2011


Log message for revision 123004:
  Use the database name as the cache-prefix by default. This
  will hopefully help people who accidentally use a single cache for
  multiple databases.
  
  

Changed:
  U   relstorage/trunk/CHANGES.txt
  U   relstorage/trunk/README.txt
  U   relstorage/trunk/relstorage/adapters/batch.py
  U   relstorage/trunk/relstorage/adapters/dbiter.py
  U   relstorage/trunk/relstorage/adapters/mover.py
  U   relstorage/trunk/relstorage/adapters/mysql.py
  U   relstorage/trunk/relstorage/adapters/oracle.py
  U   relstorage/trunk/relstorage/adapters/packundo.py
  U   relstorage/trunk/relstorage/adapters/postgresql.py
  U   relstorage/trunk/relstorage/adapters/schema.py
  U   relstorage/trunk/relstorage/cache.py
  U   relstorage/trunk/relstorage/storage.py
  U   relstorage/trunk/relstorage/tests/test_cache.py

-=-
Modified: relstorage/trunk/CHANGES.txt
===================================================================
--- relstorage/trunk/CHANGES.txt	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/CHANGES.txt	2011-09-30 21:41:22 UTC (rev 123004)
@@ -5,30 +5,34 @@
   debug; this stage takes mere seconds, even in large sites, but could produce
   10s of thousands of lines of log output.
 
-- Add an --incremental option to the zodbconvert script, letting you convert
-  additional transactions at a later date, or update a non-live copy of your
-  database, copying over missing transactions.
+- zodbconvert: Add an --incremental option to the zodbconvert script,
+  letting you convert additional transactions at a later date, or
+  update a non-live copy of your database, copying over missing
+  transactions.
 
-- Added the ro-replica-conf option, which tells RelStorage to use a
-  read-only database replica for load connections. This allows
-  RelStorage to use read-only database replicas whenever possible.
+- Replication: Added the ro-replica-conf option, which tells RelStorage
+  to use a read-only database replica for load connections. This makes
+  it easy for RelStorage clients to take advantage of read-only
+  database replicas.
 
-- When the database connection is stale (such as when RelStorage switches
-  to an asynchronous replica that is not yet up to date), RelStorage will
-  now raise ReadConflictError by default. Ideally, the application will
-  react to the error by transparently retrying the transaction, while
-  the database gets up to date. A subsequent transaction will no longer
-  be stale.
+- Replication: When the database connection is stale (such as when
+  RelStorage switches to an asynchronous replica that is not yet up to
+  date), RelStorage will now raise ReadConflictError by default.
+  Ideally, the application will react to the error by transparently
+  retrying the transaction, while the database gets up to date. A
+  subsequent transaction will no longer be stale.
 
-- Added the revert-when-stale option. When the option is true and the
-  database connection is stale, RelStorage reverts the ZODB connection
-  to the stale state rather than raise ReadConflictError. This is the
-  old behavior. This option is intended for highly available, read-only
-  ZODB clients. This option would probably confuse users of read-write
-  ZODB clients, whose changes would seem to be temporarily reverted
-  sometimes.
+- Replication: Added the revert-when-stale option. When this option is
+  true and the database connection is stale, RelStorage reverts the
+  ZODB connection to the stale state rather than raise
+  ReadConflictError. This option is intended for highly available,
+  read-only ZODB clients. This option would probably confuse users of
+  read-write ZODB clients, whose changes would sometimes seem to be
+  temporarily reverted.
 
-TODO: provide a default random memcache prefix that is consistent per database.
+- Caching: Use the database name as the cache-prefix by default. This
+  will hopefully help people who accidentally use a single cache for
+  multiple databases.
 
 1.5.0 (2011-06-30)
 ------------------

Modified: relstorage/trunk/README.txt
===================================================================
--- relstorage/trunk/README.txt	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/README.txt	2011-09-30 21:41:22 UTC (rev 123004)
@@ -596,9 +596,11 @@
         option has no effect unless cache-servers is set.
 
 ``cache-prefix``
-        The prefix for all keys in the cache.  All clients using a
-        database should use the same cache-prefix.  Use this if you use
-        a single cache for multiple databases.
+        The prefix for all keys in the cache. All clients using a
+        database should use the same cache-prefix. Defaults to the
+        database name. (For example, in PostgreSQL, the database
+        name is determined by executing ``SELECT current_database()``.)
+        Set this if you have multiple databases with the same name.
 
 ``cache-local-mb``
         RelStorage caches pickled objects in memory, similar to a ZEO

Modified: relstorage/trunk/relstorage/adapters/batch.py
===================================================================
--- relstorage/trunk/relstorage/adapters/batch.py	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/relstorage/adapters/batch.py	2011-09-30 21:41:22 UTC (rev 123004)
@@ -25,7 +25,6 @@
 
     row_limit = 100
     size_limit = 1<<20
-    database_name = None
     support_batch_insert = True
 
     def __init__(self, cursor, row_limit=None):

Modified: relstorage/trunk/relstorage/adapters/dbiter.py
===================================================================
--- relstorage/trunk/relstorage/adapters/dbiter.py	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/relstorage/adapters/dbiter.py	2011-09-30 21:41:22 UTC (rev 123004)
@@ -21,8 +21,8 @@
     """Abstract base class for database iteration.
     """
 
-    def __init__(self, database_name, runner):
-        self.use_base64 = (database_name == 'postgresql')
+    def __init__(self, database_type, runner):
+        self.use_base64 = (database_type == 'postgresql')
         self.runner = runner
 
     def iter_objects(self, cursor, tid):

Modified: relstorage/trunk/relstorage/adapters/mover.py
===================================================================
--- relstorage/trunk/relstorage/adapters/mover.py	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/relstorage/adapters/mover.py	2011-09-30 21:41:22 UTC (rev 123004)
@@ -60,10 +60,10 @@
         'upload_blob',
     )
 
-    def __init__(self, database_name, options, runner=None,
+    def __init__(self, database_type, options, runner=None,
             Binary=None, inputsizes=None, version_detector=None):
         # The inputsizes parameter is for Oracle only.
-        self.database_name = database_name
+        self.database_type = database_type
         self.keep_history = options.keep_history
         self.blob_chunk_size = options.blob_chunk_size
         self.runner = runner
@@ -72,7 +72,7 @@
         self.version_detector = version_detector
 
         for method_name in self._method_names:
-            method = getattr(self, '%s_%s' % (database_name, method_name))
+            method = getattr(self, '%s_%s' % (database_type, method_name))
             setattr(self, method_name, method)
 
 
@@ -843,7 +843,7 @@
         Returns the list of oids stored.
         """
         if self.keep_history:
-            if self.database_name == 'oracle':
+            if self.database_type == 'oracle':
                 stmt = """
                 INSERT INTO object_state
                     (zoid, tid, prev_tid, md5, state_size, state)
@@ -862,7 +862,7 @@
             cursor.execute(stmt, (tid,))
 
         else:
-            if self.database_name == 'mysql':
+            if self.database_type == 'mysql':
                 stmt = """
                 REPLACE INTO object_state (zoid, tid, state_size, state)
                 SELECT zoid, %s, COALESCE(LENGTH(state), 0), state
@@ -877,7 +877,7 @@
                 """
                 cursor.execute(stmt)
 
-                if self.database_name == 'oracle':
+                if self.database_type == 'oracle':
                     stmt = """
                     INSERT INTO object_state (zoid, tid, state_size, state)
                     SELECT zoid, :1, COALESCE(LENGTH(state), 0), state
@@ -899,7 +899,7 @@
                 cursor.execute(stmt)
 
         if txn_has_blobs:
-            if self.database_name == 'oracle':
+            if self.database_type == 'oracle':
                 stmt = """
                 INSERT INTO blob_chunk (zoid, tid, chunk_num, chunk)
                 SELECT zoid, :1, chunk_num, chunk

Modified: relstorage/trunk/relstorage/adapters/mysql.py
===================================================================
--- relstorage/trunk/relstorage/adapters/mysql.py	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/relstorage/adapters/mysql.py	2011-09-30 21:41:22 UTC (rev 123004)
@@ -110,7 +110,7 @@
             keep_history=self.keep_history,
             )
         self.mover = ObjectMover(
-            database_name='mysql',
+            database_type='mysql',
             options=options,
             Binary=MySQLdb.Binary,
             )
@@ -134,26 +134,26 @@
 
         if self.keep_history:
             self.packundo = MySQLHistoryPreservingPackUndo(
-                database_name='mysql',
+                database_type='mysql',
                 connmanager=self.connmanager,
                 runner=self.runner,
                 locker=self.locker,
                 options=options,
                 )
             self.dbiter = HistoryPreservingDatabaseIterator(
-                database_name='mysql',
+                database_type='mysql',
                 runner=self.runner,
                 )
         else:
             self.packundo = MySQLHistoryFreePackUndo(
-                database_name='mysql',
+                database_type='mysql',
                 connmanager=self.connmanager,
                 runner=self.runner,
                 locker=self.locker,
                 options=options,
                 )
             self.dbiter = HistoryFreeDatabaseIterator(
-                database_name='mysql',
+                database_type='mysql',
                 runner=self.runner,
                 )
 

Modified: relstorage/trunk/relstorage/adapters/oracle.py
===================================================================
--- relstorage/trunk/relstorage/adapters/oracle.py	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/relstorage/adapters/oracle.py	2011-09-30 21:41:22 UTC (rev 123004)
@@ -92,7 +92,7 @@
             keep_history=self.keep_history,
             )
         self.mover = ObjectMover(
-            database_name='oracle',
+            database_type='oracle',
             options=options,
             runner=self.runner,
             Binary=cx_Oracle.Binary,
@@ -129,26 +129,26 @@
 
         if self.keep_history:
             self.packundo = OracleHistoryPreservingPackUndo(
-                database_name='oracle',
+                database_type='oracle',
                 connmanager=self.connmanager,
                 runner=self.runner,
                 locker=self.locker,
                 options=options,
                 )
             self.dbiter = HistoryPreservingDatabaseIterator(
-                database_name='oracle',
+                database_type='oracle',
                 runner=self.runner,
                 )
         else:
             self.packundo = OracleHistoryFreePackUndo(
-                database_name='oracle',
+                database_type='oracle',
                 connmanager=self.connmanager,
                 runner=self.runner,
                 locker=self.locker,
                 options=options,
                 )
             self.dbiter = HistoryFreeDatabaseIterator(
-                database_name='oracle',
+                database_type='oracle',
                 runner=self.runner,
                 )
 

Modified: relstorage/trunk/relstorage/adapters/packundo.py
===================================================================
--- relstorage/trunk/relstorage/adapters/packundo.py	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/relstorage/adapters/packundo.py	2011-09-30 21:41:22 UTC (rev 123004)
@@ -31,8 +31,8 @@
 
     verify_sane_database = False
 
-    def __init__(self, database_name, connmanager, runner, locker, options):
-        self.database_name = database_name
+    def __init__(self, database_type, connmanager, runner, locker, options):
+        self.database_type = database_type
         self.connmanager = connmanager
         self.runner = runner
         self.locker = locker
@@ -403,7 +403,7 @@
         """
         log.debug("pre_pack: transaction %d: computing references ", tid)
         from_count = 0
-        use_base64 = (self.database_name == 'postgresql')
+        use_base64 = (self.database_type == 'postgresql')
 
         if use_base64:
             stmt = """
@@ -1004,7 +1004,7 @@
         Returns the number of references added.
         """
         oid_list = ','.join(str(oid) for oid in oids)
-        use_base64 = (self.database_name == 'postgresql')
+        use_base64 = (self.database_type == 'postgresql')
 
         if use_base64:
             stmt = """

Modified: relstorage/trunk/relstorage/adapters/postgresql.py
===================================================================
--- relstorage/trunk/relstorage/adapters/postgresql.py	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/relstorage/adapters/postgresql.py	2011-09-30 21:41:22 UTC (rev 123004)
@@ -79,7 +79,7 @@
             keep_history=self.keep_history,
             )
         self.mover = ObjectMover(
-            database_name='postgresql',
+            database_type='postgresql',
             options=options,
             runner=self.runner,
             version_detector=self.version_detector,
@@ -99,26 +99,26 @@
 
         if self.keep_history:
             self.packundo = HistoryPreservingPackUndo(
-                database_name='postgresql',
+                database_type='postgresql',
                 connmanager=self.connmanager,
                 runner=self.runner,
                 locker=self.locker,
                 options=options,
                 )
             self.dbiter = HistoryPreservingDatabaseIterator(
-                database_name='postgresql',
+                database_type='postgresql',
                 runner=self.runner,
                 )
         else:
             self.packundo = HistoryFreePackUndo(
-                database_name='postgresql',
+                database_type='postgresql',
                 connmanager=self.connmanager,
                 runner=self.runner,
                 locker=self.locker,
                 options=options,
                 )
             self.dbiter = HistoryFreeDatabaseIterator(
-                database_name='postgresql',
+                database_type='postgresql',
                 runner=self.runner,
                 )
 

Modified: relstorage/trunk/relstorage/adapters/schema.py
===================================================================
--- relstorage/trunk/relstorage/adapters/schema.py	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/relstorage/adapters/schema.py	2011-09-30 21:41:22 UTC (rev 123004)
@@ -765,7 +765,7 @@
 """ % globals()
 
 
-def filter_script(script, database_name):
+def filter_script(script, database_type):
     res = []
     match = False
     for line in script.splitlines():
@@ -773,7 +773,7 @@
         if not line or line.startswith('#'):
             continue
         if line.endswith(':'):
-            match = (database_name in line[:-1].split())
+            match = (database_type in line[:-1].split())
             continue
         if match:
             res.append(line)
@@ -816,7 +816,7 @@
         'temp_undo',
     )
 
-    database_name = None  # provided by a subclass
+    database_type = None  # provided by a subclass
 
     def __init__(self, connmanager, runner, keep_history):
         self.connmanager = connmanager
@@ -835,11 +835,14 @@
     def list_sequences(self, cursor):
         raise NotImplementedError()
 
+    def get_database_name(self, cursor):
+        raise NotImplementedError()
+
     def create(self, cursor):
         """Create the database tables."""
-        script = filter_script(self.schema_script, self.database_name)
+        script = filter_script(self.schema_script, self.database_type)
         self.runner.run_script(cursor, script)
-        script = filter_script(self.init_script, self.database_name)
+        script = filter_script(self.init_script, self.database_type)
         self.runner.run_script(cursor, script)
         tables = self.list_tables(cursor)
         self.check_compatibility(cursor, tables)
@@ -875,7 +878,7 @@
         if not 'blob_chunk' in tables:
             # Add the blob_chunk table (RelStorage 1.5+)
             script = filter_script(
-                self.schema_script, self.database_name)
+                self.schema_script, self.database_type)
             expr = (r'(CREATE|ALTER)\s+(GLOBAL TEMPORARY\s+)?(TABLE|INDEX)'
                 '\s+(temp_)?blob_chunk')
             script = filter_statements(script, re.compile(expr, re.I))
@@ -896,7 +899,7 @@
                     log.debug("Deleting from table %s...", table)
                     cursor.execute("DELETE FROM %s" % table)
             log.debug("Done deleting from tables.")
-            script = filter_script(self.init_script, self.database_name)
+            script = filter_script(self.init_script, self.database_type)
             if script:
                 log.debug("Running init script.")
                 self.runner.run_script(cursor, script)
@@ -920,13 +923,18 @@
 class PostgreSQLSchemaInstaller(AbstractSchemaInstaller):
     implements(ISchemaInstaller)
 
-    database_name = 'postgresql'
+    database_type = 'postgresql'
 
     def __init__(self, connmanager, runner, locker, keep_history):
         super(PostgreSQLSchemaInstaller, self).__init__(
             connmanager, runner, keep_history)
         self.locker = locker
 
+    def get_database_name(self, cursor):
+        cursor.execute("SELECT current_database()")
+        for (name,) in cursor:
+            return name
+
     def prepare(self):
         """Create the database schema if it does not already exist."""
         def callback(conn, cursor):
@@ -1037,8 +1045,13 @@
 class MySQLSchemaInstaller(AbstractSchemaInstaller):
     implements(ISchemaInstaller)
 
-    database_name = 'mysql'
+    database_type = 'mysql'
 
+    def get_database_name(self, cursor):
+        cursor.execute("SELECT DATABASE()")
+        for (name,) in cursor:
+            return name
+
     def list_tables(self, cursor):
         cursor.execute("SHOW TABLES")
         return [name for (name,) in cursor]
@@ -1063,8 +1076,13 @@
 class OracleSchemaInstaller(AbstractSchemaInstaller):
     implements(ISchemaInstaller)
 
-    database_name = 'oracle'
+    database_type = 'oracle'
 
+    def get_database_name(self, cursor):
+        cursor.execute("SELECT ora_database_name FROM DUAL")
+        for (name,) in cursor:
+            return name
+
     def prepare(self):
         """Create the database schema if it does not already exist."""
         def callback(conn, cursor):

Modified: relstorage/trunk/relstorage/cache.py
===================================================================
--- relstorage/trunk/relstorage/cache.py	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/relstorage/cache.py	2011-09-30 21:41:22 UTC (rev 123004)
@@ -59,9 +59,10 @@
     # responding stores the value.
     commit_count = object()
 
-    def __init__(self, adapter, options, local_client=None):
+    def __init__(self, adapter, options, prefix, local_client=None):
         self.adapter = adapter
         self.options = options
+        self.prefix = prefix or ''
         if local_client is None:
             local_client = LocalClient(options)
         self.clients_local_first = [local_client]
@@ -79,9 +80,6 @@
         self.clients_global_first = list(self.clients_local_first)
         self.clients_global_first.reverse()
 
-        # every cache key has a prefix
-        self.prefix = options.cache_prefix or ''
-
         # commit_count_key contains a number that is incremented
         # for every commit.  See tpc_finish().
         self.commit_count_key = '%s:commits' % self.prefix
@@ -106,9 +104,10 @@
         """Return a copy of this instance sharing the same local client"""
         if self.options.share_local_cache:
             local_client = self.clients_local_first[0]
-            return StorageCache(self.adapter, self.options, local_client)
+            return StorageCache(self.adapter, self.options, self.prefix,
+                local_client)
         else:
-            return StorageCache(self.adapter, self.options)
+            return StorageCache(self.adapter, self.options, self.prefix)
 
     def clear(self):
         """Remove all data from the cache.  Called by speed tests."""
@@ -735,4 +734,3 @@
             return res
         finally:
             self._lock_release()
-

Modified: relstorage/trunk/relstorage/storage.py
===================================================================
--- relstorage/trunk/relstorage/storage.py	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/relstorage/storage.py	2011-09-30 21:41:22 UTC (rev 123004)
@@ -191,7 +191,12 @@
         if cache is not None:
             self._cache = cache
         else:
-            self._cache = StorageCache(adapter, options)
+            prefix = options.cache_prefix
+            if not prefix:
+                # Use the database name as the cache prefix.
+                prefix = adapter.schema.get_database_name(self._load_cursor)
+                prefix = prefix.replace(' ', '_')
+            self._cache = StorageCache(adapter, options, prefix)
 
         if blobhelper is not None:
             self.blobhelper = blobhelper

Modified: relstorage/trunk/relstorage/tests/test_cache.py
===================================================================
--- relstorage/trunk/relstorage/tests/test_cache.py	2011-09-30 21:30:52 UTC (rev 123003)
+++ relstorage/trunk/relstorage/tests/test_cache.py	2011-09-30 21:41:22 UTC (rev 123004)
@@ -27,7 +27,8 @@
         return StorageCache
 
     def _makeOne(self):
-        return self.getClass()(MockAdapter(), MockOptionsWithFakeCache())
+        return self.getClass()(MockAdapter(), MockOptionsWithFakeCache(),
+            'myprefix')
 
     def test_ctor(self):
         from relstorage.tests.fakecache import Client
@@ -58,7 +59,7 @@
         from relstorage.tests.fakecache import data
         from ZODB.utils import p64
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         c.current_tid = 60
         c.checkpoints = (50, 40)
         c.delta_after0[2] = 55
@@ -70,7 +71,7 @@
         from relstorage.tests.fakecache import data
         from ZODB.utils import p64
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         c.current_tid = 60
         c.checkpoints = (50, 40)
         c.delta_after0[2] = 55
@@ -82,7 +83,7 @@
         from relstorage.tests.fakecache import data
         from ZODB.utils import p64
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         c.current_tid = 60
         c.checkpoints = (50, 40)
         c.delta_after0[2] = 55
@@ -98,7 +99,7 @@
         from relstorage.tests.fakecache import data
         from ZODB.utils import p64
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         c.current_tid = 55
         c.checkpoints = (50, 40)
         c.delta_after0[2] = 55
@@ -115,7 +116,7 @@
         from relstorage.tests.fakecache import data
         from ZODB.utils import p64
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         c.current_tid = 60
         c.checkpoints = (50, 40)
         data['myprefix:state:50:2'] = p64(45) + 'xyz'
@@ -126,7 +127,7 @@
         from relstorage.tests.fakecache import data
         from ZODB.utils import p64
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         c.current_tid = 60
         c.checkpoints = (50, 40)
         adapter.mover.data[2] = ('xyz', 45)
@@ -138,7 +139,7 @@
         from relstorage.tests.fakecache import data
         from ZODB.utils import p64
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         c.current_tid = 60
         c.checkpoints = (50, 40)
         c.delta_after1[2] = 45
@@ -151,7 +152,7 @@
         from relstorage.tests.fakecache import data
         from ZODB.utils import p64
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         c.current_tid = 60
         c.checkpoints = (50, 40)
         c.delta_after1[2] = 45
@@ -164,7 +165,7 @@
         from relstorage.tests.fakecache import data
         from ZODB.utils import p64
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         c.current_tid = 60
         c.checkpoints = (50, 40)
         data['myprefix:state:40:2'] = p64(35) + '123'
@@ -176,7 +177,7 @@
         from relstorage.tests.fakecache import data
         from ZODB.utils import p64
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         c.current_tid = 60
         c.checkpoints = (50, 40)
         adapter.mover.data[2] = ('123', 35)
@@ -337,7 +338,7 @@
         from relstorage.tests.fakecache import data
         data['myprefix:checkpoints'] = '50 40'
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         # Note that OID 3 changed twice.  list_changes is not required
         # to provide the list of changes in order, so simulate
         # a list of changes that is out of order.
@@ -354,7 +355,7 @@
         from relstorage.tests.fakecache import data
         data['myprefix:checkpoints'] = '40 30'
         adapter = MockAdapter()
-        c = self.getClass()(adapter, MockOptionsWithFakeCache())
+        c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
         adapter.poller.changes = [(3, 42), (1, 35), (2, 45)]
         c.checkpoints = (40, 30)
         c.current_tid = 40
@@ -540,14 +541,12 @@
 class MockOptions:
     cache_module_name = ''
     cache_servers = ''
-    cache_prefix = ''
     cache_local_mb = 1
     cache_delta_size_limit = 10000
 
 class MockOptionsWithFakeCache:
     cache_module_name = 'relstorage.tests.fakecache'
     cache_servers = 'host:9999'
-    cache_prefix = 'myprefix'
     cache_local_mb = 1
     cache_delta_size_limit = 10000
 



More information about the checkins mailing list