Commit Graph

5354 Commits (4c135de9e4ffbbdfcda5e28b0ede95f44eda5fc8)

Author SHA1 Message Date
Marco Slot bece86b2f7 Add some subquery on append-distributed table tests 2021-10-18 21:11:16 +02:00
Marco Slot 93e79b9262 Never allow co-located joins of append-distributed tables 2021-10-18 21:11:16 +02:00
Marco Slot b97e5081c7 Disable co-located joins for append-distributed tables 2021-10-18 21:11:16 +02:00
Marco Slot dfad73d918 Disable implicit single re-partition joins for append tables 2021-10-18 21:11:16 +02:00
Marco Slot 2206e64e42 Disable single-repartition joins for append tables 2021-10-18 21:11:16 +02:00
Sait Talha Nisanci 6ff2083311 Remove base test as it is not useful anymore 2021-10-18 20:31:18 +03:00
Sait Talha Nisanci 7336c03c22 Add local-dist table joins to arbitrary configs 2021-10-18 20:31:18 +03:00
Önder Kalacı 31c8f279ac
Add helper UDFs to inspect object dependencies (#5293)
- citus_get_all_dependencies_for_object: emulate what Citus
                                         would qualify as
					 dependency when adding
					 a new node
- citus_get_dependencies_for_object: emulate what Citus would qualify
				     as dependency when creating an
				     object

Example use:
```SQL
-- find all the depedencies of table test
SELECT
	pg_identify_object(t.classid, t.objid, t.objsubid)
FROM
	(SELECT * FROM pg_get_object_address('table', '{test}', '{}')) as addr
JOIN LATERAL
	citus_get_all_dependencies_for_object(addr.classid, addr.objid, addr.objsubid) as t(classid oid, objid oid, objsubid int)
ON TRUE
	ORDER BY 1;
```
2021-10-18 14:46:49 +03:00
Halil Ozan Akgül 169084f1bb
Merge pull request #5382 from citusdata/fix_comma_bug_in_ShardListInserCommand
Fix the extra comma bug in ShardListInsertCommand
2021-10-18 13:37:41 +03:00
Halil Ozan Akgul e3446692f3 Fix the bug by adding comma before the values 2021-10-15 18:42:23 +03:00
Halil Ozan Akgül b576e69260
Merge pull request #5378 from citusdata/turn_mx_on_columnar_schedule
Fix the tests that fail with MX in columnar_schedule
2021-10-15 13:28:53 +03:00
Halil Ozan Akgul 3fb996f6de Fix the tests that fail with MX in columnar_schedule 2021-10-15 13:09:01 +03:00
Halil Ozan Akgül eca784d088
Merge pull request #5377 from citusdata/turn_mx_on_multi_schedule
Fix tests that fail with MX in multi_schedule
2021-10-15 13:08:30 +03:00
Halil Ozan Akgul b710e0064d Fix tests that fail with MX in multi_schedule 2021-10-15 12:58:38 +03:00
Onur Tirtir 59caaf0a54
Merge pull request #5375 from citusdata/update-cl-10.2.2
Add changelog for 10.2.2
2021-10-14 14:29:55 +03:00
Onur Tirtir c2ea886085 Add changelog for 10.2.2 2021-10-14 14:09:57 +03:00
Ahmet Gedemenli 35f6fe5f9f
Refactor/Improve PreprocessAlterTableStmtAttachPartition (#5366)
* Refactor/Improve PreprocessAlterTableStmtAttachPartition
2021-10-14 11:39:39 +03:00
SaitTalhaNisanci de61a89083
Fix sql_schedule_name problem (#5371) 2021-10-13 13:10:00 +02:00
Hanefi Onaldi 3e64dc44c8
Fix some typos in comments (#5369) 2021-10-13 13:00:39 +03:00
Önder Kalacı af876bf452
Add value materialization test (#5368) 2021-10-13 09:08:24 +02:00
SaitTalhaNisanci a39859bc74
Remove unnecesary output (#5367) 2021-10-13 09:28:01 +03:00
SaitTalhaNisanci 3f65751d43
Add an infrastructure to run same tests with arbitrary configs (#5316)
To run tests in parallel use:

```bash
make check-arbitrary-configs parallel=4
```

To run tests sequentially use:

```bash
make check-arbitrary-configs parallel=1
```

To run only some configs:

```bash
make check-arbitrary-base CONFIGS=CitusSingleNodeClusterConfig,CitusSmallSharedPoolSizeConfig
```

To run only some test files with some config:

```bash
make check-arbitrary-base CONFIGS=CitusSingleNodeClusterConfig EXTRA_TESTS=dropped_columns_1
```

To get a deterministic run, you can give the random's seed:

```bash
make check-arbitrary-configs parallel=4 seed=12312
```

The `seed` will be in the output of the run.

In our regular regression tests, we can see all the details about either planning or execution but this means
we need to run the same query under different configs/cluster setups again and again, which is not really maintanable.

When we don't care about the internals of how planning/execution is done but the correctness, especially with different configs
this infrastructure can be used.

With `check-arbitrary-configs` target, the following happens:

-   a bunch of configs are loaded, which are defined in `config.py`. These configs have different settings such as different shard count, different citus settings, postgres settings, worker amount, or different metadata.
-   For each config, a separate data directory is created for tests in `tmp_citus_test` with the config's name.
-   For each config, `create_schedule` is run on the coordinator to setup the necessary tables.
-   For each config, `sql_schedule` is run. `sql_schedule` is run on the coordinator if it is a non-mx cluster. And if it is mx, it is either run on the coordinator or a random worker.
-   Tests results are checked if they match with the expected.

When tests results don't match, you can see the regression diffs in a config's datadir, such as `tmp_citus_tests/dataCitusSingleNodeClusterConfig`.

We also have a PostgresConfig which runs all the test suite with Postgres.
By default configs use regular user, but we have a config to run as a superuser as well.

So the infrastructure tests:

-   Postgres vs Citus
-   Mx vs Non-Mx
-   Superuser vs regular user
-   Arbitrary Citus configs

When you want to add a new test, you can add the create statements to `create_schedule` and add the sql queries to `sql_schedule`.
If you are adding Citus UDFs that should be a NO-OP for Postgres, make sure to override the UDFs in `postgres.sql`.

You can add your new config to `config.py`. Make sure to extend either `CitusDefaultClusterConfig` or `CitusMXBaseClusterConfig`.

On the CI, upon a failure, all logfiles will be uploaded as artifacts, so you can check the artifacts tab.
All the regressions will be shown as part of the job on CI.

In your local, you can check the regression diffs in config's datadirs as in `tmp_citus_tests/dataCitusSingleNodeClusterConfig`.
2021-10-12 14:24:19 +03:00
Teja Mupparti a8348047c5
Pushdown procedures with OUT parameters (#5348) 2021-10-11 23:14:36 -07:00
Onur Tirtir 877d21d3f4
Merge pull request #5360 from citusdata/cleanup/compat
Since we dropped support for pg versions not having oid attribute in catalog tables, removing those functions.
2021-10-11 12:00:45 +03:00
Onur Tirtir f7f4a93073 Remove get_relation_trigger_oid_compat 2021-10-11 11:53:00 +03:00
Onur Tirtir a1e0511583 Remove get_relation_constraint_oid_compat 2021-10-11 11:53:00 +03:00
Ahmet Gedemenli 47e28a4faf
Merge pull request #5296 from citusdata/partitioning-for-citus-local-tables
Add partitioning support for citus local tables
2021-10-11 11:42:01 +03:00
Ahmet Gedemenli d19793c174 Add partitioning support for citus local tables
Add/fix tests

Fix creating partitions

Add test for mx - partition creating case

Enable cascading to partitioned tables

Fix mx partition adding test

Fix cascading through fkeys

Style

Disable converting with non-inherited fkeys

Fix detach bug

Early return in case of cascade & Add tests

Style

Fix undistribute_table bug & Fix test outputs

Remove RemovePartitionRelationIds

Test with undistribute_table

Add test for mx+convert+undistribute

Remove redundant usage of CreatePartitionedCitusLocalTable

Add some comments

Introduce bulk functions for generating attach/detach partition commands

Fix: Convert partitioned tables after adding fkey

Change the error message for partitions

Introduce function ErrorIfPartitionTableAddedToMetadata

Polish attach/detach command generation functions

Use time_partitions for testing

Move mx tests to citus_local_tables_mx

Add new partitioned table to cascade test

Add test with time series management UDFs

Fix test output

Fix: Assertion fail on relation access tracking

Style

Refactor creating partitioned citus local tables

Remove CreatePartitionedCitusLocalTable

Style

Error out if converting multi-level table

Revert some old tests

Error out adding partitioned partition

Polish

Polish/address

Fix create table partition of case

Use CascadeOperationForRelationIdList if no cascade needed

Fix create partition bug

Revert / Add new tests to mx

Style

Fix dropping fkey bug

Add test with IF NOT EXISTS

Convert to CLT when doing ATTACH PARTITION

Add comments

Add more tests with time series management

Edit the error message for converting the child

Use OR instead of AND in ErrorIfUnsupportedAlterTableStmt

Edit/improve tests

Disable ddl prop when dropping default column definitions

Disable/enable ddl prop just before/after the command

Add comment

Add sequence test

Add trigger test

Remove NeedCascadeViaForeignKeys

Add one more insert to sequence test

Add comment

Style

Fix test output shard ids

Update comments

Disable creating fkey on partitions

Move partition check to CreateCitusLocalTable

Add comment

Add check for  attachingmulti-level  partition

Add test for pg_constraint

Check pg_dist_partition in tests

Add test inserting on the worker
2021-10-11 10:45:07 +03:00
Marco Slot 09a070221a
Merge pull request #5356 from citusdata/marcocitus/remove-append-2
Reduce reliance on append tables in regression tests
2021-10-08 21:39:18 +02:00
Marco Slot 386d2567d4 Reduce reliance on append tables in regression tests 2021-10-08 21:27:14 +02:00
Halil Ozan Akgül b288cc9d1f
Merge pull request #5344 from citusdata/turn_mx_on
Turn MX on by default
2021-10-08 18:42:52 +03:00
Halil Ozan Akgul 9c9d4b5eeb Turn MX on by default 2021-10-08 18:17:21 +03:00
Naisila Puka 99d3785b5c
Fix flaky test in multi_fix_partition_shard_index_names.sql (#5364) 2021-10-08 18:03:34 +03:00
Naisila Puka d0390af72d
Add fix_partition_shard_index_names udf to fix currently broken names (#5291)
* Add udf to include shardId in broken partition shard index names

* Address reviews: rename index such that operations can be done on it

* More comprehensive index tests

* Final touches and formatting
2021-10-07 19:34:52 +03:00
Marco Slot fb34b518af
Merge pull request #5350 from citusdata/marcocitus/fix-index-deparsing 2021-10-06 13:30:06 +02:00
Marco Slot 91b647024a Fixes CREATE INDEX deparsing issue 2021-10-06 13:08:16 +02:00
Onur Tirtir 5d8f74bd0b
(Share) Lock buffer page when reading from columnar storage (#5338)
Under high write concurrency, we were sometimes reading columnar
metapage as all zeros.

In `WriteToBlock()`, if `clear == true`, then it will clear the page before
writing the new one, rather than just adding data to the page. That
means any concurrent connection that is holding only a pin will be
able to see the all-zero state between the `InitPage()` and the
`memcpy_s()`.

Moreover, postgres/storage/buffer/README states that:

> Buffer access rules:
>
> 1. To scan a page for tuples, one must hold a pin and either shared or
> exclusive content lock.  To examine the commit status (XIDs and status bits)
> of a tuple in a shared buffer, one must likewise hold a pin and either shared
> or exclusive lock.

For those reasons, we have to make sure to never keep a pin on the
page without (at least) the shared lock, to avoid having such problems.
2021-10-06 11:57:02 +03:00
Halil Ozan Akgül 52879fdc96
Merge pull request #5285 from citusdata/typos_in_comment_functions
Fixes function names in comments
2021-10-06 10:52:45 +03:00
Halil Ozan Akgul 43d5853b6d Fixes function names in comments 2021-10-06 09:24:43 +03:00
Hanefi Onaldi c27b5aa7f8
Merge pull request #5335 from citusdata/bump-to-11.0devel
Bump Citus to 11.0devel
2021-10-05 11:20:32 +03:00
Hanefi Onaldi a74409f24c
Bump Citus to 11.0devel 2021-10-01 22:21:22 +03:00
Önder Kalacı 7bd746b91a
Merge pull request #5332 from citusdata/pg_14_updates
Reflect PG14 changes in the readme
2021-10-01 19:25:45 +02:00
Önder Kalacı 47c2483ed7
Merge branch 'master' into pg_14_updates 2021-10-01 13:48:21 +02:00
Onur Tirtir fe72e8bb48
Discard index deletion requests made to columnarAM (#5331)
A write operation might trigger index deletion if index already had
dead entries for the key we are about to insert.
There are two ways of index deletion:
  a) simple deletion
  b) bottom-up deletion (>= pg14)

Since columnar_index_fetch_tuple never sets all_dead to true,
columnarAM doesn't ever expect to receive simple deletion requests
(columnar_index_delete_tuples) as we don't mark any index entries
as dead.

However, since columnarAM doesn't delete any dead entries via simple
deletion, postgres might ask for a more comprehensive deletion
(i.e.: bottom-up) at some point when pg >= 14.

So with this commit, we start gracefully ignoring bottom-up deletion
requests made to columnar_index_delete_tuples.

Given that users can anyway "VACUUM FULL" their columnar tables,
we don't see any problem in ignoring deletion requests.
2021-10-01 14:32:47 +03:00
Onur Tirtir 0ce6650c88 Use pg14 in CONTRIBUTING.md 2021-10-01 12:38:55 +02:00
Onder Kalaci 0995cfef49 Reflect PG14 changes in the readme 2021-10-01 10:03:27 +02:00
SaitTalhaNisanci d7fde7dd1a
upgrade to 14.0 (#5330) 2021-09-30 17:27:37 +03:00
Önder Kalacı c2311b4c0c
Make (columnar.stripe) first_row_number index a unique constraint (#5324)
* Make (columnar.stripe) first_row_number index a unique constraint

Since stripe_first_row_number_idx is required to scan a columnar
table, we need to make sure that it is created before doing anything
with columnar tables during pg upgrades.

However, a plain btree index is not a dependency of a table, so
pg_upgrade cannot guarantee that stripe_first_row_number_idx gets
created when creating columnar.stripe, unless we make it a unique
"constraint".

To do that, drop stripe_first_row_number_idx and create a unique
constraint with the same name to keep the code change at minimum.

* Add more pg upgrade tests for columnar

* Fix a logic error in uprade_columnar_after test

Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2021-09-30 10:51:56 +03:00
Jelte Fennema 97077c5c4a
Check more exit codes in upgrade tests (#5323)
We were trying to find the cause for a strange update bug. We thought
`pg_upgrade` succeeded and then were surprised that certain data was not
in the database after the upgrade. Instead `pg_upgrade` had failed
halfway through with an actionable error. It took us pretty long to
realise this.

This commit adds checking of exit codes to a lot more subprocess
executions. That should make debugging in the future much easier.
2021-09-24 15:51:00 +02:00
Onur Tirtir 726b3b90a5
Merge pull request #5322 from citusdata/changelog-10.2.1
Add changelog for 10.2.1
2021-09-24 13:08:46 +03:00