Commit Graph

2278 Commits (1bb0ec316adec7302a9ec1c872cae40ff4f35fb6)

Author SHA1 Message Date
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
Önder Kalacı 5ddba6a7cd
Merge pull request #2367 from citusdata/fix_wrong_escaping
Do not recover wrong distributed transactions in MX
2018-09-07 11:44:11 +03:00
Onder Kalaci bf28dd0cff Do not recover wrong distributed transactions in MX 2018-09-07 09:52:46 +03:00
Murat Tuncer e5bba08595
Merge pull request #2366 from citusdata/fix_pg11_build_failure
Reflect changed index for constraint scans in PG11
2018-09-07 08:23:04 +03:00
Murat Tuncer 65276311f7 Reflect changed index for constraint scans in PG11 2018-09-07 08:07:01 +03:00
Murat Tuncer 7b63b23808
Merge pull request #2364 from citusdata/pg11_feature_index_include
Add support for INCLUDE option in index creation
2018-09-06 20:46:33 +03:00
Murat Tuncer d8279569b8 Add support for INCLUDE option in index creation
INCLUDE is a new feature in index creation in PG11.
Included column/expression paramameters are now forwarded to shards
2018-09-06 19:41:06 +03:00
Murat Tuncer 0c1bb26448
Merge pull request #2359 from citusdata/pg11_features
Add regression tests related to new PG11 partitioning features
2018-09-06 19:39:06 +03:00
Murat Tuncer 7d3f7c2bf4 Add regression tests related to new PG11 partitioning features 2018-09-06 19:06:28 +03:00
Murat Tuncer ee27637c11
Merge pull request #2368 from citusdata/allow_pg11_failures
Temporarily allow PG11 failures
2018-09-06 18:48:27 +03:00
Murat Tuncer c7094c083b Temporarily allow PG11 failures
This is a temporary commit to unblock PG11 failures at travis
until end of milestone.
2018-09-06 18:33:43 +03:00
Murat Tuncer 49645d1aee
Merge pull request #2361 from citusdata/pg11_features_part_2
Add regression tests for new PG11 window functions
2018-09-06 08:55:55 +03:00
Murat Tuncer 55cf3e321c Add regression tests for new PG11 window functions
- <offset> preceding/following
- exclude
2018-09-04 10:48:04 +03:00
Önder Kalacı c64f669755
Merge pull request #2343 from citusdata/fix_drop_table_deadlock
Make sure that table (and metadata) is dropped before shards are dropped on Citus MX
2018-09-04 09:44:57 +03:00
Onder Kalaci 1b3257816e Make sure that table is dropped before shards are dropped
This commit fixes a bug where a concurrent DROP TABLE deadlocks
with SELECT (or DML) when the SELECT is executed from the workers.

The problem was that Citus used to remove the metadata before
droping the table on the workers. That creates a time window
where the SELECT starts running on some of the nodes and DROP
table on some of the other nodes.
2018-09-04 08:57:20 +03:00
Önder Kalacı 3ace0ad5eb
Merge pull request #2345 from citusdata/truncate_on_workers
Support TRUNCATE from the MX worker nodes
2018-09-03 15:29:14 +03:00
Onder Kalaci 2ab0e63b30 Fix flaky test 2018-09-03 14:06:32 +03:00
Onder Kalaci 26e308bf2a Support TRUNCATE from the MX worker nodes
This commit enables support for TRUNCATE on both
distributed table and reference tables.

The basic idea is to acquire lock on the relation by sending
the TRUNCATE command to all metedata worker nodes. We only
skip sending the TRUNCATE command to the node that actually
executus the command to prevent a self-distributed-deadlock.
2018-09-03 14:06:31 +03:00
Onder Kalaci 97ba7bf2eb Add the option to skip the node that is executing the node 2018-09-03 14:01:24 +03:00
Marco Slot f34ab55389 Fix bug preventing rollback in stored procedure 2018-08-31 20:49:20 +02:00
Marco Slot 55f46acedf Support TABLESAMPLE in router queries 2018-08-31 13:22:38 +02:00
Burak Velioglu a4c6cefb17
Merge pull request #2351 from citusdata/master-update-changelog-28082018
Add changelog entry for 7.5.1
2018-08-28 14:09:22 +03:00
velioglu b6cee4bb96 Add changelog entry for 7.5.1 2018-08-28 13:34:37 +03:00
Burak Velioglu eb2318f413
Merge pull request #2333 from citusdata/dml_on_ref_mx
Adds support for writing to reference tables from MX nodes.
2018-08-28 09:06:43 +03:00
velioglu bd30e3e908 Add support for writing to reference tables from MX nodes 2018-08-27 18:15:04 +03:00
velioglu 2639149bd8 Enterprise functions about metadata/resource locks 2018-08-27 16:32:20 +03:00