Craig Ringer [Fri, 10 Jul 2015 03:18:24 +0000 (11:18 +0800)]
Update existing bdr triggers to 'tgisinternal'
New truncate_triggers are created as `tgisinternal` but
exiting ones are not changed. Fix that by doing a one-off
catalog update during the BDR extension upgrade, setting
any existing BDR truncate triggers to internal and appending
their oid to their names to match new triggers.
Further improvement for issue #62
Craig Ringer [Fri, 10 Jul 2015 03:17:00 +0000 (11:17 +0800)]
Create BDR's truncate triggers as 'tgisinternal'
Switch from creating triggers using the SPI to using CreateTrigger
directly, marking the new trigger as `tgisinternal` so it's not
dumped by `pg_dump` and not listed by `psql`.
Existing triggers are not updated. A subsequent commit will add
support for updating existing triggers on extension update.
Fixes issue #62
Craig Ringer [Wed, 8 Jul 2015 03:34:45 +0000 (11:34 +0800)]
BDR 0.9.2 release notes
Craig Ringer [Fri, 10 Jul 2015 01:51:11 +0000 (09:51 +0800)]
Support for upgrading from 0.9.2.0
Ian Barwick [Thu, 9 Jul 2015 09:40:32 +0000 (18:40 +0900)]
Don't append 'replication=database' when calling bdr_test_replication_connection()
This causes calls to bdr_subscribe() (UDR) to fail with this error:
FATAL: could not fetch database oid: ERROR: syntax error
CONTEXT: SQL statement "SELECT * FROM bdr_test_replication_connection(remote_dsn || ' replication=database')"
The comment for bdr_connect() explictly says the provided conninfo string should not
contain a replication= parameter; "replication=database" is automatically appended.
For some reason this did not cause any problems in BDR mode with bdr_group_join(),
which also calls bdr_test_replication_connection().
Ian Barwick [Thu, 9 Jul 2015 06:30:24 +0000 (15:30 +0900)]
Only install bdr.bdr_internal_sequence_reset_cache() in BDR mode
bdr_seq.c not compiled for UDR; attempting to create this function
in UDR mode prevents the extension from being installed.
Ian Barwick [Thu, 9 Jul 2015 03:53:14 +0000 (12:53 +0900)]
doc: fix typo
Ian Barwick [Thu, 9 Jul 2015 01:53:20 +0000 (10:53 +0900)]
doc: BDR/BDR -> BDR/UDR
Ian Barwick [Thu, 9 Jul 2015 01:39:19 +0000 (10:39 +0900)]
doc: clarify UDR build process
Ian Barwick [Wed, 8 Jul 2015 09:45:37 +0000 (18:45 +0900)]
Normalize file header
Ian Barwick [Tue, 7 Jul 2015 12:10:45 +0000 (21:10 +0900)]
doc: fix markup
Ian Barwick [Tue, 7 Jul 2015 00:54:09 +0000 (09:54 +0900)]
Use bdr_find_other_exec() for BDR_INIT_REPLICA_CMD too
Ian Barwick [Sun, 5 Jul 2015 23:54:27 +0000 (08:54 +0900)]
doc: minor copy-editing/tweaks to sequence voting docs
Petr Jelinek [Sun, 5 Jul 2015 22:22:22 +0000 (00:22 +0200)]
doc: Improve the sequence voting docs.
Ian Barwick [Sun, 5 Jul 2015 00:27:54 +0000 (09:27 +0900)]
Fix comment in bdr_supervisor_rescan_dbs()
pg_seclabel -> pg_shseclabel
Craig Ringer [Fri, 3 Jul 2015 11:30:27 +0000 (19:30 +0800)]
Revert "Don't check for presence of a PRIMARY KEY if not replicating rows"
This reverts commit
15abe5e5946c1542ecf43b42c69ba03c984d199f as the
initial change was too naïve.
The check shouldn't be within the loop.
It should run after the DDL lock check, since it could change data
in the table in ways that means the incoming DDL might not apply
anymore, e.g. inserting a NULL value into an otherwise NULL-free
table at the same time an
ALTER TABLE ... ALTER COLUMN ... SET NOT NULL
comes in.
It's also necessary for it to be skipped if the node is read-only
so a check like && !node_read_only is needed.
Ian Barwick [Fri, 3 Jul 2015 11:10:45 +0000 (20:10 +0900)]
Trivial whitespace alignment fix
Craig Ringer [Fri, 3 Jul 2015 00:51:31 +0000 (08:51 +0800)]
Fix debug message left in new join code
Craig Ringer [Wed, 1 Jul 2015 08:41:19 +0000 (16:41 +0800)]
Permit DML on pg_catalog tables
Because many pg_catalog tables don't have a PRIMARY KEY we were
rejecting DML on them. Since pg_catalog writes don't get replicated
anyway, it's safe to permit such writes.
Fixes #102
Craig Ringer [Fri, 26 Jun 2015 13:11:00 +0000 (21:11 +0800)]
Don't check for presence of a PRIMARY KEY if not replicating rows
Petr Jelinek [Wed, 1 Jul 2015 16:16:02 +0000 (18:16 +0200)]
bdr_init_copy: clean the sequence amdata cache on new node
Fixes #101
Petr Jelinek [Tue, 30 Jun 2015 16:27:46 +0000 (18:27 +0200)]
Add function to clear sequence's amdata
Function bdr.bdr_internal_sequence_reset_cache(regclass) sets the amdata
of the sequence to NULL and schedules sequencer wakeup.
This is first step for implementing GH #101.
Petr Jelinek [Tue, 30 Jun 2015 12:53:37 +0000 (14:53 +0200)]
bdr_init_copy: O_CREAT requires 3 param open()
Ian Barwick [Tue, 30 Jun 2015 06:35:44 +0000 (15:35 +0900)]
Check for zero exit codes
Also fix program name in logging output
Craig Ringer [Mon, 29 Jun 2015 07:38:25 +0000 (15:38 +0800)]
Pre-create bdr_init_copy log before base backup
If bdr_init_copy's CWD isn't writeable then it'll bail out when
it first tries to start PostgreSQL, after it's already done the
base backup.
Fixes #99
Craig Ringer [Mon, 29 Jun 2015 07:36:04 +0000 (15:36 +0800)]
Check exit status of pg_resetxlog and pg_basebackup
bdr_init_copy wasn't checking exit status from pg_resetlog,
and was doing so incorrectly - though harmlessly - for
pg_basebackup.
Related to #100
Craig Ringer [Mon, 29 Jun 2015 07:05:00 +0000 (15:05 +0800)]
Check return values for pg_ctl invocations in bdr_init_copy
Fixes #100
Craig Ringer [Fri, 26 Jun 2015 07:47:45 +0000 (15:47 +0800)]
Highlight replication sets fix in 0.9.1 relnotes
Craig Ringer [Wed, 24 Jun 2015 05:22:46 +0000 (13:22 +0800)]
Spelling in PRIMARY KEY error
Craig Ringer [Wed, 24 Jun 2015 04:43:46 +0000 (12:43 +0800)]
Expose bdr_do_not_replicate GUC for other compilation units
Ian Barwick [Sun, 28 Jun 2015 23:18:12 +0000 (08:18 +0900)]
doc: add --replication_sets option for bdr_init_copy
Ian Barwick [Sun, 28 Jun 2015 22:59:29 +0000 (07:59 +0900)]
doc: add missing '=' to bdr_init_copy parameters
Petr Jelinek [Sun, 28 Jun 2015 20:06:13 +0000 (22:06 +0200)]
Fix copy pasto in previous commit
Petr Jelinek [Sun, 28 Jun 2015 18:58:57 +0000 (20:58 +0200)]
Make sequence pernode cache configurable
Reloption cache_chunks added which sets how many chunks should be voted
for and cached on each node.
Petr Jelinek [Sun, 28 Jun 2015 16:07:35 +0000 (18:07 +0200)]
bdr_init_copy enhancements
Add --replication-sets command line parameter.
Specifies which replication sets to use for the new node. If not
specified the bdr_init_copy will check if all nodes in the bdr cluster
use same replication sets and use that one for the new node
automatically (instead of default). If the existing nodes don't all use
same replication sets it will throw error unless --replication-sets was
specified.
If the local data directory contains PostgreSQL data folder, check if
the system identifier is same as the system identifier of the remote
node. (GH #91)
When the remote node has multiple BDR activated databases make new
connections to all of them from the new local node. (GH #88)
Correctly set node_local_dsn for the new node.
Document -v option for increasing verbosity in --help output.
Petr Jelinek [Mon, 22 Jun 2015 20:17:11 +0000 (22:17 +0200)]
bdr_init_copy: only treat dbname as connstr if it's in connstr format.
Ian Barwick [Thu, 25 Jun 2015 23:27:27 +0000 (08:27 +0900)]
doc: Fix typo
Ian Barwick [Tue, 23 Jun 2015 04:53:15 +0000 (13:53 +0900)]
Add missing schema qualification
Craig Ringer [Mon, 22 Jun 2015 07:30:07 +0000 (15:30 +0800)]
Improvements to BDR/UDR join sanity checking
This is a set of related changes to the init/join
processes, focused on sanity checks and robustness
when joining nodes.
Introduces extension rev bdr 0.10.0.5.
* Expose bdr_internal_create_truncate_trigger function
to add the bdr truncate_trigger to a table. Use it
from bdr_truncate_trigger_add.
* Use bdr_truncate_trigger_add in bdr_group_join to
create truncate triggers on all existing tables
when BDR gets enabled. Previously we'd fail to
replicate TRUNCATE for tables created before
CREATE EXTENSION bdr; was run.
* Fix broken prototype for bdr_truncate_trigger_add
* In bdr_group_join prohibit enabling BDR where
exclusion constraints exist in the database's
current state. Previously you could get a BDR
db with exclusion constraints and/or a broken
clone by creating a table with exclusion constraints
before enabling BDR.
* In bdr_group_join, warn users if there are
secondary unique indexes on tables, as currently
we can't do last-update-wins conflict handling
on tuples that violate multiple unique constraints.
See issue #95. Still permit join to continue.
* Warn users about missing PRIMARY KEYs, but
permit join to continue, as it's legal to
have no PK on an INSERT-only table.
* In bdr.internal_begin_join, use
bdr_test_replication_connection to test the remote
DSN in replication mode and make sure that pg_hba.conf
permits connection in replication mode. Fixes #94.
Craig Ringer [Mon, 22 Jun 2015 04:23:38 +0000 (12:23 +0800)]
Fix outdated comment in bdr_get_remote_nodeinfo
Craig Ringer [Mon, 22 Jun 2015 04:08:10 +0000 (12:08 +0800)]
Tests show that truncate triggers are created before bdr_group_create
See #93
Craig Ringer [Fri, 19 Jun 2015 09:28:01 +0000 (17:28 +0800)]
Document that UPDATE and DELETE require a PRIMARY KEY
Fixes #84
Craig Ringer [Fri, 19 Jun 2015 09:10:11 +0000 (17:10 +0800)]
Flesh out the conflicts docs
Craig Ringer [Fri, 19 Jun 2015 04:12:03 +0000 (12:12 +0800)]
Fix docs structure errors, a few cleanups
Craig Ringer [Fri, 19 Jun 2015 03:27:22 +0000 (11:27 +0800)]
Remove duplicate conflicts info
Petr Jelinek [Thu, 18 Jun 2015 16:24:01 +0000 (18:24 +0200)]
Add our own function for finding Postgres binaries
We need our own function because the built-in function compares the
binary version including the minor version and since BDR is an extension
it's not realistic to support every possible version combination. The
BDR specific function for finding and validation of Postgres binaries
doesn't do version validation but instead returns major version in the
PG_VERSION_NUM format so it can be easily compared by the caller as
needed.
The pg_dump and pg_restore in bdr_init_replica and pg_ctl and
pg_basebackup check in bdr_init_copy are using the function now.
Petr Jelinek [Thu, 18 Jun 2015 16:22:25 +0000 (18:22 +0200)]
Don't insert node in bdr_init_copy in UDR mode.
Petr Jelinek [Wed, 17 Jun 2015 17:45:19 +0000 (19:45 +0200)]
Fix DROP replay of functions with no parameters.
Craig Ringer [Wed, 17 Jun 2015 06:53:25 +0000 (14:53 +0800)]
Explain that you can't part a node from its self
Craig Ringer [Wed, 17 Jun 2015 06:02:22 +0000 (14:02 +0800)]
Reject attempts to part from self, detect part from absent node
Reject attempts to part a node from its self. This seems like
a sensible thing to do, but we need to remove a node using another
node so that all peers find out about the removal.
Detect when asked to part a nonexistent node and complain instead
of silently doing nothing.
Also warn when asked to part a node that isn't in 'r' state.
Craig Ringer [Wed, 17 Jun 2015 06:02:02 +0000 (14:02 +0800)]
Improve error message on insert/insert multi-unique conflict
Craig Ringer [Tue, 16 Jun 2015 02:37:56 +0000 (10:37 +0800)]
More explanation of conflict types
Ian Barwick [Mon, 15 Jun 2015 07:08:13 +0000 (16:08 +0900)]
doc: fix typo
Petr Jelinek [Fri, 12 Jun 2015 12:18:03 +0000 (14:18 +0200)]
Assertion fixes
Ian Barwick [Fri, 12 Jun 2015 06:46:07 +0000 (15:46 +0900)]
Add documentation for bdr_get_local_nodeid()
Ian Barwick [Fri, 12 Jun 2015 06:38:59 +0000 (15:38 +0900)]
Fix doc references for bdr_get_local_node_name()
Ian Barwick [Fri, 12 Jun 2015 05:19:13 +0000 (14:19 +0900)]
Add missing 'bdr_' prefix
Petr Jelinek [Wed, 3 Jun 2015 18:51:07 +0000 (20:51 +0200)]
Add bdr_unsubscribe()
Petr Jelinek [Thu, 11 Jun 2015 14:12:31 +0000 (16:12 +0200)]
Fix some compiler warnings
Martín Marqués [Sat, 6 Jun 2015 18:30:15 +0000 (15:30 -0300)]
Documentation Typo
Martín Marqués [Wed, 3 Jun 2015 13:31:02 +0000 (10:31 -0300)]
Several documentation corrections
Petr Jelinek [Tue, 2 Jun 2015 19:15:09 +0000 (21:15 +0200)]
Add missing header
Petr Jelinek [Wed, 3 Jun 2015 12:22:26 +0000 (14:22 +0200)]
Change bdr_nodes_get_local_info from SPI to heap scan to avoid starting transaction.
Petr Jelinek [Wed, 3 Jun 2015 11:21:53 +0000 (13:21 +0200)]
Missing extension file
Craig Ringer [Wed, 3 Jun 2015 04:39:57 +0000 (12:39 +0800)]
Document that bdr_initial_load exists but is internal
Closes #76
Craig Ringer [Wed, 3 Jun 2015 04:34:41 +0000 (12:34 +0800)]
Correct --help output for bdr_initial_load
Per report in #76
Petr Jelinek [Tue, 2 Jun 2015 16:20:48 +0000 (18:20 +0200)]
On second thought use session cache for bdr_nodes.
This is how rest of postgres does it. The shmem cache is probably
slightly better performance-wise but it's somewhat abusing the shmem.
The node access API could use some rethinking after this - standard
access should probably go via cache. We should also avoid SPI probably.
But both of these are left for future patches.
In passing activate the read_only regression test which was previously
not added to Makefile by mistake.
Craig Ringer [Tue, 2 Jun 2015 07:25:13 +0000 (15:25 +0800)]
Build instructions changes for UDR
Closes #74
Petr Jelinek [Mon, 1 Jun 2015 20:15:01 +0000 (22:15 +0200)]
Add missing files for previous commit
Petr Jelinek [Sun, 10 May 2015 13:11:40 +0000 (15:11 +0200)]
Add read-only nodes.
Read-only node does not allow writes to permament objects.
Craig Ringer [Tue, 26 May 2015 09:57:46 +0000 (17:57 +0800)]
Upgrade support for 0.9.1.0
Craig Ringer [Tue, 26 May 2015 12:18:37 +0000 (20:18 +0800)]
Release notes for 0.9.1
Craig Ringer [Tue, 26 May 2015 09:51:55 +0000 (17:51 +0800)]
Add bdr.bdr_apply_is_paused() information function
This makes it possible to see whether replay is paused on
a node.
Also adds some tests for pause/resume.
Closes #59
Craig Ringer [Tue, 26 May 2015 07:58:29 +0000 (15:58 +0800)]
doc that bdr.bdr_replicate_ddl_command takes fully qualified name
Closes #70 by documenting that bdr.bdr_replicate_ddl_command requires
fully qualified objects.
Craig Ringer [Tue, 26 May 2015 06:19:37 +0000 (14:19 +0800)]
Update bdr_dump to include setval fixes
Update bdr_dump from bdr-pg/REL9_4_STABLE to include:
3ab2f78 Don't dump setval(...) for 'bdr' sequences
1592812 Only dump non-default sequence access methods
Craig Ringer [Tue, 26 May 2015 06:12:43 +0000 (14:12 +0800)]
Update bdr_dump to 9.4.2 + --snapshot
Update copy of pg_dump with snapshot support for UDR to the
version from bdr-pg/REL9_4_STABLE . We can't use stock pg_dump
because we need support for dumping from a pre-established
snapshot, which is added in the BDR tree.
Petr Jelinek [Tue, 26 May 2015 08:40:38 +0000 (10:40 +0200)]
Add backwards compatibility to the DDL locking
This ensures that DDL locking will work in bdr cross-version environment
for smoother upgrades.
Craig Ringer [Mon, 25 May 2015 14:38:09 +0000 (22:38 +0800)]
fixup! Add update path from 0.9.0.5 to 0.10.0.0
The Makefile.in must also know about the new files
Craig Ringer [Mon, 25 May 2015 05:57:33 +0000 (13:57 +0800)]
Add update path from 0.9.0.5 to 0.10.0.0
commit
401d117, bdr.table_set_replication_sets ...
introduces 0.9.0.5 and we need a path from it to 0.10.0.x.
Andres Freund [Mon, 25 May 2015 01:49:25 +0000 (03:49 +0200)]
bdr: Send pgstat upon replayed commit in apply process.
Previously it was only sent at apply worker shutdown.
Andres Freund [Mon, 25 May 2015 01:43:15 +0000 (03:43 +0200)]
bdr: Improve sequencer locking and pgstat reporting.
Up to now the sequencer locked its relations exclusively to prevent an
interlock with apply. That was problematic, because it would often
prevent auto vacuum/analyze from running, or interrupt it.
Instead of locking the underlying relations lock the bdr seqam object
and add code to apply to also acquire that lock. That allow autovacuum
to run undisturbed.
Testing brought an additional problem to light, namely that pgstat
records weren't sent in the sequencer until shutdown, which means that
in many situations autovacuum won't be trigger in time. This is a more
widespread problem than just the sequencer, but here only the sequencer
is fixed.
Andres Freund [Sun, 24 May 2015 23:46:02 +0000 (01:46 +0200)]
bdr: Adjust database name in debug message.
Andres Freund [Thu, 21 May 2015 21:36:41 +0000 (23:36 +0200)]
bdr: Add minimal checks for the cloning of databases with contents.
These should be expanded, but are better than nothing.
Petr Jelinek [Fri, 22 May 2015 13:40:16 +0000 (15:40 +0200)]
Add the 0.10.0.2 to Makefile
Craig Ringer [Fri, 15 May 2015 09:08:52 +0000 (17:08 +0800)]
bdr.table_set_replication_sets should permit unsafe commands
In
4005c1d bdr_replicate_ddl_command was changed not to override the
command filter, but this broke replication sets in UDR, since they have
to use SECURITY LABEL.
SET bdr.permit_unsafe_ddl_commands on bdr.table_set_replication_sets
since it knows what it's doing.
Fixes #67
Note: The ddl/replication_sets tests cannot be run as-is on UDR because
UDR does not replicate changes to replication sets. We really need
separate tests for this that cover UDR (or BDR+subscribe).
Andres Freund [Thu, 21 May 2015 21:03:30 +0000 (23:03 +0200)]
Don't specify the sequence am in UDR.
The initial cloning needs more tests, including data, but that requires
larger changes to several tests than I want to do in the fix commit
itself.
Fixes #69
Andres Freund [Fri, 15 May 2015 14:03:01 +0000 (16:03 +0200)]
Initial code to actually remove slots when parting a node.
This removes a slot when
a) It is of a remote node that has been parted.
b) We have been parted, and there are remote slots. It is not guaranteed
that we're notified of that case, but it seems worthwhile to handle
nonetheless.
Craig Ringer [Fri, 15 May 2015 09:26:08 +0000 (17:26 +0800)]
fixup! Add a test for node part
Didn't check in the expected/ data
Craig Ringer [Fri, 15 May 2015 09:18:47 +0000 (17:18 +0800)]
Fix UDR after BDRLockType introduction in
10b331fea
Craig Ringer [Fri, 15 May 2015 09:13:26 +0000 (17:13 +0800)]
Better error message if PG_CONFIG is nonsense
Petr Jelinek [Wed, 6 May 2015 14:51:53 +0000 (16:51 +0200)]
Use correct replication set and apply delay config in apply.
Craig Ringer [Wed, 6 May 2015 09:09:59 +0000 (17:09 +0800)]
Add a test for node part
This shows that the slots are currently _not_ correctly dropped.
Petr Jelinek [Tue, 5 May 2015 15:37:50 +0000 (17:37 +0200)]
Use the new lesser form of global lock for some of the DDL commands.
Petr Jelinek [Tue, 5 May 2015 15:35:30 +0000 (17:35 +0200)]
Add support for more levels of global locks.
The old ddl_lock was replaced by ddl_lock and write_lock.
The ddl_lock now only locks database against concurrent DDL but not
against writes anymore. The write_lock locks against writes the same way
old ddl_lock used to. We support upgrading the ddl_lock to write_lock at
some performance penalty (the lock needs to be negotiated again).
Petr Jelinek [Fri, 1 May 2015 13:56:02 +0000 (15:56 +0200)]
Fix broken supervisordb test
Petr Jelinek [Fri, 1 May 2015 13:51:37 +0000 (15:51 +0200)]
Make DML operation wait when there is DDL in progress.
Previously, we immediately raised ERROR when executing DML while DDL
lock was being acquired or held. Now we just keep them waiting until
either the lock is released or statement_timeout kills them.
Update isolation tests accordingly.
Petr Jelinek [Fri, 1 May 2015 13:23:40 +0000 (15:23 +0200)]
Don't immediately kill all transactions when acquiring DDL lock.
Previously we just canceled all transactions in database when acking DDL
lock. This code only cancels transactions which did any writes and gives
them some time (currently hardcoded to 10s) of grace period to finish
what they are doing.
Craig Ringer [Fri, 24 Apr 2015 07:17:40 +0000 (15:17 +0800)]
Prevent users from connecting to bdr_supervisordb
This won't stop bgworkers, but they should hopefully know better.
Craig Ringer [Fri, 24 Apr 2015 06:17:39 +0000 (14:17 +0800)]
Prevent attempts to create/drop/rename bdr_supervisordb
When the BDR extension is loaded, BDR its self can create
bdr_supervisordb, but applications cannot. This gives users
a better error message if they try to drop it, too, e.g.
DROP DATABASE bdr_supervisordb;
ERROR: The BDR extension reserves the database name bdr_supervisordb
for its own use
HINT: Use a different database name
Craig Ringer [Fri, 24 Apr 2015 04:38:26 +0000 (12:38 +0800)]
fixup! Prevent taking the DDL lock without explicit authorization
Per internal discussion, make bdr.permit_ddl_locking true by default.