Commit Graph

2253 Commits (1b1c6374f7ecb2784090f15b7f9cb1584f28dda8)

Author SHA1 Message Date
Murat Tuncer 6c66033455 Add failure tests for multi-shard update/delete
Failure tests for update/delete  on hash distributed tables
using 1PC and 2PC
2018-10-03 15:43:48 +03:00
Burak Velioglu 322dd54eee
Merge pull request #2412 from citusdata/add_all_transactions_to_views
Show router modify,select and real-time queries on MX views
2018-10-02 22:23:47 +03:00
velioglu 512d23934f Show router modify,select and real-time queries on MX views 2018-10-02 13:59:38 +03:00
Murat Tuncer 43a4ef939a
Merge pull request #2410 from citusdata/mx_partition_foreign_key
Do not create inherited constraints at worker tables
2018-09-28 16:53:13 +03:00
Murat Tuncer 9bdef67bab Do not create inherited constraints on worker shards
PG now allows foreign keys on partitioned tables.
Each foreign key constraint on partitioned table
is propagated down to partitions.

We used to create all constraints on shards when we are creating
a new shard, or when just simply moving a shard from one worker
to another. We also used the same logic when creating a copy of
coordinator table in mx node.

With this change we create the constraint on worker node only if
it is not an inherited constraint.
2018-09-28 14:14:51 +03:00
Murat Tuncer 0aa9988ae9
Merge pull request #2413 from citusdata/fix_memory_leak_minimal
Fix memory leak in FinishRemoteTransactionPrepare
2018-09-28 13:54:07 +03:00
Murat Tuncer 653c7e4ae0 Fix memory leak in FinishRemoteTransactionPrepare 2018-09-28 11:13:21 +03:00
Önder Kalacı 6c389497ab
Merge pull request #2404 from citusdata/fix_truncate
Make sure to use correct execution mode for TRUNCATE
2018-09-25 16:31:45 +03:00
Onder Kalaci cdc0d1491c Make sure to use correct execution mode for TRUNCATE
We used to set the execution mode in the truncate trigger. However,
when multiple tables are truncated with a single command, we could
set the execution mode very late. Instead, now set the execution mode
on the utility hook.
2018-09-25 15:35:27 +03:00
Marco Slot b2c3fd891b
Merge pull request #2396 from citusdata/insert_select_parameters
Do not allow unresolved parameters in INSERT...SELECT
2018-09-24 15:05:55 +02:00
Marco Slot 1ca9a5b867 Do not allow unresolved parameters in INSERT...SELECT 2018-09-24 14:12:04 +02:00
Murat Tuncer 535c535010
Merge pull request #2356 from citusdata/enable_jit
Re-enable JIT in PostgreSQL 11 tests
2018-09-24 09:55:11 +03:00
Jason Petersen d7f10b0896 Rewrite parallel ID test to avoid costly JITting
By setting the CPU tuple cost so high, we were triggering JIT. Instead,
we should use parallel_tuple_cost.

See: rhaas.blogspot.com/2018/06/using-forceparallelmode-correctly.html
2018-09-24 09:29:53 +03:00
Jason Petersen e62a1ab43d Revert "Disable JIT during PostgreSQL 11 test runs"
This reverts commit a2fb5a84f1.

JIT wasn't actually interfering with the operation of Citus, a test was
just written in a way which caused JIT to run for a function on every
row in a 150k-row table.
2018-09-24 09:29:53 +03:00
Jason Petersen 26178f72d3
Merge pull request #2358 from citusdata/fix_func_eval
Evaluate functions and parameters anywhere in query

cr: @jasonmp85
2018-09-21 13:58:53 -06:00
Marco Slot 877d703ac5
Evaluate functions (and when applicable, parameters) anywhere in query 2018-09-21 12:57:50 -06:00
Metin Döşlü 22173ae272
Merge pull request #2389 from citusdata/partitioned_tables_with_replication
Support partitioned tables with replication factor > 1
2018-09-21 18:06:41 +03:00
Onder Kalaci abc443d7fa Make sure that shard repair considers replication factor 2018-09-21 15:24:49 +03:00
Onder Kalaci 8520a5b432 worker_append_table_to_shard becomes aware of partitioned tables 2018-09-21 14:40:42 +03:00
Onder Kalaci c1b5a04f6e Allow partitioned tables with replication factor > 1
With this commit, we all partitioned distributed tables with
replication factor > 1. However, we also have many restrictions.

In summary, we disallow all kinds of modifications (including DDLs)
on the partition tables. Instead, the user is allowed to run the
modifications over the parent table.

The necessity for such a restriction have two aspects:
   - We need to acquire shard resource locks appropriately
   - We need to handle marking partitions INVALID in case
     of any failures. Note that, in theory, the parent table
     should also become INVALID, which is too aggressive.
2018-09-21 14:40:41 +03:00
Murat Tuncer 22f5af1bc3
Merge pull request #2391 from citusdata/truncate_utility
Add distributed locking to truncated mx tables
2018-09-21 14:38:00 +03:00
Murat Tuncer b6930e3db9 Add distributed locking to truncated mx tables
We acquire distributed lock on all mx nodes for truncated
tables before actually doing truncate operation.

This is needed for distributed serialization of the truncate
command without causing a deadlock.
2018-09-21 14:23:19 +03:00
Burak Velioglu 5b1dc0ac8d
Merge pull request #2381 from citusdata/add_citus_lock_waits
Add citus_lock_waits to show locked distributed queries
2018-09-20 14:59:28 +03:00
velioglu d7f75e5b48 Add citus_lock_waits to show locked distributed queries 2018-09-20 14:13:51 +03:00
Murat Tuncer 14d514d1df
Merge pull request #2383 from citusdata/pg11_drop_index
Fix drop index bug on PG11 partitioned table
2018-09-20 12:24:56 +03:00
Murat Tuncer 0f6e514bfb Fixes a bug on not being able to drop index on a partitioned table.
Reason for the failure is that PG11 introduced a new relation kind
RELKIND_PARTITIONED_INDEX to be used for partitioned indices.

We expanded our check to cover that case.
2018-09-19 13:15:05 +03:00
Marco Slot 9215c00ee2
Merge pull request #2379 from citusdata/fix_procedure_rollback
Fixes a bug preventing rollback in stored procedure
2018-09-19 11:35:30 +02:00
Önder Kalacı 513e753492
Merge pull request #2386 from citusdata/improve_walker
Use tree walker instead of mutator in relation visibility
2018-09-18 10:22:51 +03:00
Onder Kalaci 41d606b575 Use tree walker instad of mutator in relation visibility
This commit uses *_walker instead of *_mutator for performance reasons.
Given that we're only updating a functionId in the tree, the approach
seems fine.
2018-09-18 09:33:01 +03:00
Önder Kalacı f16ae31ef7
Merge pull request #2376 from citusdata/fix_crash
Relax assertion on transaction abort on PREPARE step
2018-09-17 22:57:06 +03:00
Onder Kalaci 4cae856846 Relax assertion on transaction abort on PREPARE step
In case a failure happens when a transaction is failed on PREPARE,
we used to hit an assertion for ensuring there is no pending
activity on the connection. However, that's not true after the
changes in #2031. Thus, we've replaced the assertion with a more
generic function call to consume any pending activity, if exists.
2018-09-17 18:09:16 +03:00
Önder Kalacı 8762af4473
Merge pull request #2384 from citusdata/fix_stuck_spinlock_max_backend
Prevent overflow of memory accesses during deadlock detection
2018-09-17 18:08:31 +03:00
Onder Kalaci a94184fff8 Prevent overflow of memory accesses during deadlock detection
In the distributed deadlock detection design, we concluded that prepared transactions
cannot be part of a distributed deadlock. The idea is that (a) when the transaction
is prepared it already acquires all the locks, so cannot be part of a deadlock
(b) even if some other processes blocked on the prepared transaction,  prepared transactions
 would eventually be committed (or rollbacked) and the system will continue operating.

With the above in mind, we probably had a mistake in terms of memory allocations. For each
backend initialized, we keep a `BackendData` struct. The bug we've introduced is that, we
assumed there would only be `MaxBackend` number of backends. However, `MaxBackends` doesn't
include the prepared transactions and axuliary processes. When you check Postgres' InitProcGlobal`
you'd see that `TotalProcs = MaxBackends + NUM_AUXILIARY_PROCS + max_prepared_xacts;`

This commit aligns with total procs processed with that.
2018-09-17 16:23:29 +03:00
Marco Slot e0942d9df5
Merge pull request #2332 from citusdata/tablesample
Support TABLESAMPLE in router queries
2018-09-17 15:02:58 +02:00
Jason Petersen aa16512a81
Merge pull request #2325 from citusdata/failure-packet-dumps
Attempt to stabilize packet dumps and add them back it

cr: @jasonmp85
2018-09-13 10:10:44 -06:00
Brian Cloutier 2fae06056a
Attempt to stabilize packet dumps and add them back it 2018-09-12 22:10:39 -06:00
Jason Petersen 1f64bdfc59
Merge pull request #2322 from citusdata/update-mitmproxy-version
Update mitmproxy version to remove vulnerability warnings

cr: @jasonmp85
2018-09-12 18:25:42 -06:00
Brian Cloutier 5bde8626c5
Travis uses Pipfile instead of re-specifying deps 2018-09-12 17:37:14 -06:00
Brian Cloutier e61e5d4980
Update mitmproxy version to remove vulnerability warnings 2018-09-12 17:17:22 -06:00
Murat Tuncer c3dad4bcfd
Merge pull request #2375 from citusdata/pg11_procedure
Add regression tests for procedure
2018-09-12 15:53:03 +03:00
Murat Tuncer ae0032dff8 Add regression tests for procedure calls
PG11 introduced PROCEDURE concept similar to FUNCTION
Procedure's allow committing/rolling back behavior.

This commmit adds regression tests for procedure calls.
2018-09-12 10:28:50 +03:00
Burak Velioglu 38dbc11c9a
Merge pull request #2363 from citusdata/get_whole_all_transactions
Adds UDFs for testing MX functionalities with isolation tests
2018-09-12 07:43:53 +03:00
velioglu d1f005daac Adds UDFs for testing MX functionalities with isolation tests 2018-09-12 07:04:16 +03:00
Murat Tuncer 470ee0b4d9 Revert multi_partition test back to being required
Test was marked as optional (ignore) by previous
commit. Reverting that change to make test required
2018-09-11 12:39:44 -06:00
Önder Kalacı 8e608a0e6c
Merge pull request #2360 from citusdata/dist_stat_statements
Views to provide some insight about the distributed transactions on Citus MX
2018-09-11 08:46:57 +03:00
Onder Kalaci d657759c97 Views to Provide some insight about the distributed transactions on Citus MX
With this commit, we implement two views that are very similar
to pg_stat_activity, but showing queries that are involved in
distributed queries:

    - citus_dist_stat_activity: Shows all the distributed queries
    - citus_worker_stat_activity: Shows all the queries on the shards
                                  that are initiated by distributed queries.

Both views have the same columns in the outputs. In very basic terms, both of the views
are meant to provide some useful insights about the distributed
transactions within the cluster. As the names reveal, both views are similar to pg_stat_activity.
Also note that these views can be pretty useful on Citus MX clusters.

Note that when the views are queried from the worker nodes, they'd not show the distributed
transactions that are initiated from the coordinator node. The reason is that the worker
nodes do not know the host/port of the coordinator. Thus, it is advisable to query the
views from the coordinator.

If we bucket the columns that the views returns, we'd end up with the following:

- Hostnames and ports:
   - query_hostname, query_hostport: The node that the query is running
   - master_query_host_name, master_query_host_port: The node in the cluster
                                                   initiated the query.
    Note that for citus_dist_stat_activity view, the query_hostname-query_hostport
    is always the same with master_query_host_name-master_query_host_port. The
    distinction is mostly relevant for citus_worker_stat_activity. For example,
    on Citus MX, a users starts a transaction on Node-A, which starts worker
    transactions on Node-B and Node-C. In that case, the query hostnames would be
    Node-B and Node-C whereas the master_query_host_name would Node-A.

- Distributed transaction related things:
    This is mostly the process_id, distributed transactionId and distributed transaction
    number.

- pg_stat_activity columns:
    These two views get all the columns from pg_stat_activity. We're basically joining
    pg_stat_activity with get_all_active_transactions on process_id.
2018-09-10 21:33:27 +03:00
Önder Kalacı df0ca4617f
Merge pull request #2370 from citusdata/fix_truncate_from_workers
Fix the bug introduced via allowing Truncate from MX worker nodes
2018-09-10 18:03:48 +03:00
Onder Kalaci 7de5e30432 Change flaky explain test to non-explain
This test's output changes depending on which worker is
picked for explain (e.g., worker port in the output changes).

Given that the test is only aiming to ensure that CTEs inside
CTEs work fine in DML queries, it should be fine to get rid of
the EXPLAIN. The output is verified to be correct as well.
2018-09-10 16:01:30 +03:00
Onder Kalaci 76aa6951c2 Properly send commands to other nodes
We previously implemented OTHER_WORKERS_WITH_METADATA tag. However,
that was wrong. See the related discussion:
     https://github.com/citusdata/citus/issues/2320

Instead, we switched using OTHER_WORKER_NODES and make the command
that we're running optional such that even if the node is not a
metadata node, we won't be in trouble.
2018-09-10 16:01:30 +03:00
Onder Kalaci 5cf8fbe7b6 Add infrastructure to relation if exists 2018-09-07 14:49:36 +03:00