Commit Graph

1408 Commits (8544878c4b2e752d2b03df47f5ee5f58a3b6bc5b)

Author SHA1 Message Date
Burak Yucesoy fddf9b3fcc Add distributed partitioned table support distributed table creation
With this PR, Citus starts to support all possible ways to create
distributed partitioned tables. These are;

- Distributing already created partitioning hierarchy
- CREATE TABLE ... PARTITION OF a distributed_table
- ALTER TABLE distributed_table ATTACH PARTITION non_distributed_table
- ALTER TABLE distributed_table ATTACH PARTITION distributed_table

We also support DETACHing partitions from partitioned tables and propogating
TRUNCATE and DDL commands to distributed partitioned tables.

This PR also refactors some parts of distributed table creation logic.
2017-08-09 10:01:35 +03:00
Metin Döşlü a650aaa631 Merge pull request #1483 from citusdata/update_subquery_on_where_false
Add support for router UPDATEs and DELETEs with subqueries and joins
2017-08-08 22:24:41 +03:00
Metin Doslu b8a9e7c1bf Add support for UPDATE/DELETE with subqueries 2017-08-08 21:35:08 +03:00
Marco Slot 518750bd51 Merge pull request #1519 from citusdata/connection_per_placement
Avoid connections that accessed non-colocated placements in multi-shard commands
2017-08-08 20:47:16 +04:00
Marco Slot d3e9746236 Avoid connections that accessed non-colocated placements in multi-shard commands 2017-08-08 18:32:34 +02:00
Brian Cloutier 7060ade6fe GetNodeTuple returns NULL it node does not exist
It never throws an error.
2017-08-08 13:12:06 +03:00
Brian Cloutier a3e9bef685 All users of WorkerNodeHash take an AccessShareLock
The metadata cache simulates a SELECT on pg_dist_node. Now the locks it
takes also simulate that SELECT.
2017-08-08 13:12:06 +03:00
Brian Cloutier 5914c992e6 cluster management UDFs see nodes in different clusters
- master_activate_node and master_disable_node correctly toggle
  isActive, without crashing
- master_add_node rejects duplicate nodes, even if they're in different
  clusters
- master_remove_node allows removing nodes in different clusters
2017-08-08 13:12:06 +03:00
Brian Cloutier 3151b52a0b Add citus.cluster_name GUC
- Nodes with a nodecluster which does not match citus.cluster_name
  are excluded from the metadata cache and never seen by another part of
  Citus.
2017-08-08 13:12:06 +03:00
Brian Cloutier 94947c0d54 Refactor: ReplicateShardToAllWorkers more explicitly locks pg_dist_node 2017-08-08 13:12:06 +03:00
Brian Cloutier f87fefa323 Refactor: DistributedTableSize more explicitly only locks pg_dist_node 2017-08-08 13:12:06 +03:00
Brian Cloutier 3769381366 Fix inaccurate comment on SetNodeState 2017-08-08 13:12:06 +03:00
Brian Cloutier bf197e9f0c Add test for super-long cluster names 2017-08-08 11:18:31 +03:00
Brian Cloutier fbecf48a03 Disallow adding primary nodes to non-default clusters 2017-08-08 11:18:31 +03:00
Brian Cloutier 5618e69386 Add pg_dist_node.nodecluster 2017-08-08 11:18:31 +03:00
Brian Cloutier 74ce4faab5 Make multi_cluster_management test more stable 2017-08-08 11:18:31 +03:00
Brian Cloutier e7846ba7d1 Allow metadata sync functions on secondaries
{start,stop}_metadata_sync_to_node now toggle the hasMetadata flag when
run on secondaries but don't attempt to actually sync any metadata.
2017-08-07 18:46:51 +03:00
Marco Slot 7e4b2c1595 Merge pull request #1474 from citusdata/update_where_false
Execute UPDATE/DELETE statements with 0 shards
2017-08-07 17:48:52 +04:00
Marco Slot 4cc7c36596 Simplify metadata lock acquisition for DML 2017-08-07 15:36:58 +02:00
Marco Slot aa7ca81548 Execute UPDATE/DELETE statements with 0 shards 2017-08-07 15:36:58 +02:00
Marco Slot 3248f1a2b7 Merge pull request #1506 from citusdata/descend_function_evaluation
Function evaluation descends into expression trees
2017-08-06 22:24:22 +04:00
Marco Slot bac60bb64f Function evaluation descends into expression trees 2017-08-06 19:53:05 +02:00
Brian Cloutier 37985de85e master_disable_node no longer crashes when given a non-existant node 2017-08-04 11:14:54 +03:00
Hadi Moshayedi 8229a64fe8 Remove distributed tables' dependency on distribution key columns. (#1527)
This change removes distributed tables' dependency on distribution key columns. We already check that we cannot drop distribution key columns in ErrorIfUnsupportedAlterTableStmt() at multi_utility.c, so we don't need to have distributed table to distribution key column dependency to avoid dropping of distribution key column.

Furthermore, having this dependency causes some warnings in pg_dump --schema-only (See #866), which are not desirable.

This change also adds check to disallow drop of distribution keys when citus.enable_ddl_propagation is set to false. Regression tests are updated accordingly.
2017-08-03 10:07:04 -04:00
Murat Tuncer fa18899cf9 Remove serialization/deserialization of multiplan node (#1477)
introduces copy functions for Citus MultiPlan nodes.
uses ExtensibleNode mechanism to store MultiPlan data
drops serialiazation of MultiPlans
2017-08-02 08:24:00 +03:00
Burak Yücesoy f0275fe4ae Merge pull request #1525 from citusdata/refactor_create_distributed_table
Refactor distributed table creation logic
2017-07-31 12:08:18 +03:00
Burak Yucesoy 37b200a52e Fix broken isolation tests
We try to run our isolation tests paralles as much as possible. In
some of those isolation tests we used same table name which causes
problem while running them in paralles. This commit changes table
names in those tests to ensure tests can run in parallel.
2017-07-31 11:11:49 +03:00
Burak Yucesoy 7769f1d012 Refactor distributed table creation logic
This commit is preperation for introducing distributed partitioned
table support. We want to clean and refactor some code in distributed
table creation logic so that we can handle partitioned tables in more
robust way.
2017-07-31 11:11:23 +03:00
Murat Tuncer 520d74b96d Add a regression test for citus.max_task_string_size (#1524) 2017-07-28 10:49:09 -07:00
Brian Cloutier 7d8bcb6a88 These tests sometimes deadlock on travis 2017-07-28 16:02:43 +03:00
Brian Cloutier b20a086a8f master_activate_node UDF also returns noderole 2017-07-28 16:02:43 +03:00
Murat Tuncer 26f020dc6e Make maxTaskStringSize configurable (#1501)
maxTaskStringSize determines the size of worker query string.
It was originally hard coded to a specific value. This has caused
issues at some users. Since it determines initial shared memory
allocation, we did not want to set it to an arbitrary higher number.
Instead made it configurable.

This commit introduces a new GUC variable max_task_string_size

Changes in this variable requires restart to be in effect.
2017-07-27 11:39:12 -07:00
Önder Kalacı 6698ca8d9e Merge pull request #1523 from citusdata/deadlock_detection_main
Convert the global wait edges to adjacency lists
2017-07-27 20:14:49 +03:00
Onder Kalaci 6132d17481 Convert global wait edges to adjacency list
In this commit, we add ability to convert global wait edges
into adjacency list with the following format:
 [transactionId] = [transactionNode->waitsFor {list of waiting transaction nodes}]
2017-07-27 19:53:51 +03:00
Murat Tuncer 8729b7d55a Use cstore_table_size function to determine cstore table size (#1521)
pg_table_size/pg_relation_size variants always return 0 for
cstore tables. We should be using cstore_table_size function
for cstore_tables.
2017-07-27 09:02:07 -07:00
Brian Cloutier 32e16ffe02 Give isolation tester ability to see locks on workers 2017-07-26 18:43:04 +03:00
Eren Başak db5206846e Merge pull request #1508 from citusdata/progress_tracking
Add Progress Tracking Infrastructure
2017-07-26 15:08:43 +03:00
Eren Başak a12f1980de Add Progress Tracking Infrastructure
This change adds a general purpose infrastructure to log and monitor
process about long running progresses. It uses
`pg_stat_get_progress_info` infrastructure, introduced with PostgreSQL
9.6 and used for tracking `VACUUM` commands.

This patch only handles the creation of a memory space in dynamic shared
memory, putting its info in `pg_stat_get_progress_info`, fetching the
progress monitors on demand and finalizing the progress tracking.
2017-07-26 14:12:15 +03:00
Marco Slot d33cb7d832 Merge pull request #1495 from citusdata/dump_local_wait_edges
Add functions to dump local and global wait edges
2017-07-25 17:05:27 +02:00
Marco Slot 80ea233ec1 Add function for dumping global wait edges 2017-07-25 16:52:32 +02:00
Marco Slot 81198a1d02 Add function for dumping local wait edges 2017-07-25 16:52:32 +02:00
Önder Kalacı b04aa9bf85 Merge pull request #1514 from citusdata/fix_assigned_tx_bug
Fix bug on error check for assigning distributed transaction id
2017-07-25 15:41:34 +03:00
Onder Kalaci 58faffa42b Fix bug on error check for assigning distributed transaction id
to a backend that has already been assigned a transaction.
2017-07-25 14:58:07 +03:00
Marco Slot 5923334114 Add transaction recovery regression tests 2017-07-24 20:44:38 +02:00
Marco Slot 3d7f79127d Do not release locks in LogTransactionRecord 2017-07-24 20:44:38 +02:00
Brian Cloutier 88702ca58a node_metadata takes out more sane locks
- Never release locks
- AddNodeMetadata takes ShareRowExclusiveLock so it'll conflict with the
  trigger which prevents multiple primary nodes.
- ActivateNode and SetNodeState used to take AccessShareLock, but they
  modify the table so they should take RowExclusiveLock.
- DeleteNodeRow and InsertNodeRow used to take AccessExclusiveLock but
  only need RowExclusiveLock.
2017-07-24 11:57:46 +03:00
Brian Cloutier ec99f8f983 Add nodeRole column
- master_add_node enforces that there is only one primary per group
- there's also a trigger on pg_dist_node to prevent multiple primaries
  per group
- functions in metadata cache only return primary nodes
- Rename ActiveWorkerNodeList -> ActivePrimaryNodeList
- Rename WorkerGetLive{Node->Group}Count()
- Refactor WorkerGetRandomCandidateNode
- master_remove_node only complains about active shard placements if the
  node being removed is a primary.
- master_remove_node only deletes all reference table placements in the
  group if the node being removed is the primary.
- Rename {Node->NodeGroup}HasShardPlacements, this reflects the behavior it
  already had.
- Rename DeleteAllReferenceTablePlacementsFrom{Node->NodeGroup}. This also
  reflects the behavior it already had, but the new signature forces the
  caller to pass in a groupId
- Rename {WorkerGetLiveGroup->ActivePrimaryNode}Count
2017-07-24 11:57:46 +03:00
Brian Cloutier e6c375eb81 Tiny refactor to master_create_empty_shard 2017-07-24 11:57:46 +03:00
Brian Cloutier ee270b65d7 make WorkerGetNodeWithName a static function 2017-07-24 11:57:46 +03:00
Marco Slot fd3c007beb Merge pull request #1504 from citusdata/recovery_record_entropy
Add transaction number to 2PC identifiers
2017-07-21 18:29:52 +02:00