Andres Freund [Thu, 3 Jul 2014 23:39:52 +0000 (01:39 +0200)]
bdr: Fix silly mistakes in the merge of worker and output plugins
Petr Jelinek [Thu, 3 Jul 2014 17:07:07 +0000 (19:07 +0200)]
bdr: pg_dump: check for exported snapshots support only when --snapshot option was used
Andres Freund [Thu, 3 Jul 2014 16:00:27 +0000 (18:00 +0200)]
bdr: move to version 0.6
Andres Freund [Thu, 3 Jul 2014 11:59:56 +0000 (13:59 +0200)]
bdr: Merge worker and output plugin shared objects.
The output plugin API used to require a separate shared object for
output plugins when _PG_init() did significant stuff. That's not the
case anymore, so get rid of that split.
Andres Freund [Thu, 3 Jul 2014 11:18:30 +0000 (13:18 +0200)]
bdr: Improve sequence debug messages a bit.
Andres Freund [Thu, 3 Jul 2014 11:04:14 +0000 (13:04 +0200)]
bdr: Improve handling of non-PANIC crashes of the perdb worker.
The ddl locking subsystem sent out a message to release all ddl locks
when the perdb worker was restarted. That can, among others, happen if
a DDL lock clashes with the sequencer.
RT-#37787, reported by Petr Jelinek
Andres Freund [Thu, 3 Jul 2014 09:58:55 +0000 (11:58 +0200)]
bdr: Don't error out when replicating rows with NULLs in unique keys.
At an earlier point build_index_scan_key() never had to deal with
indexes where keys can contain NULL. Instead of erroring out properly
set SK_ISNULL and return the information that the scankey returns
NULLs to the caller.
Current callers can just skip indexes with NULLs.
Craig Ringer [Wed, 2 Jul 2014 05:57:26 +0000 (13:57 +0800)]
bdr: Small usage tip for bdr_init_copy
Christoph Moench-Tegeder [Tue, 1 Jul 2014 16:47:56 +0000 (18:47 +0200)]
bdr: fix build by including sys/stat.h
the S_* constants live in sys/stat.h (according to POSIX), so include
that, too and allow building on platforms other than Linux (which
provides the S_* constants via fcntl.h).
Petr Jelinek [Tue, 1 Jul 2014 12:45:30 +0000 (14:45 +0200)]
bdr: add bdr.bdr_version() interface
Andres Freund [Wed, 25 Jun 2014 23:08:58 +0000 (01:08 +0200)]
bdr: Remove verbose message for every replayed commit.
Andres Freund [Wed, 25 Jun 2014 23:08:23 +0000 (01:08 +0200)]
bdr: Fix various memory leaks.
Found by Petr.
Craig Ringer [Wed, 25 Jun 2014 03:18:01 +0000 (11:18 +0800)]
bdr: Introduce a quickstart script to be used in the tutorial
This provides a quick way to install BDR from sources.
Craig Ringer [Wed, 18 Jun 2014 05:44:54 +0000 (13:44 +0800)]
bdr: Add sample config and basic docs
Craig Ringer [Wed, 18 Jun 2014 05:52:23 +0000 (13:52 +0800)]
bdr: Ignore some build outputs
Tweak .gitignore
Craig Ringer [Tue, 17 Jun 2014 15:09:25 +0000 (23:09 +0800)]
bdr: Add a distinct version, 9.4beta1_bdr0601, to configure.in
This allows us to tell BDR and non-BDR binaries apart, and helps with packaging.
Andres Freund [Tue, 24 Jun 2014 09:31:47 +0000 (11:31 +0200)]
bdr, deparse: Deparse nondefault seqams correctly when default_seqam is set.
This could lead to sequences being created as bdr sequences on one
node and local sequences on others.
Petr Jelinek [Mon, 9 Jun 2014 08:57:09 +0000 (10:57 +0200)]
bdr: Add bdr_init_replica utility for starting up new bdr node from a pg_basebackup copy.
Andres Freund [Mon, 9 Jun 2014 08:50:39 +0000 (10:50 +0200)]
bdr: Properly initialize stack variable.
Petr Jelinek [Fri, 6 Jun 2014 16:03:41 +0000 (18:03 +0200)]
bdr: add -s [SYSID] option to pg_resetxlog
Andres Freund [Thu, 15 May 2014 13:17:19 +0000 (15:17 +0200)]
bdr: Distributed DDL locking.
Andres Freund [Wed, 4 Jun 2014 16:06:44 +0000 (18:06 +0200)]
bdr: Allow shutdown to interrupt bdr workers by triggering PROCESS_INTERRUPTS().
Andres Freund [Wed, 4 Jun 2014 16:05:05 +0000 (18:05 +0200)]
bdr: Reset replication identifier lsn/time after a commit
Andres Freund [Wed, 4 Jun 2014 16:02:47 +0000 (18:02 +0200)]
bdr: Reduce log level of feedback messages to DEBUG2
Andres Freund [Mon, 2 Jun 2014 13:56:54 +0000 (15:56 +0200)]
bdr: Fix typo in log message
Andres Freund [Sun, 1 Jun 2014 07:45:13 +0000 (09:45 +0200)]
bdr: Don't increase the number of configured nodes after each crash restart.
Andres Freund [Tue, 3 Jun 2014 09:59:02 +0000 (11:59 +0200)]
wal_decoding: Fix sending of nontransactional messages in transactions.
Andres Freund [Tue, 3 Jun 2014 09:57:46 +0000 (11:57 +0200)]
wal_decoding: Add rmgrdesc support for the message feature
Craig Ringer [Wed, 4 Jun 2014 11:25:39 +0000 (19:25 +0800)]
bdr: Send remote transaction origin (sysid,tlid,dboid) at BEGIN
Previously we sent this information at COMMIT time, which meant code
running before COMMIT was replayed couldn't tell if it was working on
a forwarded transaction from a third party node (in catchup mode).
Now the remote identifier is decoded into a local RepNodeId at BEGIN
and stored for access throughout replay.
Petr Jelinek [Sat, 31 May 2014 21:11:55 +0000 (23:11 +0200)]
bdr: Remove unused ApplyWorker allocations from _PG_init
Petr Jelinek [Mon, 26 May 2014 13:19:50 +0000 (15:19 +0200)]
bdr: Fix crash when queueing ddl commands that are represented by more than one command row by pg_event_trigger_get_creation_commands.
Alvaro Herrera [Thu, 22 May 2014 21:49:13 +0000 (17:49 -0400)]
bdr: code review for bdr_conflict_handlers_check_handler_fun
Make the error messages clearer by adding hints; also fix a bug that it
was requesting type TEXT when in reality it wanted regclass (&^%$#!)
Alvaro Herrera [Thu, 22 May 2014 22:05:38 +0000 (18:05 -0400)]
bdr: minor code review for bdr_create_conflict_handler
Alvaro Herrera [Thu, 22 May 2014 19:23:27 +0000 (15:23 -0400)]
bdr/deparse: have DDL replication track perpetrators
This means tables (and other objects) are created with the right owners,
GRANTs are executed with the right grantors, etc.
Queueing function had to be rewritten in C in order for this to work.
Andres Freund [Sun, 18 May 2014 17:52:55 +0000 (19:52 +0200)]
bdr: Fix use of wrong variable.
Introduced in "bdr: implement per-db worker in shmem"
Andres Freund [Fri, 16 May 2014 16:26:18 +0000 (18:26 +0200)]
bdr: restart bgworkers after connection aborts again.
The recent bgworker API fixes reinterpreted the proc_exit(0) by the
old connection abort case into a "don't restart bgworker".
Craig Ringer [Sun, 18 May 2014 03:26:59 +0000 (11:26 +0800)]
bdr: Set application_name for both SPI and libpq connections
Setting application_name makes it much easier to see what bdr is doing
in pg_stat_activity and provides a useful log_line_prefix.
Craig Ringer [Fri, 16 May 2014 07:57:42 +0000 (15:57 +0800)]
bdr: Use (sysid,timelineid,dboid) on the wire, not local RepNodeId
The wire protocol was using RepNodeId in catchup mode, but RepNodeId is a
purely local identiifer that should never leave a node.
It should 've been sending the (sysid, timeline id, dboid) tuple that globally
identifies a node, then turning that back to a RepNodeId local to the apply
side when it' s received.
Craig Ringer [Fri, 16 May 2014 07:55:05 +0000 (15:55 +0800)]
bdr: Use database oid, not database name, as key in bdr.bdr_nodes
The key for a bdr node is (sysid, timelineid, dboid) so using dbname
in bdr.bdr_nodes is incorrect.
Craig Ringer [Fri, 16 May 2014 06:53:25 +0000 (14:53 +0800)]
bdr: Expose dboid via bdr_connect
We need to be able to access the remote database oid now that
we support intra-node replication.
Craig Ringer [Fri, 16 May 2014 05:00:07 +0000 (13:00 +0800)]
bdr: BGWorker exit with BGW_NO_RESTART is now respected, so simplify error handling
Craig Ringer [Thu, 15 May 2014 17:49:12 +0000 (01:49 +0800)]
bdr: Fix init_replica bug introduced by per-db workers in shmem
Two arrays that previously always had the same offsets for any given
connection no longer do after per-db workers were introduced. This
exposed a previous bug in init_replica where mapping between the two
arrays was not properly done.
Craig Ringer [Thu, 15 May 2014 12:40:23 +0000 (20:40 +0800)]
bdr: Add db oid param to fetch_sysid_via_node_id, add bdr_ prefix
Rename fetch_sysid_via_node_id to bdr_fetch_sysid_via_node_id and add a new
output parameter to return the database oid for the database that's local
to that RepNodeId.
This allows bdr_fetch_sysid_via_node_id to return the full identifying
key for a node now that we support intra-node replication.
Andres Freund [Thu, 15 May 2014 13:10:17 +0000 (15:10 +0200)]
bdr: Fixup for Mkvcbuild.pm typo
Christian Kruse [Thu, 15 May 2014 13:09:05 +0000 (15:09 +0200)]
bdr: fix: include header file for prototypes
AdvanceCachedReplicationIdentifier() and AdvanceReplicationIdentifier()
are defined in replication/replication_identifier.h
Andres Freund [Thu, 15 May 2014 13:06:04 +0000 (15:06 +0200)]
bdr: Put files to be built into a consistent order. again.
Doing so makes resolving merge conflicts far easier.
Craig Ringer [Thu, 15 May 2014 11:25:05 +0000 (19:25 +0800)]
bdr: move fetch_sysid_via_node_id into bdr_catalogs.c
This allows fetch_sysid_via_node_id to be used by the output
plugin for resolving a local RepNodeId into a (sysid,tlid) tuple.
Craig Ringer [Thu, 15 May 2014 09:59:39 +0000 (17:59 +0800)]
bdr: Add timeline ID to bdr.bdr_nodes, change sysid type to text
The unique identifier for a given bdr node is (sysid, timelineid, dbname), so
make sure that's the correct key in bdr.bdr_nodes.
Christian Kruse [Thu, 15 May 2014 07:41:00 +0000 (09:41 +0200)]
bdr: tests for DDL replication
Christian Kruse [Thu, 15 May 2014 07:39:57 +0000 (09:39 +0200)]
bdr: fixing check target
Craig Ringer [Thu, 15 May 2014 07:40:49 +0000 (15:40 +0800)]
bdr: use get_database_name() not direct syscache lookup
Per review from Andres.
Alvaro Herrera [Wed, 14 May 2014 20:00:08 +0000 (16:00 -0400)]
bdr: fix drops stuff for internal objects
Things such as TOAST tables were causing errors when tables having them
were dropped.
Alvaro Herrera [Mon, 12 May 2014 18:33:13 +0000 (14:33 -0400)]
bdr: replicate all DDL commands
Andres Freund [Wed, 14 May 2014 11:17:31 +0000 (13:17 +0200)]
bdr: Don't use send/recv protocol for array/composite types.
Craig Ringer [Wed, 14 May 2014 11:09:55 +0000 (19:09 +0800)]
bdr: Use GetSysCacheOidError2 to cut some code in conflict logging
Craig Ringer [Wed, 14 May 2014 11:05:54 +0000 (19:05 +0800)]
bdr: move GetSysCacheOidError2 into bdr_catalogs.c and bdr.h
Should be shareable between bdr apply and bdr output.
Craig Ringer [Wed, 14 May 2014 10:51:05 +0000 (18:51 +0800)]
bdr: Better error message on slot creation for db where bdr not active
We want to block slot creation on a database where there's no active
bdr connection configured for that db. Test to see whether there's a
bdr schema and refuse to create a slot in this case.
Doesn't protect against bdr being enabled then disabled, but nothing
exciting will happen in that case anyway.
Andres Freund [Tue, 13 May 2014 11:53:24 +0000 (13:53 +0200)]
bdr: minor header cleanup
Andres Freund [Mon, 12 May 2014 23:08:04 +0000 (01:08 +0200)]
bdr: don't perform ddl command filtering in non bdr databases.
Andres Freund [Mon, 12 May 2014 22:18:15 +0000 (00:18 +0200)]
bdr: disable commandfilter when running in single user mode
Christian Kruse [Wed, 14 May 2014 08:08:16 +0000 (10:08 +0200)]
bdr: test cases for cluster-internal drop replication and common conflicts
common_conflicts.spec: Generate the common conflicts
cluster-internal-drop.spec: Test case failing for a DROP bug in
cluster-internal replication
Christian Kruse [Wed, 14 May 2014 07:33:19 +0000 (09:33 +0200)]
bdr: enabling cluster-internal replication
Christian Kruse [Tue, 13 May 2014 14:28:03 +0000 (16:28 +0200)]
bdr: implementing bdr.<name>_local_dbname
Christian Kruse [Tue, 13 May 2014 13:50:21 +0000 (15:50 +0200)]
bdr: refactor BdrConnectionConfig to use char * instead of NameData
Craig Ringer [Wed, 14 May 2014 01:47:39 +0000 (09:47 +0800)]
bdr: Prevent slot creation until BDR is up and ready
Checks bdr.bdr_nodes status field for the local node in the local DB during bdr
output plugin startup and ERRORs if status isn't set to ready yet. This ensures
that we cannot begin sending changes to other nodes while we're still applying
a dump or performing catchup.
The BDR per-db worker now creates an entry in the local bdr.bdr_nodes if
init_replica isn't configured on any connection and no such entry exists. That
makes sure BDR without init_replica keeps working properly.
An error like:
ERROR: bdr.bdr_nodes entry for local node (sysid=
6013159507840554182, dbname=postgres): row missing, bdr not active on this database or is initializing.
is emitted if the DB isn't ready for BDR yet. This can be tested easily with
pg_recvlogical by deleting the bdr.bdr_nodes entry for the local node or
creating an init_replica script that pauses indefinitely.
Craig Ringer [Wed, 14 May 2014 06:02:37 +0000 (14:02 +0800)]
bdr: At high debug levels log replication protocol commands
This makes getting a view of the parameters sent when starting logical
replication easier.
Craig Ringer [Wed, 14 May 2014 05:57:24 +0000 (13:57 +0800)]
bdr: Prevent null pointer dereference for blank output plugin params
bdr_output would crash with a segfault due to a null pointer dereference
if a parameter was specified but no corresponding value was supplied, e.g.
pg_recvlogical -P bdr_output -S test -d postgres --create
pg_recvlogical -P bdr_output -S test -d postgres --start -f - -o pg_version
This now fails with an ERROR instead of crashing and forcing postmaster
re-init, e.g.
ERROR: uint32 parameter "pg_version" had no value
Craig Ringer [Wed, 14 May 2014 01:36:05 +0000 (09:36 +0800)]
bdr: Don't register duplicate apply workers on perdb worker restart
Previously we handled postmaster restarts, but not the case where a per-db
worker restarted without a postmaster restart being triggered (such as on an
ERROR in a per-db worker).
This solution is imperfect. The flag to detect postmaster restart is set after
shmem is populated with the apply worker info but before they're actually
registered. If a crash forces a postmaster restart before all apply workers are
registered by all each per-db worker we'll fail to launch any that weren't
launched before the restart, because we've lost the shmem launch state flags
and have to assume they were all launched.
A proper solution probably requires a way to query the list of registered
bgworkers to determine whether a particular worker is registered.
Christian Kruse [Tue, 13 May 2014 10:23:08 +0000 (12:23 +0200)]
bdr: fix: always send 0 as timeframe for UPDATE vs DELETE
Christian Kruse [Fri, 9 May 2014 13:21:19 +0000 (15:21 +0200)]
bdr: integration of conflict handlers for UPDATE vs DELETE
Christian Kruse [Tue, 13 May 2014 08:42:37 +0000 (10:42 +0200)]
bdr: fix: use same datatype as bdr_max_workers to avoid compiler warning
Christian Kruse [Tue, 13 May 2014 08:40:49 +0000 (10:40 +0200)]
bdr: adding errcodes to a lot of ereports
Christian Kruse [Tue, 13 May 2014 07:55:42 +0000 (09:55 +0200)]
bdr: refactoring: remove duplicate enum for conflict handlers/logging
Christian Kruse [Tue, 13 May 2014 07:54:26 +0000 (09:54 +0200)]
bdr: fix: bdr_queued_commands has been changed, use new structure
Craig Ringer [Tue, 13 May 2014 01:46:26 +0000 (09:46 +0800)]
bdr: Move apply worker global state out of shmem
Craig Ringer [Tue, 13 May 2014 01:45:52 +0000 (09:45 +0800)]
bdr: implement per-db worker in shmem
Andres Freund [Mon, 12 May 2014 22:00:20 +0000 (00:00 +0200)]
bdr: Be a bit more considerate when creating the necessary extensions.
Andres Freund [Mon, 12 May 2014 21:27:21 +0000 (23:27 +0200)]
bdr: Be more careful about recursively entered ddl replication commands
Andres Freund [Mon, 12 May 2014 21:12:13 +0000 (23:12 +0200)]
bdr: Try to be more consistent in bdr--0.5.sql
* indent with 4 spaces
* always revoke permissions from tables
* always have the revoke close to the table's definition
* creating object in a halfway meaningful order
Alvaro Herrera [Mon, 12 May 2014 18:11:02 +0000 (14:11 -0400)]
bdr: queue command_tag rather than objtype/identity
These are used for error messages anyway, so they aren't very important;
and it's hard to see what would be identity be for commands that act on
multiple objects such as GRANT.
Craig Ringer [Mon, 5 May 2014 06:54:27 +0000 (14:54 +0800)]
bdr: Log conflicts to a bdr.bdr_conflict_history table
Creates a bdr.bdr_conflict_history table and logs conflicts to it when they're
detected, with details on both sides of the error.
Currently only logs insert/insert conflicts. The infrastructure for reporting
ERROR conflicts is present but not yet used.
Craig Ringer [Fri, 9 May 2014 12:19:17 +0000 (20:19 +0800)]
bdr: move heap and index access routines into bdr_executor.c
Craig Ringer [Thu, 8 May 2014 08:35:27 +0000 (16:35 +0800)]
bdr: move bdr_process_remote_command into bdr_apply.c
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