Commit Graph

6683 Commits (1a5cf9d857a13123c14cd10ff06d55367d6c9b06)

Author SHA1 Message Date
Gürkan İndibay 1a5cf9d857
Merge branch 'main' into citus_pause_node 2023-08-08 20:19:09 +03:00
Naisila Puka 6056cb2c29
PG16 compatibility - get_relation_info hook to avoid crash from adjusted partitioning (#7099)
PG16 compatibility - Part 5

Check out part 1 42d956888d
part 2 0d503dd5ac
part 3 907d72e60d
part 4 7c6b4ce103

This commit is in the series of PG16 compatibility commits. Find the explanation below:

If we allow to adjust partitioning, we get a crash when accessing
amcostestimate of partitioned indexes, because amcostestimate is NULL
for them. The following PG commit is the culprit:
3c569049b7
3c569049b7b502bb4952483d19ce622ff0af5fd6
Previously, partitioned indexes would just be ignored.
Now, they are added in the list. However get_relation_info expects the
tables which have partitioned indexes to have the inh flag set properly.
AdjustPartitioningForDistributedPlanning plays with that flag, hence we
don't get the desired behaviour.
The hook is simply removing all partitioned indexes from the list.

More PG16 compatibility commits are coming soon ...
2023-08-08 15:51:21 +03:00
Gürkan İndibay 3fbe5e4861
Update src/backend/distributed/sql/citus--12.0-1--12.1-1.sql
Co-authored-by: Hanefi Onaldi <Hanefi.Onaldi@microsoft.com>
2023-08-07 18:45:30 +03:00
Gürkan İndibay de83b01305
Update src/backend/distributed/sql/downgrades/citus--12.1-1--12.0-1.sql
Co-authored-by: Hanefi Onaldi <Hanefi.Onaldi@microsoft.com>
2023-08-07 18:44:50 +03:00
Gürkan İndibay d10eb05b31
Merge branch 'main' into citus_pause_node 2023-08-06 22:00:37 +03:00
Naisila Puka 7c6b4ce103
PG16 compatibility - outer join checks, subscription password, crash fixes (#7097)
PG16 compatibility - Part 4

Check out part 1 42d956888d
part 2 0d503dd5ac
part 3 907d72e60d

This commit is in the series of PG16 compatibility commits.
It adds some outer join checks to the planner,
the new password_required option to the subscription,
and a crash fix related to PGIOAlignedBlock, see below for more details:

- Fix PGIOAlignedBlock Assert crash in PG16 
Relevant PG commit:
faeedbcefd
faeedbcefd40bfdf314e048c425b6d9208896d90

- Pass planner info as argument to make_simple_restrictinfo 
Pre PG16 passing plannerInfo to make_simple_restrictinfo
was only needed for placeholder Vars, which is not the case
in this part of the codebase because we are building the
expression from shard intervals which don't have placeholder
vars.
However, PG16 is counting baserels appearing in clause_relids
and is deleting the rels mentioned in plannerinfo->outer_join_rels
Hence directly accessing plannerinfo.
We will crash if we leave it as NULL.
For reference
2489d76c49 (diff-e045c41eda9686451a7993e91518e40056b3739365e39eb1b70ae438dc1f7c76R207)
Relevant PG commit:
2489d76c49
2489d76c4906f4461a364ca8ad7e0751ead8aa0d

- Add outer join checks, root->simple_rel_array

- fix rebalancer to include passwork_required option 
Relevant PG commit:
c3afe8cf5a
c3afe8cf5a1e465bd71e48e4bc717f5bfdc7a7d6

More PG16 compatibility commits are coming soon ...
2023-08-04 14:51:28 +03:00
Gürkan İndibay be2e6533fb
Merge branch 'main' into citus_pause_node 2023-08-04 14:26:52 +03:00
Naisila Puka 907d72e60d
PG16 compatibility - some test outputs (#7100)
PG16 compatibility - Part 3

Check out part 1 42d956888d
and part 2 0d503dd5ac

This commit is in the series of PG compatibility. It makes some changes
to our tests in order to be compatible with the following in PG16:

Use debug_parallel_query in PG16+, force_parallel_mode otherwise 
Relevant PG commit
5352ca22e0
5352ca22e0012d48055453ca9992a9515d811291

HINT changed to DETAIL in PG16 
Relevant PG commit:
56d0ed3b75
56d0ed3b756b2e3799a7bbc0ac89bc7657ca2c33

Fix removed read-only server setting lc_collate 
Relevant PG commit:
b0f6c43716
b0f6c437160db640d4ea3e49398ebc3ba39d1982

Fix unsupported join alias expression in sqlancer_failures 
Relevant PG commit:
2489d76c49
2489d76c4906f4461a364ca8ad7e0751ead8aa0d

More PG16 compatibility commits are coming soon ...
2023-08-04 13:03:15 +03:00
Önder Kalacı 4ae3982d14
Add single-shard router Merge command support (#7088)
Similar to https://github.com/citusdata/citus/pull/7077.

As PG 16+ has changed the join restriction information for certain outer
joins, MERGE is also impacted given that is is also underlying an outer
join.

See #7077 for the details.
2023-08-04 08:16:29 +03:00
Naisila Puka 0d503dd5ac
PG16 compatibility: ruleutils and successful CREATE EXTENSION (#7087)
PG16 compatibility - Part 2

Part 1 provided successful compilation against pg16beta2.
42d956888d

This PR provides ruleutils changes with pg16beta2 and successful CREATE EXTENSION command.
Note that more changes are needed in order to have successful regression tests.
More commits are coming soon ...

For any_value changes, I referred to this commit
8ef94dc1f5
where we did something similar for PG14 support.
2023-08-02 16:04:51 +03:00
Önder Kalacı 960a5f6104
Improve failure handling of distributed execution (#7090)
Prior to this commit, the code would skip processing the
errors happened for local commands.

Prior to https://github.com/citusdata/citus/pull/5379, it might
make sense to allow the execution continue. But, as of today,
if a modification fails on any placement, we can safely fail
the execution.

The first commit show the problem in action. The second commit
includes the fix and the test fixes.
2023-08-01 16:47:59 +03:00
Onur Tirtir dd6ea1ebd5
Makes sure to handle NULL constraints for ADD COLUMN commands (#7093)
DESCRIPTION: Fixes a bug that causes an unexpected error when adding a
column with a NULL constraint

Fixes https://github.com/citusdata/citus/issues/7092.
2023-08-01 11:07:47 +03:00
gindibay 9e79cd610e Fixes indent issues 2023-07-30 01:17:36 +03:00
gindibay 29c5b0c98a Adds comments to methods 2023-07-30 00:41:51 +03:00
gindibay a05d5fc5fc Fixes upgrade tests 2023-07-29 23:45:02 +03:00
gindibay 86e0831424 Merge branch 'citus_pause_node' of https://github.com/citusdata/citus into citus_pause_node 2023-07-29 23:31:31 +03:00
Gürkan İndibay 18c55a44a9
Merge branch 'main' into citus_pause_node 2023-08-04 09:41:37 +03:00
gindibay cc403bf458 Fixes upgrade tests 2023-07-29 23:31:29 +03:00
gindibay 6f2ddf44b4 Removes empty line 2023-07-29 21:30:34 +03:00
gindibay dd72cf09a5 Merge branch 'citus_pause_node' of https://github.com/citusdata/citus into citus_pause_node 2023-07-29 21:22:25 +03:00
Gürkan İndibay 88695c6674
Merge branch 'main' into citus_pause_node 2023-08-02 16:10:42 +03:00
gindibay 3220bd9c47 Fixes test errors after rebase 2023-07-29 21:22:22 +03:00
gindibay 1a1b633d55 Fixes multi extension tests 2023-07-29 20:31:45 +03:00
gindibay c41f93e402 Fixes indentation 2023-07-29 20:28:27 +03:00
gindibay b69c36af49 Fixes static code analysis issues 2023-07-29 20:23:07 +03:00
gindibay 4c3341e64b Fixes indentation 2023-07-29 20:07:24 +03:00
gindibay 339a47a18a Fixes review comments 2023-07-29 20:01:27 +03:00
gindibay b471bb04d2 Merge branch 'citus_pause_node' of https://github.com/citusdata/citus into citus_pause_node 2023-07-29 19:21:17 +03:00
Gürkan İndibay 3edefdc212
Merge branch 'main' into citus_pause_node 2023-08-02 02:45:43 +03:00
gindibay 1c05eebebe Updates udf name 2023-07-29 19:21:13 +03:00
gindibay 63311e546f Fixes some review notes 2023-07-29 17:35:15 +03:00
gindibay ed40dfe1a7 Give details for exception message 2023-07-28 23:35:14 +03:00
gindibay bb62b84ad7 Parameterizes node id in no node test 2023-07-28 22:57:10 +03:00
Gürkan İndibay 997a5d7217
Merge branch 'main' into citus_pause_node 2023-07-31 16:03:19 +03:00
gindibay 28cda815a3 Fixes coverage issue 2023-07-28 22:24:09 +03:00
gindibay 24380f80b9 Fixes unit tests 2023-07-28 20:34:42 +03:00
gindibay 4ed78f148e Fixes errors in code 2023-07-28 19:26:25 +03:00
gindibay d42f5579ed Adds node id detection with shard_id 2023-07-28 19:19:48 +03:00
gindibay 515627e3cc Adds code to debug 2023-07-28 17:51:42 +03:00
gindibay afa7bf640d Fixes upgrade_list_citus_objects diff 2023-07-28 17:21:11 +03:00
gindibay 6da0baada4 Adds citus_pause_node into test files 2023-07-28 17:15:55 +03:00
gindibay 8928c0ff88 Adds multi_extension.out output 2023-07-28 17:09:07 +03:00
gindibay 46ab6f1c2b Removes unnecessary changes 2023-07-28 16:00:11 +03:00
gindibay 20ae610cdc Removes unnecessary changes 2023-07-28 15:57:56 +03:00
Önder Kalacı cb5eb73048
Add support for router INSERT .. SELECT commands (#7077)
Tradionally our planner works in the following order:
   router - > pushdown -> repartition -> pull to coordinator

However, for INSERT .. SELECT commands, we did not support "router".

In practice, that is not a big issue, because pushdown planning can
handle router case as well.

However, with PG 16, certain outer joins are converted to JOIN without
any conditions (e.g., JOIN .. ON (true)) and the filters are pushed down
to the tables.

When the filters are pushed down to the tables, router planner can
detect. However, pushdown planner relies on JOIN conditions.

An example query:
```
INSERT INTO agg_events (user_id)
        SELECT raw_events_first.user_id
        FROM raw_events_first LEFT JOIN raw_events_second
        	ON raw_events_first.user_id = raw_events_second.user_id
        WHERE raw_events_first.user_id = 10;
```

As a side effect of this change, now we can also relax certain
limitation that "pushdown" planner emposes, but not "router". So, with
this PR, we also allow those.

Closes https://github.com/citusdata/citus/pull/6772
DESCRIPTION: Prevents unnecessarily pulling the data into coordinator
for some INSERT .. SELECT queries that target a single-shard group
2023-07-28 15:07:20 +03:00
gindibay b178a7524c Fixes static code analysis issues 2023-07-28 14:26:53 +03:00
gindibay 7ccbb848b0 Adds unit tests 2023-07-28 14:25:56 +03:00
gindibay 304a00ee08 Fixed unit test problems 2023-07-28 14:13:28 +03:00
Teja Mupparti 846cbc3a39 In the MERGE join clause, there is a datatype mismatch between target's distribution column
and the expression originating from the source. If the types are different, Citus uses
different hash functions for the two column types, which might lead to incorrect repartitioning
of the result data
2023-07-27 16:06:00 -07:00
Nils Dijk 186804c119
fix flappyness of shard_rebalancer operations test (#7083)
Fixes flappyness where the order of shards was dependent on the physical
layout in the heap. Failed here
https://app.circleci.com/pipelines/github/citusdata/citus/33844/workflows/1651f8f5-6e6a-457e-9d35-34b8788ea6d1/jobs/1189836


```diff
--- /home/circleci/project/src/test/regress/expected/shard_rebalancer.out.modified	2023-07-24 12:51:27.126284675 +0000
+++ /home/circleci/project/src/test/regress/results/shard_rebalancer.out.modified	2023-07-24 12:51:27.170285079 +0000
@@ -2571,24 +2571,24 @@
 CREATE TABLE test_with_all_shards_excluded(a int PRIMARY KEY);
 SELECT create_distributed_table('test_with_all_shards_excluded', 'a', colocate_with:='none', shard_count:=4);
  create_distributed_table 
 --------------------------
  
 (1 row)
 
 SELECT shardid FROM pg_dist_shard;
  shardid 
 ---------
-  433504
   433505
   433506
   433507
+  433504
 (4 rows)
 
 SELECT rebalance_table_shards('test_with_all_shards_excluded', excluded_shard_list:='{102073, 102074, 102075, 102076}');
  rebalance_table_shards 
 ------------------------
  
 (1 row)
 
 DROP TABLE test_with_all_shards_excluded;
 SET citus.shard_count TO 2;
```
2023-07-27 16:24:35 +02:00