Christian Kruse [Mon, 12 May 2014 09:46:10 +0000 (11:46 +0200)]
bdr: fix: include timeframe in conflict handlers view
Christian Kruse [Fri, 9 May 2014 12:15:54 +0000 (14:15 +0200)]
bdr: fix: partly reverting
ff6fc55 due to mussjudgements
Christian Kruse [Fri, 9 May 2014 11:48:25 +0000 (13:48 +0200)]
bdr: we now use ereport() and elog(DEBUG1) in various cases
Christian Kruse [Fri, 9 May 2014 11:10:41 +0000 (13:10 +0200)]
bdr: fix: get schema name from oid and don't use hard coded public
Christian Kruse [Fri, 9 May 2014 10:01:59 +0000 (12:01 +0200)]
bdr: fix: do not use vars named errmsg, generate proper log message
Christian Kruse [Fri, 9 May 2014 09:50:52 +0000 (11:50 +0200)]
bdr: fix: use correct datatypes in various loops
This avoids compiler warnings for signed vs unsigned comparison.
Christian Kruse [Thu, 8 May 2014 12:33:25 +0000 (14:33 +0200)]
bdr: command filter enhancements and fixes
Forbidding renaming of ALTER AGGREGATE β¦ RENAME TO β¦, ALTER COLLATION β¦
RENAME TO β¦, ALTER CONVERSION β¦ RENAME TO β¦, ALTER OPERATOR CLASS β¦
RENAME TO β¦, ALTER OPERATOR FAMILY β¦ RENAME TO β¦. Forbidding ALTER
TABLESPACE β¦ MOVE β¦, too.
Christian Kruse [Thu, 8 May 2014 10:17:58 +0000 (12:17 +0200)]
bdr: conflict handlers: refactored handler invocation
In the previous code we forgot in one case to call conflict
handlers. This lead to calling them in each if branch. Thus we decided
to refactor the code to call the handlers above the code.
Christian Kruse [Thu, 8 May 2014 10:00:34 +0000 (12:00 +0200)]
bdr: fix: use CreateCommandTag() for various commands
Due to inernals completionCommand is not always available. Use
CreateCommandTag() in this cases.
Christian Kruse [Thu, 8 May 2014 09:59:58 +0000 (11:59 +0200)]
bdr: fix: really disallow SECURITY LABEL for now
Craig Ringer [Thu, 8 May 2014 08:37:04 +0000 (16:37 +0800)]
bdr: Don't use hack to avoid copying whole tuples when putting them in slots.
The current hack isn't sufficient, instead more widespread changes to the slot
mechanism are required.
This caused errors like:
ERROR: could not access status of transaction
4294967295
DETAIL: Could not open file "pg_clog/0FFF": No such file or directory.
when getting a Datum for a tuple with ExecFetchSlotTupleDatum .
Author: Andres Freund
Craig Ringer [Thu, 8 May 2014 03:43:07 +0000 (11:43 +0800)]
bdr: Send remote transaction ID in begin messages
Adds 4 bytes to each BEGIN, but allows better debugging information
by logging the remote transaction ID when conflicts are detected
or apply errors occur.
Craig Ringer [Thu, 8 May 2014 03:36:52 +0000 (11:36 +0800)]
bdr: Remove unused field has_timetravel from ReorderBufferTXN
This field is never used and doesn't appear in the copy of ReorderBufferTXN in
master. It looks like a merge oversight.
Christian Kruse [Wed, 7 May 2014 14:49:01 +0000 (16:49 +0200)]
bdr: fix: use createCommandTag()
Use createCommandTag() for T_DefineStmt/T_CreateTableAsStmt class
queries because completionTag isn't available in this case (due to
internals).
Christian Kruse [Wed, 7 May 2014 13:44:34 +0000 (15:44 +0200)]
bdr: conflict handlers: always forbid conflict handlers on system tables
Christian Kruse [Wed, 7 May 2014 12:20:35 +0000 (14:20 +0200)]
bdr: isolationtester: some basic tests for generating conflicts
Christian Kruse [Wed, 7 May 2014 09:35:41 +0000 (11:35 +0200)]
bdr: allow VALIDATE CONSTRAINT
Christian Kruse [Tue, 6 May 2014 20:09:23 +0000 (22:09 +0200)]
bdr: fix: build bdr_relcache.c and bdr_conflict_handlers.c on Windows, too
Christian Kruse [Wed, 9 Apr 2014 09:31:09 +0000 (11:31 +0200)]
bdr: introducing conflict handlers
Conflict handlers are user definable functions which get called when a
conflict appears. Currently there is only UPDATE vs UPDATE implemented
Christian Kruse [Fri, 25 Apr 2014 14:31:16 +0000 (16:31 +0200)]
bdr: introducing a relcache
The relcache caches relation dependent data to avoid gathering them again
for every action
Christian Kruse [Tue, 6 May 2014 13:09:24 +0000 (15:09 +0200)]
bdr: fix: don't access relation after it's been closed
Christian Kruse [Mon, 5 May 2014 15:32:18 +0000 (17:32 +0200)]
bdr: fix command filter to check on the transformed ALTER TABLE statements
Abhijit Menon-Sen [Mon, 5 May 2014 11:07:09 +0000 (16:37 +0530)]
bdr: Fix a couple of minor typos
Andres Freund [Thu, 1 May 2014 17:01:14 +0000 (19:01 +0200)]
bdr: Significantly improve the commandfilter.
Several previously allowed command are now forbidden and vice versa.
Andres Freund [Thu, 1 May 2014 13:50:23 +0000 (15:50 +0200)]
bdr: Place assertion forbidding expression unique indexes more precisely.
Andres Freund [Thu, 1 May 2014 13:47:27 +0000 (15:47 +0200)]
bdr: Use a more narrow START/END critical section in sequences code.
Alvaro Herrera [Wed, 30 Apr 2014 22:39:20 +0000 (18:39 -0400)]
bdr: also replicate CREATE FUNCTION
Alvaro Herrera [Wed, 30 Apr 2014 22:38:50 +0000 (18:38 -0400)]
bdr: don't replicate objects in extensions
Alvaro Herrera [Wed, 30 Apr 2014 17:48:23 +0000 (13:48 -0400)]
bdr: also replicate ALTER SEQUENCE
Andres Freund [Wed, 30 Apr 2014 16:37:14 +0000 (18:37 +0200)]
bdr: Also accept ProcessedConstraints in the commandfilter.
That makes CREATE TABLE ..( ... REFERENCES ...) work.
Andres Freund [Wed, 30 Apr 2014 15:11:00 +0000 (17:11 +0200)]
bdr: WIP: add more info to ddl queues
Craig Ringer [Wed, 30 Apr 2014 12:21:37 +0000 (20:21 +0800)]
bdr: in get_worker_option removal, it helps to increment the counter
Failure to increment the loop counter led to >2 node configurations failing.
Andres Freund [Wed, 30 Apr 2014 12:05:39 +0000 (14:05 +0200)]
bdr: Supply a 'short_desc' for bdr.default_apply_delay.
Otherwise SHOW ALL crashes.
Andres Freund [Wed, 30 Apr 2014 11:14:53 +0000 (13:14 +0200)]
bdr: Fix typo in the get_worker_option() removal patch.
Craig Ringer [Wed, 30 Apr 2014 06:21:08 +0000 (14:21 +0800)]
bdr: Remove get_worker_option in favour of direct GUC access
Store GUCs for each bdr.[connname] as members of a postmaster palloc'd struct
accessed via a global array. Pass BDR workers indexes into this array in shmem
so they know how to access their GUC values.
Fixes Andres's concerns with get_worker_option. This also makes it easier to
support EXEC_BACKEND later.
Andres Freund [Tue, 29 Apr 2014 18:31:41 +0000 (20:31 +0200)]
bdr: Don't include frontend libpq in generic bdr header.
Otherwise we need to link to libpq on windows to get the right include
dir added.
Andres Freund [Tue, 29 Apr 2014 18:27:48 +0000 (20:27 +0200)]
bdr: Remove further pre C99 incompatibility.
Alvaro Herrera [Tue, 29 Apr 2014 18:07:04 +0000 (14:07 -0400)]
bdr/deparse: don't use TG_TAG
It's not useful in case of nested commands (maybe in other cases too);
rely on pg_event_trigger_get_creation_commands().command_tag instead.
Craig Ringer [Tue, 29 Apr 2014 13:42:19 +0000 (21:42 +0800)]
bdr: Don't use c99-only const array initializers
Craig Ringer [Tue, 29 Apr 2014 13:15:03 +0000 (21:15 +0800)]
bdr: Windows? Not yet. #ifdef out bdr_exec_init_replica
In future we should CreateProcessEx for Windows. This really wants a new
function for port/ that uses fork()/exec() on *nix, and CreateProcessEx on
Windows.
That's not within the scope of BDR as specified, and time's a-'ticking, so for
now let's just make this feature unsupported on Windows so the buildfarm stops
whining.
Andres Freund [Mon, 28 Apr 2014 23:00:12 +0000 (01:00 +0200)]
bdr: Allow ALTER TABLE DROP COLUMN/SET NULL/DROP NULL
Christian Kruse [Mon, 28 Apr 2014 17:48:16 +0000 (19:48 +0200)]
bdr: fix compiler warning about unused variable
Andres Freund [Mon, 28 Apr 2014 18:47:32 +0000 (20:47 +0200)]
bdr: Always use the correct relation name in truncation triggers.
Andres Freund [Mon, 28 Apr 2014 16:55:59 +0000 (18:55 +0200)]
bdr: Adapt to postgresql upstream changes
Alvaro Herrera [Tue, 25 Feb 2014 16:18:55 +0000 (13:18 -0300)]
bdr: deparse: Support USING in CREATE SEQUENCE
Christian Kruse [Mon, 28 Apr 2014 12:59:26 +0000 (14:59 +0200)]
bdr: fix: include header files instead of forward declare data structures
Andres Freund [Sun, 27 Apr 2014 13:49:23 +0000 (15:49 +0200)]
bdr: Include errno.h not sys/errno.h
Andres Freund [Sun, 27 Apr 2014 13:47:38 +0000 (15:47 +0200)]
bdr: some cleanups for the init replica functionality.
Craig Ringer [Sun, 27 Apr 2014 13:22:35 +0000 (21:22 +0800)]
bdr: Build bdr_init_replica.c on Windows too
Andres Freund [Sun, 27 Apr 2014 13:01:54 +0000 (15:01 +0200)]
bdr: clean up include file mess
Andres Freund [Sun, 27 Apr 2014 11:14:44 +0000 (13:14 +0200)]
bdr: document types of conflicts and their resolution (internals)
Craig Ringer [Sun, 27 Apr 2014 04:47:24 +0000 (12:47 +0800)]
bdr: Don't create TRUNCATE triggers for DDL replication during pg_restore
Craig Ringer [Mon, 21 Apr 2014 05:22:39 +0000 (13:22 +0800)]
bdr: Use logical dump/reload and catchup mode during DB startup
Install BDR extension in remote, track progress in bdr.bdr_nodes,
support pg_dump --snapshot and pg_restore for dump+reload apply,
use catchup mode.
Craig Ringer [Fri, 18 Apr 2014 04:29:01 +0000 (12:29 +0800)]
bdr: Support stopping replay at a specified LSN
Craig Ringer [Thu, 17 Apr 2014 03:26:18 +0000 (11:26 +0800)]
bdr: Expose origin id and lsn in decoded commit records
This is required for catchup mode.
Abhijit Menon-Sen [Fri, 25 Apr 2014 11:03:54 +0000 (16:33 +0530)]
bdr: Add bdr_apply_pause/_resume functions
These are analogous to pg_xlog_replay_pause()/_resume().
Andres Freund [Fri, 25 Apr 2014 12:06:27 +0000 (14:06 +0200)]
bdr: reorder functions in bdr_apply.c
Christian Kruse [Fri, 25 Apr 2014 11:11:33 +0000 (13:11 +0200)]
bdr: do no longer generate a warning when bdr.permit_unsafe_ddl_commands = yes
Craig Ringer [Fri, 25 Apr 2014 10:55:48 +0000 (18:55 +0800)]
bdr: Permit exclusion constraints in bdr extension creation
Abhijit Menon-Sen [Thu, 24 Apr 2014 21:15:47 +0000 (02:45 +0530)]
bdr: Remove defunct contrib/bdr tests
Christian Kruse [Thu, 24 Apr 2014 08:01:31 +0000 (10:01 +0200)]
bdr: forbid partial unique indexes on permanent relations
Christian Kruse [Thu, 24 Apr 2014 08:01:01 +0000 (10:01 +0200)]
bdr: forbid EXCLUDE constraints on permanent relations
Andres Freund [Wed, 23 Apr 2014 23:47:33 +0000 (01:47 +0200)]
bdr: Greatly improve conflict handling for insert
Needs some more refactoring and logging improvements.
Andres Freund [Wed, 23 Apr 2014 12:06:21 +0000 (14:06 +0200)]
bdr: Add bdr.default_apply_delay GUC
Alvaro Herrera [Tue, 22 Apr 2014 16:17:07 +0000 (13:17 -0300)]
bdr: create extensions IF NOT EXISTS
This avoids useless errors when the btree_gist extension is already
installed.
Christian Kruse [Tue, 22 Apr 2014 09:02:59 +0000 (11:02 +0200)]
bdr: fix: actually set sys id and timeline
Christian Kruse [Tue, 22 Apr 2014 08:55:55 +0000 (10:55 +0200)]
bdr: fix: use palloc0() instead of palloc()
When using palloc(), bdr_startup_context->workers is not NULL/NIL and
therefore the later lcons() call will lead to a segfault.
Christian Kruse [Tue, 22 Apr 2014 08:41:37 +0000 (10:41 +0200)]
bdr: added prototype for bdr_worker_shmem_release()
Currently the prototype has an unused attribute since function is not yet used
Christian Kruse [Wed, 16 Apr 2014 10:27:54 +0000 (12:27 +0200)]
bdr: fix: ensure to use the right format by using format constants now
Conflicts:
contrib/bdr/bdr.c
Craig Ringer [Mon, 21 Apr 2014 05:51:31 +0000 (13:51 +0800)]
bdr: If bdr.max_connections is zero, don't try to allocate -1 shmem
Craig Ringer [Fri, 18 Apr 2014 13:44:11 +0000 (21:44 +0800)]
bdr: auto-calculate bdr.max_workers from bdr.connections if unset
Allocate enough shared memory to create BdrWorker entries in BdrWorkerCtl for
one per-database worker and one apply worker for every configured connection,
i.e. assume each configured connection is for a different DB.
Andres Freund [Fri, 18 Apr 2014 12:20:35 +0000 (14:20 +0200)]
bdr: Don't print an informative message in a signal handler.
Andres Freund [Fri, 18 Apr 2014 12:16:00 +0000 (14:16 +0200)]
bdr: code style cleanups for the dynamic bgworker change
Including formatting and shmem vs shm consistency cleanups.
Andres Freund [Fri, 18 Apr 2014 12:00:34 +0000 (14:00 +0200)]
bdr: fix shmem size computation for the recent dynamic bgworker change
Craig Ringer [Thu, 17 Apr 2014 01:55:00 +0000 (09:55 +0800)]
bdr: prefix functions with bdr_
Craig Ringer [Wed, 16 Apr 2014 08:54:36 +0000 (16:54 +0800)]
bdr: Use dynamic background workers and shared memory
BDR previously used one static bgworker for each apply connection, passing the
configuration for each apply worker as a pointer into postmaster memory.
This relied on the ability to fork() without exec(), which won't work on
EXEC_BACKEND platforms (i.e. Windows). It also prevented any possibility
of adding new connections at runtime, made it harder to control when
apply workers started, and made it impossible to run a short lived apply
worker.
In order to properly support dump/apply for logical dump based node bring-up,
we need to be able to run short-lived bgworkers and pass parameters to them
that are only determined after postmaster start. This requires dynamic
bgworkers and the use of shared memory to communicate parameters to bgworkers.
Christian Kruse [Thu, 10 Apr 2014 07:27:57 +0000 (09:27 +0200)]
bdr: fix: corrected typo in PG_FUNCTION_INFO_V1() call
Christian Kruse [Thu, 10 Apr 2014 07:03:15 +0000 (09:03 +0200)]
bdr: fix: SPI expects a char array for NULLs
Andres Freund [Wed, 9 Apr 2014 12:33:17 +0000 (14:33 +0200)]
bdr: Fix issues with transaction local state used in ddl queues processing.
Otherwise CONCURRENTLY commands fails because resources will be freed
twice and because tupledescs et al. are still referenced.
Christian Kruse [Wed, 9 Apr 2014 12:25:41 +0000 (14:25 +0200)]
bdr: bugfix: avoid replication of internal schema
Andres Freund [Wed, 9 Apr 2014 12:06:38 +0000 (14:06 +0200)]
bdr: Apply event from the command queue using full blown portals.
This has the advantage that we can support normal SQL statements in
the command queue which is needed for conflict triggers.
Alvaro Herrera [Tue, 8 Apr 2014 21:00:10 +0000 (18:00 -0300)]
bdr: lift restriction on ALTER .. RENAME
Alvaro Herrera [Tue, 8 Apr 2014 20:51:35 +0000 (17:51 -0300)]
bdr: fix idiotic bdr-drops merge mistaek
Alvaro Herrera [Tue, 8 Apr 2014 20:36:31 +0000 (17:36 -0300)]
bdr: lift restriction on DROP
Alvaro Herrera [Fri, 4 Apr 2014 20:16:04 +0000 (17:16 -0300)]
bdr: add DROP support, using stuff from bdr-drops
Andres Freund [Tue, 8 Apr 2014 10:20:18 +0000 (12:20 +0200)]
bdr: Improve buffer and snapshot tracking.
As a preparation for more elaborate conflict handling track tuples
using TupleTableSlots and acquire/release snapshots more granulary.
Andres Freund [Mon, 7 Apr 2014 07:56:11 +0000 (09:56 +0200)]
bdr: Minor code formatting fixes
Craig Ringer [Mon, 7 Apr 2014 08:07:14 +0000 (16:07 +0800)]
bdr: Introduce support for forwarding changes from foreign nodes
Adds the "forward_changesets" option to the bdr_output plugin.
This can be used to cascade changes from one node to another,
potentially allowing cascading logical replication.
It's required to support proper addition of a new node via logical
dump.
Andres Freund [Fri, 4 Apr 2014 12:21:55 +0000 (14:21 +0200)]
bdr: Use sequencer wakeup scheduling code in the apply path as well.
Andres Freund [Fri, 4 Apr 2014 11:07:03 +0000 (13:07 +0200)]
bdr: Improve sequencer wakeup logic.
Schedule a sequencer wakeup at EOXact whenever a sequence is created
or it's setttings are modified. This allows to significantly decrease
the frequency of unneccessary sequencer wakeups and also significantly
reduces the time until a new sequence is initialized.
Andres Freund [Fri, 4 Apr 2014 10:57:08 +0000 (12:57 +0200)]
bdr: Fix some embarrassing oversights in recent commits leading to aborting replay.
Christian Kruse [Wed, 2 Apr 2014 11:15:24 +0000 (13:15 +0200)]
bdr: allow certain types of ALTER TABLE commands
For now we allow:
- ADD COLUMN
- DEFAULT
- CLUSTER ON
- SET WITHOUT CLUSTER
- SET (...)
- RESET (...)
- replace reloption list
Christian Kruse [Mon, 31 Mar 2014 12:16:08 +0000 (14:16 +0200)]
bdr: better error messages for SPI calls
I could be wrong but βblubβ or βblartβ is not a very comprehensible
error message ;-)
Andres Freund [Tue, 1 Apr 2014 22:39:06 +0000 (00:39 +0200)]
bdr: Don't forbid CREATE INDEX CONCURRENTLY anymore.
Andres Freund [Tue, 1 Apr 2014 18:04:31 +0000 (20:04 +0200)]
bdr: Clean up remote update replay code a bit.
Andres Freund [Tue, 1 Apr 2014 17:24:31 +0000 (19:24 +0200)]
bdr: Remove superflous check_sequencer_wakeup() call.
Andres Freund [Tue, 1 Apr 2014 17:22:53 +0000 (19:22 +0200)]
bdr: Simplify logic for generating the primary key during updates.
That hopefully gets rid of compiler warnings on older gccs.
Andres Freund [Tue, 1 Apr 2014 17:21:59 +0000 (19:21 +0200)]
bdr: Try to add bdr_commandfilter.c to windows buildsystem.
Also reorder some sourcefiles into alphabetical order...
Christian Kruse [Wed, 26 Mar 2014 12:03:26 +0000 (13:03 +0100)]
bdr: prevent specific utility commands from being executed
We use a ProcessUtility_hook to prevent some utility commands from being
executed. Currently this contains:
- SECURITY LABEL
- CREATE INDEX CONCURRENTLY
- ALTER TABLE
- ALTER β¦ RENAME TO
- DROP TABLE/VIEW/SEQUENCE/TRIGGER/RULE/EXTENSION/TYPE
- DROP OWNED
- ALTER TYPE β¦ ADD VALUE
Still TODO:
- Prevent replication for CREATE/DROP/ALTER TABLESPACE/ALTER TABLESPACE
MOVE.
- Prevent replication of COMMENT ON for non-local objects.
- Implement a new GUC, bdr.ddl_prevent_replication
Christian Kruse [Mon, 31 Mar 2014 12:08:37 +0000 (14:08 +0200)]
bdr: bugfix: end critical section in βnot acquired newβ case as well