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).
Andres Freund [Mon, 3 Nov 2014 13:14:15 +0000 (14:14 +0100)]
bdr: Cache information about a relation being replicated in an output plugin.
That's primarily useful because it will make it easier to maintain the
state necessary for replication set wide settings. But the new
infrastructure is also generally more efficient.
The information is added to the bdr relation descriptor - as logical
decoding maintains that cache coherently that's quite convenient.
Andres Freund [Mon, 3 Nov 2014 11:58:31 +0000 (12:58 +0100)]
bdr: Try to make bdr_relcache.c's logic works correctly for recursive flushes.
Andres Freund [Sun, 2 Nov 2014 15:10:42 +0000 (16:10 +0100)]
bdr: Add tests for the effects of replication sets to replicated data.
Andres Freund [Sun, 2 Nov 2014 14:55:03 +0000 (15:55 +0100)]
bdr: Add basic test for replication set manipulation.
The test needs to be expanded with actually testing whether sets
properly control replication.
Andres Freund [Sun, 2 Nov 2014 14:53:49 +0000 (15:53 +0100)]
bdr: Actually andle the implicit 'all' and 'default' replication sets.
Andres Freund [Sun, 2 Nov 2014 14:38:44 +0000 (15:38 +0100)]
bdr: Increase validation around replication sets.
Andres Freund [Sun, 2 Nov 2014 12:57:17 +0000 (13:57 +0100)]
bdr: Automatically remake makefile when Makefile.in changes
Andres Freund [Mon, 20 Oct 2014 07:19:12 +0000 (09:19 +0200)]
bdr: Initial implementation of replication sets.
Tables can be added to replication sets using
SELECT bdr.table_set_replication_sets('do_replicate_tbl', '{do_replicate}');
and viewed
SELECT bdr.table_get_replication_sets('do_replicate_tbl');
Nodes by default replicate all replication sets, but can be configured
to only consume specific ones using the bdr.%s_replication_sets GUC.
Tests are sorely needed.
Andres Freund [Mon, 20 Oct 2014 07:19:12 +0000 (09:19 +0200)]
bdr: Include Makefile.custom if it exists.
That allows to add local, additional, rules. Useful e.g. to add
flymake support.
Petr Jelinek [Fri, 17 Oct 2014 07:58:21 +0000 (09:58 +0200)]
bdr: Make use of the updated GetReplicationInfoByIdentifier interface.
Andres Freund [Thu, 16 Oct 2014 15:09:58 +0000 (17:09 +0200)]
bdr: Try to make configure (i.e. sed) work on OSX.
Also fix future issue that bdr wouldn't detect 9.4.0+ properly.
Andres Freund [Thu, 16 Oct 2014 14:32:51 +0000 (16:32 +0200)]
bdr: Add autoconf output to make compiling on odd platforms easier.
Petr Jelinek [Thu, 16 Oct 2014 13:18:57 +0000 (15:18 +0200)]
bdr: Update the installation instructions.
Andres Freund [Thu, 16 Oct 2014 12:43:44 +0000 (14:43 +0200)]
bdr: Fix path to pg_regress in run_tests to work in more environments
Andres Freund [Thu, 16 Oct 2014 12:34:30 +0000 (14:34 +0200)]
bdr: Add minimal installation instructions for bdr plugin.
Andres Freund [Wed, 8 Oct 2014 15:15:33 +0000 (17:15 +0200)]
bdr: Move flush/feedback association logic entirely to bdr_apply.c
Andres Freund [Wed, 8 Oct 2014 15:05:00 +0000 (17:05 +0200)]
bdr: Schedule sequencer wakeup in a couple more situations.
That allows a bit higher sequence throughput.
Andres Freund [Sun, 12 Oct 2014 13:41:52 +0000 (15:41 +0200)]
bdr: bdr_init_replica fixes (correct version check + correct build)
Andres Freund [Tue, 7 Oct 2014 11:43:02 +0000 (13:43 +0200)]
bdr: Extend maintainer-clean target for autoconf/configure output.
Andres Freund [Tue, 7 Oct 2014 11:23:29 +0000 (13:23 +0200)]
Add a autoconf generated configure build infrastructure.
This allows us to check that we're compiling against a sane version of
postgres. And later to switch between building udr/bdr.
Andres Freund [Fri, 26 Sep 2014 22:08:41 +0000 (00:08 +0200)]
bdr: Add omitted break in commandfilter.
Luckily the omission turned out to be harmless.
Andres Freund [Fri, 26 Sep 2014 22:07:43 +0000 (00:07 +0200)]
bdr: Allow CREATE TABLE AS/SELECT INTO when targeting temp tables.
Andres Freund [Fri, 26 Sep 2014 11:32:42 +0000 (13:32 +0200)]
bdr: Adapt gitignore to the new out-of-tree situation
Andres Freund [Fri, 26 Sep 2014 11:31:16 +0000 (13:31 +0200)]
bdr: Rework build/test infrastructure to better work as a out of tree module
We now implicitly build using pgxs and have our own wrapper around
pg_*regress to run make check without a sourcetree around. Also tests
are based on a commonly included config file instead of duplicating
things over and over.
Craig Ringer [Fri, 26 Sep 2014 09:09:56 +0000 (17:09 +0800)]
bdr: add a git-dist target to the Makefile
You can now prepare dist tarballs of the BDR extension. They'll contain the BDR
version in the filename and will have the git revision in a .distgitrev file in
the tarball. There's also a .distgittag file that contains the tag if there's
one, or 'undefined' if there isn't.
Document making dist tarballs in the README.developers too.
Petr Jelinek [Mon, 15 Sep 2014 15:56:14 +0000 (17:56 +0200)]
bdr: WAL log bdr sequences correcly
Christoph Moench-Tegeder [Mon, 8 Sep 2014 15:50:42 +0000 (17:50 +0200)]
bdr: fix isolation tests after move
Christoph Moench-Tegeder [Mon, 8 Sep 2014 15:37:02 +0000 (17:37 +0200)]
bdr: copy bdr isolation tests from base tree
in preparation for their removal there
Andres Freund [Mon, 8 Sep 2014 16:05:28 +0000 (18:05 +0200)]
bdr: Don't try to forbid T_AlterTableSpaceMoveStmt - doesn't exist anymore
It's replaced by a ALTER TABLE veriant that should be fine.
Craig Ringer [Tue, 2 Sep 2014 07:48:21 +0000 (15:48 +0800)]
bdr: Remove version suffix from quickstart script
The --with-extra-version suffix was breaking some tools, so
remove it. We can now check the version using bdr.bdr_version()
anyway.
Andres Freund [Fri, 29 Aug 2014 15:16:42 +0000 (17:16 +0200)]
bdr: Disallow calling setval() on distributed sequences.
We actually allow setval() to be called, as long as it's not changing
values. That's required because the relevant code is called from other
contexts as well.
Petr Jelinek [Fri, 29 Aug 2014 14:58:22 +0000 (16:58 +0200)]
bdr: fix the possibly broken^Conflict history sequence in upgrade script
See
766e3bcb3c3c37981b12f93d0e4210213fa281c2 for more info.
Petr Jelinek [Thu, 28 Aug 2014 14:28:21 +0000 (16:28 +0200)]
bdr: decouple conflict logging and remote apply
Previously we always logged even applyed rows (which are not technically
conflicting) with optional check for apply_update. Now we log based on
what is actually happening and if the row was conflicting or not.
This also removes the bdr.log_applyed_conflicts config option as it's
not needed anymore.
Andres Freund [Thu, 28 Aug 2014 14:11:32 +0000 (16:11 +0200)]
bdr: Replay all insert/update/delete messages while in MessageContext
That allows us to decode large transactions more
efficiently. Previously we leaked memory until a commit was being
replayed.
Petr Jelinek [Thu, 28 Aug 2014 11:07:04 +0000 (13:07 +0200)]
bdr: make sure the conflict history sequence is created as local one
This fixes #RT-37956 and possibly #RT-37944.
Per Andres.