Commit Graph

2595 Commits (c582eb89c8ab1947aa8f19e1af6a09cdbd04512c)

Author SHA1 Message Date
Jason Petersen 5baa257c91 Add second assert to guard against future changes
This isn't entirely necessary but I feel safer with it here.
2019-03-22 20:32:19 -06:00
Jason Petersen 69adb627c3 Add Assert that will crash before coercion fix is in 2019-03-22 20:32:19 -06:00
Hadi Moshayedi ff1d4f697a
Ignore test_times.log (#2638) 2019-03-22 10:29:01 -07:00
Nils Dijk feaac69769
Implementation for asycn FinishConnectionListEstablishment (#2584) 2019-03-22 17:30:42 +01:00
Marco Slot 7a094edc4c
Merge pull request #2635 from citusdata/rescan_withhold
Allow rescan in DECLARE .. WITH HOLD
2019-03-22 16:09:01 +01:00
Marco Slot e3b7e74f43 Allow rescan in DECLARE .. WITH HOLD 2019-03-22 11:25:55 +01:00
Jason Petersen 1a7c73c37b
Merge pull request #2632 from citusdata/fix_conninfo_memory_bugs
Fix conninfo memory bugs

cr: @onderkalaci, @marcocitus
2019-03-21 12:47:12 -06:00
Jason Petersen a2c6f596f9 Address code review comments 2019-03-21 11:59:52 -06:00
Jason Petersen 04aa34da68 Invalidate ConnParamsHash at config reload
At configuration reload, we free all "global" (i.e. GUC-set) connection
parameters, but these may still have live references in the connection
parameters hash. By marking the entries as invalid, we can ensure they
will not be used after free.
2019-03-21 00:03:35 -06:00
Jason Petersen 00d836e5a3 alloc non-global conn. params in provided context
Having DATA-segment string literals made blindly freeing the keywords/
values difficult, so I've switched to allocating all in the provided
context; because of this (and with the knowledge of the end point of
the global parameters), we can safely pfree non-global parameters when
we come across an invalid connection parameter entry.
2019-03-21 00:03:35 -06:00
Önder Kalacı 67ecbe821a
Merge pull request #2633 from citusdata/trivial_parts_of_faster_all_things
Decrease CPU overhead of some of the planner functions
2019-03-20 11:27:43 +01:00
Marco Slot e8152d9b6d Only look in top-level rtable in ExtractFirstDistributedTableId 2019-03-20 12:14:46 +03:00
Marco Slot ee6a0b6943 Speed up RTE walkers
Do it in two ways (a) re-use the rte list as much as possible instead of
re-calculating over and over again (b) Limit the recursion to the relevant
parts of the query tree
2019-03-20 12:14:46 +03:00
Marco Slot 5ff1821411 Cache the current database name
Purely for performance reasons.
2019-03-20 12:14:46 +03:00
Marco Slot 0ea4e52df5 Add nodeId to shardPlacements and use it for shard placement comparisons
Before this commit, shardPlacements were identified with shardId, nodeName
and nodeport. Instead of using nodeName and nodePort, we now use nodeId
since it apparently has performance benefits in several places in the
code.
2019-03-20 12:14:46 +03:00
Önder Kalacı 32ee0217d5
Merge pull request #2617 from citusdata/add_more_tests
Add some more regression tests for outer join pushdown
2019-03-19 11:01:20 +01:00
Onder Kalaci 41d8c4030a Add some more regression tests for outer join pushdown 2019-03-19 11:49:38 +03:00
Önder Kalacı 7914a039a7
Merge pull request #2628 from citusdata/fix_infinite_recursion
Some queries lead to infinite recursion during recursive planning
2019-03-18 15:15:25 +01:00
Onder Kalaci ad5ff1d01a Some queries lead to infinite recursion with recurisve planning
The rule for infinite recursion is the following:

    - If the query contains a subquery which is recursively planned, and
      no other subqueries can be recursively planned due to correlation
      (e.g., LATERAL joins), the planner keeps recursing again and again.

One interesting thing here is that even if a subquery contains only intermediate
result(s), we re-recursively plan that. In the end, the logic in the code does the following:

  - Try recursive planning any of the subqueries in the query tree
     - If any subquery is recursively planned, call the planner again
        where the subquery is replaced with the intermediate result.
        - Try recursively planning any of the queries
          - If any subquery is recursively planned, call the planner again
            where the subquery (in this case it is already intermediate result)
            is replaced with the intermediate result.
              - Try recursively planning any of the queries
                - If any subquery is recursively planned, call the planner again
                  where the subquery (in this case it is already intermediate result)
                  is replaced with the intermediate result.
                  - Try recursively planning any of the queries
                    - If any subquery is recursively planned, call the planner again
                      where the subquery (in this case it is already intermediate result)
                      is replaced with the intermediate result.
                      ......
2019-03-18 10:35:00 +03:00
Jason Petersen 8787cb3199
Merge pull request #2587 from citusdata/xact_functions
Treat functions as transaction blocks

cr: @jasonmp85
2019-03-15 16:54:20 -06:00
Marco Slot f2abf2b8e5 Functions are treated as transaction blocks 2019-03-15 16:34:08 -06:00
Marco Slot 4b9bd54ae0 Remove create_insert_proxy_for_table 2019-03-15 14:13:03 -06:00
exialin 84b853e1b5 Fix some typos (#2620) 2019-03-14 16:48:31 -07:00
Hadi Moshayedi cd00e92cbc
Merge pull request #2629 from citusdata/disable_constraint_checking_on_coordinator
Don't execute ALTER TABLE constraint checks in coordinator.
2019-03-14 16:14:30 -07:00
Hadi Moshayedi a9e6d06a98 Skip execution of ALTER TABLE constraint checks on the coordinator 2019-03-14 15:40:56 -07:00
Hadi Moshayedi cdd3b15ac8 Fix distributed deadlock for ALTER TABLE ... ATTACH PARTITION.
Following scenario resulted in distributed deadlock before this commit:

CREATE TABLE partitioning_test(id int, time date) PARTITION BY RANGE (time);
CREATE TABLE partitioning_test_2009 (LIKE partitioning_test);
CREATE TABLE partitioning_test_reference(id int PRIMARY KEY, subid int);

SELECT create_distributed_table('partitioning_test_2009', 'id'),
       create_distributed_table('partitioning_test', 'id'),
       create_reference_table('partitioning_test_reference');

ALTER TABLE partitioning_test ADD CONSTRAINT partitioning_reference_fkey FOREIGN KEY (id) REFERENCES partitioning_test_reference(id) ON DELETE CASCADE;
ALTER TABLE partitioning_test_2009 ADD CONSTRAINT partitioning_reference_fkey_2009 FOREIGN KEY (id) REFERENCES partitioning_test_reference(id) ON DELETE CASCADE;

ALTER TABLE partitioning_test ATTACH PARTITION partitioning_test_2009 FOR VALUES FROM ('2009-01-01') TO ('2010-01-01');
2019-03-14 15:28:37 -07:00
Hadi Moshayedi f19feb742c
Remove never assigned colocatedRelation from CreateDistributedTable (#2479) 2019-03-12 14:50:18 -07:00
Hanefi Onaldi 2e0860489f
Merge pull request #2602 from citusdata/improve-mitmproxy-documentation
Also:
- migrate mitmproxy readme to markdown
- create failure test contribution guidelines
2019-03-12 08:26:35 -07:00
Hanefi Onaldi 419f52884f
Merge branch 'master' into improve-mitmproxy-documentation 2019-03-12 07:16:01 -07:00
Murat Tuncer e813df4d7f
Merge pull request #2601 from citusdata/fix_column_alias
Add support for column aliases on join clauses
2019-03-07 13:39:11 +03:00
Murat Tuncer 2681231c98 Create column aliases for shard tables in worker queries when requested 2019-03-07 12:54:42 +03:00
Hadi Moshayedi f4d3b94e22
Fix some of the casts for groupId (#2609)
A small change which partially addresses #2608.
2019-03-05 12:06:44 -08:00
Burak Velioglu 900ffa76f5
Merge pull request #2597 from citusdata/full_outer_pushdown
Fix full outer join with subquery pushdown
2019-03-05 17:08:08 +03:00
velioglu faf50849d7 Enhance pushdown planning logic to handle full outer joins with using clause
Since flattening query may flatten outer joins' columns into coalesce expr that is
in the USING part, and that was not expected before this commit, these queries were
erroring out. It is fixed by this commit with considering coalesce expression as well.
2019-03-05 11:49:30 +03:00
Önder Kalacı 6594ffafa1
Merge pull request #2618 from citusdata/fix_relation_size_leak
Make sure to clear `PGresult` in missing places
2019-03-01 14:44:43 +01:00
Onder Kalaci 26f569abd8 Make sure to clear PGresult on few places
This leads to a memory leak otherwise.
2019-02-28 13:44:34 +03:00
Jason Petersen bf9a119b6f
Merge pull request #2616 from citusdata/circleci
Enable CircleCI
2019-02-26 23:48:11 -07:00
Jason Petersen dceaae3b95
Remove codecov push from Travis build 2019-02-26 23:01:40 -07:00
Jason Petersen 6c3f7b665f
Squelch indentation errors (uncrustify is old in Travis) 2019-02-26 23:01:40 -07:00
Jason Petersen 3df2f51881
Turn on style-checking, fix lingering violations
We'd been ignoring updating uncrustify for some time now because I'd
thought these were misclassifications that would require an update in
our rules to address. Turns out they're legit, so I'm checking them in.
2019-02-26 23:01:40 -07:00
Jason Petersen 383871af7e
Upload Codecov results after test runs
Our first orb use!
2019-02-26 23:01:40 -07:00
Jason Petersen 5817bc3cce
Add test-timing script
Through some clever stream redirections and options, we can get decent
timing data for each of our tests.
2019-02-26 23:01:40 -07:00
Jason Petersen 1b605a6109
Modernize coverage options
These hadn't been looked at in a while, and I'm somewhat certain they
actually were running with optimization on, which is pretty bad.

Swapped out the lower-level flags for `--coverage`, which will work
with both `clang` and `gcc`. On some platforms, linker flags are need-
ed as well.
2019-02-26 22:20:31 -07:00
Jason Petersen 5db45bac45
Enable CircleCI
The configuration for the build is in the YAML file; the changes to the
regression runner are backward-compatible with Travis and just add the
logic to detect whether our custom (isolation- and vanilla-enabled) pkg
is present.
2019-02-26 22:17:26 -07:00
Önder Kalacı 25b5fc9d14
Merge pull request #2610 from citusdata/improve_round_robin
Add transactionId based round robin policy
2019-02-25 13:12:24 +01:00
Onder Kalaci f706772b2f Round-robin task assignment policy relies on local transaction id
Before this commit, round-robin task assignment policy was relying
on the taskId. Thus, even inside a transaction, the tasks were
assigned to different nodes. This was especially problematic
while reading from reference tables within transaction blocks.
Because, we had to expand the distributed transaction to many
nodes that are not necessarily already in the distributed transaction.
2019-02-22 19:26:38 +03:00
Önder Kalacı acc2b0a387
Merge pull request #2606 from citusdata/fast_path_router_planner
Introduce fast path router planning
2019-02-22 17:17:17 +01:00
Onder Kalaci e521e7e39c Apply feedback 2019-02-22 18:14:30 +03:00
Onder Kalaci 407d0e30f5 Fix selectForUpdate bug 2019-02-21 18:21:41 +03:00
Onder Kalaci f144bb4911 Introduce fast path router planning
In this context, we define "Fast Path Planning for SELECT" as trivial
queries where Citus can skip relying on the standard_planner() and
handle all the planning.

For router planner, standard_planner() is mostly important to generate
the necessary restriction information. Later, the restriction information
generated by the standard_planner is used to decide whether all the shards
that a distributed query touches reside on a single worker node. However,
standard_planner() does a lot of extra things such as cost estimation and
execution path generations which are completely unnecessary in the context
of distributed planning.

There are certain types of queries where Citus could skip relying on
standard_planner() to generate the restriction information. For queries
in the following format, Citus does not need any information that the
standard_planner() generates:

  SELECT ... FROM single_table WHERE distribution_key = X;  or
  DELETE FROM single_table WHERE distribution_key = X; or
  UPDATE single_table SET value_1 = value_2 + 1 WHERE distribution_key = X;

Note that the queries might not be as simple as the above such that
GROUP BY, WINDOW FUNCIONS, ORDER BY or HAVING etc. are all acceptable. The
only rule is that the query is on a single distributed (or reference) table
and there is a "distribution_key = X;" in the WHERE clause. With that, we
could use to decide the shard that a distributed query touches reside on
a worker node.
2019-02-21 13:27:01 +03:00