← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:rename-database-policies into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:rename-database-policies into launchpad:master.

Commit message:
Rename database policies to use primary/standby terminology

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/411256
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:rename-database-policies into launchpad:master.
diff --git a/cronscripts/rosetta-export-queue.py b/cronscripts/rosetta-export-queue.py
index b9fb461..6427347 100755
--- a/cronscripts/rosetta-export-queue.py
+++ b/cronscripts/rosetta-export-queue.py
@@ -5,7 +5,7 @@
 
 import _pythonpath  # noqa: F401
 
-from lp.services.database.policy import SlaveDatabasePolicy
+from lp.services.database.policy import StandbyDatabasePolicy
 from lp.services.scripts.base import LaunchpadCronScript
 from lp.translations.scripts.po_export_queue import process_queue
 
@@ -14,7 +14,7 @@ class RosettaExportQueue(LaunchpadCronScript):
     """Translation exports."""
 
     def main(self):
-        with SlaveDatabasePolicy():
+        with StandbyDatabasePolicy():
             process_queue(self.txn, self.logger)
 
 
diff --git a/lib/lp/archivepublisher/scripts/generate_contents_files.py b/lib/lp/archivepublisher/scripts/generate_contents_files.py
index 2fa9d60..14e6416 100644
--- a/lib/lp/archivepublisher/scripts/generate_contents_files.py
+++ b/lib/lp/archivepublisher/scripts/generate_contents_files.py
@@ -24,7 +24,7 @@ from lp.services.command_spawner import (
 from lp.services.config import config
 from lp.services.database.policy import (
     DatabaseBlockedPolicy,
-    SlaveOnlyDatabasePolicy,
+    StandbyOnlyDatabasePolicy,
     )
 from lp.services.osutils import ensure_directory_exists
 from lp.services.scripts.base import (
@@ -304,5 +304,5 @@ class GenerateContentsFiles(LaunchpadCronScript):
     def main(self):
         """See `LaunchpadScript`."""
         # This code has no need to alter the database.
-        with SlaveOnlyDatabasePolicy():
+        with StandbyOnlyDatabasePolicy():
             self.process()
diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
index 79d793e..0d4f5f9 100644
--- a/lib/lp/registry/model/person.py
+++ b/lib/lp/registry/model/person.py
@@ -251,7 +251,7 @@ from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
 from lp.services.database.interfaces import IStore
-from lp.services.database.policy import MasterDatabasePolicy
+from lp.services.database.policy import PrimaryDatabasePolicy
 from lp.services.database.sqlbase import (
     convert_storm_clause_to_string,
     cursor,
@@ -3332,10 +3332,10 @@ class PersonSet:
             "OpenID identifier must not be empty.")
 
         # Load the EmailAddress, Account and OpenIdIdentifier records
-        # from the master (if they exist). We use the master to avoid
+        # from the primary (if they exist). We use the primary to avoid
         # possible replication lag issues but this might actually be
         # unnecessary.
-        with MasterDatabasePolicy():
+        with PrimaryDatabasePolicy():
             identifier = IStore(OpenIdIdentifier).find(
                 OpenIdIdentifier, identifier=openid_identifier).one()
             email = getUtility(IEmailAddressSet).getByEmail(email_address)
diff --git a/lib/lp/services/database/doc/db-policy.txt b/lib/lp/services/database/doc/db-policy.txt
index 48255e9..17dc147 100644
--- a/lib/lp/services/database/doc/db-policy.txt
+++ b/lib/lp/services/database/doc/db-policy.txt
@@ -1,15 +1,15 @@
 Storm Stores & Database Policies
 ================================
 
-Launchpad has multiple master and slave databases. Changes to data are
-made on the master and replicated asynchronously to the slave
-databases. Slave databases will usually lag a few seconds behind their
-master. Under high load they may lag a few minutes behind, during
+Launchpad has multiple primary and standby databases. Changes to data are
+made on the primary and replicated asynchronously to the standby
+databases. Standby databases will usually lag a few seconds behind their
+primary. Under high load they may lag a few minutes behind, during
 maintenance they may lag a few hours behind and if things explode
 while admins are on holiday they may lag days behind.
 
-If know your code needs to change data, or must have the latest posible
-information, you retrieve objects from the master databases that stores
+If you know your code needs to change data, or must have the latest possible
+information, you retrieve objects from the primary database that stores
 the data for your database class.
 
     >>> from lp.services.database.interfaces import IMasterStore
@@ -24,12 +24,12 @@ the data for your database class.
 
 Sometimes though we know we will not make changes and don't care much
 if the information is a little out of date. In these cases you should
-explicitly retrieve objects from a slave.
+explicitly retrieve objects from a standby.
 
-The more agressively we retrieve objects from slave databases instead
-of the master, the better the overall performance of Launchpad will be.
-We can distribute this load over many slave databases but are limited to
-a single master.
+The more aggressively we retrieve objects from standby databases instead
+of the primary, the better the overall performance of Launchpad will be.
+We can distribute this load over many standby databases but are limited to
+a single primary.
 
     >>> from lp.services.database.interfaces import ISlaveStore
     >>> ro_janitor = ISlaveStore(Person).find(
@@ -57,28 +57,28 @@ depends on the currently installed database policy.
     True
 
 As you can see, the default database policy retrieves objects from
-the master database. This allows our code written before database
+the primary database. This allows our code written before database
 replication was implemented to keep working.
 
 To alter this behaviour, you can install a different database policy.
 
-    >>> from lp.services.database.policy import SlaveDatabasePolicy
-    >>> with SlaveDatabasePolicy():
+    >>> from lp.services.database.policy import StandbyDatabasePolicy
+    >>> with StandbyDatabasePolicy():
     ...     default_janitor = IStore(Person).find(
     ...         Person, Person.name == 'janitor').one()
     >>> default_janitor is writable_janitor
     False
 
 The database policy can also affect what happens when objects are
-explicitly retrieved from a slave or master database. For example,
+explicitly retrieved from a standby or primary database. For example,
 if we have code that needs to run during database maintenance or
-code we want to prove only accesses slave database resources, we can
-raise an exception if an attempt is made to access master database
+code we want to prove only accesses standby database resources, we can
+raise an exception if an attempt is made to access primary database
 resources.
 
     >>> from lp.services.database.policy import (
-    ...     SlaveOnlyDatabasePolicy)
-    >>> with SlaveOnlyDatabasePolicy():
+    ...     StandbyOnlyDatabasePolicy)
+    >>> with StandbyOnlyDatabasePolicy():
     ...     whoops = IMasterStore(Person).find(
     ...         Person, Person.name == 'janitor').one()
     Traceback (most recent call last):
@@ -103,7 +103,7 @@ IStoreSelector utility for cases where the 'with' syntax cannot
 be used.
 
     >>> from lp.services.database.interfaces import IStoreSelector
-    >>> getUtility(IStoreSelector).push(SlaveDatabasePolicy())
+    >>> getUtility(IStoreSelector).push(StandbyDatabasePolicy())
     >>> try:
     ...     default_janitor = IStore(Person).find(
     ...         Person, Person.name == 'janitor').one()
diff --git a/lib/lp/services/database/policy.py b/lib/lp/services/database/policy.py
index 803d4bc..a347060 100644
--- a/lib/lp/services/database/policy.py
+++ b/lib/lp/services/database/policy.py
@@ -7,9 +7,9 @@ __all__ = [
     'BaseDatabasePolicy',
     'DatabaseBlockedPolicy',
     'LaunchpadDatabasePolicy',
-    'MasterDatabasePolicy',
-    'SlaveDatabasePolicy',
-    'SlaveOnlyDatabasePolicy',
+    'PrimaryDatabasePolicy',
+    'StandbyDatabasePolicy',
+    'StandbyOnlyDatabasePolicy',
     ]
 
 from datetime import (
@@ -192,10 +192,10 @@ class DatabaseBlockedPolicy(BaseDatabasePolicy):
         raise DisallowedStore(name, flavor)
 
 
-class MasterDatabasePolicy(BaseDatabasePolicy):
+class PrimaryDatabasePolicy(BaseDatabasePolicy):
     """`IDatabasePolicy` that selects the MASTER_FLAVOR by default.
 
-    Slave databases can still be accessed if requested explicitly.
+    Standby databases can still be accessed if requested explicitly.
 
     This policy is used for XMLRPC and WebService requests which don't
     support session cookies. It is also used when no policy has been
@@ -204,15 +204,15 @@ class MasterDatabasePolicy(BaseDatabasePolicy):
     default_flavor = MASTER_FLAVOR
 
 
-class SlaveDatabasePolicy(BaseDatabasePolicy):
+class StandbyDatabasePolicy(BaseDatabasePolicy):
     """`IDatabasePolicy` that selects the SLAVE_FLAVOR by default.
 
-    Access to a master can still be made if requested explicitly.
+    Access to the primary can still be made if requested explicitly.
     """
     default_flavor = SLAVE_FLAVOR
 
 
-class SlaveOnlyDatabasePolicy(BaseDatabasePolicy):
+class StandbyOnlyDatabasePolicy(BaseDatabasePolicy):
     """`IDatabasePolicy` that only allows access to SLAVE_FLAVOR stores.
 
     This policy is used for Feeds requests and other always-read only request.
@@ -223,8 +223,7 @@ class SlaveOnlyDatabasePolicy(BaseDatabasePolicy):
         """See `IDatabasePolicy`."""
         if flavor == MASTER_FLAVOR:
             raise DisallowedStore(flavor)
-        return super(SlaveOnlyDatabasePolicy, self).getStore(
-            name, SLAVE_FLAVOR)
+        return super().getStore(name, SLAVE_FLAVOR)
 
 
 def LaunchpadDatabasePolicyFactory(request):
@@ -375,10 +374,10 @@ def WebServiceDatabasePolicyFactory(request):
     """
     # If a session cookie was sent with the request, use the
     # standard Launchpad database policy for load balancing to
-    # the slave databases. The javascript web service libraries
+    # the standby databases. The javascript web service libraries
     # send the session cookie for authenticated users.
     cookie_name = getUtility(IClientIdManager).namespace
     if cookie_name in request.cookies:
         return LaunchpadDatabasePolicy(request)
-    # Otherwise, use the master only web service database policy.
-    return MasterDatabasePolicy(request)
+    # Otherwise, use the primary only web service database policy.
+    return PrimaryDatabasePolicy(request)
diff --git a/lib/lp/services/librarian/tests/test_client.py b/lib/lp/services/librarian/tests/test_client.py
index a5528f9..99b8369 100644
--- a/lib/lp/services/librarian/tests/test_client.py
+++ b/lib/lp/services/librarian/tests/test_client.py
@@ -26,7 +26,7 @@ import transaction
 from lp.services.config import config
 from lp.services.daemons.tachandler import TacTestSetup
 from lp.services.database.interfaces import ISlaveStore
-from lp.services.database.policy import SlaveDatabasePolicy
+from lp.services.database.policy import StandbyDatabasePolicy
 from lp.services.database.sqlbase import block_implicit_flushes
 from lp.services.librarian import client as client_module
 from lp.services.librarian.client import (
@@ -293,14 +293,14 @@ class LibrarianClientTestCase(TestCase):
             client.addFile,
             'sample.txt', 7, io.BytesIO(b'sample'), 'text/plain')
 
-    def test_addFile_uses_master(self):
+    def test_addFile_uses_primary(self):
         # addFile is a write operation, so it should always use the
-        # master store, even if the slave is the default. Close the
-        # slave store and try to add a file, verifying that the master
+        # primary store, even if the standby is the default. Close the
+        # standby store and try to add a file, verifying that the primary
         # is used.
         client = LibrarianClient()
         ISlaveStore(LibraryFileAlias).close()
-        with SlaveDatabasePolicy():
+        with StandbyDatabasePolicy():
             alias_id = client.addFile(
                 'sample.txt', 6, io.BytesIO(b'sample'), 'text/plain')
         transaction.commit()
diff --git a/lib/lp/services/webapp/adapter.py b/lib/lp/services/webapp/adapter.py
index 0792cac..816f206 100644
--- a/lib/lp/services/webapp/adapter.py
+++ b/lib/lp/services/webapp/adapter.py
@@ -60,7 +60,7 @@ from lp.services.database.interfaces import (
     MASTER_FLAVOR,
     SLAVE_FLAVOR,
     )
-from lp.services.database.policy import MasterDatabasePolicy
+from lp.services.database.policy import PrimaryDatabasePolicy
 from lp.services.database.postgresql import ConnectionString
 from lp.services.log.loglevels import DEBUG2
 from lp.services.stacktrace import (
@@ -749,7 +749,7 @@ class StoreSelector:
         """See `IStoreSelector`."""
         db_policy = StoreSelector.get_current()
         if db_policy is None:
-            db_policy = MasterDatabasePolicy(None)
+            db_policy = PrimaryDatabasePolicy(None)
         return db_policy.getStore(name, flavor)
 
 
diff --git a/lib/lp/services/webapp/database.zcml b/lib/lp/services/webapp/database.zcml
index 0655a5f..2d9fcd1 100644
--- a/lib/lp/services/webapp/database.zcml
+++ b/lib/lp/services/webapp/database.zcml
@@ -13,7 +13,7 @@
     <adapter
         for="zope.publisher.interfaces.xmlrpc.IXMLRPCRequest"
         provides="lp.services.database.interfaces.IDatabasePolicy"
-        factory="lp.services.database.policy.MasterDatabasePolicy"
+        factory="lp.services.database.policy.PrimaryDatabasePolicy"
         />
     <adapter
         for="lp.layers.WebServiceLayer"
@@ -23,7 +23,7 @@
     <adapter
         for="lp.layers.FeedsLayer"
         provides="lp.services.database.interfaces.IDatabasePolicy"
-        factory="lp.services.database.policy.SlaveOnlyDatabasePolicy"
+        factory="lp.services.database.policy.StandbyOnlyDatabasePolicy"
         />
 
     <!-- Storm Store selector. -->
diff --git a/lib/lp/services/webapp/doc/webapp-publication.txt b/lib/lp/services/webapp/doc/webapp-publication.txt
index 98f1fd0..5bf86ce 100644
--- a/lib/lp/services/webapp/doc/webapp-publication.txt
+++ b/lib/lp/services/webapp/doc/webapp-publication.txt
@@ -1134,11 +1134,11 @@ principal's access_level and scope will match what was specified in the
 token.
 
     >>> from lp.registry.interfaces.product import IProductSet
-    >>> from lp.services.database.policy import MasterDatabasePolicy
+    >>> from lp.services.database.policy import PrimaryDatabasePolicy
     >>> from lp.services.database.interfaces import IStoreSelector
     >>> from lp.services.oauth.interfaces import IOAuthConsumerSet
     >>> from lp.services.webapp.interfaces import OAuthPermission
-    >>> getUtility(IStoreSelector).push(MasterDatabasePolicy())
+    >>> getUtility(IStoreSelector).push(PrimaryDatabasePolicy())
     >>> salgado = getUtility(IPersonSet).getByName('salgado')
     >>> consumer = getUtility(IOAuthConsumerSet).getByKey(u'foobar123451432')
     >>> token, _ = consumer.newRequestToken()
diff --git a/lib/lp/services/webapp/login.py b/lib/lp/services/webapp/login.py
index 4ae264c..82f38e1 100644
--- a/lib/lp/services/webapp/login.py
+++ b/lib/lp/services/webapp/login.py
@@ -47,7 +47,7 @@ from lp.registry.interfaces.person import (
     TeamEmailAddressError,
     )
 from lp.services.config import config
-from lp.services.database.policy import MasterDatabasePolicy
+from lp.services.database.policy import PrimaryDatabasePolicy
 from lp.services.identity.interfaces.account import (
     AccountDeceasedError,
     AccountSuspendedError,
@@ -361,15 +361,15 @@ class OpenIDCallbackView(OpenIDLogin):
         If the account is suspended, we stop and render an error page.
 
         We also update the 'last_write' key in the session if we've done any
-        DB writes, to ensure subsequent requests use the master DB and see
+        DB writes, to ensure subsequent requests use the primary DB and see
         the changes we just did.
         """
         identifier = self.openid_response.identity_url.split('/')[-1]
         identifier = six.ensure_text(identifier, encoding='ascii')
         should_update_last_write = False
-        # Force the use of the master database to make sure a lagged slave
-        # doesn't fool us into creating a Person/Account when one already
-        # exists.
+        # Force the use of the primary database to make sure a lagged
+        # standby doesn't fool us into creating a Person/Account when one
+        # already exists.
         person_set = getUtility(IPersonSet)
         email_address, full_name = self._getEmailAddressAndFullName()
         try:
@@ -393,7 +393,7 @@ class OpenIDCallbackView(OpenIDLogin):
             self.discharge_macaroon_raw = (
                 self.macaroon_response.discharge_macaroon_raw)
 
-        with MasterDatabasePolicy():
+        with PrimaryDatabasePolicy():
             self.login(person)
 
         if self.params.get('discharge_macaroon_field'):
@@ -402,7 +402,7 @@ class OpenIDCallbackView(OpenIDLogin):
         if should_update_last_write:
             # This is a GET request but we changed the database, so update
             # session_data['last_write'] to make sure further requests use
-            # the master DB and thus see the changes we've just made.
+            # the primary DB and thus see the changes we've just made.
             session_data = ISession(self.request)['lp.dbpolicy']
             session_data['last_write'] = datetime.utcnow()
         self._redirect()
diff --git a/lib/lp/services/webapp/tests/test_dbpolicy.py b/lib/lp/services/webapp/tests/test_dbpolicy.py
index c418683..a8eac12 100644
--- a/lib/lp/services/webapp/tests/test_dbpolicy.py
+++ b/lib/lp/services/webapp/tests/test_dbpolicy.py
@@ -45,9 +45,9 @@ from lp.services.database.interfaces import (
 from lp.services.database.policy import (
     BaseDatabasePolicy,
     LaunchpadDatabasePolicy,
-    MasterDatabasePolicy,
-    SlaveDatabasePolicy,
-    SlaveOnlyDatabasePolicy,
+    PrimaryDatabasePolicy,
+    StandbyDatabasePolicy,
+    StandbyOnlyDatabasePolicy,
     )
 from lp.services.webapp.servers import LaunchpadTestRequest
 from lp.testing import TestCase
@@ -98,13 +98,13 @@ class BaseDatabasePolicyTestCase(ImplicitDatabasePolicyTestCase):
         self.assertProvides(self.policy, IDatabasePolicy)
 
 
-class SlaveDatabasePolicyTestCase(BaseDatabasePolicyTestCase):
-    """Tests for the `SlaveDatabasePolicy`."""
+class StandbyDatabasePolicyTestCase(BaseDatabasePolicyTestCase):
+    """Tests for the `StandbyDatabasePolicy`."""
 
     def setUp(self):
         if self.policy is None:
-            self.policy = SlaveDatabasePolicy()
-        super(SlaveDatabasePolicyTestCase, self).setUp()
+            self.policy = StandbyDatabasePolicy()
+        super().setUp()
 
     def test_defaults(self):
         for store in ALL_STORES:
@@ -119,12 +119,12 @@ class SlaveDatabasePolicyTestCase(BaseDatabasePolicyTestCase):
                 IMasterStore)
 
 
-class SlaveOnlyDatabasePolicyTestCase(SlaveDatabasePolicyTestCase):
-    """Tests for the `SlaveDatabasePolicy`."""
+class StandbyOnlyDatabasePolicyTestCase(StandbyDatabasePolicyTestCase):
+    """Tests for the `StandbyOnlyDatabasePolicy`."""
 
     def setUp(self):
-        self.policy = SlaveOnlyDatabasePolicy()
-        super(SlaveOnlyDatabasePolicyTestCase, self).setUp()
+        self.policy = StandbyOnlyDatabasePolicy()
+        super().setUp()
 
     def test_master_allowed(self):
         for store in ALL_STORES:
@@ -133,15 +133,15 @@ class SlaveOnlyDatabasePolicyTestCase(SlaveDatabasePolicyTestCase):
                 getUtility(IStoreSelector).get, store, MASTER_FLAVOR)
 
 
-class MasterDatabasePolicyTestCase(BaseDatabasePolicyTestCase):
-    """Tests for the `MasterDatabasePolicy`."""
+class PrimaryDatabasePolicyTestCase(BaseDatabasePolicyTestCase):
+    """Tests for the `PrimaryDatabasePolicy`."""
 
     def setUp(self):
-        self.policy = MasterDatabasePolicy()
-        super(MasterDatabasePolicyTestCase, self).setUp()
+        self.policy = PrimaryDatabasePolicy()
+        super().setUp()
 
-    def test_XMLRPCRequest_uses_MasterPolicy(self):
-        """XMLRPC should always use the master flavor, since they always
+    def test_XMLRPCRequest_uses_PrimaryDatabasePolicy(self):
+        """XMLRPC should always use the primary flavor, since they always
         use POST and do not support session cookies.
         """
         request = LaunchpadTestRequest(
@@ -149,22 +149,22 @@ class MasterDatabasePolicyTestCase(BaseDatabasePolicyTestCase):
         setFirstLayer(request, IXMLRPCRequest)
         policy = getAdapter(request, IDatabasePolicy)
         self.assertTrue(
-            isinstance(policy, MasterDatabasePolicy),
-            "Expected MasterDatabasePolicy, not %s." % policy)
+            isinstance(policy, PrimaryDatabasePolicy),
+            "Expected PrimaryDatabasePolicy, not %s." % policy)
 
-    def test_slave_allowed(self):
-        # We get the master store even if the slave was requested.
+    def test_standby_allowed(self):
+        # We get the primary store even if the standby was requested.
         for store in ALL_STORES:
             self.assertProvides(
                 getUtility(IStoreSelector).get(store, SLAVE_FLAVOR),
                 ISlaveStore)
 
 
-class LaunchpadDatabasePolicyTestCase(SlaveDatabasePolicyTestCase):
+class LaunchpadDatabasePolicyTestCase(StandbyDatabasePolicyTestCase):
     """Fuller LaunchpadDatabasePolicy tests are in the page tests.
 
     This test just checks the defaults, which is the same as the
-    slave policy for unauthenticated requests.
+    standby policy for unauthenticated requests.
     """
 
     def setUp(self):
@@ -176,8 +176,8 @@ class LaunchpadDatabasePolicyTestCase(SlaveDatabasePolicyTestCase):
 class LayerDatabasePolicyTestCase(TestCase):
     layer = FunctionalLayer
 
-    def test_FeedsLayer_uses_SlaveDatabasePolicy(self):
-        """FeedsRequest should use the SlaveDatabasePolicy since they
+    def test_FeedsLayer_uses_StandbyOnlyDatabasePolicy(self):
+        """FeedsRequest should use the StandbyOnlyDatabasePolicy since they
         are read-only in nature. Also we don't want to send session cookies
         over them.
         """
@@ -185,10 +185,10 @@ class LayerDatabasePolicyTestCase(TestCase):
             SERVER_URL='http://feeds.launchpad.test')
         setFirstLayer(request, FeedsLayer)
         policy = IDatabasePolicy(request)
-        self.assertIsInstance(policy, SlaveOnlyDatabasePolicy)
+        self.assertIsInstance(policy, StandbyOnlyDatabasePolicy)
 
-    def test_WebServiceRequest_uses_MasterDatabasePolicy(self):
-        """WebService requests should always use the master flavor, since
+    def test_WebServiceRequest_uses_PrimaryDatabasePolicy(self):
+        """WebService requests should always use the primary flavor, since
         it's likely that clients won't support cookies and thus mixing read
         and write requests will result in incoherent views of the data.
 
@@ -201,12 +201,12 @@ class LayerDatabasePolicyTestCase(TestCase):
         request = LaunchpadTestRequest(SERVER_URL=server_url)
         setFirstLayer(request, WebServiceLayer)
         policy = IDatabasePolicy(request)
-        self.assertIsInstance(policy, MasterDatabasePolicy)
+        self.assertIsInstance(policy, PrimaryDatabasePolicy)
 
     def test_WebServiceRequest_uses_LaunchpadDatabasePolicy(self):
         """WebService requests with a session cookie will use the
         standard LaunchpadDatabasePolicy so their database queries
-        can be outsourced to a slave database when possible.
+        can be outsourced to a standby database when possible.
         """
         api_prefix = getUtility(
             IWebServiceConfiguration).active_versions[0]
diff --git a/lib/lp/services/webapp/tests/test_login.py b/lib/lp/services/webapp/tests/test_login.py
index 9abc359..c5a8956 100644
--- a/lib/lp/services/webapp/tests/test_login.py
+++ b/lib/lp/services/webapp/tests/test_login.py
@@ -50,7 +50,7 @@ from lp.services.database.interfaces import (
     IStore,
     IStoreSelector,
     )
-from lp.services.database.policy import MasterDatabasePolicy
+from lp.services.database.policy import PrimaryDatabasePolicy
 from lp.services.identity.interfaces.account import (
     AccountStatus,
     IAccountSet,
@@ -112,9 +112,9 @@ class StubbedOpenIDCallbackView(OpenIDCallbackView):
         super(StubbedOpenIDCallbackView, self).login(account)
         self.login_called = True
         current_policy = getUtility(IStoreSelector).get_current()
-        if not isinstance(current_policy, MasterDatabasePolicy):
+        if not isinstance(current_policy, PrimaryDatabasePolicy):
             raise AssertionError(
-                "Not using the master store: %s" % current_policy)
+                "Not using the primary store: %s" % current_policy)
 
 
 class FakeConsumer:
@@ -174,17 +174,17 @@ def MacaroonResponse_fromSuccessResponse_stubbed():
 def IAccountSet_getByOpenIDIdentifier_monkey_patched():
     # Monkey patch getUtility(IAccountSet).getByOpenIDIdentifier() with a
     # method that will raise an AssertionError when it's called and the
-    # installed DB policy is not MasterDatabasePolicy.  This is to ensure that
-    # the code we're testing forces the use of the master DB by installing the
-    # MasterDatabasePolicy.
+    # installed DB policy is not PrimaryDatabasePolicy.  This is to ensure
+    # that the code we're testing forces the use of the primary DB by
+    # installing the PrimaryDatabasePolicy.
     account_set = removeSecurityProxy(getUtility(IAccountSet))
     orig_getByOpenIDIdentifier = account_set.getByOpenIDIdentifier
 
     def fake_getByOpenIDIdentifier(identifier):
         current_policy = getUtility(IStoreSelector).get_current()
-        if not isinstance(current_policy, MasterDatabasePolicy):
+        if not isinstance(current_policy, PrimaryDatabasePolicy):
             raise AssertionError(
-                "Not using the master store: %s" % current_policy)
+                "Not using the primary store: %s" % current_policy)
         return orig_getByOpenIDIdentifier(identifier)
 
     try:
@@ -224,9 +224,9 @@ class TestOpenIDCallbackView(TestCaseWithFactory):
         view.initialize()
         view.openid_response = response
         # Monkey-patch getByOpenIDIdentifier() to make sure the view uses the
-        # master DB. This mimics the problem we're trying to avoid, where
+        # primary DB. This mimics the problem we're trying to avoid, where
         # getByOpenIDIdentifier() doesn't find a newly created account because
-        # it looks in the slave database.
+        # it looks in the standby database.
         with IAccountSet_getByOpenIDIdentifier_monkey_patched():
             html = view.render()
         return view, html
@@ -247,7 +247,7 @@ class TestOpenIDCallbackView(TestCaseWithFactory):
         # The 'last_write' flag was not updated (unlike in the other test
         # methods) because in this case we didn't have to create a
         # Person/Account entry, so it's ok for further requests to hit the
-        # slave DBs.
+        # standby DBs.
         self.assertNotIn('last_write', ISession(view.request)['lp.dbpolicy'])
 
     def test_gather_params(self):
@@ -350,7 +350,7 @@ class TestOpenIDCallbackView(TestCaseWithFactory):
                          removeSecurityProxy(person.preferredemail).email)
 
         # We also update the last_write flag in the session, to make sure
-        # further requests use the master DB and thus see the newly created
+        # further requests use the primary DB and thus see the newly created
         # stuff.
         self.assertLastWriteIsSet(view.request)
 
@@ -389,7 +389,7 @@ class TestOpenIDCallbackView(TestCaseWithFactory):
         self.assertEqual('Test account', person.displayname)
 
         # We also update the last_write flag in the session, to make sure
-        # further requests use the master DB and thus see the newly created
+        # further requests use the primary DB and thus see the newly created
         # stuff.
         self.assertLastWriteIsSet(view.request)
 
@@ -416,7 +416,7 @@ class TestOpenIDCallbackView(TestCaseWithFactory):
         self.assertEqual(AccountStatus.ACTIVE, person.account.status)
         self.assertEqual(email, person.preferredemail.email)
         # We also update the last_write flag in the session, to make sure
-        # further requests use the master DB and thus see the newly created
+        # further requests use the primary DB and thus see the newly created
         # stuff.
         self.assertLastWriteIsSet(view.request)
 
@@ -442,7 +442,7 @@ class TestOpenIDCallbackView(TestCaseWithFactory):
         self.assertEqual(AccountStatus.ACTIVE, person.account.status)
         self.assertEqual(email, person.preferredemail.email)
         # We also update the last_write flag in the session, to make sure
-        # further requests use the master DB and thus see the newly created
+        # further requests use the primary DB and thus see the newly created
         # stuff.
         self.assertLastWriteIsSet(view.request)
 
diff --git a/lib/lp/soyuz/stories/soyuz/xx-private-builds.txt b/lib/lp/soyuz/stories/soyuz/xx-private-builds.txt
index c21f02a..362ad7b 100644
--- a/lib/lp/soyuz/stories/soyuz/xx-private-builds.txt
+++ b/lib/lp/soyuz/stories/soyuz/xx-private-builds.txt
@@ -276,9 +276,9 @@ Let's make the iceweasel package available in breezy-autotest.
 First log in as an admin to be able to manipulate the source publishing.
 
     >>> login("foo.bar@xxxxxxxxxxxxx")
-    >>> from lp.services.database.policy import MasterDatabasePolicy
+    >>> from lp.services.database.policy import PrimaryDatabasePolicy
     >>> from lp.services.database.interfaces import IStoreSelector
-    >>> getUtility(IStoreSelector).push(MasterDatabasePolicy())
+    >>> getUtility(IStoreSelector).push(PrimaryDatabasePolicy())
     >>> ubuntutest = getUtility(IDistributionSet)['ubuntutest']
     >>> breezy_autotest = ubuntutest['breezy-autotest']
     >>> new_pub = private_source_pub.copyTo(
diff --git a/lib/lp/testing/factory.py b/lib/lp/testing/factory.py
index 2856fa0..684661f 100644
--- a/lib/lp/testing/factory.py
+++ b/lib/lp/testing/factory.py
@@ -255,7 +255,7 @@ from lp.services.database.interfaces import (
     IStore,
     IStoreSelector,
     )
-from lp.services.database.policy import MasterDatabasePolicy
+from lp.services.database.policy import PrimaryDatabasePolicy
 from lp.services.database.sqlbase import flush_database_updates
 from lp.services.gpg.interfaces import (
     GPGKeyAlgorithm,
@@ -408,7 +408,7 @@ def default_master_store(func):
         except ComponentLookupError:
             # Utilities not registered. No policies.
             return func(*args, **kw)
-        store_selector.push(MasterDatabasePolicy())
+        store_selector.push(PrimaryDatabasePolicy())
         try:
             return func(*args, **kw)
         finally:
diff --git a/lib/lp/translations/scripts/po_export_queue.py b/lib/lp/translations/scripts/po_export_queue.py
index 4be8aef..2ee4434 100644
--- a/lib/lp/translations/scripts/po_export_queue.py
+++ b/lib/lp/translations/scripts/po_export_queue.py
@@ -19,7 +19,7 @@ from zope.component import (
 from lp.registry.interfaces.productseries import IProductSeries
 from lp.registry.interfaces.sourcepackage import ISourcePackage
 from lp.services.config import config
-from lp.services.database.policy import SlaveOnlyDatabasePolicy
+from lp.services.database.policy import StandbyOnlyDatabasePolicy
 from lp.services.librarian.interfaces import ILibraryFileAliasSet
 from lp.services.mail.helpers import (
     get_contact_email_addresses,
@@ -374,7 +374,7 @@ def process_request(person, objects, format, logger):
     multiple files) and information about files that we failed to export (if
     any).
     """
-    # Keep as much work off the master store as possible, so we avoid
+    # Keep as much work off the primary store as possible, so we avoid
     # opening unnecessary transactions there.  It could be a while
     # before we get to the commit.
     translation_exporter = getUtility(ITranslationExporter)
@@ -412,13 +412,13 @@ def process_queue(transaction_manager, logger):
     while request != no_request:
 
         # This can take a long time.  Make sure we don't open any
-        # transactions on the master store before we really need to.
+        # transactions on the primary store before we really need to.
         transaction_manager.commit()
-        with SlaveOnlyDatabasePolicy():
+        with StandbyOnlyDatabasePolicy():
             person, objects, format, request_ids = request
             result = process_request(person, objects, format, logger)
 
-        # Almost done.  Now we can go back to using the master database
+        # Almost done.  Now we can go back to using the primary database
         # where needed.
         result.upload(logger=logger)
         result.notify()