Remove PostgreSQL 9.3 support

PostgreSQL 9.3 community support ended in November 2018.
This commit is contained in:
Ian Barwick
2020-09-04 09:26:38 +09:00
parent f4938a4a42
commit 3945314e65
15 changed files with 143 additions and 342 deletions

View File

@@ -277,8 +277,19 @@ get_controlfile(const char *DataDir)
return control_file_info; return control_file_info;
} }
if (version_num >= 120000)
if (version_num >= 90500) {
#if PG_ACTUAL_VERSION_NUM >= 120000
expected_size = sizeof(ControlFileData12);
ControlFileDataPtr = palloc0(expected_size);
#endif
}
else if (version_num >= 110000)
{
expected_size = sizeof(ControlFileData11);
ControlFileDataPtr = palloc0(expected_size);
}
else if (version_num >= 90500)
{ {
expected_size = sizeof(ControlFileData95); expected_size = sizeof(ControlFileData95);
ControlFileDataPtr = palloc0(expected_size); ControlFileDataPtr = palloc0(expected_size);
@@ -288,12 +299,6 @@ get_controlfile(const char *DataDir)
expected_size = sizeof(ControlFileData94); expected_size = sizeof(ControlFileData94);
ControlFileDataPtr = palloc0(expected_size); ControlFileDataPtr = palloc0(expected_size);
} }
else if (version_num >= 90300)
{
expected_size = sizeof(ControlFileData93);
ControlFileDataPtr = palloc0(expected_size);
}
if (read(fd, ControlFileDataPtr, expected_size) != expected_size) if (read(fd, ControlFileDataPtr, expected_size) != expected_size)
{ {
@@ -359,17 +364,6 @@ get_controlfile(const char *DataDir)
control_file_info->minRecoveryPointTLI = ptr->minRecoveryPointTLI; control_file_info->minRecoveryPointTLI = ptr->minRecoveryPointTLI;
control_file_info->minRecoveryPoint = ptr->minRecoveryPoint; control_file_info->minRecoveryPoint = ptr->minRecoveryPoint;
} }
else if (version_num >= 90300)
{
ControlFileData93 *ptr = (struct ControlFileData93 *)ControlFileDataPtr;
control_file_info->system_identifier = ptr->system_identifier;
control_file_info->state = ptr->state;
control_file_info->checkPoint = ptr->checkPoint;
control_file_info->data_checksum_version = ptr->data_checksum_version;
control_file_info->timeline = ptr->checkPointCopy.ThisTimeLineID;
control_file_info->minRecoveryPointTLI = ptr->minRecoveryPointTLI;
control_file_info->minRecoveryPoint = ptr->minRecoveryPoint;
}
pfree(ControlFileDataPtr); pfree(ControlFileDataPtr);

View File

@@ -31,9 +31,7 @@ typedef struct
} ControlFileInfo; } ControlFileInfo;
typedef struct CheckPoint94
/* Same for 9.3, 9.4 */
typedef struct CheckPoint93
{ {
XLogRecPtr redo; /* next RecPtr available when we began to XLogRecPtr redo; /* next RecPtr available when we began to
* create CheckPoint (i.e. REDO start point) */ * create CheckPoint (i.e. REDO start point) */
@@ -53,7 +51,7 @@ typedef struct CheckPoint93
pg_time_t time; /* time stamp of checkpoint */ pg_time_t time; /* time stamp of checkpoint */
TransactionId oldestActiveXid; TransactionId oldestActiveXid;
} CheckPoint93; } CheckPoint94;
/* Same for 9.5, 9.6, 10, 11 */ /* Same for 9.5, 9.6, 10, 11 */
@@ -128,65 +126,6 @@ typedef struct CheckPoint12
} CheckPoint12; } CheckPoint12;
#endif #endif
typedef struct ControlFileData93
{
uint64 system_identifier;
uint32 pg_control_version; /* PG_CONTROL_VERSION */
uint32 catalog_version_no; /* see catversion.h */
DBState state; /* see enum above */
pg_time_t time; /* time stamp of last pg_control update */
XLogRecPtr checkPoint; /* last check point record ptr */
XLogRecPtr prevCheckPoint; /* previous check point record ptr */
CheckPoint93 checkPointCopy; /* copy of last check point record */
XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */
XLogRecPtr minRecoveryPoint;
TimeLineID minRecoveryPointTLI;
XLogRecPtr backupStartPoint;
XLogRecPtr backupEndPoint;
bool backupEndRequired;
int wal_level;
int MaxConnections;
int max_prepared_xacts;
int max_locks_per_xact;
uint32 maxAlign; /* alignment requirement for tuples */
double floatFormat; /* constant 1234567.0 */
uint32 blcksz; /* data block size for this DB */
uint32 relseg_size; /* blocks per segment of large relation */
uint32 xlog_blcksz; /* block size within WAL files */
uint32 xlog_seg_size; /* size of each WAL segment */
uint32 nameDataLen; /* catalog name field width */
uint32 indexMaxKeys; /* max number of columns in an index */
uint32 toast_max_chunk_size; /* chunk size in TOAST tables */
/* flag indicating internal format of timestamp, interval, time */
bool enableIntTimes; /* int64 storage enabled? */
/* flags indicating pass-by-value status of various types */
bool float4ByVal; /* float4 pass-by-value? */
bool float8ByVal; /* float8, int8, etc pass-by-value? */
/* Are data pages protected by checksums? Zero if no checksum version */
uint32 data_checksum_version;
} ControlFileData93;
/*
* Following field added since 9.3:
*
* int max_worker_processes;
*/
typedef struct ControlFileData94 typedef struct ControlFileData94
{ {
@@ -200,7 +139,7 @@ typedef struct ControlFileData94
XLogRecPtr checkPoint; /* last check point record ptr */ XLogRecPtr checkPoint; /* last check point record ptr */
XLogRecPtr prevCheckPoint; /* previous check point record ptr */ XLogRecPtr prevCheckPoint; /* previous check point record ptr */
CheckPoint93 checkPointCopy; /* copy of last check point record */ CheckPoint94 checkPointCopy; /* copy of last check point record */
XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */ XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */

View File

@@ -5538,21 +5538,9 @@ get_replication_info(PGconn *conn, t_server_type node_type, ReplInfo *replicatio
} }
else else
{ {
if (PQserverVersion(conn) >= 90400)
{
appendPQExpBufferStr(&query,
" COALESCE(pg_catalog.pg_last_xlog_receive_location(), '0/0'::PG_LSN) AS last_wal_receive_lsn, "
" COALESCE(pg_catalog.pg_last_xlog_replay_location(), '0/0'::PG_LSN) AS last_wal_replay_lsn, ");
}
else
{
/* 9.3 does not have "pg_lsn" datatype */
appendPQExpBufferStr(&query,
" COALESCE(pg_catalog.pg_last_xlog_receive_location(), '0/0') AS last_wal_receive_lsn, "
" COALESCE(pg_catalog.pg_last_xlog_replay_location(), '0/0') AS last_wal_replay_lsn, ");
}
appendPQExpBufferStr(&query, appendPQExpBufferStr(&query,
" COALESCE(pg_catalog.pg_last_xlog_receive_location(), '0/0'::PG_LSN) AS last_wal_receive_lsn, "
" COALESCE(pg_catalog.pg_last_xlog_replay_location(), '0/0'::PG_LSN) AS last_wal_replay_lsn, "
" CASE WHEN pg_catalog.pg_is_in_recovery() IS FALSE " " CASE WHEN pg_catalog.pg_is_in_recovery() IS FALSE "
" THEN FALSE " " THEN FALSE "
" ELSE pg_catalog.pg_is_xlog_replay_paused() " " ELSE pg_catalog.pg_is_xlog_replay_paused() "
@@ -5723,28 +5711,11 @@ get_node_replication_stats(PGconn *conn, t_node_info *node_info)
appendPQExpBufferStr(&query, appendPQExpBufferStr(&query,
" SELECT pg_catalog.current_setting('max_wal_senders')::INT AS max_wal_senders, " " SELECT pg_catalog.current_setting('max_wal_senders')::INT AS max_wal_senders, "
" (SELECT pg_catalog.count(*) FROM pg_catalog.pg_stat_replication) AS attached_wal_receivers, "); " (SELECT pg_catalog.count(*) FROM pg_catalog.pg_stat_replication) AS attached_wal_receivers, "
" current_setting('max_replication_slots')::INT AS max_replication_slots, "
/* no replication slots in PostgreSQL 9.3 */ " (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE slot_type='physical') AS total_replication_slots, "
if (PQserverVersion(conn) < 90400) " (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS TRUE AND slot_type='physical') AS active_replication_slots, "
{ " (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS FALSE AND slot_type='physical') AS inactive_replication_slots, "
appendPQExpBufferStr(&query,
" 0 AS max_replication_slots, "
" 0 AS total_replication_slots, "
" 0 AS active_replication_slots, "
" 0 AS inactive_replication_slots, ");
}
else
{
appendPQExpBufferStr(&query,
" current_setting('max_replication_slots')::INT AS max_replication_slots, "
" (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE slot_type='physical') AS total_replication_slots, "
" (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS TRUE AND slot_type='physical') AS active_replication_slots, "
" (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS FALSE AND slot_type='physical') AS inactive_replication_slots, ");
}
appendPQExpBufferStr(&query,
" pg_catalog.pg_is_in_recovery() AS in_recovery"); " pg_catalog.pg_is_in_recovery() AS in_recovery");
log_verbose(LOG_DEBUG, "get_node_replication_stats():\n%s", query.data); log_verbose(LOG_DEBUG, "get_node_replication_stats():\n%s", query.data);

View File

@@ -22,6 +22,9 @@
&repmgr; 5 is fundamentally the same code base as &repmgr; 4, but provides &repmgr; 5 is fundamentally the same code base as &repmgr; 4, but provides
support for the revised replication configuration mechanism in PostgreSQL 12. support for the revised replication configuration mechanism in PostgreSQL 12.
</para> </para>
<para>
Support for PostgreSQL 9.3 is no longer available from &repmgr; 5.2.
</para>
</note> </note>
<para> <para>
&repmgr; 3.x builds on the improved replication facilities added &repmgr; 3.x builds on the improved replication facilities added

View File

@@ -14,7 +14,7 @@
</para> </para>
<para> <para>
&repmgr; &repmgrversion; is compatible with all PostgreSQL versions from 9.3. See &repmgr; &repmgrversion; is compatible with all PostgreSQL versions from 9.4. See
section <link linkend="install-compatibility-matrix">&repmgr; compatibility matrix</link> section <link linkend="install-compatibility-matrix">&repmgr; compatibility matrix</link>
for an overview of version compatibility. for an overview of version compatibility.
</para> </para>
@@ -115,7 +115,7 @@
<row> <row>
<entry> <entry>
&repmgr; 5.x &repmgr; 5.2
</entry> </entry>
<entry> <entry>
YES YES
@@ -123,6 +123,21 @@
<entry> <entry>
<link linkend="release-current">&repmgrversion;</link> (&releasedate;) <link linkend="release-current">&repmgrversion;</link> (&releasedate;)
</entry> </entry>
<entry>
9.4, 9.5, 9.6, 10, 11, 12, 13
</entry>
</row>
<row>
<entry>
&repmgr; 5.0, &repmgr; 5.1
</entry>
<entry>
YES
</entry>
<entry>
<link linkend="release-5.1.0">5.1</link> (2020-04-13)
</entry>
<entry> <entry>
9.3, 9.4, 9.5, 9.6, 10, 11, 12 9.3, 9.4, 9.5, 9.6, 10, 11, 12
</entry> </entry>
@@ -226,6 +241,9 @@
<ulink url="https://www.postgresql.org/docs/9.3/release-9-3-25.html">9.3.25</ulink> <ulink url="https://www.postgresql.org/docs/9.3/release-9-3-25.html">9.3.25</ulink>
in November 2018) and will no longer be updated with security or bugfixes. in November 2018) and will no longer be updated with security or bugfixes.
</para> </para>
<para>
Beginning with &repmgr; 5.2, &repmgr; no longer supports PostgreSQL 9.3.
</para>
<para> <para>
PostgreSQL 9.4 has reached the end of its community support period (final release was PostgreSQL 9.4 has reached the end of its community support period (final release was
<ulink url="https://www.postgresql.org/docs/9.4/release-9-4-26.html">9.4.26</ulink> <ulink url="https://www.postgresql.org/docs/9.4/release-9-4-26.html">9.4.26</ulink>

View File

@@ -76,7 +76,7 @@
</para> </para>
<para> <para>
It is only necessary to provide the <application>pg_rewind</application> path It is only necessary to provide the <application>pg_rewind</application> path
if using PostgreSQL 9.3 or 9.4, and <application>pg_rewind</application> if using PostgreSQL 9.4, and <application>pg_rewind</application>
is not installed in the PostgreSQL <filename>bin</filename> directory. is not installed in the PostgreSQL <filename>bin</filename> directory.
</para> </para>
</listitem> </listitem>
@@ -246,7 +246,7 @@
<command>repmgr node rejoin</command> can optionally use <command>pg_rewind</command> to re-integrate a <command>repmgr node rejoin</command> can optionally use <command>pg_rewind</command> to re-integrate a
node which has diverged from the rest of the cluster, typically a failed primary. node which has diverged from the rest of the cluster, typically a failed primary.
<command>pg_rewind</command> is available in PostgreSQL 9.5 and later as part of the core distribution, <command>pg_rewind</command> is available in PostgreSQL 9.5 and later as part of the core distribution,
and can be installed from external sources for PostgreSQL 9.3 and 9.4. and can be installed from external sources for PostgreSQL 9.4.
</para> </para>
<note> <note>
<para> <para>

View File

@@ -147,7 +147,7 @@
<para> <para>
Use <application>pg_rewind</application> to reintegrate the old primary if necessary Use <application>pg_rewind</application> to reintegrate the old primary if necessary
(and the prerequisites for using <application>pg_rewind</application> are met). (and the prerequisites for using <application>pg_rewind</application> are met).
If using PostgreSQL 9.3 or 9.4, and the <application>pg_rewind</application> If using PostgreSQL 9.4, and the <application>pg_rewind</application>
binary is not installed in the PostgreSQL <filename>bin</filename> directory, binary is not installed in the PostgreSQL <filename>bin</filename> directory,
provide its full path. For more details see also <xref linkend="switchover-pg-rewind"/>. provide its full path. For more details see also <xref linkend="switchover-pg-rewind"/>.
</para> </para>

View File

@@ -26,7 +26,7 @@
<abstract> <abstract>
<para> <para>
This is the official documentation of &repmgr; &repmgrversion; for This is the official documentation of &repmgr; &repmgrversion; for
use with PostgreSQL 9.3 - PostgreSQL 12. use with PostgreSQL 9.4 - PostgreSQL 13.
</para> </para>
<para> <para>
&repmgr; is being continually developed and we strongly recommend using the &repmgr; is being continually developed and we strongly recommend using the

View File

@@ -244,16 +244,15 @@
</para> </para>
<para> <para>
<application>pg_rewind</application> has been part of the core PostgreSQL distribution since <application>pg_rewind</application> has been part of the core PostgreSQL distribution since
version 9.5. Users of versions 9.3 and 9.4 will need to manually install it; the source code is available here: version 9.5. Users of PostgreSQL 9.4 will need to manually install it; the source code is available here:
<ulink url="https://github.com/vmware/pg_rewind">https://github.com/vmware/pg_rewind</ulink>. <ulink url="https://github.com/vmware/pg_rewind">https://github.com/vmware/pg_rewind</ulink>.
If the <application>pg_rewind</application> If the <application>pg_rewind</application>
binary is not installed in the PostgreSQL <filename>bin</filename> directory, provide binary is not installed in the PostgreSQL <filename>bin</filename> directory, provide
its full path on the demotion candidate with <option>--force-rewind</option>. its full path on the demotion candidate with <option>--force-rewind</option>.
</para> </para>
<para> <para>
Note that building the 9.3/9.4 version of <application>pg_rewind</application> requires the PostgreSQL Note that building the 9.4 version of <application>pg_rewind</application> requires the PostgreSQL
source code. Also, PostgreSQL 9.3 does not provide <varname>wal_log_hints</varname>, source code.
meaning data checksums must have been enabled when the database was initialized.
</para> </para>
</sect2> </sect2>
@@ -343,7 +342,7 @@
<itemizedlist spacing="compact" mark="bullet"> <itemizedlist spacing="compact" mark="bullet">
<listitem> <listitem>
<simpara> <simpara>
If using PostgreSQL 9.3 or 9.4, you should ensure that the shutdown command If using PostgreSQL 9.4, you should ensure that the shutdown command
is configured to use PostgreSQL's <varname>fast</varname> shutdown mode (the default in 9.5 is configured to use PostgreSQL's <varname>fast</varname> shutdown mode (the default in 9.5
and later). If relying on <command>pg_ctl</command> to perform database server operations, and later). If relying on <command>pg_ctl</command> to perform database server operations,
you should include <literal>-m fast</literal> in <varname>pg_ctl_options</varname> you should include <literal>-m fast</literal> in <varname>pg_ctl_options</varname>

View File

@@ -85,7 +85,6 @@ do_node_status(void)
t_recovery_conf recovery_conf = T_RECOVERY_CONF_INITIALIZER; t_recovery_conf recovery_conf = T_RECOVERY_CONF_INITIALIZER;
char data_dir[MAXPGPATH] = ""; char data_dir[MAXPGPATH] = "";
int server_version_num = UNKNOWN_SERVER_VERSION_NUM;
char server_version_str[MAXVERSIONSTR] = ""; char server_version_str[MAXVERSIONSTR] = "";
/* /*
@@ -103,7 +102,7 @@ do_node_status(void)
conn = establish_db_connection(config_file_options.conninfo, true); conn = establish_db_connection(config_file_options.conninfo, true);
strncpy(data_dir, config_file_options.data_directory, MAXPGPATH); strncpy(data_dir, config_file_options.data_directory, MAXPGPATH);
server_version_num = get_server_version(conn, server_version_str); (void)get_server_version(conn, server_version_str);
/* check node exists */ /* check node exists */
@@ -334,13 +333,7 @@ do_node_status(void)
} }
} }
if (server_version_num < 90400) if (node_info.max_replication_slots == 0)
{
key_value_list_set(&node_status,
"Replication slots",
"not available");
}
else if (node_info.max_replication_slots == 0)
{ {
key_value_list_set(&node_status, key_value_list_set(&node_status,
"Replication slots", "Replication slots",
@@ -1843,12 +1836,7 @@ do_node_check_slots(PGconn *conn, OutputMode mode, t_node_info *node_info, Check
initPQExpBuffer(&details); initPQExpBuffer(&details);
if (PQserverVersion(conn) < 90400) if (node_info->total_replication_slots == 0)
{
appendPQExpBufferStr(&details,
_("replication slots not available for this PostgreSQL version"));
}
else if (node_info->total_replication_slots == 0)
{ {
appendPQExpBufferStr(&details, appendPQExpBufferStr(&details,
_("node has no physical replication slots")); _("node has no physical replication slots"));
@@ -1919,50 +1907,42 @@ do_node_check_missing_slots(PGconn *conn, OutputMode mode, t_node_info *node_inf
initPQExpBuffer(&details); initPQExpBuffer(&details);
if (PQserverVersion(conn) < 90400) get_downstream_nodes_with_missing_slot(conn,
config_file_options.node_id,
&missing_slots);
if (missing_slots.node_count == 0)
{ {
appendPQExpBufferStr(&details, appendPQExpBufferStr(&details,
_("replication slots not available for this PostgreSQL version")); _("node has no missing physical replication slots"));
} }
else else
{ {
get_downstream_nodes_with_missing_slot(conn, NodeInfoListCell *missing_slot_cell = NULL;
config_file_options.node_id, bool first_element = true;
&missing_slots);
if (missing_slots.node_count == 0) status = CHECK_STATUS_CRITICAL;
appendPQExpBuffer(&details,
_("%i physical replication slots are missing"),
missing_slots.node_count);
if (missing_slots.node_count)
{ {
appendPQExpBufferStr(&details, appendPQExpBufferStr(&details, ": ");
_("node has no missing physical replication slots"));
}
else
{
NodeInfoListCell *missing_slot_cell = NULL;
bool first_element = true;
status = CHECK_STATUS_CRITICAL; for (missing_slot_cell = missing_slots.head; missing_slot_cell; missing_slot_cell = missing_slot_cell->next)
appendPQExpBuffer(&details,
_("%i physical replication slots are missing"),
missing_slots.node_count);
if (missing_slots.node_count)
{ {
appendPQExpBufferStr(&details, ": "); if (first_element == true)
for (missing_slot_cell = missing_slots.head; missing_slot_cell; missing_slot_cell = missing_slot_cell->next)
{ {
if (first_element == true) first_element = false;
{
first_element = false;
}
else
{
appendPQExpBufferStr(&details, ", ");
}
appendPQExpBufferStr(&details, missing_slot_cell->node_info->slot_name);
} }
else
{
appendPQExpBufferStr(&details, ", ");
}
appendPQExpBufferStr(&details, missing_slot_cell->node_info->slot_name);
} }
} }
} }
@@ -2557,10 +2537,6 @@ do_node_rejoin(void)
/* check provided upstream connection */ /* check provided upstream connection */
upstream_conn = establish_db_connection_by_params(&source_conninfo, true); upstream_conn = establish_db_connection_by_params(&source_conninfo, true);
/* sanity checks for 9.3 */
if (PQserverVersion(upstream_conn) < 90400)
check_93_config();
if (get_primary_node_record(upstream_conn, &primary_node_record) == false) if (get_primary_node_record(upstream_conn, &primary_node_record) == false)
{ {
log_error(_("unable to retrieve primary node record")); log_error(_("unable to retrieve primary node record"));

View File

@@ -2772,10 +2772,6 @@ do_standby_follow(void)
/* check this is a standby */ /* check this is a standby */
check_recovery_type(local_conn); check_recovery_type(local_conn);
/* sanity-checks for 9.3 */
if (PQserverVersion(local_conn) < 90400)
check_93_config();
/* attempt to retrieve local node record */ /* attempt to retrieve local node record */
record_status = get_node_record(local_conn, record_status = get_node_record(local_conn,
config_file_options.node_id, config_file_options.node_id,
@@ -3205,9 +3201,6 @@ do_standby_follow(void)
/* /*
* Perform the actuall "follow" operation; this is executed by * Perform the actuall "follow" operation; this is executed by
* "node rejoin" too. * "node rejoin" too.
*
* For PostgreSQL 9.3, ensure check_93_config() was called before calling
* this function.
*/ */
bool bool
do_standby_follow_internal(PGconn *primary_conn, PGconn *follow_target_conn, t_node_info *follow_target_node_record, PQExpBufferData *output, int general_error_code, int *error_code) do_standby_follow_internal(PGconn *primary_conn, PGconn *follow_target_conn, t_node_info *follow_target_node_record, PQExpBufferData *output, int general_error_code, int *error_code)
@@ -6004,10 +5997,6 @@ check_upstream_config(PGconn *conn, int server_version_num, t_node_info *upstrea
standy_clone_mode mode; standy_clone_mode mode;
bool pg_setting_ok; bool pg_setting_ok;
/* Disable configuration file options incompatible with 9.3 */
if (server_version_num < 90400)
check_93_config();
/* /*
* Detecting the intended cloning mode * Detecting the intended cloning mode
*/ */
@@ -6040,13 +6029,6 @@ check_upstream_config(PGconn *conn, int server_version_num, t_node_info *upstrea
if (strlen(backup_options.wal_method) && strcmp(backup_options.wal_method, "stream") != 0) if (strlen(backup_options.wal_method) && strcmp(backup_options.wal_method, "stream") != 0)
wal_method_stream = false; wal_method_stream = false;
/* Check that WAL level is set correctly */
if (server_version_num < 90400)
{
i = guc_set(conn, "wal_level", "=", "hot_standby");
wal_error_message = _("parameter \"wal_level\" must be set to \"hot_standby\"");
}
else
{ {
char *levels_pre96[] = { char *levels_pre96[] = {
"hot_standby", "hot_standby",
@@ -6170,14 +6152,10 @@ check_upstream_config(PGconn *conn, int server_version_num, t_node_info *upstrea
"until the standby has been cloned and started.\n " "until the standby has been cloned and started.\n "
"Alternatively set up WAL archiving using e.g. PgBarman and configure " "Alternatively set up WAL archiving using e.g. PgBarman and configure "
"'restore_command' in repmgr.conf to fetch WALs from there.")); "'restore_command' in repmgr.conf to fetch WALs from there."));
log_hint(_("In PostgreSQL 9.4 and later, replication slots can be used, which "
if (server_version_num >= 90400) "do not require \"%s\" to be set "
{ "(set parameter \"use_replication_slots\" in repmgr.conf to enable)\n"),
log_hint(_("In PostgreSQL 9.4 and later, replication slots can be used, which " wal_keep_parameter_name);
"do not require \"%s\" to be set "
"(set parameter \"use_replication_slots\" in repmgr.conf to enable)\n"),
wal_keep_parameter_name);
}
} }
if (exit_on_error == true) if (exit_on_error == true)
@@ -6199,7 +6177,7 @@ check_upstream_config(PGconn *conn, int server_version_num, t_node_info *upstrea
} }
if (config_file_options.use_replication_slots == false && server_version_num >= 90400) if (config_file_options.use_replication_slots == false)
{ {
log_info(_("replication slot usage not requested; no replication slot will be set up for this standby")); log_info(_("replication slot usage not requested; no replication slot will be set up for this standby"));
} }
@@ -6452,30 +6430,17 @@ check_upstream_config(PGconn *conn, int server_version_num, t_node_info *upstrea
} }
/* wal_log_hints available from PostgreSQL 9.4; can be read by any user */ /* wal_log_hints available from PostgreSQL 9.4; can be read by any user */
if (PQserverVersion(conn) >= 90400) if (get_pg_setting_bool(conn, "wal_log_hints", &wal_log_hints) == false)
{ {
if (get_pg_setting_bool(conn, "wal_log_hints", &wal_log_hints) == false) /* highly unlikely this will happen */
{ log_error(_("unable to determine value for \"wal_log_hints\""));
/* highly unlikely this will happen */ exit(ERR_BAD_CONFIG);
log_error(_("unable to determine value for \"wal_log_hints\""));
exit(ERR_BAD_CONFIG);
}
} }
if (data_checksums == false && wal_log_hints == false) if (data_checksums == false && wal_log_hints == false)
{ {
/* log_warning(_("data checksums are not enabled and \"wal_log_hints\" is \"off\""));
* If anyone's still on 9.3, there's not a lot we can do anyway log_detail(_("pg_rewind requires \"wal_log_hints\" to be enabled"));
*/
if (PQserverVersion(conn) < 90400)
{
log_warning(_("data checksums are not enabled"));
}
else
{
log_warning(_("data checksums are not enabled and \"wal_log_hints\" is \"off\""));
log_detail(_("pg_rewind requires \"wal_log_hints\" to be enabled"));
}
} }
} }
@@ -6520,67 +6485,60 @@ initialise_direct_clone(t_node_info *local_node_record, t_node_info *upstream_no
if (config_file_options.tablespace_mapping.head != NULL) if (config_file_options.tablespace_mapping.head != NULL)
{ {
if (source_server_version_num < 90400) TablespaceListCell *cell;
KeyValueList not_found = {NULL, NULL};
int total = 0,
matched = 0;
bool success = false;
for (cell = config_file_options.tablespace_mapping.head; cell; cell = cell->next)
{ {
log_warning(_("tablespace mapping not supported in PostgreSQL 9.3, ignoring")); char *old_dir_escaped = escape_string(source_conn, cell->old_dir);
char name[MAXLEN] = "";
success = get_tablespace_name_by_location(source_conn, old_dir_escaped, name);
pfree(old_dir_escaped);
if (success == true)
{
matched++;
}
else
{
key_value_list_set(&not_found,
cell->old_dir,
"");
}
total++;
} }
else
if (not_found.head != NULL)
{ {
TablespaceListCell *cell; PQExpBufferData detail;
KeyValueList not_found = {NULL, NULL}; KeyValueListCell *kv_cell;
int total = 0,
matched = 0;
bool success = false;
log_error(_("%i of %i mapped tablespaces not found"),
total - matched, total);
for (cell = config_file_options.tablespace_mapping.head; cell; cell = cell->next) initPQExpBuffer(&detail);
for (kv_cell = not_found.head; kv_cell; kv_cell = kv_cell->next)
{ {
char *old_dir_escaped = escape_string(source_conn, cell->old_dir); appendPQExpBuffer(
char name[MAXLEN] = ""; &detail,
" %s\n", kv_cell->key);
success = get_tablespace_name_by_location(source_conn, old_dir_escaped, name);
pfree(old_dir_escaped);
if (success == true)
{
matched++;
}
else
{
key_value_list_set(&not_found,
cell->old_dir,
"");
}
total++;
} }
if (not_found.head != NULL) log_detail(_("following tablespaces not found:\n%s"),
{ detail.data);
PQExpBufferData detail; termPQExpBuffer(&detail);
KeyValueListCell *kv_cell;
log_error(_("%i of %i mapped tablespaces not found"), exit(ERR_BAD_CONFIG);
total - matched, total);
initPQExpBuffer(&detail);
for (kv_cell = not_found.head; kv_cell; kv_cell = kv_cell->next)
{
appendPQExpBuffer(
&detail,
" %s\n", kv_cell->key);
}
log_detail(_("following tablespaces not found:\n%s"),
detail.data);
termPQExpBuffer(&detail);
exit(ERR_BAD_CONFIG);
}
} }
} }
/* /*
* If replication slots requested, create appropriate slot on the source * If replication slots requested, create appropriate slot on the source
* node; this must be done before pg_basebackup is called. * node; this must be done before pg_basebackup is called.

View File

@@ -252,7 +252,6 @@ extern char pg_bindir[MAXLEN];
/* global functions */ /* global functions */
extern int check_server_version(PGconn *conn, char *server_type, bool exit_on_error, char *server_version_string); extern int check_server_version(PGconn *conn, char *server_type, bool exit_on_error, char *server_version_string);
extern void check_93_config(void);
extern bool create_repmgr_extension(PGconn *conn); extern bool create_repmgr_extension(PGconn *conn);
extern int test_ssh_connection(char *host, char *remote_user); extern int test_ssh_connection(char *host, char *remote_user);

View File

@@ -2923,30 +2923,6 @@ check_server_version(PGconn *conn, char *server_type, bool exit_on_error, char *
} }
/*
* check_93_config()
*
* Disable options not compatible with PostgreSQL 9.3
*/
void
check_93_config(void)
{
if (config_file_options.recovery_min_apply_delay_provided == true)
{
config_file_options.recovery_min_apply_delay_provided = false;
log_warning(_("configuration file option \"recovery_min_apply_delay\" not compatible with PostgreSQL 9.3, ignoring"));
}
if (config_file_options.use_replication_slots == true)
{
config_file_options.use_replication_slots = false;
log_warning(_("configuration file option \"use_replication_slots\" not compatible with PostgreSQL 9.3, ignoring"));
log_hint(_("replication slots are available from PostgreSQL 9.4"));
}
}
int int
test_ssh_connection(char *host, char *remote_user) test_ssh_connection(char *host, char *remote_user)
{ {
@@ -3138,15 +3114,12 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
appendPQExpBufferStr(&rsync_flags, appendPQExpBufferStr(&rsync_flags,
" --exclude=recovery.conf --exclude=recovery.done"); " --exclude=recovery.conf --exclude=recovery.done");
if (server_version_num >= 90400) /*
{ * Ideally we'd use PG_AUTOCONF_FILENAME from utils/guc.h, but
/* * that has too many dependencies for a mere client program.
* Ideally we'd use PG_AUTOCONF_FILENAME from utils/guc.h, but */
* that has too many dependencies for a mere client program. appendPQExpBuffer(&rsync_flags, " --exclude=%s.tmp",
*/ PG_AUTOCONF_FILENAME);
appendPQExpBuffer(&rsync_flags, " --exclude=%s.tmp",
PG_AUTOCONF_FILENAME);
}
/* Temporary files which we don't want, if they exist */ /* Temporary files which we don't want, if they exist */
appendPQExpBuffer(&rsync_flags, " --exclude=%s*", appendPQExpBuffer(&rsync_flags, " --exclude=%s*",
@@ -3599,27 +3572,6 @@ can_use_pg_rewind(PGconn *conn, const char *data_directory, PQExpBufferData *rea
{ {
bool can_use = true; bool can_use = true;
/* wal_log_hints not available in 9.3, so just determine if data checksums enabled */
if (PQserverVersion(conn) < 90400)
{
int data_checksum_version = get_data_checksum_version(data_directory);
if (data_checksum_version < 0)
{
appendPQExpBuffer(reason,
_("unable to determine data checksum version"));
can_use = false;
}
else if (data_checksum_version == 0)
{
appendPQExpBuffer(reason,
_("this cluster was initialised without data checksums"));
can_use = false;
}
return can_use;
}
/* "full_page_writes" must be on in any case */ /* "full_page_writes" must be on in any case */
if (guc_set(conn, "full_page_writes", "=", "off")) if (guc_set(conn, "full_page_writes", "=", "off"))
{ {

View File

@@ -33,22 +33,14 @@
#include "storage/shmem.h" #include "storage/shmem.h"
#include "storage/spin.h" #include "storage/spin.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#if (PG_VERSION_NUM >= 90400)
#include "utils/pg_lsn.h" #include "utils/pg_lsn.h"
#endif
#include "utils/timestamp.h" #include "utils/timestamp.h"
#include "lib/stringinfo.h" #include "lib/stringinfo.h"
#include "access/xact.h" #include "access/xact.h"
#include "utils/snapmgr.h" #include "utils/snapmgr.h"
#if (PG_VERSION_NUM >= 90400)
#include "pgstat.h" #include "pgstat.h"
#else
#define PGSTAT_STAT_PERMANENT_DIRECTORY "pg_stat"
#endif
#include "voting.h" #include "voting.h"

View File

@@ -74,8 +74,8 @@
#include "log.h" #include "log.h"
#include "sysutils.h" #include "sysutils.h"
#define MIN_SUPPORTED_VERSION "9.3" #define MIN_SUPPORTED_VERSION "9.4"
#define MIN_SUPPORTED_VERSION_NUM 90300 #define MIN_SUPPORTED_VERSION_NUM 90400
#define REPLICATION_TYPE_PHYSICAL 1 #define REPLICATION_TYPE_PHYSICAL 1