Commit Graph

1036 Commits

Author SHA1 Message Date
Ian Barwick 609453a848 Handle failover of top-level standby
Cascaded standbys will not go into failover so we need to ignore
these when looking for candidates for promotion.
2015-01-16 12:35:01 +09:00
Ian Barwick a82d37e48a Improve node metadata and upstream connecting mechanism
To handle cascaded replication we're going to have to keep track
of each node's upstream node. Also enumerate the node type
("primary", "standby" or "witness") and mark if active.
2015-01-16 10:28:02 +09:00
Ian Barwick 4b6c097a3e Use AS for consistency 2015-01-16 08:46:28 +09:00
Ian Barwick 3dfa33d01d Store upstream node ID if set
Required to manage cascaded standbys
2015-01-16 00:29:43 +09:00
Ian Barwick a20afe28ec Add upstream_node_id to repl_nodes table 2015-01-15 23:54:07 +09:00
Ian Barwick 692204e381 Consolidate duplicated schema check code 2015-01-15 18:34:51 +09:00
Ian Barwick 2ae27521a3 Some infrastructure for supporting cascading replication
Does not fully work yet.
2015-01-15 15:37:09 +09:00
Ian Barwick d141d2a8aa Remove unused variable 2015-01-14 16:25:24 +09:00
Ian Barwick fc6f5ddaa7 Add function repmgr_get_primary_conninfo() 2015-01-14 16:23:08 +09:00
Ian Barwick 4b7fb70de3 Add current year to copyright 2015-01-14 15:50:42 +09:00
Ian Barwick 5db6489ae5 Initial support for cascaded standbys 2015-01-14 14:18:57 +09:00
Ian Barwick 96f6695a52 Clean up repmgr_get_last_standby_location() polling loop
No need to reconnect on every iteration of the loop. Move conditions
which break out of the loop straight away out of the loop.
2015-01-13 16:08:36 +09:00
Ian Barwick f006a79af9 Clean up log messages for invalid LSNs 2015-01-13 14:53:55 +09:00
Ian Barwick 3a8aa86e0c Remove pointless check 2015-01-13 14:25:58 +09:00
Ian Barwick 9cbac64ad4 Remove pointless check
Witness server can never be considered as a promotion candidate.
2015-01-13 14:24:19 +09:00
Ian Barwick 242fc8416c Consolidate disconnection calls 2015-01-13 13:59:27 +09:00
Ian Barwick 355d8b8f01 Use InvalidXLogRecPtr for pedantic correctness 2015-01-13 13:47:22 +09:00
Ian Barwick 8df7966540 Rename variable
"find_best" sounds like an imperative.
2015-01-13 13:42:30 +09:00
Ian Barwick 1a790549ea Refactor if-statement 2015-01-13 13:40:47 +09:00
Ian Barwick b80d25ad33 Add some hopefully correct comments for future reference
Also some debugging output which will need to be removed later.
2015-01-13 11:12:20 +09:00
Ian Barwick a1a61e5ec3 Remove unneeded include 2015-01-13 07:57:54 +09:00
Ian Barwick 1221b73293 repmgrd: explicitly state INSERT statement target columns 2015-01-12 20:47:22 +09:00
Ian Barwick 93d5d7905f Remove "XL*" macros and rationalize XLogRecPtr handling
As of 9.3, XLogRecPtr is a uint64, which makes it much easier to
handle, so we can retire the legacy macros and work directly
with the values.
2015-01-12 17:18:57 +09:00
Ian Barwick 41a5274b44 Comment for consistency 2015-01-12 15:30:17 +09:00
Ian Barwick d9f83cf620 Replace hard-coded value with local_options.reconnect_attempts; 2015-01-12 14:09:44 +09:00
Ian Barwick 905a2d0a5e Have witness server retry determining the new master
Loop a few times before giving up
2015-01-12 14:05:37 +09:00
Ian Barwick 526803c5e0 Witness server should always try to re-connect to primary
Standbys will try to reconnect even in MANUAL_FAILOVER mode,
so it's consistent to have the witness server do that too.
2015-01-12 13:32:04 +09:00
Ian Barwick 2ff24fecf2 Remove redundant constant 2015-01-12 13:16:13 +09:00
Ian Barwick a5ead16d6f Change query to use COUNT(*)
No point implying we're fetching the entire record
2015-01-12 12:28:06 +09:00
Ian Barwick 5fb84b9627 Witness server: on failover attempt to reconnect to new master
Previously it was just quitting.
2015-01-12 11:23:20 +09:00
Ian Barwick 437485bf6a Fix debugging output 2015-01-12 09:47:13 +09:00
Ian Barwick 822867ec24 Fix thinko 2015-01-12 09:40:47 +09:00
Ian Barwick 5b88a980b8 Add some debugging output 2015-01-12 07:57:42 +09:00
Ian Barwick e958b8f2d7 Fix typo 2015-01-09 18:44:31 +09:00
Ian Barwick 74a963a10e Fix schema quoting
There was a lot of duplicated/unused related to handling the
schema name; consolidated and rationalised.
2015-01-09 15:51:34 +09:00
Ian Barwick dd064cb47c res1 -> res 2015-01-09 11:20:07 +09:00
Ian Barwick 17de82493a Consolidate repl_node insert statements 2015-01-09 11:14:47 +09:00
Ian Barwick f2fa60f5cf Tidy up SQL statements
Improves readability
2015-01-09 09:46:41 +09:00
Ian Barwick acf2744ed7 Replace magic number with defined constant
And use it to restrict the number of rows retrieved to avoid
overflowing the array.
2015-01-08 17:19:02 +09:00
Ian Barwick 7bafd490c1 Remove #define for pre-9.3 versions 2015-01-08 16:59:10 +09:00
Ian Barwick 7c15176646 Clean up comments 2015-01-08 14:04:43 +09:00
Ian Barwick 97cbd7d557 Remove superfluous variable 2015-01-08 13:23:33 +09:00
Ian Barwick 5798241205 Add 'recovery_target_timeline = latest' to recovery.conf
Also revert to generating our own recovery.conf rather than using
pg_basebackup's minimal file.
2015-01-08 10:46:49 +09:00
Ian Barwick 5b5b4cd4cd Remove redundant comment 2015-01-08 09:51:53 +09:00
Ian Barwick 9dd78f34db Add missing short options to --help output 2015-01-07 08:56:05 +09:00
Ian Barwick a5b5e3d384 No need to store master version number here 2015-01-07 08:55:17 +09:00
Ian Barwick 241622694d Remove support for pre-9.3 servers 2015-01-06 14:53:26 +09:00
Ian Barwick 687872e979 get_data_directory() -> get_pg_setting()
More code consolidation
2015-01-06 13:47:31 +09:00
Ian Barwick 3033f2dfaf Fix get_cluster_size()
Was returning a pointer to a cleared PQresult
2015-01-06 10:30:33 +09:00
Ian Barwick 718024454e Add function get_data_directory()
Consolidate duplicate code
2015-01-06 10:06:58 +09:00