Commit Graph

637 Commits (807fc1cc28fedbaf91b3a1e64605361a02cc7d0a)

Author SHA1 Message Date
Onder Kalaci 807fc1cc28 Reference Table Support - Phase 1
With this commit, we implemented some basic features of reference tables.

To start with, a reference table is
  * a distributed table whithout a distribution column defined on it
  * the distributed table is single sharded
  * and the shard is replicated to all nodes

Reference tables follows the same code-path with a single sharded
tables. Thus, broadcast JOINs are applicable to reference tables.
But, since the table is replicated to all nodes, table fetching is
not required any more.

Reference tables support the uniqueness constraints for any column.

Reference tables can be used in INSERT INTO .. SELECT queries with
the following rules:
  * If a reference table is in the SELECT part of the query, it is
    safe join with another reference table and/or hash partitioned
    tables.
  * If a reference table is in the INSERT part of the query, all
    other participating tables should be reference tables.

Reference tables follow the regular co-location structure. Since
all reference tables are single sharded and replicated to all nodes,
they are always co-located with each other.

Queries involving only reference tables always follows router planner
and executor.

Reference tables can have composite typed columns and there is no need
to create/define the necessary support functions.

All modification queries, master_* UDFs, EXPLAIN, DDLs, TRUNCATE,
sequences, transactions, COPY, schema support works on reference
tables as expected. Plus, all the pre-requisites associated with
distribution columns are dismissed.
2016-12-20 14:09:35 +02:00
Eren Başak ca35163648 Merge pull request #912 from citusdata/add_timeout_guc
Add citus.node_connection_timeout GUC
2016-12-20 13:33:54 +02:00
Eren Basak 5eb90d6d93 Add citus.node_connection_timeout GUC 2016-12-20 14:11:37 +03:00
Marco Slot 7a39282597 Merge pull request #1049 from citusdata/bugfix/schema_owner
Fix permissions for multi-user re-partition queries
2016-12-20 11:22:59 +01:00
Marco Slot c772dcd32e Run copy commands in worker_merge_files_into_table as superuser 2016-12-20 10:15:42 +01:00
Marco Slot 2ebd92de0a Set user as pg_merge_job_* schema owner 2016-12-20 10:15:42 +01:00
Murat Tuncer 43d9aa0305 Merge pull request #1027 from citusdata/feature/930_keep_router_planner_active_at_all_times
Make router planner active at all times
2016-12-20 10:56:13 +02:00
Murat Tuncer 6c95f0352e Make router planner active at all times
We used to disable router planner and executor
when task executor is set to task-tracker.

This change enables router planning and execution
at all times regardless of task execution mode.

We are introducing a hidden flag enable_router_execution
to enable/disable router execution. Its default value is
true. User may disable router planning by setting it to false.
2016-12-20 11:24:01 +03:00
Jason Petersen 54c2efccc1 Add targeted VACUUM/ANALYZE support
Adds support for VACUUM and ANALYZE commands which target a specific
distributed table. After grabbing the appropriate locks, this imple-
mentation sends VACUUM commands to each placement (using one connec-
tion per placement). These commands are sent in parallel, so users
with large tables will benefit from sharding. Except for VERBOSE, all
VACUUM and ANALYZE options are supported, including the explicit
column list used by ANALYZE.

As with many of our utility commands, the local command also runs. In
the VACUUM/ANALYZE case, the local command is executed before any re-
mote propagation. Because error handling is managed after local proc-
essing, this can result in a VACUUM completing locally but erroring
out when distributed processing commences: a minor technicality in all
cases, as there isn't really much reason to ever roll back a VACUUM (an
impossibility in any case, as VACUUM cannot run within a transaction).

Remote propagation of targeted VACUUM/ANALYZE is controlled by the
enable_ddl_propagation setting; warnings are emitted if such a command
is attempted when DDL propagation is disabled. Unqualified VACUUM or
ANALYZE is not handled, but a warning message informs the user of this.

Implementation note: this commit adds a "BARE" value to MultiShard-
CommitProtocol. When active, no BEGIN command is ever sent to remote
nodes, useful for commands such as VACUUM/ANALYZE which must not run in
a transaction block. This value is not user-facing and is reset at
transaction end.
2016-12-16 16:59:06 -07:00
Metin Döşlü 54f18a1c88 Merge pull request #1046 from citusdata/feature/colocate_with
Add colocate_with option to create_distributed_table()
2016-12-16 14:33:22 +02:00
Metin Doslu fc908a3ab6 Refactor distribution column type check for colocation 2016-12-16 15:24:45 +02:00
Metin Doslu d43a01ebae Don't allow tables with different replication models to be colocated 2016-12-16 15:23:49 +02:00
Metin Doslu 4ff550429f Add colocate_with option to create_distributed_table()
With this commit, we support three versions of colocate_with: i.default, ii.none
and iii. a specific table name.
2016-12-16 14:53:35 +02:00
Metin Doslu 15aeac0502 Move colocation related functions to colocation_utils.c 2016-12-16 14:52:40 +02:00
Marco Slot 130b9ccd3a Merge pull request #1042 from citusdata/feature/column_name
Expose the column_to_column_name UDF
2016-12-16 11:40:29 +01:00
Marco Slot d733bfa044 Expose the column_to_column_name UDF to make partkey in pg_dist_partition human-readable 2016-12-14 10:46:33 +01:00
Eren Başak 8dbb523377 Merge pull request #997 from citusdata/add_sync_metadata_to_node
Add sync_metadata_to_node UDF
2016-12-14 10:06:17 +02:00
Eren Basak 7a9f9af9ea Add stop_metadata_sync_to_node UDF 2016-12-14 10:53:12 +03:00
Eren Basak 59b95a958d Propagate CREATE SCHEMA commands with the correct AUTHORIZATION clause in start_metadata_sync_to_node 2016-12-14 10:53:12 +03:00
Eren Basak 72e5e826b8 Make start_metadata_sync_to_node UDF to propagate foreign-key constraints 2016-12-14 10:53:12 +03:00
Eren Basak eea27619a0 Make truncate triggers propagated on start_metadata_sync_to_node call 2016-12-14 10:53:10 +03:00
Eren Basak 9b6d33f5b4 Prevent Transactions in start_metadata_sync_to_node 2016-12-13 10:48:03 +03:00
Eren Basak 1b812ec3b1 Add Regression Tests For start_metadata_sync_to_node 2016-12-13 10:48:03 +03:00
Eren Basak 9c415d4f34 Add start_metadata_sync_to_node UDF
This change adds `start_metadata_sync_to_node` UDF which copies the metadata about nodes and MX tables
from master to the specified worker, sets its local group ID and marks its hasmetadata to true to
allow it receive future DDL changes.
2016-12-13 10:48:03 +03:00
Andres Freund 6e4443b555 Merge pull request #835 from citusdata/valgrind-support
Allow to run regression tests under valgrind
2016-12-12 16:34:58 -08:00
Andres Freund bed853664e Add support for running regression tests under valgrind.
Note that this only provides infrastructure for running tests under
valgrind - there's some spurious failures due to timeouts.
2016-12-12 15:42:11 -08:00
Andres Freund d4463e9d2c Merge pull request #1020 from citusdata/feature/transaction-management
Centralized Transaction Management Infrastructure
2016-12-12 15:27:27 -08:00
Andres Freund 90ad02f5fb Integrate router executor into transaction management framework.
One less place managing remote transactions. It also makes it fairly
easy to use 2PC for certain modifications (e.g. reference tables). Just
issue a CoordinatedTransactionUse2PC(). If every placement failure
should cause the whole transaction to abort, additionally mark the
relevant transactions as critical.
2016-12-12 15:18:12 -08:00
Andres Freund 21449ed0a0 Convert multi_shard_transaction.[ch] to new framework. 2016-12-12 15:18:12 -08:00
Andres Freund 7ac4a2bc94 Coordinated remote transaction management. 2016-12-12 15:18:12 -08:00
Andres Freund ccb2a35b6b Add PQgetResult() wrapper handling interrupts.
This makes it possible to implement cancelling queries blocked on
communication with remote nodes.
2016-12-12 15:18:12 -08:00
Andres Freund c9e8b10b29 Merge pull request #1017 from citusdata/vanillatests
Add support for running postgres tests against a database with citus loaded
2016-12-12 14:34:20 -08:00
Andres Freund a26b9d3b8f Add support for running postgres tests against a database with citus loaded.
Not that this is not with the citus *extension* loaded, just the shared
library. The former runs (by adding --use-existing to the flags) but
has a bunch of trivial test differences.
2016-12-12 14:25:06 -08:00
Jason Petersen abccd8d5f1 Merge pull request #1035 from citusdata/tweak_coverage
Tweak coverage options

cr: @jasonmp85
2016-12-09 14:19:52 -07:00
Jason Petersen 3439548c86 Bump target to 87.5%
With the ignore rules in place, we can increase the target.
2016-12-09 14:06:35 -07:00
Jason Petersen bbbb7f1ef6 Format for readability 2016-12-09 13:33:58 -07:00
Jason Petersen f8cbf4f024 Add ignore rules 2016-12-09 13:03:23 -07:00
Jason Petersen db13abba11 Make patch target 75%
If a patch has very bad coverage, reject it.
2016-12-09 13:03:23 -07:00
Jason Petersen 086187bcde Be explicit about coverage project requirements
If a change drops coverage (absolutely) beneath 80% or (relatively)
reduces coverage by more than 0.5%, give it a bad status.
2016-12-09 13:03:23 -07:00
Jason Petersen 37b8c5f7b6 Add default Codecov configuration
Will change shortly.
2016-12-09 13:03:23 -07:00
Andres Freund 7269a7da98 Merge pull request #1022 from citusdata/feature/2PCBUMPISM
Make prepared transactions available if not configured.
2016-12-08 20:04:00 -08:00
Andres Freund 820f300de2 Make prepared transactions available if not configured. 2016-12-08 19:57:22 -08:00
Burak Yücesoy 5559b8201d Merge pull request #876 from citusdata/foreign_key_push_down_for_alter_table
Add Foreign Key Support to ALTER TABLE commands
2016-12-08 14:11:01 +02:00
Burak Yucesoy cdb725a561 Add Foreign Key Support to ALTER TABLE commands
With this PR, we add foreign key support to ALTER TABLE commands. For now,
we only support foreign constraint creation via ALTER TABLE query, if it
is only subcommand in ALTER TABLE subcommand list.

We also only allow foreign key creation if replication factor is 1.
2016-12-08 15:03:25 +02:00
Andres Freund b16540725a Merge pull request #863 from citusdata/feature/connection-lifecycle
Connection Lifecycle Management Infrastructure
2016-12-07 11:51:02 -08:00
Andres Freund 3754e74acb Move multi_client_executor.[ch] ontop of connection_management.[ch].
That way connections can be automatically closed after errors and such,
and the connection management infrastructure gets wider testing.  It
also fixes a few issues around connection string building.
2016-12-07 11:44:24 -08:00
Andres Freund c7f19f6c83 Use connection_management.c from within connection_cache.c.
This is a temporary step towards removing connection_cache.c.
2016-12-07 11:44:24 -08:00
Andres Freund 7bc7284b61 Add initial helpers to make interactions with MultiConnection et al. easier.
This includes basic infrastructure for logging of commands sent to
remote/worker nodes. Note that this has no effect as of yet, since no
callers are converted to the new infrastructure.
2016-12-07 11:44:24 -08:00
Andres Freund 8e32951eb9 Centralized Connection Lifetime Management.
Connections are tracked and released by integrating into postgres'
transaction handling. That allows to to use connections without having
to resort to having to disable interrupts or using PG_TRY/CATCH blocks
to avoid leaking connections.

This is intended to eventually replace multi_client_executor.c and
connection_cache.c, and to provide the basis of a centralized
transaction management.

The newly introduced transaction hook should, in the future, be the only
one in citus, to allow for proper ordering between operations.  For now
this central handler is responsible for releasing connections and
resetting XactModificationLevel after a transaction.
2016-12-07 11:43:18 -08:00
Andres Freund 9564e1e7fc Add some basic helpers to make use of dynahash hashtables easier. 2016-12-06 14:15:36 -08:00