← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:rename-rw-main-master-slave into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:rename-rw-main-master-slave into launchpad:master.

Commit message:
Rename rw_main_{master,slave} to rw_main_{primary,standby}

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/409523

These are both more inclusive and more accurate names; and, as a bonus, they're the same length so line up naturally in code.  I've left some compatibility code in place for now to avoid having to rename everything at once, as production configs and Storm store integration code both still need to be updated.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:rename-rw-main-master-slave into launchpad:master.
diff --git a/configs/development/launchpad-lazr.conf b/configs/development/launchpad-lazr.conf
index 138714d..c704f29 100644
--- a/configs/development/launchpad-lazr.conf
+++ b/configs/development/launchpad-lazr.conf
@@ -67,8 +67,8 @@ foreign_tree_store: file:///tmp/foreign-branches
 forced_hostname: bazaar-importer
 
 [database]
-rw_main_master: dbname=launchpad_dev
-rw_main_slave:  dbname=launchpad_dev
+rw_main_primary: dbname=launchpad_dev
+rw_main_standby: dbname=launchpad_dev
 
 [distributionmirrorprober]
 use_proxy: False
diff --git a/configs/replicated-development/launchpad-lazr.conf b/configs/replicated-development/launchpad-lazr.conf
index 30ef01b..1b94204 100644
--- a/configs/replicated-development/launchpad-lazr.conf
+++ b/configs/replicated-development/launchpad-lazr.conf
@@ -6,8 +6,8 @@
 extends: ../development/launchpad-lazr.conf
 
 [database]
-rw_main_master: dbname=launchpad_dev_master port=5433
-rw_main_slave: dbname=launchpad_dev_slave port=5433
+rw_main_primary: dbname=launchpad_dev_primary port=5433
+rw_main_standby: dbname=launchpad_dev_standby port=5433
 
 [launchpad]
 devmode: true
diff --git a/configs/test-playground/launchpad-lazr.conf b/configs/test-playground/launchpad-lazr.conf
index 422485f..aee48c0 100644
--- a/configs/test-playground/launchpad-lazr.conf
+++ b/configs/test-playground/launchpad-lazr.conf
@@ -6,8 +6,8 @@
 extends: ../development/launchpad-lazr.conf
 
 [database]
-rw_main_master: dbname=launchpad_ftest_playground
-rw_main_slave:  dbname=launchpad_ftest_playground
+rw_main_primary: dbname=launchpad_ftest_playground
+rw_main_standby: dbname=launchpad_ftest_playground
 
 [launchpad]
 devmode: true
diff --git a/configs/testrunner/launchpad-lazr.conf b/configs/testrunner/launchpad-lazr.conf
index eeaabb2..9fe2aa0 100644
--- a/configs/testrunner/launchpad-lazr.conf
+++ b/configs/testrunner/launchpad-lazr.conf
@@ -24,8 +24,8 @@ access_log: /tmp/test-codehosting-access.log
 internal_branch_by_id_root: file:///var/tmp/bazaar.launchpad.test/mirrors
 
 [database]
-rw_main_master: dbname=launchpad_ftest
-rw_main_slave:  dbname=launchpad_ftest
+rw_main_primary: dbname=launchpad_ftest
+rw_main_standby: dbname=launchpad_ftest
 
 [error_reports]
 oops_prefix: T
diff --git a/database/replication/helpers.py b/database/replication/helpers.py
index 8096075..e90be33 100644
--- a/database/replication/helpers.py
+++ b/database/replication/helpers.py
@@ -331,7 +331,7 @@ def get_all_cluster_nodes(con):
         assert len(node_ids) == 1, "Multiple nodes but no paths."
         master_node_id = node_ids[0]
         master_connection_string = ConnectionString(
-            config.database.rw_main_master)
+            config.database.rw_main_primary)
         master_connection_string.user = 'slony'
         return [Node(
             master_node_id, 'node%d_node' % master_node_id,
diff --git a/lib/lp/app/stories/basics/xx-dbpolicy.txt b/lib/lp/app/stories/basics/xx-dbpolicy.txt
index 433973f..b0b8e21 100644
--- a/lib/lp/app/stories/basics/xx-dbpolicy.txt
+++ b/lib/lp/app/stories/basics/xx-dbpolicy.txt
@@ -14,9 +14,9 @@ request is querying the master or slave database.
     >>> from textwrap import dedent
     >>> config_overlay = dedent("""
     ...     [database]
-    ...     rw_main_slave: dbname=launchpad_empty
+    ...     rw_main_standby: dbname=launchpad_empty
     ...     """)
-    >>> config.push('empty_slave', config_overlay)
+    >>> config.push('empty_standby', config_overlay)
 
     >>> from lp.registry.model.person import Person
     >>> from lp.services.database.interfaces import IMasterStore, ISlaveStore
@@ -172,4 +172,4 @@ returning a 404 error to the user.
 
 Reset our config to avoid affecting other tests.
 
-    >>> ignored = config.pop('empty_slave')
+    >>> ignored = config.pop('empty_standby')
diff --git a/lib/lp/app/stories/basics/xx-opstats.txt b/lib/lp/app/stories/basics/xx-opstats.txt
index 53a5396..1539c53 100644
--- a/lib/lp/app/stories/basics/xx-opstats.txt
+++ b/lib/lp/app/stories/basics/xx-opstats.txt
@@ -104,7 +104,7 @@ Number of 404s
 --------------
 
 Note that retries is incremented too. As per the standard Launchpad
-database policy, this request first uses the slave DB. The requested
+database policy, this request first uses the standby DB. The requested
 information is not found in there, so a retry is attempted against the
 master DB in case the information is missing due to replication lag.
 
@@ -309,8 +309,8 @@ to somewhere that doesn't exist.
 
     >>> no_db_overrides = """
     ...     [database]
-    ...     rw_main_master: dbname=nonexistant
-    ...     rw_main_slave: dbname=nonexistant
+    ...     rw_main_primary: dbname=nonexistant
+    ...     rw_main_standby: dbname=nonexistant
     ...
     ...     [launchpad_session]
     ...     dbname: nonexistant
diff --git a/lib/lp/services/config/__init__.py b/lib/lp/services/config/__init__.py
index b045e11..4eca253 100644
--- a/lib/lp/services/config/__init__.py
+++ b/lib/lp/services/config/__init__.py
@@ -300,23 +300,33 @@ class DatabaseConfig:
     _config_section = None
     _db_config_attrs = frozenset([
         'dbuser',
-        'rw_main_master', 'rw_main_slave',
+        'rw_main_primary', 'rw_main_standby',
         'db_statement_timeout', 'db_statement_timeout_precision',
         'isolation_level', 'soft_request_timeout',
         'storm_cache', 'storm_cache_size'])
     _db_config_required_attrs = frozenset([
-        'dbuser', 'rw_main_master', 'rw_main_slave'])
+        'dbuser', 'rw_main_primary', 'rw_main_standby'])
 
     def __init__(self):
         self.reset()
 
     @property
-    def main_master(self):
-        return self.rw_main_master
+    def main_primary(self):
+        return self.rw_main_primary
 
     @cachedproperty
+    def main_standby(self):
+        return random.choice(self.rw_main_standby.split(','))
+
+    # XXX cjwatson 2021-10-01: Remove these once Launchpad's store flavors
+    # have been renamed.
+    @property
+    def main_master(self):
+        return self.main_primary
+
+    @property
     def main_slave(self):
-        return random.choice(self.rw_main_slave.split(','))
+        return self.main_standby
 
     def override(self, **kwargs):
         """Override one or more config attributes.
@@ -331,12 +341,12 @@ class DatabaseConfig:
                     delattr(self.overrides, attr)
             else:
                 setattr(self.overrides, attr, value)
-                if attr == 'rw_main_slave':
-                    del get_property_cache(self).main_slave
+                if attr == 'rw_main_standby':
+                    del get_property_cache(self).main_standby
 
     def reset(self):
         self.overrides = DatabaseConfigOverrides()
-        del get_property_cache(self).main_slave
+        del get_property_cache(self).main_standby
 
     def _getConfigSections(self):
         """Returns a list of sections to search for database configuration.
@@ -354,6 +364,16 @@ class DatabaseConfig:
             raise AttributeError(name)
         value = None
         for section in sections:
+            # XXX cjwatson 2021-10-01: Remove this once production configs
+            # have been updated to the new name.
+            if name == 'rw_main_primary':
+                value = getattr(section, 'rw_main_master', None)
+                if value is not None:
+                    break
+            elif name == 'rw_main_standby':
+                value = getattr(section, 'rw_main_slave', None)
+                if value is not None:
+                    break
             value = getattr(section, name, None)
             if value is not None:
                 break
diff --git a/lib/lp/services/config/doc/canonical-config.txt b/lib/lp/services/config/doc/canonical-config.txt
index d3c330a..c3f0ec2 100644
--- a/lib/lp/services/config/doc/canonical-config.txt
+++ b/lib/lp/services/config/doc/canonical-config.txt
@@ -18,7 +18,7 @@ configuration).
     >>> from lp.services.config import config
     >>> from lp.testing.layers import DatabaseLayer
     >>> expected = 'dbname=%s' % DatabaseLayer._db_fixture.dbname
-    >>> expected == config.database.rw_main_master
+    >>> expected == config.database.rw_main_primary
     True
 
     >>> config.database.db_statement_timeout is None
diff --git a/lib/lp/services/config/schema-lazr.conf b/lib/lp/services/config/schema-lazr.conf
index 673b9fe..668b8cf 100644
--- a/lib/lp/services/config/schema-lazr.conf
+++ b/lib/lp/services/config/schema-lazr.conf
@@ -539,11 +539,17 @@ timeout: 30
 # Note that user is not included, as it is specified by the dbuser
 # option. This allows config sections to easily override just the dbuser.
 # datatype: pgconnection
-rw_main_master: dbname=launchpad_prod_3 host=wildcherry.canonical.com
+rw_main_primary: dbname=launchpad_prod_3 host=wildcherry.canonical.com
 # datatype: pgconnection
-rw_main_slave:  dbname=launchpad_prod_2 host=chokecherry.canonical.com
+rw_main_standby: dbname=launchpad_prod_2 host=chokecherry.canonical.com
+# Deprecated, for compatibility only.  Use rw_main_primary instead.
+# datatype: pgconnection
+rw_main_master: none
+# Deprecated, for compatibility only.  Use rw_main_standby instead.
+# datatype: pgconnection
+rw_main_slave: none
 
-# If the replication lag is more than this many seconds, slave databases
+# If the replication lag is more than this many seconds, standby databases
 # will not be used.
 max_usable_lag: 120
 
@@ -925,7 +931,7 @@ test_openid_provider_store:
 # resembling a production enviornment.
 basic_auth_password: none
 
-# Assume the slave database is lagged if it takes more than this many
+# Assume the standby database is lagged if it takes more than this many
 # milliseconds to calculate this information from the Slony-I tables.
 # datatype: integer
 lag_check_timeout: 250
diff --git a/lib/lp/services/config/tests/test_database_config.py b/lib/lp/services/config/tests/test_database_config.py
index d4261b6..44b1d47 100644
--- a/lib/lp/services/config/tests/test_database_config.py
+++ b/lib/lp/services/config/tests/test_database_config.py
@@ -3,7 +3,12 @@
 
 __metaclass__ = type
 
-from lp.services.config import DatabaseConfig
+from textwrap import dedent
+
+from lp.services.config import (
+    config,
+    DatabaseConfig,
+    )
 from lp.services.propertycache import get_property_cache
 from lp.testing import TestCase
 from lp.testing.layers import DatabaseLayer
@@ -43,18 +48,46 @@ class TestDatabaseConfig(TestCase):
         dbc.reset()
         self.assertEqual('launchpad_main', dbc.dbuser)
 
-    def test_main_slave(self):
-        # If rw_main_slave is a comma-separated list, then the main_slave
-        # property selects among them randomly, and caches the result.
+    def test_main_standby(self):
+        # If rw_main_standby is a comma-separated list, then the
+        # main_standby property selects among them randomly, and caches the
+        # result.
         dbc = DatabaseConfig()
-        original_standby = dbc.main_slave
+        original_standby = dbc.main_standby
         standbys = [
             'dbname=launchpad_standby1 port=5433',
             'dbname=launchpad_standby2 port=5433',
             ]
-        dbc.override(rw_main_slave=','.join(standbys))
-        selected_standby = dbc.main_slave
+        dbc.override(rw_main_standby=','.join(standbys))
+        selected_standby = dbc.main_standby
         self.assertIn(selected_standby, standbys)
-        self.assertEqual(selected_standby, get_property_cache(dbc).main_slave)
+        self.assertEqual(
+            selected_standby, get_property_cache(dbc).main_standby)
         dbc.reset()
-        self.assertEqual(original_standby, dbc.main_slave)
+        self.assertEqual(original_standby, dbc.main_standby)
+
+    def test_main_master_compatibility(self):
+        # The old rw_main_master compatibility name works, until such time
+        # as we update production configs to stop using it.
+        config_key = 'old-naming'
+        config.push(config_key, dedent('''\
+            [database]
+            rw_main_master: dbname=launchpad_test_primary port=5433
+            '''))
+        self.addCleanup(config.pop, config_key)
+        dbc = DatabaseConfig()
+        self.assertEqual(
+            'dbname=launchpad_test_primary port=5433', dbc.main_primary)
+
+    def test_main_slave_compatibility(self):
+        # The old rw_main_slave compatibility name works, until such time as
+        # we update production configs to stop using it.
+        config_key = 'old-naming'
+        config.push(config_key, dedent('''\
+            [database]
+            rw_main_slave: dbname=launchpad_test_standby port=5433
+            '''))
+        self.addCleanup(config.pop, config_key)
+        dbc = DatabaseConfig()
+        self.assertEqual(
+            'dbname=launchpad_test_standby port=5433', dbc.main_standby)
diff --git a/lib/lp/services/database/sqlbase.py b/lib/lp/services/database/sqlbase.py
index 7757749..8c4269a 100644
--- a/lib/lp/services/database/sqlbase.py
+++ b/lib/lp/services/database/sqlbase.py
@@ -573,10 +573,10 @@ def connect_string(user=None, dbname=None):
     Allows you to pass the generated connection details to external
     programs like pg_dump or embed in slonik scripts.
     """
-    # We must connect to the read-write DB here, so we use rw_main_master
+    # We must connect to the read-write DB here, so we use rw_main_primary
     # directly.
     from lp.services.database.postgresql import ConnectionString
-    con_str = ConnectionString(dbconfig.rw_main_master)
+    con_str = ConnectionString(dbconfig.rw_main_primary)
     if user is not None:
         con_str.user = user
     if dbname is not None:
diff --git a/lib/lp/services/librarianserver/storage.py b/lib/lp/services/librarianserver/storage.py
index aec7ff1..ec44470 100644
--- a/lib/lp/services/librarianserver/storage.py
+++ b/lib/lp/services/librarianserver/storage.py
@@ -250,7 +250,7 @@ class LibraryFileUpload(object):
                 # due to pgbouncer database aliases. Lets check both,
                 # and succeed if either matches.
                 config_dbname = ConnectionString(
-                    dbconfig.rw_main_master).dbname
+                    dbconfig.rw_main_primary).dbname
 
                 store = getUtility(IStoreSelector).get(
                     MAIN_STORE, DEFAULT_FLAVOR)
diff --git a/lib/lp/services/scripts/__init__.py b/lib/lp/services/scripts/__init__.py
index 56557eb..94d575e 100644
--- a/lib/lp/services/scripts/__init__.py
+++ b/lib/lp/services/scripts/__init__.py
@@ -148,9 +148,9 @@ def db_options(parser):
     'baz'
     >>> options.dbport
     6432
-    >>> config.database.rw_main_master
+    >>> config.database.rw_main_primary
     'dbname=foo user=baz host=bar port=6432'
-    >>> config.database.rw_main_slave
+    >>> config.database.rw_main_standby
     'dbname=foo user=baz host=bar port=6432'
 
     Make sure that the default user is None
@@ -161,12 +161,12 @@ def db_options(parser):
     >>> print(options.dbuser)
     None
     """
-    conn_string = ConnectionString(config.database.rw_main_master)
+    conn_string = ConnectionString(config.database.rw_main_primary)
 
     def update_db_config(**kw):
         connection_string_keys = [
-            'rw_main_master',
-            'rw_main_slave',
+            'rw_main_primary',
+            'rw_main_standby',
             ]
         config_data = ["[database]"]
         for con_str_key in connection_string_keys:
diff --git a/lib/lp/services/webapp/tests/test_dbpolicy.py b/lib/lp/services/webapp/tests/test_dbpolicy.py
index ae7e3ab..48a3727 100644
--- a/lib/lp/services/webapp/tests/test_dbpolicy.py
+++ b/lib/lp/services/webapp/tests/test_dbpolicy.py
@@ -253,13 +253,13 @@ class MasterFallbackTestCase(TestCase):
         # Generate a db connection string that will go via pgbouncer.
         conn_str_pgbouncer = 'dbname=%s host=localhost' % dbname
 
-        # Configure slave connections via pgbouncer, so we can shut them
-        # down. Master connections direct so they are unaffected.
-        config_key = 'master-slave-separation'
+        # Configure standby connections via pgbouncer, so we can shut them
+        # down. Primary connections direct so they are unaffected.
+        config_key = 'primary-standby-separation'
         config.push(config_key, dedent('''\
             [database]
-            rw_main_master: %s
-            rw_main_slave: %s
+            rw_main_primary: %s
+            rw_main_standby: %s
             ''' % (conn_str_direct, conn_str_pgbouncer)))
         self.addCleanup(lambda: config.pop(config_key))
 
@@ -359,21 +359,21 @@ class TestFastDowntimeRollout(TestCase):
     def setUp(self):
         super(TestFastDowntimeRollout, self).setUp()
 
-        self.master_dbname = DatabaseLayer._db_fixture.dbname
-        self.slave_dbname = self.master_dbname + '_slave'
+        self.primary_dbname = DatabaseLayer._db_fixture.dbname
+        self.standby_dbname = self.primary_dbname + '_standby'
 
         self.pgbouncer_fixture = PGBouncerFixture()
-        self.pgbouncer_fixture.databases[self.slave_dbname] = (
-            self.pgbouncer_fixture.databases[self.master_dbname])
+        self.pgbouncer_fixture.databases[self.standby_dbname] = (
+            self.pgbouncer_fixture.databases[self.primary_dbname])
 
-        # Configure master and slave connections to go via different
+        # Configure primary and standby connections to go via different
         # pgbouncer aliases.
-        config_key = 'master-slave-separation'
+        config_key = 'primary-standby-separation'
         config.push(config_key, dedent('''\
             [database]
-            rw_main_master: dbname=%s host=localhost
-            rw_main_slave: dbname=%s host=localhost
-            ''' % (self.master_dbname, self.slave_dbname)))
+            rw_main_primary: dbname=%s host=localhost
+            rw_main_standby: dbname=%s host=localhost
+            ''' % (self.primary_dbname, self.standby_dbname)))
         self.addCleanup(lambda: config.pop(config_key))
 
         self.useFixture(self.pgbouncer_fixture)
@@ -414,21 +414,21 @@ class TestFastDowntimeRollout(TestCase):
 
         # All connections to the master are killed so database schema
         # updates can be applied.
-        self.pgbouncer_cur.execute('DISABLE %s' % self.master_dbname)
-        self.pgbouncer_cur.execute('KILL %s' % self.master_dbname)
+        self.pgbouncer_cur.execute('DISABLE %s' % self.primary_dbname)
+        self.pgbouncer_cur.execute('KILL %s' % self.primary_dbname)
 
         # Of course, slave connections are unaffected.
         self.assertTrue(self.store_is_working(store))
 
         # After schema updates have been made to the master, it is
         # reenabled.
-        self.pgbouncer_cur.execute('RESUME %s' % self.master_dbname)
-        self.pgbouncer_cur.execute('ENABLE %s' % self.master_dbname)
+        self.pgbouncer_cur.execute('RESUME %s' % self.primary_dbname)
+        self.pgbouncer_cur.execute('ENABLE %s' % self.primary_dbname)
 
         # And the slaves taken down, and replication reenabled so the
         # schema updates can replicate.
-        self.pgbouncer_cur.execute('DISABLE %s' % self.slave_dbname)
-        self.pgbouncer_cur.execute('KILL %s' % self.slave_dbname)
+        self.pgbouncer_cur.execute('DISABLE %s' % self.standby_dbname)
+        self.pgbouncer_cur.execute('KILL %s' % self.standby_dbname)
 
         # The next attempt at accessing the slave store will fail
         # with a DisconnectionError.
@@ -461,8 +461,8 @@ class TestFastDowntimeRollout(TestCase):
         transaction.abort()
 
         # Once replication has caught up, the slave is reenabled.
-        self.pgbouncer_cur.execute('RESUME %s' % self.slave_dbname)
-        self.pgbouncer_cur.execute('ENABLE %s' % self.slave_dbname)
+        self.pgbouncer_cur.execute('RESUME %s' % self.standby_dbname)
+        self.pgbouncer_cur.execute('ENABLE %s' % self.standby_dbname)
 
         # And next transaction, we are back to normal.
         store = ISlaveStore(Person)
@@ -489,8 +489,8 @@ class TestFastDowntimeRollout(TestCase):
 
         # All connections to the master are killed so database schema
         # updates can be applied.
-        self.pgbouncer_cur.execute('DISABLE %s' % self.master_dbname)
-        self.pgbouncer_cur.execute('KILL %s' % self.master_dbname)
+        self.pgbouncer_cur.execute('DISABLE %s' % self.primary_dbname)
+        self.pgbouncer_cur.execute('KILL %s' % self.primary_dbname)
 
         # Of course, slave connections are unaffected.
         self.assertTrue(self.store_is_working(slave_store))
@@ -501,13 +501,13 @@ class TestFastDowntimeRollout(TestCase):
 
         # After schema updates have been made to the master, it is
         # reenabled.
-        self.pgbouncer_cur.execute('RESUME %s' % self.master_dbname)
-        self.pgbouncer_cur.execute('ENABLE %s' % self.master_dbname)
+        self.pgbouncer_cur.execute('RESUME %s' % self.primary_dbname)
+        self.pgbouncer_cur.execute('ENABLE %s' % self.primary_dbname)
 
         # And the slaves taken down, and replication reenabled so the
         # schema updates can replicate.
-        self.pgbouncer_cur.execute('DISABLE %s' % self.slave_dbname)
-        self.pgbouncer_cur.execute('KILL %s' % self.slave_dbname)
+        self.pgbouncer_cur.execute('DISABLE %s' % self.standby_dbname)
+        self.pgbouncer_cur.execute('KILL %s' % self.standby_dbname)
 
         # The master store is working again.
         master_store = IMasterStore(Person)
@@ -530,8 +530,8 @@ class TestFastDowntimeRollout(TestCase):
         self.assertTrue(self.store_is_working(slave_store))
 
         # Once replication has caught up, the slave is reenabled.
-        self.pgbouncer_cur.execute('RESUME %s' % self.slave_dbname)
-        self.pgbouncer_cur.execute('ENABLE %s' % self.slave_dbname)
+        self.pgbouncer_cur.execute('RESUME %s' % self.standby_dbname)
+        self.pgbouncer_cur.execute('ENABLE %s' % self.standby_dbname)
 
         # And next transaction, we are back to normal.
         transaction.abort()
diff --git a/lib/lp/soyuz/scripts/gina/runner.py b/lib/lp/soyuz/scripts/gina/runner.py
index c956744..b825cf1 100644
--- a/lib/lp/soyuz/scripts/gina/runner.py
+++ b/lib/lp/soyuz/scripts/gina/runner.py
@@ -63,7 +63,7 @@ def run_gina(options, ztm, target_section):
     if component_override is not None:
         log.info("Override components to: %s", component_override)
     log.info("Architectures to import: %s", ", ".join(archs))
-    log.debug("Launchpad database: %s", config.database.rw_main_master)
+    log.debug("Launchpad database: %s", config.database.rw_main_primary)
     log.info("SourcePackage Only: %s", source_only)
     log.info("SourcePackageName Only: %s", spnames_only)
     log.debug("Librarian: %s:%s", LIBRHOST, LIBRPORT)
diff --git a/lib/lp/testing/pgsql.py b/lib/lp/testing/pgsql.py
index 2aa623f..eb419e7 100644
--- a/lib/lp/testing/pgsql.py
+++ b/lib/lp/testing/pgsql.py
@@ -195,8 +195,8 @@ class PgTestSetup:
                 # available.
                 # Avoid circular imports
                 section = """[database]
-rw_main_master: dbname=%s
-rw_main_slave:  dbname=%s
+rw_main_primary: dbname=%s
+rw_main_standby: dbname=%s
 
 """ % (self.dbname, self.dbname)
                 if BaseLayer.config_fixture is not None:
diff --git a/lib/lp/testing/tests/test_fixture.py b/lib/lp/testing/tests/test_fixture.py
index 16cf3f9..c8f3da9 100644
--- a/lib/lp/testing/tests/test_fixture.py
+++ b/lib/lp/testing/tests/test_fixture.py
@@ -226,7 +226,7 @@ class TestPGBouncerFixtureWithoutCA(TestCase):
 
     def is_db_available(self):
         # Direct connection to the DB.
-        con_str = dbconfig.rw_main_master + ' user=launchpad_main'
+        con_str = dbconfig.rw_main_primary + ' user=launchpad_main'
         try:
             con = psycopg2.connect(con_str)
             cur = con.cursor()
@@ -335,7 +335,7 @@ class TestDisableTriggerFixture(TestCase):
 
     def setUp(self):
         super(TestDisableTriggerFixture, self).setUp()
-        con_str = dbconfig.rw_main_master + ' user=launchpad_main'
+        con_str = dbconfig.rw_main_primary + ' user=launchpad_main'
         con = psycopg2.connect(con_str)
         con.set_isolation_level(0)
         self.cursor = con.cursor()
diff --git a/lib/lp/testing/tests/test_pgsql.py b/lib/lp/testing/tests/test_pgsql.py
index b83e7c2..48470f9 100644
--- a/lib/lp/testing/tests/test_pgsql.py
+++ b/lib/lp/testing/tests/test_pgsql.py
@@ -59,11 +59,11 @@ class TestPgTestSetup(testtools.TestCase, TestWithFixtures):
         self.addCleanup(fixture.dropDb)
         self.addCleanup(fixture.tearDown)
         expected_value = 'dbname=%s' % fixture.dbname
-        self.assertEqual(expected_value, dbconfig.rw_main_master)
-        self.assertEqual(expected_value, dbconfig.rw_main_slave)
+        self.assertEqual(expected_value, dbconfig.rw_main_primary)
+        self.assertEqual(expected_value, dbconfig.rw_main_standby)
         with ConfigUseFixture(BaseLayer.appserver_config_name):
-            self.assertEqual(expected_value, dbconfig.rw_main_master)
-            self.assertEqual(expected_value, dbconfig.rw_main_slave)
+            self.assertEqual(expected_value, dbconfig.rw_main_primary)
+            self.assertEqual(expected_value, dbconfig.rw_main_standby)
 
 
 class TestPgTestSetupTuning(testtools.TestCase, TestWithFixtures):