Commit Graph

891 Commits (1285cabf28411d9c49718022bb16a39353364ae7)

Author SHA1 Message Date
Andres Freund c390daed0f Use interrupt checking libpq wrappers in router executor. 2017-01-09 14:02:45 -08:00
Andres Freund d8cdb552e5 Merge pull request #1079 from citusdata/feature/shardstate
Centralized placement ->connection mapping & placement health management
2017-01-09 13:28:22 -08:00
Andres Freund 7320c17f00 Convert router executor to placement connection management infrastructure.
Remove the router specific transaction and shard management, and
replace it with the new placement connection API.  This mostly leaves
behaviour alone, except that it is now, inside a transaction, legal to
select from a shard to which no pre-existing connection exists.

To simplify code the code handling task executions for select and
modify has been split into two - the previous coding was starting to
get confusing due to the amount of only conditionally applicable code.

Modification connections & transactions are now always established in
parallel, not just for reference tables.
2017-01-09 13:13:02 -08:00
Andres Freund bfa742d794 Centralized shard/placement connection and state management.
Currently there are several places in citus that map placements to
connections and that manage placement health. Centralize this
knowledge.  Because of the centralized knowledge about which
connection has previously been used for which shard/placement, this
also provides the basis for relaxing restrictions around combining
various forms of DDL/DML.

Connections for a placement can now be acquired using
GetPlacementConnection(). If the connection is used for DML or DDL the
FOR_DDL/DML flags should be used respectively.  If an individual
remote transaction fails (but the transaction on the master succeeds)
and FOR_DDL/DML have been specified, the placement is marked as
invalid, unless that'd mark all placements for a shard as invalid.
2017-01-09 13:13:02 -08:00
Andres Freund aca3770364 Merge pull request #1104 from citusdata/connmgr_cleanup
Minor connection/transaction management related cleanups
2017-01-06 09:31:24 -08:00
Andres Freund 3286b99ff1 Remove useless changing of CurrentMemoryContext. 2017-01-06 09:16:45 -08:00
Andres Freund 6291998ae1 Use FinishConnectionListEstablishment() instead of manually iterating. 2017-01-06 09:16:01 -08:00
Andres Freund d256f3fca9 Remove unused LogPreparedTransactions() function.
This is unused since 92c7567008.
2017-01-06 09:15:01 -08:00
Burak Yücesoy 350b1e6431 Merge pull request #1091 from citusdata/replicate_reference_table_on_add_node
Replicate reference tables when new node is added
2017-01-05 13:37:45 +02:00
Burak Yucesoy 9c9f479e4b Replicate reference tables when new node is added
With this change, we start to replicate all reference tables to the new node when new node
is added to the cluster with master_add_node command. We also update replication factor
of reference table's colocation group.
2017-01-05 14:30:41 +03:00
Burak Yucesoy 1d18950860 Modify tests to create clean workspace
Since we will now replicate reference tables each time we add node, we need to ensure
that test space is clean in terms of reference tables before any add node operation.
For this purpose we had to change order of multi_drop_extension test which caused
change of some of the colocation ids.
2017-01-05 12:22:44 +03:00
Önder Kalacı 2e3e801768 Merge pull request #1058 from citusdata/reference_tables_use_2pc_and_add_to_task
Allow reference tables to use 2PC for all modifications
2017-01-04 12:57:01 +02:00
Onder Kalaci 6d050fd677 Use 2PC for reference table modification
With this commit, we ensure that router executor always uses
2PC for reference table modifications and never mark the placements
of it as INVALID.
2017-01-04 12:46:35 +02:00
Burak Yücesoy 43f5efecff Merge pull request #1075 from citusdata/upgrade_reference_table
Add upgrade_to_reference_table
2017-01-02 17:03:59 +02:00
Burak Yucesoy 31cd2357fe Add upgrade_to_reference_table
With this change we introduce new UDF, upgrade_to_reference_table, which can be used to
upgrade existing broadcast tables reference tables. For upgrading, we require that given
table contains only one shard.
2017-01-02 17:54:42 +02:00
Eren Başak 7953916ae2 Merge pull request #1068 from citusdata/mx_error_on_unsupported_operations
Error on Unsupported Features on Workers
2017-01-02 16:40:29 +02:00
Eren Basak 7e09bd6836 Error on Unsupported Features on Workers
This change makes the metadata workers error out on unsupported commands.
2017-01-02 16:03:45 +03:00
Jason Petersen 3182287574 Merge pull request #1063 from citusdata/multi_shard_multi_connection
Convert multi_shard_transaction to the new connection API

cr: @jasonmp85
2016-12-30 14:56:17 -07:00
Marco Slot 59bc5972fa
Use MultiConnection in multi-shard transactions 2016-12-30 14:43:21 -07:00
Metin Döşlü 7f10d8562b Merge pull request #1073 from citusdata/refactor_shard_index
Add binary search capability to ShardIndex()
2016-12-30 18:02:22 +02:00
Metin Doslu 1ddc70ca55 Add binary search capability to ShardIndex()
Renamed FindShardIntervalIndex() to ShardIndex() and added binary search
capability. It used to assume that hash partition tables are always
uniformly distributed which is not true if upcoming tenant isolation
feature is applied. This commit also reduces code duplication.
2016-12-30 18:55:34 +02:00
Murat Tuncer 29e5e3e715 Merge pull request #1070 from citusdata/feature/where_is_null
Add null clause test cases to router planner regression tests
2016-12-29 09:51:25 +02:00
Murat Tuncer fc01a47ea4 Add null clause test cases to router planner regression tests
Router planner already handles cases when all shards
are pruned out. This is about missing test cases. Notice that
"column is null" and "column = null" have different shard
pruning behavior.
2016-12-29 10:42:31 +03:00
Eren Başak 2b90620f15 Merge pull request #1067 from citusdata/fix_mx_drop_sequence_deadlock
Prevent Deadlock on Dropping MX Tables with Sequences
2016-12-28 15:52:53 +02:00
Eren Basak e43eed0f7a Prevent Deadlock on Dropping MX Tables with Sequences
This change prevents a deadlock situation during DROP TABLE on an
mx table with sequences on workers with metadata.
2016-12-28 16:32:20 +03:00
Burak Yücesoy c8bdac699c Merge pull request #1061 from citusdata/error_out_fk_on_reference_tables
Error out on foreign keys with reference tables
2016-12-28 14:56:43 +02:00
Burak Yucesoy 88ee7802dd Address Onder's comments 2016-12-28 12:26:16 +03:00
Burak Yucesoy bb9e95e134 Error out on foreign keys with reference tables
We have one replication of reference table for each node. Therefore all problems with
replication factor > 1 also applies to reference table. As a solution we will not allow
foreign keys on reference tables. It is not possible to define foreign key from, to or
between reference tables.
2016-12-28 10:58:26 +03:00
Murat Tuncer 19b96a17c1 Merge pull request #1031 from citusdata/fix/750_better_error
Add error hint to failing modify query
2016-12-23 18:54:42 +02:00
Murat Tuncer 2f76b4be99 Add error hint to failing modify query 2016-12-23 19:43:55 +03:00
Marco Slot 25e28763b2 Merge pull request #1057 from citusdata/bugfix/add_node_failure
Convert worker_transactions to new connection API
2016-12-23 16:30:40 +01:00
Marco Slot 6cbc1945f9 Enable transaction recovery in connection API 2016-12-23 16:14:29 +01:00
Marco Slot 92c7567008 Convert worker_transactions to new connection API 2016-12-23 16:14:29 +01:00
Marco Slot 00d55ad957 Add a wrapper for PQsendQuery 2016-12-23 16:14:29 +01:00
Marco Slot 87c62d598e Connectionapify SendCommandListToWorkerInSingleTransaction 2016-12-23 16:14:29 +01:00
Burak Yücesoy 5cd21771a9 Merge pull request #1062 from citusdata/grant_public_select_access_to_metadata_tables
GRANT SELECT access for metadata tables to public
2016-12-23 16:43:15 +03:00
Burak Yucesoy 0851fd2f0b GRANT SELECT access for metadata tables to public
Previously, we errored out if non-user tries to SELECT query for some metadata tables. It
seems that we already GRANT SELECT access to some metadata tables but not others. With
this change, we GRANT SELECT access to all existing Citus metadata tables.
2016-12-23 16:32:47 +03:00
Eren Başak d608ef3311 Merge pull request #1045 from citusdata/propagate_mx_metadata_changes
Propagate MX Metadata Changes
2016-12-23 14:58:49 +02:00
Eren Basak 31af40cc26 Handle MX tables on workers during drop table commands 2016-12-23 15:43:32 +03:00
Eren Basak bed2e353db Propagate `mark_tables_colocated` changes in `pg_dist_partition` table to metadata workers. 2016-12-23 15:43:32 +03:00
Eren Basak 71d73ec5ff Propagate DDL commands to metadata workers for MX tables 2016-12-23 15:43:32 +03:00
Eren Basak 048fddf4da Propagate MX table and shard metadata on `create_distributed_table` call 2016-12-23 15:43:32 +03:00
Eren Basak efcb1f9dd9 Rename multi_metadata_snapshot to multi_metadata_sync to make it include future mx metadata syncing regression tests 2016-12-23 15:43:32 +03:00
Eren Basak 61a1e487d0 Mark hash distributed tables with replication factor = 1 as streaming replicated tables (repmodel=s).
This works only with `create_distributed_table` call.
2016-12-23 15:43:31 +03:00
Marco Slot 6b947c4201 Merge pull request #1010 from citusdata/feature/insert_select_functions
Evaluate functions in INSERT..SELECT
2016-12-23 13:24:21 +01:00
Marco Slot 11031bcf55 Enable evaluation of stable functions in INSERT..SELECT 2016-12-23 12:47:21 +01:00
Marco Slot d745d7bf70 Add explicit RelationShards mapping to tasks 2016-12-23 10:23:43 +01:00
Marco Slot b7d0a3237b Merge pull request #1056 from citusdata/feature/mx_locks
Add shard locking UDFs
2016-12-22 11:20:43 +01:00
Marco Slot 6852f8a951 Add shard locking UDFs 2016-12-22 11:04:34 +01:00
Burak Yücesoy 501a2ecead Add get_distribution_value_shardid UDF (#1048)
* Add get_distribution_value_shardid UDF

With this UDF users can now map given distribution value to shard id. We mostly hide
shardids from users to prevent unnecessary complexity but some power users might need
to know about which entry/value is stored in which shard for maintanence purposes.

Signature of this UDF is as follows;

bigint get_distribution_value_shardid(table_name regclass, distribution_value anyelement)
2016-12-22 12:17:08 +03:00