mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	pg_createsubscriber: Message style improvements
This commit is contained in:
		@@ -88,8 +88,9 @@ PostgreSQL documentation
 | 
				
			|||||||
     <term><option>--database=<replaceable class="parameter">dbname</replaceable></option></term>
 | 
					     <term><option>--database=<replaceable class="parameter">dbname</replaceable></option></term>
 | 
				
			||||||
     <listitem>
 | 
					     <listitem>
 | 
				
			||||||
      <para>
 | 
					      <para>
 | 
				
			||||||
       The database name to create the subscription.  Multiple databases can
 | 
					       The name of the database in which to create a subscription.  Multiple
 | 
				
			||||||
       be selected by writing multiple <option>-d</option> switches.
 | 
					       databases can be selected by writing multiple <option>-d</option>
 | 
				
			||||||
 | 
					       switches.
 | 
				
			||||||
      </para>
 | 
					      </para>
 | 
				
			||||||
     </listitem>
 | 
					     </listitem>
 | 
				
			||||||
    </varlistentry>
 | 
					    </varlistentry>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -195,13 +195,13 @@ cleanup_objects_atexit(void)
 | 
				
			|||||||
				 */
 | 
									 */
 | 
				
			||||||
				if (dbinfo[i].made_publication)
 | 
									if (dbinfo[i].made_publication)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					pg_log_warning("publication \"%s\" in database \"%s\" on primary might be left behind",
 | 
										pg_log_warning("publication \"%s\" created in database \"%s\" on primary was left behind",
 | 
				
			||||||
								   dbinfo[i].pubname, dbinfo[i].dbname);
 | 
													   dbinfo[i].pubname, dbinfo[i].dbname);
 | 
				
			||||||
					pg_log_warning_hint("Consider dropping this publication before trying again.");
 | 
										pg_log_warning_hint("Drop this publication before trying again.");
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				if (dbinfo[i].made_replslot)
 | 
									if (dbinfo[i].made_replslot)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					pg_log_warning("replication slot \"%s\" in database \"%s\" on primary might be left behind",
 | 
										pg_log_warning("replication slot \"%s\" created in database \"%s\" on primary was left behind",
 | 
				
			||||||
								   dbinfo[i].replslotname, dbinfo[i].dbname);
 | 
													   dbinfo[i].replslotname, dbinfo[i].dbname);
 | 
				
			||||||
					pg_log_warning_hint("Drop this replication slot soon to avoid retention of WAL files.");
 | 
										pg_log_warning_hint("Drop this replication slot soon to avoid retention of WAL files.");
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -221,14 +221,14 @@ usage(void)
 | 
				
			|||||||
	printf(_("Usage:\n"));
 | 
						printf(_("Usage:\n"));
 | 
				
			||||||
	printf(_("  %s [OPTION]...\n"), progname);
 | 
						printf(_("  %s [OPTION]...\n"), progname);
 | 
				
			||||||
	printf(_("\nOptions:\n"));
 | 
						printf(_("\nOptions:\n"));
 | 
				
			||||||
	printf(_("  -d, --database=DBNAME           database to create a subscription\n"));
 | 
						printf(_("  -d, --database=DBNAME           database in which to create a subscription\n"));
 | 
				
			||||||
	printf(_("  -D, --pgdata=DATADIR            location for the subscriber data directory\n"));
 | 
						printf(_("  -D, --pgdata=DATADIR            location for the subscriber data directory\n"));
 | 
				
			||||||
	printf(_("  -n, --dry-run                   dry run, just show what would be done\n"));
 | 
						printf(_("  -n, --dry-run                   dry run, just show what would be done\n"));
 | 
				
			||||||
	printf(_("  -p, --subscriber-port=PORT      subscriber port number (default %s)\n"), DEFAULT_SUB_PORT);
 | 
						printf(_("  -p, --subscriber-port=PORT      subscriber port number (default %s)\n"), DEFAULT_SUB_PORT);
 | 
				
			||||||
	printf(_("  -P, --publisher-server=CONNSTR  publisher connection string\n"));
 | 
						printf(_("  -P, --publisher-server=CONNSTR  publisher connection string\n"));
 | 
				
			||||||
	printf(_("  -s, --socketdir=DIR             socket directory to use (default current dir.)\n"));
 | 
						printf(_("  -s, --socketdir=DIR             socket directory to use (default current dir.)\n"));
 | 
				
			||||||
	printf(_("  -t, --recovery-timeout=SECS     seconds to wait for recovery to end\n"));
 | 
						printf(_("  -t, --recovery-timeout=SECS     seconds to wait for recovery to end\n"));
 | 
				
			||||||
	printf(_("  -U, --subscriber-username=NAME  subscriber username\n"));
 | 
						printf(_("  -U, --subscriber-username=NAME  user name for subscriber connection\n"));
 | 
				
			||||||
	printf(_("  -v, --verbose                   output verbose messages\n"));
 | 
						printf(_("  -v, --verbose                   output verbose messages\n"));
 | 
				
			||||||
	printf(_("      --config-file=FILENAME      use specified main server configuration\n"
 | 
						printf(_("      --config-file=FILENAME      use specified main server configuration\n"
 | 
				
			||||||
			 "                                  file when running target cluster\n"));
 | 
								 "                                  file when running target cluster\n"));
 | 
				
			||||||
@@ -670,7 +670,7 @@ modify_subscriber_sysid(const struct CreateSubscriberOptions *opt)
 | 
				
			|||||||
		if (rc == 0)
 | 
							if (rc == 0)
 | 
				
			||||||
			pg_log_info("subscriber successfully changed the system identifier");
 | 
								pg_log_info("subscriber successfully changed the system identifier");
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			pg_fatal("subscriber failed to change system identifier: exit code: %d", rc);
 | 
								pg_fatal("could not change system identifier of subscriber: %s", wait_result_to_str(rc));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pg_free(cf);
 | 
						pg_free(cf);
 | 
				
			||||||
@@ -926,7 +926,7 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (max_walsenders - cur_walsenders < num_dbs)
 | 
						if (max_walsenders - cur_walsenders < num_dbs)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		pg_log_error("publisher requires %d wal sender processes, but only %d remain",
 | 
							pg_log_error("publisher requires %d WAL sender processes, but only %d remain",
 | 
				
			||||||
					 num_dbs, max_walsenders - cur_walsenders);
 | 
										 num_dbs, max_walsenders - cur_walsenders);
 | 
				
			||||||
		pg_log_error_hint("Increase the configuration parameter \"%s\" to at least %d.",
 | 
							pg_log_error_hint("Increase the configuration parameter \"%s\" to at least %d.",
 | 
				
			||||||
						  "max_wal_senders", cur_walsenders + num_dbs);
 | 
											  "max_wal_senders", cur_walsenders + num_dbs);
 | 
				
			||||||
@@ -935,7 +935,7 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (max_prepared_transactions != 0)
 | 
						if (max_prepared_transactions != 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		pg_log_warning("two_phase option will not be enabled for slots");
 | 
							pg_log_warning("two_phase option will not be enabled for replication slots");
 | 
				
			||||||
		pg_log_warning_detail("Subscriptions will be created with the two_phase option disabled.  "
 | 
							pg_log_warning_detail("Subscriptions will be created with the two_phase option disabled.  "
 | 
				
			||||||
							  "Prepared transactions will be replicated at COMMIT PREPARED.");
 | 
												  "Prepared transactions will be replicated at COMMIT PREPARED.");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -1791,7 +1791,7 @@ set_replication_progress(PGconn *conn, const struct LogicalRepInfo *dbinfo, cons
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	originname = psprintf("pg_%u", suboid);
 | 
						originname = psprintf("pg_%u", suboid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pg_log_info("setting the replication progress (node name \"%s\" ; LSN %s) in database \"%s\"",
 | 
						pg_log_info("setting the replication progress (node name \"%s\", LSN %s) in database \"%s\"",
 | 
				
			||||||
				originname, lsnstr, dbinfo->dbname);
 | 
									originname, lsnstr, dbinfo->dbname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	resetPQExpBuffer(str);
 | 
						resetPQExpBuffer(str);
 | 
				
			||||||
@@ -1806,7 +1806,7 @@ set_replication_progress(PGconn *conn, const struct LogicalRepInfo *dbinfo, cons
 | 
				
			|||||||
		res = PQexec(conn, str->data);
 | 
							res = PQexec(conn, str->data);
 | 
				
			||||||
		if (PQresultStatus(res) != PGRES_TUPLES_OK)
 | 
							if (PQresultStatus(res) != PGRES_TUPLES_OK)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			pg_log_error("could not set replication progress for the subscription \"%s\": %s",
 | 
								pg_log_error("could not set replication progress for subscription \"%s\": %s",
 | 
				
			||||||
						 dbinfo->subname, PQresultErrorMessage(res));
 | 
											 dbinfo->subname, PQresultErrorMessage(res));
 | 
				
			||||||
			disconnect_database(conn, true);
 | 
								disconnect_database(conn, true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1963,7 +1963,7 @@ main(int argc, char **argv)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					pg_log_error("duplicate database \"%s\"", optarg);
 | 
										pg_log_error("database \"%s\" specified more than once", optarg);
 | 
				
			||||||
					exit(1);
 | 
										exit(1);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
@@ -2004,7 +2004,7 @@ main(int argc, char **argv)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					pg_log_error("duplicate publication \"%s\"", optarg);
 | 
										pg_log_error("publication \"%s\" specified more than once", optarg);
 | 
				
			||||||
					exit(1);
 | 
										exit(1);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
@@ -2016,7 +2016,7 @@ main(int argc, char **argv)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					pg_log_error("duplicate replication slot \"%s\"", optarg);
 | 
										pg_log_error("replication slot \"%s\" specified more than once", optarg);
 | 
				
			||||||
					exit(1);
 | 
										exit(1);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
@@ -2028,7 +2028,7 @@ main(int argc, char **argv)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					pg_log_error("duplicate subscription \"%s\"", optarg);
 | 
										pg_log_error("subscription \"%s\" specified more than once", optarg);
 | 
				
			||||||
					exit(1);
 | 
										exit(1);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
@@ -2106,7 +2106,7 @@ main(int argc, char **argv)
 | 
				
			|||||||
			simple_string_list_append(&opt.database_names, dbname_conninfo);
 | 
								simple_string_list_append(&opt.database_names, dbname_conninfo);
 | 
				
			||||||
			num_dbs++;
 | 
								num_dbs++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			pg_log_info("database \"%s\" was extracted from the publisher connection string",
 | 
								pg_log_info("database name \"%s\" was extracted from the publisher connection string",
 | 
				
			||||||
						dbname_conninfo);
 | 
											dbname_conninfo);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
@@ -2121,22 +2121,22 @@ main(int argc, char **argv)
 | 
				
			|||||||
	/* Number of object names must match number of databases */
 | 
						/* Number of object names must match number of databases */
 | 
				
			||||||
	if (num_pubs > 0 && num_pubs != num_dbs)
 | 
						if (num_pubs > 0 && num_pubs != num_dbs)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		pg_log_error("wrong number of publication names");
 | 
							pg_log_error("wrong number of publication names specified");
 | 
				
			||||||
		pg_log_error_hint("Number of publication names (%d) must match number of database names (%d).",
 | 
							pg_log_error_detail("The number of specified publication names (%d) must match the number of specified database names (%d).",
 | 
				
			||||||
							num_pubs, num_dbs);
 | 
												num_pubs, num_dbs);
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (num_subs > 0 && num_subs != num_dbs)
 | 
						if (num_subs > 0 && num_subs != num_dbs)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		pg_log_error("wrong number of subscription names");
 | 
							pg_log_error("wrong number of subscription names specified");
 | 
				
			||||||
		pg_log_error_hint("Number of subscription names (%d) must match number of database names (%d).",
 | 
							pg_log_error_detail("The number of specified subscription names (%d) must match the number of specified database names (%d).",
 | 
				
			||||||
							num_subs, num_dbs);
 | 
												num_subs, num_dbs);
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (num_replslots > 0 && num_replslots != num_dbs)
 | 
						if (num_replslots > 0 && num_replslots != num_dbs)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		pg_log_error("wrong number of replication slot names");
 | 
							pg_log_error("wrong number of replication slot names specified");
 | 
				
			||||||
		pg_log_error_hint("Number of replication slot names (%d) must match number of database names (%d).",
 | 
							pg_log_error_detail("The number of specified replication slot names (%d) must match the number of specified database names (%d).",
 | 
				
			||||||
							num_replslots, num_dbs);
 | 
												num_replslots, num_dbs);
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -2178,8 +2178,8 @@ main(int argc, char **argv)
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (stat(pidfile, &statbuf) == 0)
 | 
						if (stat(pidfile, &statbuf) == 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		pg_log_error("standby is up and running");
 | 
							pg_log_error("standby server is running");
 | 
				
			||||||
		pg_log_error_hint("Stop the standby and try again.");
 | 
							pg_log_error_hint("Stop the standby server and try again.");
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2188,7 +2188,7 @@ main(int argc, char **argv)
 | 
				
			|||||||
	 * by command-line options). The goal is to avoid connections during the
 | 
						 * by command-line options). The goal is to avoid connections during the
 | 
				
			||||||
	 * transformation steps.
 | 
						 * transformation steps.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	pg_log_info("starting the standby with command-line options");
 | 
						pg_log_info("starting the standby server with command-line options");
 | 
				
			||||||
	start_standby_server(&opt, true, false);
 | 
						start_standby_server(&opt, true, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Check if the standby server is ready for logical replication */
 | 
						/* Check if the standby server is ready for logical replication */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user