From cdc02919f9d1b2c2d1c5cdf7eb15e1c9a0b38f09 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Mon, 12 Dec 2016 12:00:00 -0500
Subject: [PATCH 8/8] fixup! Add logical replication workers

---
 doc/src/sgml/logical-replication.sgml      | 136 ++++++++++++++---------------
 doc/src/sgml/monitoring.sgml               |  10 +--
 doc/src/sgml/ref/create_publication.sgml   |   2 +-
 src/backend/catalog/system_views.sql       |  16 ++--
 src/backend/executor/execReplication.c     |  28 +++---
 src/backend/postmaster/postmaster.c        |   6 +-
 src/backend/replication/logical/apply.c    |   4 +-
 src/backend/replication/logical/launcher.c |  13 ++-
 src/include/catalog/pg_subscription.h      |   9 +-
 9 files changed, 109 insertions(+), 115 deletions(-)

diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index bf5966e5ac..6603533ba6 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -6,7 +6,7 @@ <title>Logical Replication</title>
   <para>
     Logical replication is a method of replicating data objects and their
     changes, based upon their replication identity (usually a primary key).
-    We use the term logical in contrast to physical replication which
+    We use the term logical in contrast to physical replication, which
     uses exact block addresses and byte-by-byte replication.
     PostgreSQL supports both mechanisms concurrently, see
     <xref linkend="high-availability">. Logical replication allows
@@ -37,7 +37,7 @@ <title>Logical Replication</title>
     <listitem>
       <para>
         Sending incremental changes in a single database or a subset of
-        a database to Subscribers as they occur.
+        a database to subscribers as they occur.
       </para>
     </listitem>
     <listitem>
@@ -54,7 +54,7 @@ <title>Logical Replication</title>
     </listitem>
     <listitem>
       <para>
-        Replicating between different major versions of PostgreSQL
+        Replicating between different major versions of PostgreSQL.
       </para>
     </listitem>
     <listitem>
@@ -74,7 +74,7 @@ <title>Logical Replication</title>
     PostgreSQL instance and can be used as a publisher for other
     databases by defining its own publications. When the subscriber is
     treated as read-only by application, there will be no conflicts from
-    a single subscription. On the other hand if there are other writes
+    a single subscription. On the other hand, if there are other writes
     done either by application or other subscribers to the same set of
     tables conflicts can arise.
   </para>
@@ -84,14 +84,13 @@ <title>Publication</title>
   <para>
     A <firstterm>publication</> object can be defined on any physical
     replication master. The node where a publication is defined is referred
-    to as <firstterm>publisher</>. Only superusers or members of the
-    <literal>REPLICATION</> role can define a publication. A publication is
+    to as <firstterm>publisher</>. A publication is
     a set of changes generated from a group of tables, and might also be
     described as a <firstterm>change set</> or <firstterm>replication set</>.
     Each publication exists in only one database.
   </para>
   <para>
-    Publications are different from table schema and do not affect
+    Publications are different from schemas and do not affect
     how the table is accessed. Each table can be added to multiple
     publications if needed.  Publications may currently only contain
     tables. Objects must be added explicitly, except when a publication
@@ -99,38 +98,35 @@ <title>Publication</title>
   </para>
   <para>
     Publications can choose to limit the changes they produce to show
-    any combination of <command>INSERT</>, <command>UPDATE</> and
+    any combination of <command>INSERT</>, <command>UPDATE</>, and
     <command>DELETE</> in a similar way to the way triggers are fired by
-    particular event types. If a table with without a
-    <literal>REPLICA IDENTITY</> is added to a publication which replicates
+    particular event types. If a table without a
+    <literal>REPLICA IDENTITY</> is added to a publication that replicates
     <command>UPDATE</> or <command>DELETE</> operations then subsequent
     <command>UPDATE</> or <command>DELETE</> operations will fail on the
     publisher.
    </para>
   <para>
-    The definition of a publication object will be included within
-    pg_dump.
-  </para>
-  <para>
     Every publication can have multiple subscribers.
   </para>
   <para>
-    Publication is created using the <xref linkend="sql-createpublication">
+    A publication is created using the <xref linkend="sql-createpublication">
     command and may be later altered or dropped using corresponding commands.
   </para>
   <para>
     The individual tables can be added and removed dynamically using
     <xref linkend="sql-alterpublication">. Both the <literal>ADD TABLE</>
-    and <literal>DROP TABLE</> operations are transactional so the table
+    and <literal>DROP TABLE</> operations are transactional; so the table
     will start or stop replicating at the correct snapshot once the
     transaction has committed.
   </para>
 </sect1>
+
 <sect1 id="logical-replication-subscription">
   <title>Subscription</title>
   <para>
     A <firstterm>subscription</> is the downstream side of logical
-    replication. The node where subscription is defined is referred to as
+    replication. The node where a subscription is defined is referred to as
     the <firstterm>subscriber</>. Subscription defines the connection to
     another database and set of publications (one or more) to which it
     wants to be subscribed.
@@ -141,7 +137,7 @@ <title>Subscription</title>
     databases by defining its own publications.
   </para>
   <para>
-    A subscriber may have multiple subscriptions if desired. It is
+    A subscriber node may have multiple subscriptions if desired. It is
     possible to define multiple subscriptions between a single
     publisher-subscriber pair, in which case extra care must be taken
     to ensure that the subscribed publication objects don't overlap.
@@ -153,32 +149,33 @@ <title>Subscription</title>
     of pre-existing table data.
   </para>
   <para>
-    Subscriptions are not dumped by pg_dump by default but can be
-    requested using the --subscriptions parameter.
+    Subscriptions are not dumped by <command>pg_dump</command> by default but can be
+    requested using the command-line option <option>--subscriptions</option>.
   </para>
   <para>
     The subscription is added using <xref linkend="sql-createsubscription">
     and can be stopped/resumed at any time using the
-    <xref linkend="sql-altersubscription"> command or removed using
+    <xref linkend="sql-altersubscription"> command and removed using
     <xref linkend="sql-dropsubscription">.
   </para>
   <para>
-    When subscription is dropped and recreated, the synchronization
+    When a subscription is dropped and recreated, the synchronization
     information is lost. This means that the data has to be
     resynchronized afterwards.
   </para>
   <para>
     The schema definitions are not replicated and the published tables
     must exist on the subsriber for replication to work. Only regular
-    tables may be the target of replication (ie, you can't replicate
+    tables may be the target of replication (i.e., you can't replicate
     to a view).
   </para>
   <para>
-    The tables are matched using fully qualified table name. Replication
-    to differently named tables on subscriber is not supported.
+    The tables are matched between the publisher and the subscriber using
+    the fully qualified table name. Replication
+    to differently-named tables on the subscriber is not supported.
   </para>
   <para>
-    Columns of a table are also matched by name. The different order of
+    Columns of a table are also matched by name. A different order of
     columns in the target table is allowed, but the column types have to
     match.
   </para>
@@ -197,11 +194,11 @@ <title>Conflicts</title>
   <para>
     A conflict will produce an error and will stop the replication; it
     must be resolved manually by the user. Details about the conflict can
-    be found in the subscribers PostgreSQL log.
+    be found in the subscriber's server log.
   </para>
   <para>
     The resolution can be done either by changing data on the subscriber
-    so that it does not conflict with incoming change or by skipping the
+    so that it does not conflict with the incoming change or by skipping the
     transaction that conflicts with the existing data. The transaction
     can be skipped by calling the
     <link linkend="pg-replication-origin-advance">
@@ -217,42 +214,42 @@ <title>Architecture</title>
   <para>
     Logical replication starts by copying a snapshot of the data on
     the publisher database. Once that is done, changes on the publisher
-    are sent to the subscriber as they occur in real-time. The subscriber
+    are sent to the subscriber as they occur in real time. The subscriber
     applies data in the order in which commits were made on the
     publisher so that transactional consistency is guaranteed for the
-    publications within any single Subscription.
+    publications within any single subscription.
   </para>
   <para>
     Logical replication is built with an architecture similar to
     physical streaming replication
     (see <xref linkend="streaming-replication">). It is implemented by
-    WalSender and the Apply processes. The WalSender starts logical
+    <quote>walsender</quote> and the <quote>apply</quote> processes. The walsender starts logical
     decoding (described in <xref linkend="logicaldecoding">) of the WAL and
     loads the standard logical decoding plugin (pgoutput). The plugin
     transforms the changes read from WAL to the logical replication protocol
     (see <xref linkend="protocol-logical-replication">) and filters the data
-    according to publication specification. The data is then continuously
-    transferred using the streaming replication protocol to the Apply worker
+    according to the publication specification. The data is then continuously
+    transferred using the streaming replication protocol to the apply worker,
     which maps the data to local tables and applies the individual changes as
     they are received in exact transactional order.
   </para>
   <para>
-    The Apply process on the subscriber database always runs with
-    session_replication_role set to replica, which produces the usual effects
+    The apply process on the subscriber database always runs with
+    <varname>session_replication_role</varname> set to <literal>replica</literal>, which produces the usual effects
     on triggers and constraints.
   </para>
   <sect2 id="logical-replication-snapshot">
-    <title>Initial snapshot</title>
+    <title>Initial Snapshot</title>
     <para>
       The initial data in existing subscribed tables are snapshotted and
-      copied in a parallel instance of a special kind of Apply process.
+      copied in a parallel instance of a special kind of apply process.
       This process will create its own temporary replication slot and
       copy the existing data. Once existing data is copied, the worker
-      enters synchronization mode which ensures that the table is brought
-      up to synchronized state with the main Apply process by streaming
-      any changes which happened during the initial data copy using standard
+      enters synchronization mode, which ensures that the table is brought
+      up to a synchronized state with the main apply process by streaming
+      any changes that happened during the initial data copy using standard
       logical replication. Once the synchronization is done, the control
-      of the replication of the table is given back to the main Apply
+      of the replication of the table is given back to the main apply
       process where the replication continues as normal.
     </para>
   </sect2>
@@ -262,81 +259,82 @@ <title>Monitoring</title>
   <para>
     Because logical replication is based on similar architecture as
     <link linkend="streaming-replication">physical streaming
-    replication</link> the monitoring on publication is very similar to
+    replication</link> the monitoring on a publication node is very similar to
     monitoring of physical replication master (see
     <xref linkend="streaming-replication-monitoring">).
   </para>
   <para>
     The monitoring information about subscription is visible in
     <link linkend="pg-stat-subscription"><literal>pg_stat_subscription</></link>.
-    This view contains one row for every subscription worker. Subscription
+    This view contains one row for every subscription worker. A subscription
     can have zero or more active subscription workers depending on its state.
   </para>
   <para>
-    Normally there is a single Apply process running for the enabled
-    subscription. The disabled subscription of crashed subscription will
+    Normally, there is a single apply process running for an enabled
+    subscription. A disabled subscription or a crashed subscription will
     have zero rows in this view. If the initial data synchronization of
-    any table is in progress there will be additional worker(s) for the
-    table(s) being synchronized.
+    any table is in progress there will be additional workers for the
+    tables being synchronized.
   </para>
 </sect1>
 <sect1 id="logical-replication-security">
   <title>Security</title>
   <para>
-    Replication connection can occur in the same way as physical streaming
+    Logical replication connections occur in the same way as physical streaming
     replication. It requires access to be specifically given using
-    pg_hba.conf. The role used for the replication must have
-    <literal>REPLICATION</literal> privilege <command>GRANT</command>ED.
+    <filename>pg_hba.conf</filename>. The role used for the replication connection must have
+    the <literal>REPLICATION</literal> attribute.
     This gives a role access to both logical and physical replication.
   </para>
   <para>
-    To create a publication the user must have the REPLICATION role, or be
-    a superuser.
+    To create a publication, the user must have the <literal>CREATE</literal>
+    privilege in the database.
   </para>
   <para>
-    To create a subscription the user must be a superuser.
+    To create a subscription, the user must be a superuser.
   </para>
   <para>
     The subscription apply process will run in the local database
     with the privileges of a superuser.
   </para>
   <para>
-    In particular, note that privileges are not re-checked as each change
+    Privileges are only checked once at the start of a replication connection.
+    They are not re-checked as each change
     record is read from the publisher, nor are they re-checked for each change
-    when applied. Security is checked once at startup.
+    when applied.
   </para>
 </sect1>
 <sect1 id="logical-replication-gucs">
   <title>Logical replication related configuration parameters</title>
   <para>
-    The Logical Replication requires several configuration options to be
+    Logical replication requires several configuration options to be
     set.
   </para>
   <para>
-    On the publisher side the <varname>wal_level</> must be set to
+    On the publisher side, <varname>wal_level</> must be set to
     <literal>logical</>, and <varname>max_replication_slots</> has to be set to
-    at least the number of Subscriptions expected to connect with some reserve
-    for table synchronization as well. And <varname>max_wal_senders</>
+    at least the number of subscriptions expected to connect with some reserve
+    for table synchronization. And <varname>max_wal_senders</>
     should be set to at least the same as <varname>max_replication_slots</> plus
     the number of physical replicas that are connected at the same time.
   </para>
   <para>
-    The Subscriber also requires the <varname>max_replication_slots</> to
+    The subscriber also requires the <varname>max_replication_slots</> to
     be set. In this case it should be set to at least the number of
-    Subscriptions that will be added to the Subscriber. The
+    subscriptions that will be added to the subscriber.
     <varname>max_logical_replication_workers</> has to be set to at least
-    the number of Subscriptions again with some reserve for the table
+    the number of subscriptions, again with some reserve for the table
     synchronization. Additionally the <varname>max_worker_processes</> may
     need to be adjusted to accommodate for replication workers, at least
-    (<varname>max_logical_replication_workers</> + <literal>1</>). Please
-    note that some extensions and parallel queries also take worker slots
+    (<varname>max_logical_replication_workers</> + <literal>1</>).
+    Note that some extensions and parallel queries also take worker slots
     from <varname>max_worker_processes</>.
   </para>
 </sect1>
 <sect1 id="logical-replication-quick-setup">
   <title>Quick setup</title>
   <para>
-    First set the configuration options in the postgresql.conf:
+    First set the configuration options in <filename>postgresql.conf</filename>:
 <programlisting>
 wal_level = logical
 max_worker_processes = 10 # one per subscription + one per instance needed on subscriber
@@ -346,7 +344,7 @@ <title>Quick setup</title>
 </programlisting>
   </para>
   <para>
-    The pg_hba.conf needs to be adjusted to allow replication (the
+    <filename>pg_hba.conf</filename> needs to be adjusted to allow replication (the
     values here depend on your actual network configuration and user you
     want to use for connecting):
 <programlisting>
@@ -360,13 +358,13 @@ <title>Quick setup</title>
 </programlisting>
   </para>
   <para>
-    And on the Subscriber database:
+    And on the subscriber database:
 <programlisting>
-CREATE SUBSCRIPTION mysub WITH CONNECTION 'dbname=foo host=bar user=repuser' PUBLICATION mypub;
+CREATE SUBSCRIPTION mysub CONNECTION 'dbname=foo host=bar user=repuser' PUBLICATION mypub;
 </programlisting>
   </para>
   <para>
-    The above will start the replication process which synchronizes the
+    The above will start the replication process, which synchronizes the
     initial table contents of <literal>users</literal> and
     <literal>departments</literal> tables and then starts replicating
     incremental changes to those tables.
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 4d04330776..5c61ac785e 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -310,7 +310,7 @@ <title>Dynamic Statistics Views</title>
 
      <row>
       <entry><structname>pg_stat_subscription</><indexterm><primary>pg_stat_subscription</primary></indexterm></entry>
-      <entry>At least one row per subscription, showing statistics about
+      <entry>At least one row per subscription, showing information about
        the subscription workers.
        See <xref linkend="pg-stat-subscription"> for details.
       </entry>
@@ -1564,8 +1564,8 @@ <title><structname>pg_stat_subscription</structname> View</title>
    <tbody>
     <row>
      <entry><structfield>subid</></entry>
-     <entry><type>Oid</></entry>
-     <entry>Oid of the subscription</entry>
+     <entry><type>oid</></entry>
+     <entry>OID of the subscription</entry>
     </row>
     <row>
      <entry><structfield>subname</></entry>
@@ -1612,8 +1612,8 @@ <title><structname>pg_stat_subscription</structname> View</title>
 
   <para>
    The <structname>pg_stat_subscription</structname> view will contain one
-   row per subscription for main worker (with NULL pid if the worker is
-   not running) and then additional rows for workers handling initial data
+   row per subscription for main worker (with null PID if the worker is
+   not running), and additional rows for workers handling the initial data
    copy of the subscribed tables.
   </para>
 
diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml
index 2a0da598f3..995f2bcf3c 100644
--- a/doc/src/sgml/ref/create_publication.sgml
+++ b/doc/src/sgml/ref/create_publication.sgml
@@ -47,7 +47,7 @@ <title>Description</title>
    A publication is essentially a group of tables whose data changes are
    intended to be replicated through logical replication.  See
    <xref linkend="logical-replication-publication"> for details about how
-   publications fit into logical replication setup.
+   publications fit into the logical replication setup.
    </para>
  </refsect1>
 
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index acfeeee27a..ff1ac75a90 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -719,14 +719,14 @@ CREATE VIEW pg_stat_wal_receiver AS
 
 CREATE VIEW pg_stat_subscription AS
     SELECT
-			su.oid as subid,
-			su.subname,
-			st.pid,
-			st.received_lsn,
-			st.last_msg_send_time,
-			st.last_msg_receipt_time,
-			st.latest_end_lsn,
-			st.latest_end_time
+            su.oid AS subid,
+            su.subname,
+            st.pid,
+            st.received_lsn,
+            st.last_msg_send_time,
+            st.last_msg_receipt_time,
+            st.latest_end_lsn,
+            st.latest_end_time
     FROM pg_subscription su
             LEFT JOIN pg_stat_get_subscription(NULL) st
                       ON (st.subid = su.oid);
diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c
index 44248a49f1..897118f52a 100644
--- a/src/backend/executor/execReplication.c
+++ b/src/backend/executor/execReplication.c
@@ -72,8 +72,8 @@ build_replindex_scan_key(ScanKey skey, Relation rel, Relation idxrel,
 		Oid			optype = get_opclass_input_type(opclass->values[attoff]);
 
 		/*
-		 * Load the operator info, we need this to get the equality operator
-		 * function for the scankey.
+		 * Load the operator info.  We need this to get the equality operator
+		 * function for the scan key.
 		 */
 		opfamily = get_opclass_family(opclass->values[attoff]);
 
@@ -109,8 +109,8 @@ build_replindex_scan_key(ScanKey skey, Relation rel, Relation idxrel,
 /*
  * Search the relation 'rel' for tuple using the index.
  *
- * If a matching tuple is found lock it with lockmode, fill the slot with its
- * contents and return true, return false is returned otherwise.
+ * If a matching tuple is found, lock it with lockmode, fill the slot with its
+ * contents, and return true.  Return false otherwise.
  */
 bool
 RelationFindReplTupleByIndex(Relation rel, Oid idxoid,
@@ -258,8 +258,8 @@ tuple_equals_slot(TupleDesc	desc, HeapTuple tup, TupleTableSlot *slot)
 /*
  * Search the relation 'rel' for tuple using the sequential scan.
  *
- * If a matching tuple is found lock it with lockmode, fill the slot with its
- * contents and return true, return false is returned otherwise.
+ * If a matching tuple is found, lock it with lockmode, fill the slot with its
+ * contents, and return true.  Return false otherwise.
  *
  * Note that this stops on the first matching tuple.
  *
@@ -357,10 +357,10 @@ RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode,
 }
 
 /*
- * Insert tuple represented in the slot to the relation, update the indexes
- * and execute any constraints and per row triggers.
+ * Insert tuple represented in the slot to the relation, update the indexes,
+ * and execute any constraints and per-row triggers.
  *
- * Caller is repsonsible for opening the indexes.
+ * Caller is responsible for opening the indexes.
  */
 void
 ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot)
@@ -412,12 +412,11 @@ ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot)
 	}
 }
 
-
 /*
  * Find the searchslot tuple and update it with data in the slot,
- * update the indexes and execute any constraints and per row triggers.
+ * update the indexes, and execute any constraints and per-row triggers.
  *
- * Caller is repsonsible for opening the indexes.
+ * Caller is responsible for opening the indexes.
  */
 void
 ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate,
@@ -475,12 +474,11 @@ ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate,
 	}
 }
 
-
 /*
  * Find the searchslot tuple and delete it, and execute any constraints
- * and per row triggers.
+ * and per-row triggers.
  *
- * Caller is repsonsible for opening the indexes.
+ * Caller is responsible for opening the indexes.
  */
 void
 ExecSimpleRelationDelete(EState *estate, EPQState *epqstate,
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 9069a43e1d..8212db3b9f 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -935,9 +935,9 @@ PostmasterMain(int argc, char *argv[])
 #endif
 
 	/*
-	 * Register the apply launcher. Since it registers background worker,
-	 * it needs to be called before InitializeMaxBackends() and it's probably
-	 * good idea to call it before aby modules had chance to take the
+	 * Register the apply launcher.  Since it registers a background worker,
+	 * it needs to be called before InitializeMaxBackends(), and it's probably
+	 * a good idea to call it before any modules had chance to take the
 	 * background worker slots.
 	 */
 	ApplyLauncherRegister();
diff --git a/src/backend/replication/logical/apply.c b/src/backend/replication/logical/apply.c
index de50f1dde6..3f78b30797 100644
--- a/src/backend/replication/logical/apply.c
+++ b/src/backend/replication/logical/apply.c
@@ -568,7 +568,7 @@ check_relation_updatable(LogicalRepRelMapEntry *rel)
 	ereport(ERROR,
 			(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 			 errmsg("the logical replication target %s has "
-					"neither REPLICA IDENTIY index or PRIMARY "
+					"neither REPLICA IDENTIY index nor PRIMARY "
 					"KEY and published relation does not have "
 					"REPLICA IDENTITY FULL",
 					quote_qualified_identifier(rel->remoterel.nspname,
@@ -1163,7 +1163,7 @@ reread_subscription(void)
 	if (!equal(newsub->publications, MySubscription->publications))
 	{
 		elog(LOG, "logical replication worker for subscription %s will "
-			 "restart because ssubscription's publications were changed",
+			 "restart because subscription's publications were changed",
 			 MySubscription->name);
 
 		walrcv_disconnect(wrconn);
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index 7d5a233580..f5b5ebcd06 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -251,9 +251,8 @@ logicalrep_worker_launch(Oid dbid, Oid subid)
 	{
 		ereport(WARNING,
 				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("logical replication worker registration failed, "
-						"you might want to increase "
-						"max_logical_replication_workers setting")));
+				 errmsg("out of logical replication workers slots"),
+				 errhint("You might need to increase max_logical_replication_workers.")));
 		return;
 	}
 
@@ -293,7 +292,7 @@ logicalrep_worker_launch(Oid dbid, Oid subid)
  * slot.
  *
  * Note it's caller's job to ensure that new workers are not being started
- * during this functiion call. That can be achieven by holding exclusive
+ * during this function call. That can be achieven by holding exclusive
  * lock on LogicalRepLauncherLock.
  */
 void
@@ -567,7 +566,7 @@ ApplyLauncherMain(Datum main_arg)
 									   ALLOCSET_DEFAULT_MAXSIZE);
 		oldctx = MemoryContextSwitchTo(subctx);
 
-		/* Block any concurrent DROPs. */
+		/* Block any concurrent DROP SUBSCRIPTION. */
 		LWLockAcquire(LogicalRepLauncherLock, LW_EXCLUSIVE);
 
 		/* search for subscriptions to start or stop. */
@@ -605,8 +604,8 @@ ApplyLauncherMain(Datum main_arg)
 					   started ? 5000L : 180000L,
 					   WAIT_EVENT_LOGICAL_LAUNCHER_MAIN);
 
-        /* emergency bailout if postmaster has died */
-        if (rc & WL_POSTMASTER_DEATH)
+		/* emergency bailout if postmaster has died */
+		if (rc & WL_POSTMASTER_DEATH)
 			proc_exit(1);
 
 		ResetLatch(&MyProc->procLatch);
diff --git a/src/include/catalog/pg_subscription.h b/src/include/catalog/pg_subscription.h
index b337d6dc7c..342066f17f 100644
--- a/src/include/catalog/pg_subscription.h
+++ b/src/include/catalog/pg_subscription.h
@@ -21,12 +21,11 @@
 #define SubscriptionRelationId			6100
 #define SubscriptionRelation_Rowtype_Id	6101
 
-/* ----------------
- * Technicaly, the subscriptions live inside the database so shared catalog
+/*
+ * Technicaly, the subscriptions live inside the database, so a shared catalog
  * seems weird, but the replication launcher process needs to access all of
- * then to be able to start the workers so we have to put them in a shared,
- * nailed catalogs.
- * ----------------
+ * them to be able to start the workers, so we have to put them in a shared,
+ * nailed catalog.
  */
 CATALOG(pg_subscription,6100) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101) BKI_SCHEMA_MACRO
 {
-- 
2.11.0

