Craig Ringer [Fri, 6 Feb 2015 13:37:58 +0000 (02:37 +1300)]
bdr: refactor bdr_connect to be more useful to other callers
Craig Ringer [Fri, 6 Feb 2015 11:29:55 +0000 (00:29 +1300)]
bdr: add bdr_get_remote_nodeinfo(...)
Add a utility function that permits a remote node to be probed
for BDR identification information of interest.
Andres Freund [Mon, 19 Jan 2015 14:20:38 +0000 (15:20 +0100)]
bdr: Add caching layer above databases.
Currently that layer is just used to cache (and abstract away) checks
whether a database is enabled for bdr. But likely we'll end up caching
additional data in there.
FIXME: Right now this isn't going to work for UDR. We need to make it
set a flag on the source side for it.
Craig Ringer [Tue, 27 Jan 2015 10:59:56 +0000 (21:59 +1100)]
bdr: Add bdr_error_nodeids_must_differ for a common error
Craig Ringer [Tue, 27 Jan 2015 00:44:28 +0000 (11:44 +1100)]
bdr: add bdr_parse_version(...)
Provide a utility function for parsing a text BDR version
Craig Ringer [Sat, 7 Feb 2015 07:23:39 +0000 (20:23 +1300)]
bdr: rename worker struct members/unions to be shorter
Renames BdrWorker.worker_data => BdrWorker.data
and renames its union members:
* apply_worker => apply
* perdb_worker => perdb
as well as the bdr_perdb_worker variable in bdr_perdb.c
Andres Freund [Sun, 8 Feb 2015 12:06:27 +0000 (13:06 +0100)]
Fix VPATH build against 9.4 (i.e. UDR).
Craig Ringer [Wed, 4 Feb 2015 11:09:43 +0000 (22:09 +1100)]
bdr: Bump bdr-plugin/next to 0.9.0
Craig Ringer [Fri, 6 Feb 2015 03:56:18 +0000 (14:56 +1100)]
bdr: Ignore generated Makefile.global and doc/Makefile
Craig Ringer [Fri, 6 Feb 2015 03:53:15 +0000 (14:53 +1100)]
bdr: Make some more externally callable functions PGDLLEXPORT
Andres Freund [Wed, 4 Feb 2015 22:02:58 +0000 (23:02 +0100)]
bdr: Add missing pgstat_report_activity(STATE_IDLE) during apply worker start.
Petr Jelinek [Wed, 4 Feb 2015 19:57:22 +0000 (20:57 +0100)]
bdr: Fix unitialized variable.
Petr Jelinek [Wed, 4 Feb 2015 19:21:49 +0000 (20:21 +0100)]
bdr: Fix initialization of replication identifier emulation.
Andres Freund [Wed, 4 Feb 2015 16:33:13 +0000 (17:33 +0100)]
bdr: Add base structure for sgml documentation.
No meaningful content, but buildable. With index and everything.
Andres Freund [Wed, 4 Feb 2015 15:40:42 +0000 (16:40 +0100)]
bdr: Improve build infrastructure to allow more than one src dir
This is preparation for also building docs; and could also be used to
build bdr_dump.
Petr Jelinek [Wed, 4 Feb 2015 12:41:27 +0000 (13:41 +0100)]
bdr: Always allow temp tables manipulation on UDR provider.
Backpatched from dynconf.
Petr Jelinek [Wed, 4 Feb 2015 12:40:59 +0000 (13:40 +0100)]
bdr: Remove unused variable
Craig Ringer [Wed, 4 Feb 2015 11:29:10 +0000 (22:29 +1100)]
bdr: move extension control files into extsql/
Craig Ringer [Wed, 4 Feb 2015 10:36:32 +0000 (21:36 +1100)]
bdr: stable branch quickstart should prefer bdr-plugin/stable
Craig Ringer [Wed, 4 Feb 2015 10:33:53 +0000 (21:33 +1100)]
bdr: Update the README and INSTALL docs for 0.8.0
Craig Ringer [Sat, 13 Dec 2014 18:45:13 +0000 (02:45 +0800)]
bdr: Add a debug message for DDL replication enqueues
Craig Ringer [Wed, 4 Feb 2015 04:30:29 +0000 (15:30 +1100)]
bdr: All SQL-callable functions should be PGDLLEXPORT
Craig Ringer [Wed, 4 Feb 2015 03:23:45 +0000 (14:23 +1100)]
bdr: Add bdr_version_num() and bdr_min_remote_version_num()
Craig Ringer [Tue, 3 Feb 2015 00:18:27 +0000 (11:18 +1100)]
bdr: Correct parameter types for bdr_get_local_nodeid()
bdr_get_local_nodeid() was returning 'oid' for sysid, but it's a uint64
that won't fit that type's width. Use 'text'.
Andres Freund [Sat, 17 Jan 2015 23:04:46 +0000 (00:04 +0100)]
bdr: Add missing waits in regression tests.
These sometimes caused errors due to not yet released ddl locks.
Andres Freund [Sat, 17 Jan 2015 16:45:00 +0000 (17:45 +0100)]
bdr: Add .gitattribute to enforce a minimum of whitespace consistency.
Also fix some existing damage shown by git log/diff --check
Andres Freund [Sat, 17 Jan 2015 16:29:43 +0000 (17:29 +0100)]
bdr: Fix build logic to work in spite of pg vpath logic changes.
e907997f42faada60e5a26b116cc0b79b69309d1 broke bdr VPATH builds.
Andres Freund [Sat, 17 Jan 2015 16:02:52 +0000 (17:02 +0100)]
bdr: Fix up file headers and copyright dates.
Andres Freund [Fri, 16 Jan 2015 12:32:22 +0000 (13:32 +0100)]
bdr: Fix race between asking for replay confirmation and processing replies.
bdr_process_acquire_ddl_lock() sent out lock requests before being
ready to accept responses. While the window isn't big, it *does*
contain a WAL flush. That can lead to lock acquirations never
finishing because some backend can miss a response to a replay
request.
To fix simply hold the lock appropriately long.
Craig Ringer [Mon, 5 Jan 2015 12:54:42 +0000 (20:54 +0800)]
bdr: Update quickstart guide for split source tree
Petr Jelinek [Wed, 31 Dec 2014 10:24:29 +0000 (11:24 +0100)]
bdr: We actually want to log remote tuple on conflict.
Petr Jelinek [Tue, 30 Dec 2014 20:19:58 +0000 (21:19 +0100)]
bdr: Conflict handler enhancements.
* When user defined conflict handler returns tuple, log it as part of
conflict logging instead of the original remote tuple.
* Allow user defined conflict handler to return tuple for UPDATE/DELETE
conflict (and INSERT the new user provided tuple).
* Call user defined conflict handler for DELETE/DELETE conflict (this
one is not allowed to return tuple).
* Clean-up conflict handling debugging code.
Craig Ringer [Fri, 19 Dec 2014 08:47:13 +0000 (16:47 +0800)]
bdr: Use bdr.do_not_replicate to suppress replication of pg_restore
Changes from pg_restore would have previously been replicated through
the slot from the new node back to the root node during init, because
we didn't apply them with any replicaiton origin ID.
Use the bdr.do_not_replicate GUC to set DoNotReplicateRepNodeID as the
origin, so these changes get suppressed from replication.
Craig Ringer [Thu, 18 Dec 2014 11:56:40 +0000 (19:56 +0800)]
bdr: Add bdr.do_not_replicate GUC
Suppresses replication of changes from a session by setting the
origin replication identifier to DoNotReplicateRepNodeId.
Craig Ringer [Thu, 18 Dec 2014 10:20:22 +0000 (18:20 +0800)]
bdr: Make waitforstart reliably notice when BDR has come up
pg_stat_activity caches within the transaction and must be reset to see new
results. This was filtering out rows from pg_stat_get_wal_senders.
See comments inline for details.
Craig Ringer [Mon, 15 Dec 2014 10:42:39 +0000 (18:42 +0800)]
bdr: Prevent slot creation on output plugin if bdr ext missing
We shouldn't allow slot creation if the BDR extension is not installed
in a database.
Craig Ringer [Wed, 17 Dec 2014 06:27:05 +0000 (14:27 +0800)]
bdr: Document contribs required for test runs
Craig Ringer [Tue, 16 Dec 2014 17:47:16 +0000 (01:47 +0800)]
bdr: EXEC_BACKEND support for background worker launches
We were using direct function pointers in bdr for launching bgworkers.
Instead use library name and function name so it works with
EXEC_BACKEND.
Craig Ringer [Thu, 20 Nov 2014 06:21:28 +0000 (14:21 +0800)]
bdr: Introduce bdr_get_local_nodeid()
Craig Ringer [Tue, 16 Dec 2014 17:03:26 +0000 (01:03 +0800)]
bdr: When init_replica fails, close the replication connection
Craig Ringer [Sat, 13 Dec 2014 16:25:53 +0000 (00:25 +0800)]
bdr: Leave environment intact when launching pg_dump/pg_restore for init_replica
Launch pg_dump and pg_restore by full path found using find_other_exec and
passed to bdr_init_replica, instead of messing with the environment.
Craig Ringer [Tue, 16 Dec 2014 15:29:49 +0000 (23:29 +0800)]
bdr: update .gitignore to skip generated .sql files
Craig Ringer [Tue, 16 Dec 2014 15:26:47 +0000 (23:26 +0800)]
bdr: move perdb_worker_main to new bdr_perdb.c
Craig Ringer [Tue, 16 Dec 2014 10:42:57 +0000 (18:42 +0800)]
bdr: Move bdr_apply_main into bdr_apply.c
Craig Ringer [Mon, 15 Dec 2014 16:55:53 +0000 (00:55 +0800)]
bdr: Don't check for DDL locking in DML when DDL locking disabled
Petr Jelinek [Mon, 15 Dec 2014 08:44:09 +0000 (09:44 +0100)]
bdr: bdr_init_copy now uses replica_local_dsn for local connection.
Andres Freund [Tue, 9 Dec 2014 17:12:36 +0000 (18:12 +0100)]
bdr: Fix bdr.table_set_replication_sets() for relations outside the search path.
Using format()'s %I for regclass parameters is wrong as they already
contain the required escaping. Doing otherwise ends up doing too much
escaping.
Fixes #38171.
Petr Jelinek [Thu, 4 Dec 2014 15:35:14 +0000 (16:35 +0100)]
bdr: Use correct connection for extension creation in bdr_init_copy.
Petr Jelinek [Thu, 4 Dec 2014 10:58:58 +0000 (11:58 +0100)]
bdr: No need for submake-libpq
Andres Freund [Tue, 2 Dec 2014 10:28:00 +0000 (11:28 +0100)]
bdr: Minor sequence voting performance improvements.
Andres Freund [Tue, 2 Dec 2014 09:53:59 +0000 (10:53 +0100)]
bdr: Improve logic and output of when to do sequence voting steps.
Andres Freund [Sat, 29 Nov 2014 03:22:55 +0000 (04:22 +0100)]
bdr: Dramatically increase chance of successful sequence votes.
Up to now any conflict between nodes over who gets to allocate a
specific value chunk was resolved by neither getting the chunk. That
could lead to significant gaps in distributed values and prolonged
voting periods.
The reason for the current logic is/was that it wasn't easy to do
better using one SQL query. Thus transfer the logic to a plpgsql
function where it's possible to handle things procedually. The
fundamental change is that now when two nodes conflict because both
want a specific chunk we don't fail both anymore, but allow the node
with the smaller (sysid, tlid, dboid, name) win. That favors some
nodes, but still leads to a much faster overall convergence.
Andres Freund [Fri, 28 Nov 2014 17:43:57 +0000 (18:43 +0100)]
bdr: Prepare SQL statements used by the sequencer.
Turns out that that, especially for get_chunk_sql, leads to a
significant performance improvement.
Andres Freund [Fri, 28 Nov 2014 17:29:35 +0000 (18:29 +0100)]
bdr: Only wait on the latch in the sequencer after a round of voting.
This way we restart voting quicker after a restart/crash. It also gets
rid of a potential usage of a uninitialized variable.
Andres Freund [Tue, 2 Dec 2014 11:00:29 +0000 (12:00 +0100)]
bdr: Use "C" collation for the text columns used in sequence voting.
As it turns out using a plain collation can reduce sequence voting
cost considerably - I could observe about 50% reduction in time. As
the column's contents are originally of type 'name' (only that that's
not supported by btree_gist) or sysids, we can be perfectly content
with sorting "C" gives us.
Petr Jelinek [Tue, 2 Dec 2014 09:08:59 +0000 (10:08 +0100)]
bdr: Build bdr--0.8.0.1.sql too
Craig Ringer [Mon, 1 Dec 2014 05:06:59 +0000 (13:06 +0800)]
bdr: Update ber_version.h.in to 0.8.0 to reflect bdr.control version
Petr Jelinek [Fri, 28 Nov 2014 16:07:26 +0000 (17:07 +0100)]
bdr: proper upgrade script for the UDR merge changes
Petr Jelinek [Fri, 28 Nov 2014 12:55:17 +0000 (13:55 +0100)]
bdr: Enable set_sysid in UDR's bdr_init_copy.
Petr Jelinek [Fri, 28 Nov 2014 09:31:18 +0000 (10:31 +0100)]
bdr: Make bdr_init_copy work for online upgrade correctly.
Petr Jelinek [Fri, 28 Nov 2014 09:27:42 +0000 (10:27 +0100)]
bdr: Move some replication identifier interfaces to C.
Craig Ringer [Fri, 28 Nov 2014 09:20:01 +0000 (17:20 +0800)]
bdr: Allow builds to explicitly specify that they expect BDR or UDR
Previously it was always autodetected, but for packaging we really
want to be able to specifically specify this.
Andres Freund [Wed, 26 Nov 2014 18:41:33 +0000 (19:41 +0100)]
bdr: Also don't acquire the ddl lock for DROP REL pg_temp.*.
It'd be much nicer if we could do that safely for all temporary
objects, not just ones referred to with pg_temp.*. But that'd
currently be racy as hell...
Andres Freund [Wed, 26 Nov 2014 17:18:19 +0000 (18:18 +0100)]
bdr: Don't acquire the DDL lock for CREATE TEMPORARY TABLE [AS].
This logic should be extended to other cases, but this is already
quite helpful.
Andres Freund [Wed, 26 Nov 2014 16:39:16 +0000 (17:39 +0100)]
bdr: Make sure tables can't be created WITH OIDs
Andres Freund [Wed, 26 Nov 2014 01:49:17 +0000 (02:49 +0100)]
bdr: Add tests for ALTER TABLE ... ALTER COLUMN ... SET STATISTICS.
Andres Freund [Wed, 26 Nov 2014 01:48:36 +0000 (02:48 +0100)]
bdr: Add 'bdr.skip_ddl_locking' - useful to speedup initial loading.
Petr Jelinek [Tue, 25 Nov 2014 14:45:41 +0000 (15:45 +0100)]
bdr: ALTER TABLE ONLY tests
Andres Freund [Tue, 25 Nov 2014 13:09:43 +0000 (14:09 +0100)]
bdr: Allow ALTER TABLE ... ALTER COLUMN ... SET STATISTICS
Andres Freund [Tue, 25 Nov 2014 12:59:37 +0000 (13:59 +0100)]
bdr: Fix URLs in INSTALL.src to work without a git.pg.o account.
Petr Jelinek [Mon, 24 Nov 2014 17:18:59 +0000 (18:18 +0100)]
bdr: Support CREATE/DROP AGGREGATE/OPERATOR
Andres Freund [Sun, 23 Nov 2014 14:28:48 +0000 (15:28 +0100)]
bdr: Fix regression database setup to work with VPATH builds.
This also has the slight advantage that fewer output files have to be
changed should we need to add additional variables.
Andres Freund [Sun, 23 Nov 2014 08:47:26 +0000 (09:47 +0100)]
bdr: Don't use free'd memory in bdr_queue_dropped_objects().
Petr Jelinek [Sat, 22 Nov 2014 15:05:13 +0000 (16:05 +0100)]
bdr: regenerate configure script
Petr Jelinek [Fri, 21 Nov 2014 19:11:20 +0000 (20:11 +0100)]
bdr: Add 'interactive' option to output plugin.
This makes it easier to examine the replication queue manually from SQL
as bdr will use local node defaults for the replication protocol options
when the interactive option is used.
Petr Jelinek [Fri, 21 Nov 2014 19:08:29 +0000 (20:08 +0100)]
bdr: Fix transaction handling in output plugin.
Previously it was impossible to use the output plugin from within SQL
(for example using pg_logical_slot_peek_binary_changes) as it crashed
because it tryed to start transaction even if one was already started.
Petr Jelinek [Sat, 18 Oct 2014 22:15:47 +0000 (00:15 +0200)]
bdr: Add some explanatory comments.
Petr Jelinek [Wed, 29 Oct 2014 10:50:35 +0000 (11:50 +0100)]
bdr: Rewrite the dml tests so they work with both BDR and UDR.
Also make isolation tests run again.
Petr Jelinek [Fri, 17 Oct 2014 08:50:31 +0000 (10:50 +0200)]
bdr: Overhauld of bdr_replicate_ddl_command
* execute the ddl on local node
* force the input query to be fully qualified
* use command filter to disallow dangerous DDL commands even when using
bdr_replicate_ddl_command unless overriden by the GUC
* make it work in BDR and make sure it does not do double replication of
the DDL
* rewrite of queue_dropped_objects into C
* rename the drop trigger so that the order of execution is correct
* recognize bdr node by replication slot with bdr output plugin
Petr Jelinek [Fri, 17 Oct 2014 08:49:33 +0000 (10:49 +0200)]
bdr: Update of replication identifier emulation code
* new GetReplicationInfoByIdentifier compatible with upstream changes
* split replication_identifier emulation table into two to save on WAL
* add short explanation of replication identifier emulation
* don't replicate replication_identifier emulation table changes
Petr Jelinek [Sun, 26 Oct 2014 08:52:27 +0000 (09:52 +0100)]
bdr: Logical initialization works for UDR now.
Petr Jelinek [Thu, 23 Oct 2014 07:04:13 +0000 (09:04 +0200)]
bdr: Don't try to handle UPDATE/UPDATE conflicts in UDR.
Petr Jelinek [Mon, 13 Oct 2014 20:27:35 +0000 (22:27 +0200)]
bdr: make UDR work with new buildsystem
Use new bdr_variant() interface instead of bdr_version() for
determining if this is bdr of udr build.
Petr Jelinek [Mon, 13 Oct 2014 12:07:08 +0000 (14:07 +0200)]
bdr: Make bdr_init_copy work for UDR
Petr Jelinek [Sat, 20 Sep 2014 00:08:26 +0000 (02:08 +0200)]
bdr: prototype of DDL replication in UDR
The actual user facing function is quite ugly currently so the commit is
mainly about refactoring to make this possible.
Petr Jelinek [Mon, 15 Sep 2014 20:32:21 +0000 (22:32 +0200)]
bdr: compiles and works with vanilla 9.4
This is UDR v0. Basic master->slave replication works.
Currently the build has to be done using `make UDR=1` as there is no
detection if the plugin is being built with 9.4 or the 9.4bdr.
There are still warnings (about unused variables because of #ifdefs),
bdr_init_replica and bdr_init_copy don't work yet.
Craig Ringer [Wed, 19 Nov 2014 05:58:15 +0000 (13:58 +0800)]
bdr: Don't read past the end of shmem in bdr_sequencer_wakeup
bdr_sequencer_wakeup() was iterating over BdrSequencerCtl->slots
using bdr_seq_nnodes instead of bdr_seq_nsequencers, which would
cause it to attempt access past the end of the shared memory segment
allocated for BdrSequencerCtl.
Petr Jelinek [Thu, 13 Nov 2014 23:18:04 +0000 (00:18 +0100)]
bdr: conflict handling refactor phase 2
New logging API has one unified function that creates Conflict object
which then can be used to log both into server log and to table.
Logging of all conflict types was unified under this new API.
Added two new conflict resolution types 'apply_change' and 'skip_change'
which are used in places where it's impossible to use conflict handlers
(like delete_delete conflict) and also in UDR instead of last update
wins.
In passing fix the timeframe handling of user defined conflict handlers.
Petr Jelinek [Thu, 6 Nov 2014 13:30:09 +0000 (14:30 +0100)]
bdr: Add regression test for ALTER TABLE ... RENAME COLUMN TO.
Petr Jelinek [Wed, 5 Nov 2014 11:01:56 +0000 (12:01 +0100)]
bdr: Out of tree builds work again.
Petr Jelinek [Wed, 5 Nov 2014 10:30:50 +0000 (11:30 +0100)]
bdr: configure update
Petr Jelinek [Tue, 4 Nov 2014 15:10:10 +0000 (16:10 +0100)]
bdr: add missing Makefile for bdr_dump.
Petr Jelinek [Tue, 4 Nov 2014 14:34:21 +0000 (15:34 +0100)]
bdr: Use bdr_resetxlog and bdr_dump instead of Postgres version of those.
Petr Jelinek [Tue, 4 Nov 2014 14:33:35 +0000 (15:33 +0100)]
bdr: pg_dump: Apply BDR patchset and build as bdr_dump.
Petr Jelinek [Tue, 4 Nov 2014 14:21:20 +0000 (15:21 +0100)]
bdr: Embed pg_dump from 9.4
Petr Jelinek [Tue, 4 Nov 2014 14:20:41 +0000 (15:20 +0100)]
bdr: pg_resetxlog: Add -s and -c options and build it as bdr_resetxlog.
Petr Jelinek [Tue, 4 Nov 2014 14:18:18 +0000 (15:18 +0100)]
bdr: Embed pg_resetxlog from 9.4
Andres Freund [Tue, 4 Nov 2014 00:06:34 +0000 (01:06 +0100)]
bdr: Add test for extension upgrades.
Andres Freund [Tue, 4 Nov 2014 00:03:52 +0000 (01:03 +0100)]
bdr: Allow to replicate insert/update/delete selectively on a per set basis.
Currently the user interface for this is the
bdr.bdr_replication_set_config table. We'll need a layer ontop of
that.
This commit also introduces some other novelty because it starts to
create the initial version specific extension scripts out of
components.
Petr Jelinek [Wed, 29 Oct 2014 10:56:01 +0000 (11:56 +0100)]
bdr: Output plugin installs bdr extension if missing now.
This is needed for UDR case (there is no perdbworker on master node at the moment).