Commit Graph

3464 Commits (fd8cdb92f444fca2f4c81383ef04bb0eebb28ccd)

Author SHA1 Message Date
Marco Slot fd8cdb92f4 Evaluate nextval in the target list on the coordinator 2020-04-02 02:53:19 +02:00
SaitTalhaNisanci d80baa3557
Merge pull request #3636 from citusdata/enh/localShardCreationExecution
add local shard creation support
2020-04-01 18:30:50 +03:00
SaitTalhaNisanci df88ab71b6 normalize assign_distributed_transaction_id in tests 2020-04-01 18:23:16 +03:00
SaitTalhaNisanci 0aebd78ea7 use localExecution in ExecuteTaskListExtended
ExecuteTaskListExtended is the common method for different codepaths,
and instead of writing separate local execution logics in different
codepaths, it makes more sense to have the logic here. We still need to
do some refactoring, this is an initial step.

After this commit, we can run create shard commands locally. There is a
special case with shard creation commands. A create shard command might
have a concatenated query string, however local execution did not know
how to execute a task with multiple query strings. This is also
implemented in this commit. We go over each query in the concatenated
query string and plan/execute them one by one.

A more clean solution to this would be to make sure that each task has a
single query. We currently cannot do that because we need to ensure the
task dependencies. However, it would make sense to do that at some point
and it would simplify the code a lot.
2020-04-01 18:23:16 +03:00
SaitTalhaNisanci ba01f3457a
use macros for pg versions instead of hardcoded values (#3694)
3 Macros are defined for removing the hardcoded pg versions.
PG_VERSION_11, PG_VERSION_12 and PG_VERSION_13.
2020-04-01 17:01:52 +03:00
Philip Dubé 4fa06388e3
Merge pull request #3689 from citusdata/fix-upgrade-type-after-ordering
upgrade_type_after: ORDER BY
2020-04-01 04:58:28 +00:00
Philip Dubé 3bb4f14efd upgrade_type_after: ORDER BY 2020-04-01 01:07:21 +00:00
Hadi Moshayedi b4ba832ae9
Merge pull request #3686 from citusdata/fix-typos
tests: remove stale comment, fix typo
2020-03-31 15:05:18 -07:00
Philip Dubé d155149c18 tests: remove stale comment, fix typo 2020-03-31 20:13:51 +00:00
Philip Dubé 4552a990e9
Merge pull request #3685 from citusdata/assert-shard-index-valid
Assert bounds checks on two array reads which rely on data not being out of bounds
2020-03-31 20:13:21 +00:00
Philip Dubé ddc3377026 Assert bounds checks on two array reads which rely on data not being out of bounds 2020-03-31 18:58:35 +00:00
Hadi Moshayedi bab4cff1c9
Merge pull request #3679 from citusdata/fix/table_type
Allow table type to be used in target list
2020-03-31 11:38:06 -07:00
Marco Slot 252abcce16 Allow table type to be used in target list 2020-03-31 11:11:01 -07:00
SaitTalhaNisanci 5bf9f32dd3
disable one of deadlock detection test (#3682)
It seems that one of the deadlock detection tests fails way too often in
our CI. The difference is only ordering. Currently it seems that it is a
good idea to disable this test for the sake of development.
2020-03-31 19:47:58 +03:00
SaitTalhaNisanci 6cd32b0db1
refactor ExecuteLocalTaskList (#3617)
ExecuteLocalTaskList doesn't need scanState as it only uses
paramListInfo, distributedPlan and tupleStoreState. It is better to pass
only the variables that the function needs, so that we can call this
function from other places when we dont have scanState.
2020-03-31 19:19:54 +03:00
SaitTalhaNisanci 96358079ac
decrease cirleci no output timeout to 2 mins from 10 mins (#3681)
We sometimes get no output timeout in our cirleci jobs. There is no
point in waiting for 10 minutes to get those timeouts. Ideally we should
see some output, this will also prevent adding a test that takes longer
than 2 mins to run.
2020-03-31 18:53:59 +03:00
SaitTalhaNisanci e04a307a4d
Merge pull request #3659 from citusdata/refactor/queryString
refactor query string of task
2020-03-31 16:12:24 +03:00
SaitTalhaNisanci b5591b1b28 use taskQuery as a struct to simplify the code 2020-03-31 15:47:55 +03:00
SaitTalhaNisanci 8806c4d697 move queryStringList into taskQuery
Also allocate task query in the memory context of task.
2020-03-31 15:47:55 +03:00
SaitTalhaNisanci c796ac335d add TaskQuery struct to abstract query string related fields
We had many fields in task related to query strings. It was kind of
complex, and only of them could be set at a time. Therefore it makes
more sense to abstract this and use a union so that it is clear that
only of them should be set.

We have three fields that could have query related strings:
- queryForLocation
- queryStringLazy
- perPlacementQueryStrings

Relatively, they can be set with:
- SetTaskQueryString
- SetTaskQueryIfShouldLazyDeparse
- SetTaskPerPlacementQueryStrings

The direct usage of the query related fields are also removed.

Rename queryForLocalExecution

Currently queryForLocalExecution is only used for deparsing purposes,
therefore it makes sense to rename it to what it is doing.
2020-03-31 15:47:55 +03:00
SaitTalhaNisanci 98f95e2a5e add TaskQueryStringForPlacement
TaskQueryStringForPlacement simplifies how the executor gets the query
string for a given placement. Task will use the necessary fields to
return the correct query placement string. Executor doesn't need to know
the details for this.

rename TaskQueryString as TaskQueryStringAllPlacements

TaskQueryString returns the query string that will be the same for all
the placements. In INSERT..SELECT the query string can be different for
each placement. Adaptive executor uses TaskQueryStringForPlacement,
which returns the query string for a placement. It makes sense to rename
TaskQueryString as TaskQueryStringAllPlacements as it is returning the
query string for all placements.

rename SetTaskQuery as SetTaskQueryIfShouldLazyDeparse

SetTaskQuery does not always sets the task query. It can set the query
string as well. So it is more clear to name it
SetTaskQueryIfShouldLazyDeparse, since it will set the query not query
string only when we should deparse the query in a lazy way.
2020-03-31 15:47:55 +03:00
SaitTalhaNisanci 982b5fbabf add SetTaskPerPlacementStrings
It is possible that a task will have different query string for each
placement. This is the case in INSERT..SELECT via repartitioning. When
we are setting task->perPlacementQueryString, we should set
queryStringLazy to NULL. Therefore a method for that purpose is created.
2020-03-31 15:47:55 +03:00
Marco Slot 157f4599c3
Merge pull request #3668 from citusdata/fix/left_join_pk
Fix error when using LEFT JOIN with GROUP BY on primary key
2020-03-31 10:30:53 +02:00
SaitTalhaNisanci e1802c5c00
extract local plan cache related methods into a file (#3667) 2020-03-31 11:11:34 +03:00
SaitTalhaNisanci 8dfc2cb122
not append ; if end of the list in StringJoin (#3672) 2020-03-31 10:01:28 +03:00
Philip Dubé 67d2ad4e37
Fixes flaky test in multi_reference_table: ORDER BY (#3676)
Fixes app.circleci.com/pipelines/github/citusdata/citus/7744/workflows/0848f36c-af9e-46b7-9dda-a421df54ba56/jobs/109503
2020-03-30 23:31:10 +02:00
Philip Dubé ae1e92e337
Merge pull request #3670 from citusdata/avoid-stale-metadata
multi_copy.c: remove tableMetadata
2020-03-30 20:00:25 +00:00
Philip Dubé 4eb2c33f38 multi_copy.c: remove tableMetadata 2020-03-30 19:26:44 +00:00
Onur Tirtir aedfc99b62
Update CHANGELOG for 9.2.4 (#3675) 2020-03-30 20:45:26 +03:00
Marco Slot 331b45348c Fix error when using LEFT JOIN with GROUP BY on primary key 2020-03-30 16:42:22 +02:00
Jelte Fennema 3be665269f
Reintroduce ForceSearchShardPlacementInList (#3664)
This was added to silence static analysis errors. It was removed
accidentally in #3591. This reintroduces it again.
2020-03-27 14:28:50 +01:00
Hanefi Onaldi c0930d157e
Merge pull request #3510 from citusdata/alter-role-set-propagation
In PostgreSQL, user defaults for config parameters can be changed by
ALTER ROLE .. SET statements. We wish to propagate those defaults
across the Citus cluster so that the behavior will be similar in
different workers.

The defaults can either be set in a specific database, or the whole
cluster, similarly they can be set for a single role or all roles.

We propagate the ALTER ROLE .. SET if all the conditions below are met:
- The query affects the current database, or all databases
- The user is already created in worker nodes
2020-03-27 14:04:39 +03:00
Hanefi Onaldi 0e8103b101
Propagate ALTER ROLE .. SET statements
In PostgreSQL, user defaults for config parameters can be changed by
ALTER ROLE .. SET statements. We wish to propagate those defaults
accross the Citus cluster so that the behaviour will be similar in
different workers.

The defaults can either be set in a specific database, or the whole
cluster, similarly they can be set for a single role or all roles.

We propagate the ALTER ROLE .. SET if all the conditions below are met:
- The query affects the current database, or all databases
- The user is already created in worker nodes
2020-03-27 13:02:48 +03:00
Philip Dubé bda1f1d530
Merge pull request #3661 from citusdata/fix/agg_evaluation
Fixes a bug that causes some DML queries containing aggregates to fail
2020-03-26 16:14:42 +00:00
Marco Slot a65ffee266 Fixes a bug that causes some DML queries containing aggregates to fail 2020-03-26 16:08:34 +00:00
SaitTalhaNisanci d3fdade2e8
add missing perPlacementQueryStrings to copy and out funcs (#3657) 2020-03-26 17:16:29 +03:00
Marco Slot 6bc3895b02
Merge pull request #3651 from citusdata/fix/srf_evaluation
Fix a bug which caused queries with SRFs and function evaluation to fail
2020-03-26 14:48:26 +01:00
SaitTalhaNisanci dd1a456407
store query command list in task (#3649)
Sometimes we have concatenated query strings for a task. However,
when we want to find each query string, it is not a trivial task.
Therefore, it makes sense to store this in task so that when we need
each query string we can easily get it.
2020-03-26 12:04:08 +03:00
Philip Dubé 4686133bf2
Merge pull request #3653 from citusdata/fix-grouping-sets-segfault
Don't segfault on queries using GROUPING
2020-03-25 17:43:26 +00:00
Philip Dubé 0ad1956551
Merge pull request #3537 from citusdata/master-window-functions
Master window functions
2020-03-25 17:27:31 +00:00
Philip Dubé 917cb6ae93 Don't segfault on queries using GROUPING
GROUPING will always return 0 outside of GROUPING SETS, CUBE, or ROLLUP
Since we don't support those, it makes sense to reject GROUPING in queries
2020-03-25 15:46:43 +00:00
Philip Dubé 720525cfda Add support for window functions on coordinator
Some refactoring:
Consolidate expression which decides whether GROUP BY/HAVING are pushed down
Rename early pullUpIntermediateRows to hasNonDistributableAggregates
Create WorkerColumnName to handle formatting WORKER_COLUMN_FORMAT
Ignore NULL StringInfo pointers to SafeToPushdownWindowFunction
Fix bug where SubqueryPushdownMultiNodeTree mutates supplied Query,
	SafeToPushdownWindowFunction requires the original query as it relies on rtable
2020-03-25 15:31:20 +00:00
Jelte Fennema 36ff150465
Update CHANGELOG for v9.2.3 (#3648) 2020-03-25 14:32:55 +01:00
Nils Dijk 4e611cfc25
Refactor dependency resolution and resolve from pg_shdepend (#3633)
DESCRIPTION: Refactor dependency resolution and resolve from pg_shdepend

This PR refactors how dependencies are resolved by not assuming solely a `pg_depend` record describing the dependency. Instead we keep a definition of the dependency around which records how the dependency is resolved. This can be one of the following ways
 - `pg_depend`, data will contain a copy of the `pg_depend` record
 - `pg_shdepend`, data will contain a copy of the `pg_shdepend` record
 - `ObjectAddress`, data will contain only an `ObjectAddress` describing a dependency

Irregardless of way the dependency was found it will always be able to get to the address of the dependency as that is the most important property.

For some checks we can inspect the source where the dependency was found and perform a deep inspection to decide if we want to follow the dependency. This is important to not distribute dependencies coming from extensions for example.
2020-03-25 13:38:25 +01:00
Onur Tirtir eaaf302795
Merge pull request #3644 from citusdata/refactor/small-typos-etc
Move MakeNameListFromRangeVar function and some other small changes
2020-03-25 11:36:50 +03:00
Onur Tirtir 52fd58d51f move MakeNameListFromRangeVar function to a more appropriate file 2020-03-25 11:01:50 +03:00
Onur Tirtir 2396b66ac5 remove an outdated comment in local executor 2020-03-25 11:01:40 +03:00
Onur Tirtir 8ebb8ef31d use PG_USED_FOR_ASSERTS_ONLY 2020-03-25 11:01:33 +03:00
Onur Tirtir 81d48d3466 fix some typos 2020-03-25 11:01:26 +03:00
Marco Slot b89e9dc158 Fix a bug which caused queries with SRFs and function evalution to fail 2020-03-25 06:55:53 +01:00