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.
Christoph Moench-Tegeder [Tue, 26 Aug 2014 15:24:41 +0000 (17:24 +0200)]
bdr: be more specific in ALTER TABLE rejections
try to reject unsupported/unsafe ALTER TABLE statements with
some info about what exactly is unsupported/unsafe.
RT-#37879
Petr Jelinek [Tue, 26 Aug 2014 13:14:07 +0000 (15:14 +0200)]
bdr: drop replication identifier correctly on logical replica init failure
Andres Freund [Mon, 25 Aug 2014 15:27:09 +0000 (17:27 +0200)]
bdr: Fiddle with logical replica init message log levels.
Andres Freund [Mon, 25 Aug 2014 15:25:48 +0000 (17:25 +0200)]
bdr: Use find_other_exec() API correctly when searching for bdr_init_replica.
The previous code only somewhat worked because the calling code
incorrectly checked for success.
Andres Freund [Mon, 25 Aug 2014 15:23:10 +0000 (17:23 +0200)]
bdr: Properly accept -V in bdr_initial_load invocations.
Otherwise find_other_exec() can't work correctly.
This requires the file to be generated automatically - lest we
manually change it after every version number increment. Use sed for
that for now, windows already isn't supported by it.
Andres Freund [Mon, 25 Aug 2014 15:17:12 +0000 (17:17 +0200)]
bdr: Echo error messages to stderr in bdr_initial_load.
Andres Freund [Mon, 25 Aug 2014 13:49:52 +0000 (15:49 +0200)]
bdr: Concentrate global guc creation to bdr.c:_PG_init().
Easier to get an overview this way.
Andres Freund [Mon, 25 Aug 2014 13:36:30 +0000 (15:36 +0200)]
bdr: Minor cleanups in bdr_maintain_schema().
Andres Freund [Mon, 25 Aug 2014 13:28:02 +0000 (15:28 +0200)]
bdr: Make bdr_init_copy output the newly created system identifier.
Andres Freund [Mon, 25 Aug 2014 13:27:24 +0000 (15:27 +0200)]
bdr: Add -o option to bdr_init_copy which is passed through to pg_ctl's -o.
Andres Freund [Mon, 25 Aug 2014 12:15:54 +0000 (14:15 +0200)]
bdr: Add trailing \n to all die() invocations in bdr_init_copy.
Petr Jelinek [Mon, 25 Aug 2014 10:50:34 +0000 (12:50 +0200)]
bdr: don't replicate DDL executed during internal schema maitenance
Andres Freund [Mon, 25 Aug 2014 10:00:08 +0000 (12:00 +0200)]
bdr: Reload configuration files after SIGHUP
Petr Jelinek [Fri, 22 Aug 2014 07:47:07 +0000 (09:47 +0200)]
bdr: bump version to 0.7.1
Main point of this release is to add pg_replication_identifier_drop() when missing.
Andres Freund [Thu, 21 Aug 2014 21:42:30 +0000 (23:42 +0200)]
bdr: Fix typo in printing of LSNs
Petr Jelinek [Thu, 21 Aug 2014 17:53:03 +0000 (19:53 +0200)]
bdr: bdr_init_copy use pg_replication_identifier_drop to drop unwanted identifiers
Petr Jelinek [Wed, 20 Aug 2014 16:35:49 +0000 (18:35 +0200)]
bdr: allow ALTER TABLE ... DISABLE/ENABLE TRIGGER commands
Petr Jelinek [Wed, 20 Aug 2014 16:17:07 +0000 (18:17 +0200)]
bdr: make ddl/view tests more stable
Andres Freund [Wed, 20 Aug 2014 15:17:29 +0000 (17:17 +0200)]
bdr: Properly free tuple table slots in conflict logging code.
This lead to "TupleDesc reference leak: TupleDesc %p (%u,%d) still
referenced" warnings when bdr.log_conflicts_to_table was enabled.
Petr Jelinek [Wed, 20 Aug 2014 13:23:17 +0000 (15:23 +0200)]
bdr: tests for functions containing windows newline
This is test for RT-#37936.
Andres Freund [Mon, 8 Sep 2014 15:10:45 +0000 (17:10 +0200)]
bdr: Fixup tests for amdata removal from psql
Andres Freund [Wed, 20 Aug 2014 06:21:18 +0000 (08:21 +0200)]
bdr: Disable function body checks during apply
That's necessary because
a) the creator of the function might have had it disabled
b) the function might be search_path dependant and we don't fix the
contents of functions.
Andres Freund [Mon, 18 Aug 2014 15:20:00 +0000 (17:20 +0200)]
bdr: Add error context callbacks for ddl replay.
This is useful to be able to much easier diagnose ddl replication
problems/bugs.
The implementation for ddl drops is rather ugly, but better than
nothing.
Andres Freund [Mon, 18 Aug 2014 15:11:32 +0000 (17:11 +0200)]
bdr: Run both isolation and plain regression tests during 'make check'
Andres Freund [Mon, 18 Aug 2014 15:02:31 +0000 (17:02 +0200)]
bdr: Respect bdr.skip_ddl_replication for queued drops.
Previously only CREATE/ALTER respected it.
Andres Freund [Mon, 18 Aug 2014 13:44:08 +0000 (15:44 +0200)]
bdr: Demote some sequence log messages to DEBUG2
Andres Freund [Mon, 18 Aug 2014 13:41:05 +0000 (15:41 +0200)]
bdr: Consider a sequence vote successfull in more scenarios.
If either there's no nays or the number of yays is bigger than the
concensus the vote can be considered successful. We don't want to
always wait for a majority of yays, because that'd possibly delay
voting for a long time, even if enough nodes for a consensus on
another chunk are online.
Andres Freund [Mon, 18 Aug 2014 13:16:43 +0000 (15:16 +0200)]
bdr: Limit the amount of time spent in voting.
Don't endlessly vote if there's votes to be done. As voting happens
inside a single xact that'll just lead to large transactions that the
other nodes can't see yet.
Andres Freund [Mon, 18 Aug 2014 11:09:11 +0000 (13:09 +0200)]
bdr: Vote on several sequences at once to speed up the voting process.
We can only vote on elections started by a single node at a time
without further complications. The problem is that otherwise two votes
could conflict which isn't trivial to detect in a query. Select one
node with open elections and vote on up to 1000 elections started by
that node.
Andres Freund [Mon, 18 Aug 2014 11:07:19 +0000 (13:07 +0200)]
bdr: Add indexes to make sequence voting faster.
Andres Freund [Mon, 18 Aug 2014 11:06:37 +0000 (13:06 +0200)]
bdr: Fix type of bdr_votes.dboid column to oid from bigint
This prevented index usage in at least one query.
Petr Jelinek [Sun, 17 Aug 2014 14:36:22 +0000 (16:36 +0200)]
bdr: add conflict logging tests
New isolation tests for simple insert_insert, update_update,
update_delete and delete_delete resolving/logging tests.
In passing make the isolation test initialization more sane.
Petr Jelinek [Sun, 17 Aug 2014 14:28:57 +0000 (16:28 +0200)]
bdr: make conflict logging behave consistently
Conflict logging was mess, some of the conflicts were logged to table,
some to server log, some as DEBUG, some as LOG, the log messages looked
completely differently for each conflict, etc.
This patch introduces single interface for logging into server log which
is always called and has common log line template and handles all
current case.
Other change is that all conflicts can now be logged to the log table
(previously only insert_insert conflicts could be logged there).
This is step1, not the final code, but it brings enough improvement that
it's worth committing as is.
Petr Jelinek [Sun, 17 Aug 2014 14:27:29 +0000 (16:27 +0200)]
bdr: add delete_delete conflict type to bdr_conflict_type.
Bump BDR extension version accordingly and when at it bump the BDR version too.
Petr Jelinek [Sun, 17 Aug 2014 11:59:41 +0000 (13:59 +0200)]
bdr: add minimum bdr version to the output plugin options
This enables BDR upgrades without dump/reload in the future.
Note that this change breaks compatibility with any previous version.
Petr Jelinek [Fri, 15 Aug 2014 14:46:37 +0000 (16:46 +0200)]
bdr: tests for ddl lock conflict
Andres Freund [Fri, 15 Aug 2014 14:33:56 +0000 (16:33 +0200)]
bdr: Improve concurrency and error recovery of ddl locking.
Previously there were three major issues:
* If we failed acquiring the lock on some, but not all nodes we didn't
always send out a message forcing the lock to be released again on
the succeeding node.
* There were some scenarios in which a lock was held only
intermittenly in a way that allowed the lock's state to change in
unhandled ways.
* Two backends within a single node didn't really protect against each
other requiring the ddl lock. That's not really problematic in itself
because locally there's plain relation locking to take care of things,
but two concurrent lock acquisitions could cause problems.
Now we'll always send lock release messages if we fail during the
acquisition of a lock. That means that nodes need to be prepared to
deal with the fact that a lock is released that's not held.
RT-#37905
Andres Freund [Fri, 15 Aug 2014 14:26:11 +0000 (16:26 +0200)]
bdr: Improve log messages about ddl locking.
A previous commit changed the capitalization wrongly. Also add a bit
more detail about which nodes are holding the lock to some error
messages.
More work is needed, but it's a clear improvement already.
Petr Jelinek [Fri, 15 Aug 2014 09:16:12 +0000 (11:16 +0200)]
bdr: add GRANT/REVOKE tests
Craig Ringer [Fri, 15 Aug 2014 03:16:46 +0000 (11:16 +0800)]
bdr: Emit informative error messages for global sequence failures
Related to bug #37914
Craig Ringer [Fri, 15 Aug 2014 03:02:14 +0000 (11:02 +0800)]
bdr: Minimalist error message notes and link to style guide
Craig Ringer [Fri, 15 Aug 2014 02:23:18 +0000 (10:23 +0800)]
bdr: Avoid date --iso-8601 , OS X doesn't like it
Report per Ian Barwick
Petr Jelinek [Tue, 12 Aug 2014 21:31:21 +0000 (23:31 +0200)]
bdr: make ddl/function tests more stable across environments
Andres Freund [Mon, 8 Sep 2014 15:41:55 +0000 (17:41 +0200)]
bdr: Test ALTER SEQUENCE USING support
Craig Ringer [Tue, 12 Aug 2014 05:45:21 +0000 (13:45 +0800)]
bdr: Make ddl/function test independent of login username
Create two new users, 'super' and 'nonsuper', during init. These
may be used for any test.
Run ddl/function tests as the 'super' user instead of the user
with the same name as the current unix user that pg_regress
will otherwise pick, so output is stable.
Craig Ringer [Tue, 12 Aug 2014 05:09:27 +0000 (13:09 +0800)]
bdr: Don't attempt to use get_database_name unsafely
The prior commit "bdr: Show database name when a DDL lock error is encountered"
added use of get_database_name(..) to clarify an error message. However, it's not
always safe to access the catalogs from this call site.
Remove the unsafe call and document the issue in the code so it won't be added
back later.
Craig Ringer [Tue, 12 Aug 2014 05:04:24 +0000 (13:04 +0800)]
bdr: Remove bdr: prefixes from messages
Petr Jelinek [Mon, 11 Aug 2014 22:42:07 +0000 (00:42 +0200)]
bdr: fix typo in variable name
Petr Jelinek [Mon, 11 Aug 2014 22:39:59 +0000 (00:39 +0200)]
bdr: disallow UPDATEs and DELETEs on tables without PK
Petr Jelinek [Mon, 11 Aug 2014 16:51:27 +0000 (18:51 +0200)]
bdr: refactor apply main loop into separate function
The main loop is now in bdr_apply_work, and was moved from bdr.c to
bdr_apply.c where it belongs more naturally.
In passing start updating rollback stats counter properly.
Petr Jelinek [Mon, 11 Aug 2014 15:47:30 +0000 (17:47 +0200)]
bdr: make bdr stats work for inserts and make updates stats behave consistently
* insert count is increased every time row was added/updated
* insert conflict count is increased for every logged conflict
* update count is increased ever time row was updated
* update conflict count is increased for every logged conflict
* delete count is increased for every existing row
* delete conflict count is increased for every missing row
Petr Jelinek [Mon, 11 Aug 2014 14:24:30 +0000 (16:24 +0200)]
bdr: change loglevel for DELETE conflicts to LOG for consistency