Ian Barwick
fe758eda9f
Update repl_nodes following failover
...
repl_nodes table updated by each node following failover to
show that either it is the primary, or which primary it has
started to follow.
2015-01-16 16:28:09 +09:00
Ian Barwick
c413cff461
Function to update node records
2015-01-16 14:14:04 +09:00
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
2ae27521a3
Some infrastructure for supporting cascading replication
...
Does not fully work yet.
2015-01-15 15:37:09 +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
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
5b88a980b8
Add some debugging output
2015-01-12 07:57:42 +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
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
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
9dd78f34db
Add missing short options to --help output
2015-01-07 08:56:05 +09:00
Ian Barwick
241622694d
Remove support for pre-9.3 servers
2015-01-06 14:53:26 +09:00
Ian Barwick
4e9c58c7db
Update copyright to 2015
2015-01-03 08:12:13 +09:00
Ian Barwick
8b69b1e16f
Optionally retrieve server_version string as well
...
In a couple of places we'll need to report the human-readable
version number
2014-12-29 15:52:53 +09:00
Ian Barwick
f94626bf7b
Refactor version number detection
...
Use the reported `server_version_num` integer for version number
detection and comparison. This makes it easier to set an arbitrary
minimum supported version (rather than "9.0 or later") as well
as future-proofing for 10.x and later.
2014-12-29 14:54:04 +09:00
Warren Moore
d93d42fadb
fix: witness creation and monitoring
...
While reading node entries from master use a separate PGresult when inserting into witness.
Witness monitoring supplies a null value for 'last_apply_time'.
2014-03-24 14:19:29 +00:00
József Kószó
b9ab9010c0
debian init script and config file documentation fixes
2014-03-22 22:13:33 +01:00
József Kószó
2a6c835a5a
debian init script and config file documentation fixes
2014-03-21 14:18:07 +01:00
Christian Kruse
91c29fe2a2
removed old comment
2014-03-06 18:34:41 +01:00
Christian Kruse
573f1d3b2e
no longer use global variable for SQL query buffer
2014-03-06 18:34:41 +01:00
Christian Kruse
0a6ff7faec
removed no-longer used variable
2014-03-06 18:34:41 +01:00
Christian Kruse
98b1f8d28a
rather big refactoring: use a naming scheme
...
In the past naming of functions, variables and such didn't really have a
naming scheme. Now they should have.
2014-03-06 18:34:40 +01:00
Christian Kruse
9eba986833
avoid usage of snprintf()
...
We have a nice little abstraction for snprintf with covering the case
that a string is too big for the target buffer – let's use that!
2014-03-06 18:34:40 +01:00
Christian Kruse
d8b8bf0e2a
pg_indent'ing all files…
2014-03-06 18:34:40 +01:00
Christian Kruse
98c7635fb5
fixing more compiler warnings
2014-03-04 17:58:36 +01:00
Christian Kruse
90ecb2b107
fix: check return values of freopen()
...
Some compiles complain about not checking the return value of freopen(),
so we check it
2014-03-04 15:32:48 +01:00
Christian Kruse
0ff14a2aa1
avoid compiler warnings
2014-02-21 13:47:29 +01:00
Christian Kruse
5215265694
fix: now CloseConnections() is much more safe
2014-02-18 17:06:36 +01:00
Christian Kruse
e45ac25348
fix: progname is const, do not free it
...
The leak is irrelevant
2014-02-18 16:45:35 +01:00
Christian Kruse
a1ce01f033
fix: fixed some leaks
2014-02-18 16:35:29 +01:00