Commit Graph

1992 Commits (aeef44e60fc149cbb39ba03edbde331d5ec2657a)

Author SHA1 Message Date
Brian Cloutier 735218ee5d Remove sslmode structs and add more helpful description 2018-07-05 14:12:36 +02:00
Nils Dijk 1bff1c2d3d
Merge pull request #2254 from citusdata/feature/policy-stub
create placeholder for policy ddl
2018-07-05 12:45:35 +02:00
Nils Dijk c1c8c38dc9 create placeholder for policy ddl 2018-07-05 11:07:01 +02:00
Mehmet Furkan ŞAHİN 19e92ee369
Merge pull request #2186 from citusdata/hll_agg_support
Hll aggregate support
2018-07-05 10:42:00 +03:00
mehmet furkan şahin df11dda750 hll aggregates are tested 2018-07-05 08:19:01 +03:00
mehmet furkan şahin 06217be326 hll aggregate functions are supported natively 2018-07-04 16:41:09 +03:00
Marco Slot 0c33d7ea9a
Merge pull request #2251 from citusdata/landlord_base
Move partition key logging related code from enterprise
2018-07-04 12:34:28 +02:00
Murat Tuncer 901066a421 Move partition key logging related code from enterprise 2018-07-04 13:11:34 +03:00
Mehmet Furkan ŞAHİN b480bf8d0e
Merge pull request #2240 from citusdata/foreign_master
Foreign Key support from distributed to reference tables
2018-07-03 17:55:59 +03:00
mehmet furkan şahin f7b901e3fd CopyShardForeignConstraintCommandList API change for grouped constraints 2018-07-03 17:05:55 +03:00
mehmet furkan şahin 35eac2318d lock referenced reference table metadata is added
For certain operations in enterprise, we need to lock the
referenced reference table shard distribution metadata
2018-07-03 17:05:55 +03:00
Onder Kalaci d83be3a33f Enforce foreign key restrictions inside transaction blocks
When a hash distributed table have a foreign key to a reference
table, there are few restrictions we have to apply in order to
prevent distributed deadlocks or reading wrong results.

The necessity to apply the restrictions arise from cascading
nature of foreign keys. When a foreign key on a reference table
cascades to a distributed table, a single operation over a single
connection can acquire locks on multiple shards of the distributed
table. Thus, any parallel operation on that distributed table, in the
same transaction should not open parallel connections to the shards.
Otherwise, we'd either end-up with a self-distributed deadlock or
read wrong results.

As briefly described above, the restrictions that we apply is done
by tracking the distributed/reference relation accesses inside
transaction blocks, and act accordingly when necessary.

The two main rules are as follows:
   - Whenever a parallel distributed relation access conflicts
     with a consecutive reference relation access, Citus errors
     out
   - Whenever a reference relation access is followed by a
     conflicting parallel relation access, the execution mode
     is switched to sequential mode.

There are also some other notes to mention:
   - If the user does SET LOCAL citus.multi_shard_modify_mode
     TO 'sequential';, all the queries should simply work with
     using one connection per worker and sequentially executing
     the commands. That's obviously a slower approach than Citus'
     usual parallel execution. However, we've at least have a way
     to run all commands successfully.

   - If an unrelated parallel query executed on any distributed
     table, we cannot switch to sequential mode. Because, the essense
     of sequential mode is using one connection per worker. However,
     in the presence of a parallel connection, the connection manager
     picks those connections to execute the commands. That contradicts
     with our purpose, thus we error out.

   - COPY to a distributed table cannot be executed in sequential mode.
     Thus, if we switch to sequential mode and COPY is executed, the
     operation fails and there is currently no way of implementing that.
     Note that, when the local table is not empty and create_distributed_table
     is used, citus uses COPY internally. Thus, in those cases,
     create_distributed_table() will also fail.

   - There is a GUC called citus.enforce_foreign_key_restrictions
     to disable all the checks. We added that GUC since the restrictions
     we apply is sometimes a bit more restrictive than its necessary.
     The user might want to relax those. Similarly, if you don't have
     CASCADEing reference tables, you might consider disabling all the
     checks.
2018-07-03 17:05:55 +03:00
velioglu 6be6911ed9 Create foreign key relation graph and functions to query on it 2018-07-03 17:05:55 +03:00
mehmet furkan şahin 89a8d6ab95 FK from dist to ref is tested for partitioning, MX 2018-07-03 17:05:55 +03:00
mehmet furkan şahin 4db72c99f6 Specific DDLs are sequentialized when there is FK
-[x] drop constraint
-[x] drop column
-[x] alter column type
-[x] truncate

are sequentialized if there is a foreign constraint from
a distributed table to a reference table on the affected relations
by the above commands.
2018-07-03 17:05:55 +03:00
mehmet furkan şahin e37f76c276 tests are added 2018-07-03 17:05:01 +03:00
mehmet furkan şahin 2c5d59f3a8 create_distributed_table in transaction is fixed 2018-07-03 17:05:01 +03:00
mehmet furkan şahin 45f8017f42 create_distributed_table with fk to ref table is implemented 2018-07-03 17:05:01 +03:00
mehmet furkan şahin 2fa4e38841 FK from dist to ref can be added with alter table 2018-07-03 17:05:01 +03:00
Murat Tuncer 58486fd1b9
Merge pull request #2247 from citusdata/enable_preloading_libraries
Add pg_stat_statements to shared_preload_libraries if installed
2018-07-03 16:59:34 +03:00
Murat Tuncer 3fc98e8225 Add pg_stat_statements to shared_preload_libraries if installed 2018-07-03 16:33:15 +03:00
Murat Tuncer 54aa865c3c
Merge pull request #2249 from citusdata/landlord_base
Update citus_stat_statements view and regression tests
2018-07-03 16:32:47 +03:00
Murat Tuncer 23800f50f1 Update citus_stat_statements view and regression tests 2018-07-03 16:14:13 +03:00
Murat Tuncer 493e3b1b9e
Merge pull request #2248 from citusdata/partition_key_extraction_fix
Strip implicit coercions when determining partition key value of an INSERT
2018-07-02 18:21:16 +03:00
Murat Tuncer e532755a6e Fix bug in partition column extraction
added strip_implicit_coercion prior to
checking if the expression is Const.
This is important to find values for types
like bigint.
2018-07-02 18:08:16 +03:00
Murat Tuncer a3f1350bfe
Merge pull request #2246 from citusdata/bump-tools-version
Bump tools version in .travis.yml
2018-07-02 15:44:36 +03:00
Burak Yucesoy 06589131d7 Bump tools version in .travis.yml
To be able to test landlord in travis, we need pg_stat_statements from
contrib packages. New tools version, 0.7.8, installs pg_stat_statements
too, so we are switching to version 0.7.8 in our travis tests.
2018-07-02 14:55:23 +03:00
Murat Tuncer 1c95d5d497
Merge pull request #2242 from citusdata/master_stage_protocol_refactoring
Apply master_stage_protocol refactoring changes
2018-06-28 14:23:48 +03:00
Murat Tuncer 3fc7cdfe6d Apply master_stage_protocol refactoring changes 2018-06-28 11:24:57 +03:00
Murat Tuncer 86a3dd5a90
Merge pull request #2235 from citusdata/landlord_base
Add groundwork for citus_stat_statements api
2018-06-27 14:47:18 +03:00
Murat Tuncer 4d35b92016 Add groundwork for citus_stat_statements api 2018-06-27 14:20:03 +03:00
Brian Cloutier 5ce18327a7 Don't spinloop when trying to cleanup a failed connection 2018-06-26 13:13:34 -07:00
Önder Kalacı d63cbf3822
Merge pull request #2220 from citusdata/relation_access_via_placement_access
Track relation accesses using the connection management infrastructure
2018-06-25 22:52:57 +03:00
Onder Kalaci 4ccabf9544 Increase timeout to keep appveyor happy 2018-06-25 18:40:40 +03:00
Onder Kalaci 7d0f7835e7 Improve relation accesses association to do less job 2018-06-25 18:40:40 +03:00
Onder Kalaci 8ccb8b679e Real-time executor marks multi shard relation accesses before opening connections 2018-06-25 18:40:31 +03:00
Onder Kalaci 2890154420 Make sure that TRUNCATE always opens a DDL access 2018-06-25 18:40:31 +03:00
Onder Kalaci 21038f0d0e Make sure that inter-shard DDL commands are always covers both tables 2018-06-25 18:40:30 +03:00
Onder Kalaci 2f01894589 Track relation accesses using the connection management infrastructure 2018-06-25 18:40:30 +03:00
Önder Kalacı 8520ecc460
Merge pull request #2232 from citusdata/start_non_data_access
Use non-data connection for intermediate results
2018-06-21 15:33:49 +03:00
Onder Kalaci d5472614df Use non-data connection for intermediate results
Make sure that intermediate results use a connection that is
not associated with any placement. That is useful in two ways:
    - More complex queries can be executed with CTEs
    - Safely use the same connections when there is a foreign key
      to reference table from a distributed table, which needs to
      use the same connection for modifications since the reference
      table might cascade to the distributed table.
2018-06-21 13:26:13 +03:00
Önder Kalacı 460eb6f295
Merge pull request #2229 from citusdata/improve_tests
Move test UDF under test folder
2018-06-21 09:29:54 +03:00
Onder Kalaci 7762d81cba Move test UDF under test folder 2018-06-21 08:42:44 +03:00
Jason Petersen 7a75c2ed31 Add connparam invalidation trigger creation logic
This needs to live in Community, since we haven't yet added the com-
plication of having divergent upgrade scripts in Enterprise.
2018-06-20 14:13:18 -06:00
Burak Velioglu 19cadf52ca
Merge pull request #2230 from citusdata/changelog-7.4.1
Add changelog entry for 7.4.1
2018-06-20 12:24:56 +03:00
velioglu 0ce613405e Add changelog entry for 7.4.1 2018-06-20 11:26:15 +03:00
Mehmet Furkan ŞAHİN 42be04551c
Merge pull request #2227 from citusdata/seq_create_distributed_table
create_distributed_table honors sequential mode
2018-06-19 22:03:14 +03:00
mehmet furkan şahin 2b2ce036eb create_distributed_table honors sequential mode 2018-06-19 17:33:45 +03:00
Önder Kalacı 0c47d16e8e
Merge pull request #2224 from citusdata/set_local_via_c
Implement C interface for setting GUC
2018-06-19 12:14:57 +03:00
Onder Kalaci 8f5821493a Implement C interface for setting GUC
We need the ability to switch to sequential mode (e.g.,
 SET LOCAL citus.multi_shard_modify_mode = 'sequential'). This
commit enables that.
2018-06-19 10:23:43 +03:00