Ian Barwick
333083869b
repmgrd: fix more PostgreSQL 10 WAL function renamings
2017-05-22 22:25:53 +09:00
Ian Barwick
57fae00844
repmgrd: support latest round of PostgreSQL 10 WAL function renamings
2017-05-22 11:02:22 +09:00
Ian Barwick
e53f1bf844
repmgrd: support further renamed WAL function for PostgreSQL 10
2017-05-22 08:38:12 +09:00
Ian Barwick
98998f73bf
repmgrd: remove unnecessary inclusions
...
Per gripe in GitHub #303
2017-05-22 08:13:39 +09:00
Ian Barwick
c02a12a113
repmgrd: actually call repmgr_update_last_updated()
...
Function was created but never actually used, resulting in incorrect
values for "communication_time_lag" in the "repl_status" view.
This appears to have been an oversight in the original commit
( c3b58658ad ).
Addresses GitHub #290
2017-05-05 09:22:46 +09:00
Ian Barwick
67e8ca73b5
repmgrd: fix XLogRecPtr conversion function
2017-01-11 15:03:13 +09:00
Ian Barwick
a1a1d64e1f
repmgrd: fix usage description
...
Matches the one provided by repmgr.
2017-01-11 15:03:07 +09:00
Ian Barwick
76509038cc
repmgrd: prevent invalid apply lag value being written to the monitoring table
2017-01-11 15:03:02 +09:00
Ian Barwick
7f8e50c882
Update copyright notice to 2017
...
Also standardize case to "(c)"
2017-01-11 15:02:55 +09:00
Ian Barwick
d89a73cbf4
repmgrd: fix log messages and code comments to reflect what is actually happening
...
Sometimes we're setting node status to active.
2016-12-27 14:48:34 +09:00
Ian Barwick
9788b2bd29
repmgr: don't display timestamp in log output
...
Differentiate between repmgr and repmgrd output
2016-12-05 10:44:30 +09:00
Ian Barwick
b54f98ed8a
repmgr: always log to STDERR even if log facility defined
2016-11-23 08:55:55 +09:00
Ian Barwick
26f73686e5
repmgrd: fixes to configuration reload mechanism
2016-11-02 23:23:26 +09:00
Ian Barwick
e274a2cbcb
repmgrd: clean up some redundant code
2016-11-02 16:52:44 +09:00
Ian Barwick
bb842c3989
repmgr: improve replication status checking during switchover
...
When checking the new standby's record in pg_stat_replication, keep
polling until the expected status is reported, and only give up
after a timeout was exceeded.
Previously repmgr would report an error if status was "startup",
even though this is not a problem.
2016-11-01 17:42:35 +09:00
Ian Barwick
0cde0068dd
repmgrd: improve witness failover logging
...
Log the new master node as INFO rather than DEBUG.
2016-10-20 10:56:16 +09:00
Ian Barwick
b7f20ee1f7
repmgrd: don't start if node is inactive and failover=automatic
...
If failover=automatic, it would be reasonable to expect repmgrd to
consider this node as a promotion candidate, however this will not
happen if it is marked inactive. This often happens when a failed
primary is recloned as a standby but not re-registered, and if
repmgrd would run it would give the incorrect impression that
failover capability is available.
Addresses GitHub #153 .
2016-09-28 10:59:20 +09:00
Ian Barwick
8de84707d9
Always use PQstatus to check connection status
...
This addresses GitHib #234 .
2016-08-25 08:35:47 +09:00
Ian Barwick
ef7bed1b3d
repmgrd: refactor standby monitoring status query and code
...
This had grown somewhat complex with addition of handling for
various corner cases. Much of the work has now been delegated
to the query itself.
2016-08-16 19:15:58 +09:00
Ian Barwick
6bd1c6a36d
Skip largely pointless master reconnection attempt.
...
Experimental - see notes in code.
2016-08-16 13:25:39 +09:00
Ian Barwick
9831cabd4d
Minor refactoring of do_master_failover()
...
- rename some variables for clarity
- ensure all structures are initialised correctly
- update code comments
2016-08-16 11:23:59 +09:00
Ian Barwick
a310417a49
Refactor standby monitoring query
...
Addresses GitHub #224
2016-08-11 17:28:16 +09:00
Ian Barwick
84ab37c600
Improve handling of failover events when failover is set to manual
...
- prevent repmgrd from repeatedly executing the failover code
- add event notification 'standby_disconnect_manual'
- update documentation
This addresses GitHub #221 .
2016-08-09 12:09:09 +09:00
Ian Barwick
6a198401db
Fix repmgrd's command line help option parsing
...
As in commit d0c05e6f46 , properly distinguish between
the command line option -? and getopt's unknown option marker '?'
2016-08-08 21:17:56 +09:00
Ian Barwick
cb78802027
repmgrd: prevent endless loops in failover with manual node
...
The LSN reported by the shared memory function defaults to "0/0"
(InvalidXLogRecPtr) - this indicates that the repmgrd on that node
hasn't been able to update it yet. However during failover several
places in the code assumed this is an error, which would cause
an endless loop waiting for updates which would never come.
To get around this without changing function definitions, we can
store an explicit message in the shared memory location field so the
caller can tell whether the other node hasn't yet updated the field,
or encountered situation which means it should not be considered
as a promotion candidate (which in most cases will be because
`failover` is set to `manual`.
Resolves GitHub #222 .
2016-08-08 14:29:24 +09:00
Ian Barwick
02668ee045
Parse the contents of the "pg_basebackup_options" parameter in repmgr.conf
...
This is to ensure that when repmgr executes pg_basebackup it doesn't
add any options which would conflict with user-supplied options.
This is related to GitHub #206 , where the -S/--slot option has been
added for 9.6 - it's important to check this doesn't conflict with
-X/--xlog-method.
While we're at it, rename the ErrorList handling code to ItemList
etc. so we can use it for generic non-error-related lists.
2016-07-26 16:12:43 +09:00
Ian Barwick
091541619d
Fix repmgrd monitoring calculation when in archive recovery
2016-07-06 09:27:31 +09:00
Ian Barwick
74f6f97f26
repmgrd: log whether in standby or witness monitor loop
...
This is mainly for development and debugging purposes.
2016-06-29 10:31:57 +09:00
Ian Barwick
f1ee6e19b6
Ensure configuration options correctly initialised in repmgrd.c
...
Per GitHub #150 .
Also remove unused variable.
2016-06-27 11:26:05 +09:00
Ian Barwick
a2b5ba595a
repmgrd: reword log message for clarity
2016-06-23 09:47:35 +09:00
Ian Barwick
c16ab3c889
Fix handling of global PGconn variables in repmgrd
...
Don't call PQfinish before calling terminate(), elsewhere always
set to NULL after calling PQfinish().
This fixes GitHub #182 .
2016-06-21 17:30:22 +09:00
Ian Barwick
dd5b6f9f12
Whitespace fixes
2016-06-21 16:04:41 +09:00
Ian Barwick
303bb22ee1
Note potential replication lag check improvement
2016-06-20 12:23:34 +09:00
Ian Barwick
5d8b1a3a31
monitoring: ensure that invalid replication_lag value is not inserted.
...
Per Github #189 .
2016-06-20 10:55:25 +09:00
Ian Barwick
1ade1acb22
Report standby location as last apply location when in archive recovery
...
Otherwise the monitoring table's 'last_wal_standby_location' will stay at
the location of the last streaming WAL received.
This complements the bugfix applied in e814c1120e .
2016-06-15 15:41:10 +09:00
Ian Barwick
66fd003ab4
Schema-qualify pg_catalog objects
2016-06-10 17:58:10 +09:00
Martin
b6ebd34e2f
Some other indentation fixes found
2016-06-03 20:20:43 -03:00
Martin
46ff9fb587
No code change, just indentation was incorrect in the failover part
...
making it hard to read.
2016-06-03 20:20:43 -03:00
Ian Barwick
e814c1120e
repmgrd: handle situations where streaming replication is inactive
2016-05-12 22:17:44 +09:00
Ian Barwick
247823db4d
Remove extraneous PQfinish()
2016-05-12 14:05:44 +09:00
Ian Barwick
0a798bf6e4
Comment fixes and formatting tweaks
2016-05-12 09:52:22 +09:00
Ian Barwick
21b2ff1a1f
repmgrd: better handling of missing upstream_node_id
...
Ensure we default to master node.
2016-05-12 09:20:33 +09:00
Ian Barwick
57f9432692
Add missing newlines in log messages
2016-05-11 21:47:40 +09:00
Ian Barwick
54d3c7a4ca
repmgrd: avoid additional connection to local instance in do_master_failover()
2016-05-11 09:55:38 +09:00
Ian Barwick
b0f6b7bad7
repmgrd: rename variable for clarity
2016-05-11 08:29:55 +09:00
Ian Barwick
4dbbf40196
Don't follow the promotion candidate standby if the primary reappears
2016-05-10 13:58:59 +09:00
Ian Barwick
d5e24689a4
Don't terminate a standby's repmgrd if self-promotion fails due to master reappearing
...
Per GitHub #173
2016-05-10 11:45:03 +09:00
Ian Barwick
2946c097f0
repmgrd: rename some variables to better match the system functions they're populated from
2016-04-12 15:51:42 +09:00
Ian Barwick
5d32026b79
Improve debugging output for node resyncing
...
We'll need this for testing.
2016-04-01 11:29:35 +09:00
Ian Barwick
190cc7dcb4
Rename copy_configuration () to witness_copy_node_records()
...
As it's witness-specific. Per suggestion from Martín.
2016-04-01 08:44:23 +09:00