Commit Graph

3075 Commits (7794aab38ca372dc94802db61c8be960cd740868)

Author SHA1 Message Date
Jelte Fennema-Nio 5a48a1602e
Debug flaky logical_replication test (#7309)
Sometimes in CI our logical_replication test fails like this:

```diff
+++ /__w/citus/citus/src/test/regress/results/logical_replication.out.modified	2023-11-01 14:15:08.562758546 +0000
@@ -40,21 +40,21 @@

 SELECT count(*) from pg_publication;
  count
 -------
      0
 (1 row)

 SELECT count(*) from pg_replication_slots;
  count
 -------
-     0
+     1
 (1 row)

 SELECT count(*) FROM dist;
  count
 -------
```

It's hard to understand what is going on here, just based on the wrong
number. So this PR changes the test to show the name of the
subscription, publication and replication slot to make finding the cause
easier.

In passing this also fixes another flaky test in the same file that our
flaky test detection picked up. This is done by waiting for resource
cleanup after the shard move.
2023-11-02 13:15:02 +01:00
Onur Tirtir 9867c5b949
Fix flaky multi_mx_node_metadata.sql test (#7317)
Fixes the flaky test that results in following diff:
```diff
--- /__w/citus/citus/src/test/regress/expected/multi_mx_node_metadata.out.modified	2023-11-01 14:22:12.890476575 +0000
+++ /__w/citus/citus/src/test/regress/results/multi_mx_node_metadata.out.modified	2023-11-01 14:22:12.914476657 +0000
@@ -840,24 +840,26 @@
 (1 row)
 
 \c :datname - - :master_port
 SELECT datname FROM pg_stat_activity WHERE application_name LIKE 'Citus Met%';
   datname   
 ------------
  db_to_drop
 (1 row)
 
 DROP DATABASE db_to_drop;
+ERROR:  database "db_to_drop" is being accessed by other users
 SELECT datname FROM pg_stat_activity WHERE application_name LIKE 'Citus Met%';
   datname   
 ------------
-(0 rows)
+ db_to_drop
+(1 row)
 
 -- cleanup
 DROP SEQUENCE sequence CASCADE;
 NOTICE:  drop cascades to default value for column a of table reference_table
```
2023-11-02 11:02:34 +00:00
Jelte Fennema-Nio a6e86884f6
Fix flaky isolation_metadata_sync_deadlock (#7312)
Sometimes isolation_metadata_sync_deadlock fails in CI like this:

```diff
diff -dU10 -w /__w/citus/citus/src/test/regress/expected/isolation_metadata_sync_deadlock.out /__w/citus/citus/src/test/regress/results/isolation_metadata_sync_deadlock.out
--- /__w/citus/citus/src/test/regress/expected/isolation_metadata_sync_deadlock.out.modified	2023-11-01 16:03:15.090199229 +0000
+++ /__w/citus/citus/src/test/regress/results/isolation_metadata_sync_deadlock.out.modified	2023-11-01 16:03:15.098199312 +0000
@@ -110,10 +110,14 @@
 t
 (1 row)

 step s2-stop-connection:
  SELECT stop_session_level_connection_to_node();

 stop_session_level_connection_to_node
 -------------------------------------

 (1 row)
+
+teardown failed: ERROR:  localhost:57638 is a metadata node, but is out of sync
+HINT:  If the node is up, wait until metadata gets synced to it and try again.
+CONTEXT:  SQL statement "SELECT master_remove_distributed_table_metadata_from_workers(v_obj.objid, v_obj.schema_name, v_obj.object_name)"
```

Source:
https://github.com/citusdata/citus/actions/runs/6721938040/attempts/1#summary-18268946448

To fix this we now wait for the metadata to be fully synced to all
nodes at the start of the teardown steps.
2023-11-02 10:39:05 +01:00
Onur Tirtir 2cf4c04023
Fix flaky global_cancel.sql test (#7316) 2023-11-01 23:59:41 +01:00
Jelte Fennema-Nio e3c93c303d
Fix flaky citus_non_blocking_split_shard_cleanup (#7311)
Sometimes in CI citus_non_blocking_split_shard_cleanup failed like this:

```diff
--- /__w/citus/citus/src/test/regress/expected/citus_non_blocking_split_shard_cleanup.out.modified	2023-11-01 15:07:14.280551207 +0000
+++ /__w/citus/citus/src/test/regress/results/citus_non_blocking_split_shard_cleanup.out.modified	2023-11-01 15:07:14.292551358 +0000
@@ -106,21 +106,22 @@
 -----------------------------------

 (1 row)

 \c - - - :worker_2_port
 SET search_path TO "citus_split_test_schema";
 -- Replication slots should be cleaned up
 SELECT slot_name FROM pg_replication_slots;
             slot_name
 ---------------------------------
-(0 rows)
+ citus_shard_split_slot_19_10_17
+(1 row)

 -- Publications should be cleanedup
 SELECT count(*) FROM pg_publication;
  count
```

It's expected that the replication slot is sometimes not cleaned up if
we don't wait until resource cleanup completes. This PR starts doing
that here.
2023-11-01 16:21:12 +00:00
Jelte Fennema-Nio c9f2fc892d
Fix flaky failure_split_cleanup (#7299)
Sometimes failure_split_cleanup failed in CI like this:

```diff
 ERROR:  server closed the connection unexpectedly
 CONTEXT:  while executing command on localhost:9060
     SELECT operation_id, object_type, object_name, node_group_id, policy_type
     FROM pg_dist_cleanup where operation_id = 777 ORDER BY object_name;
  operation_id | object_type |                        object_name                        | node_group_id | policy_type
 --------------+-------------+-----------------------------------------------------------+---------------+-------------
           777 |           1 | citus_failure_split_cleanup_schema.table_to_split_8981000 |             1 |           0
-          777 |           1 | citus_failure_split_cleanup_schema.table_to_split_8981002 |             1 |           1
           777 |           1 | citus_failure_split_cleanup_schema.table_to_split_8981002 |             2 |           0
+          777 |           1 | citus_failure_split_cleanup_schema.table_to_split_8981002 |             1 |           1
           777 |           1 | citus_failure_split_cleanup_schema.table_to_split_8981003 |             2 |           1
           777 |           4 | citus_shard_split_publication_1_10_777                    |             2 |           0
 (5 rows)

     -- we need to allow connection so that we can connect to proxy
```

Source:
https://github.com/citusdata/citus/actions/runs/6717642291/attempts/1#summary-18256014949

It's the common problem where we're missing a column in the ORDER BY
clause. This fixes that by adding an node_group_id to the query in
question.
2023-11-01 14:08:51 +00:00
Jelte Fennema-Nio c83c556702
Fix flaky isolation_master_update_node (#7303)
Sometimes in CI isolation_master_update_node fails like this:

```diff
 ------------------

 (1 row)

 step s2-abort: ABORT;
 step s1-abort: ABORT;
 FATAL:  terminating connection due to administrator command
 FATAL:  terminating connection due to administrator command
 SSL connection has been closed unexpectedly
+server closed the connection unexpectedly

 master_remove_node
 ------------------

```

This just seesm like a random error line. The only way to reasonably fix
this is by adding an extra output file. So that's what this PR does.
2023-11-01 16:44:45 +03:00
Jelte Fennema-Nio 0d83ab57de
Fix flaky multi_cluster_management (#7295)
One of our most flaky and most anoying tests is
multi_cluster_management. It usually fails like this:
```diff
 SELECT citus_disable_node('localhost', :worker_2_port);
  citus_disable_node
 --------------------

 (1 row)

 SELECT public.wait_until_metadata_sync(60000);
+WARNING:  waiting for metadata sync timed out
  wait_until_metadata_sync
 --------------------------

 (1 row)

```

This tries to address that by hardening wait_until_metadata_sync. I
believe the reason for this warning is that there is a race condition in
wait_until_metadata_sync. It's possible for the pre-check to fail, then
have the maintenance daemon send a notification. And only then have the
backend start to listen. I tried to fix it in two ways:
1. First run LISTEN, and only then read do the pre-check.
2. If we time out, check again just to make sure that we did not miss
   the notification somehow. And don't show a warning if all metadata is
   synced after the timeout.

It's hard to know for sure that this fixes it because the test is not
repeatable and I could not reproduce it locally. Let's just hope for the
best.

---------

Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2023-11-01 10:46:01 +00:00
Gürkan İndibay 595d078f95
Merge branch 'main' into create_alter_database 2023-11-01 13:30:09 +03:00
Jelte Fennema-Nio 20ae42e7fa
Fix flaky multi_reference_table test (#7294)
Sometimes multi_reference_table failed in CI like this:

```diff
 \c - - - :master_port
 DROP INDEX reference_schema.reference_index_2;
 \c - - - :worker_1_port
 SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='reference_schema.reference_table_ddl_1250019'::regclass;
- Column  |            Type             |  Modifiers
----------------------------------------------------------------------
- value_2 | double precision            | default 25.0
- value_3 | text                        | not null
- value_4 | timestamp without time zone |
- value_5 | double precision            |
-(4 rows)
-
+ERROR:  schema "citus_local_table_queries" does not exist
 \di reference_schema.reference_index_2*
           List of relations
  Schema | Name | Type | Owner | Table
```

Source:
https://github.com/citusdata/citus/actions/runs/6707535961/attempts/2#summary-18226879513

Reading from table_desc apparantly has an issue that if the schema gets
deleted from one of the items, while it is being read that we get such
an error.

This change fixes that by not running multi_reference_table in parallel
with citus_local_tables_queries anymore.
2023-11-01 10:12:06 +00:00
Cédric Villemain 37415ef8f5
Allow citus_*_size on index related to a distributed table (#7271)
I just enhanced the existing code to check if the relation is an index
belonging to a distributed table.
If so the shardId is appended to relation (index) name and the *_size
function are executed as before.

There is a change in an extern function:
  `extern StringInfo GenerateSizeQueryOnMultiplePlacements(...)`
It's possible to create a new function and deprecate this one later if
compatibility is an issue.

Fixes https://github.com/citusdata/citus/issues/6496.

DESCRIPTION: Allows using Citus size functions on distributed tables
indexes.

---------

Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2023-11-01 09:05:51 +00:00
Jelte Fennema-Nio a76a832553
Fix flaky validate_constraint test (#7293)
Sometimes validate constraint would fail like this:

```diff
  validatable_constraint_8000016 | t
 (10 rows)

 DROP TABLE constrained_table;
+ERROR:  deadlock detected
+DETAIL:  Process 16602 waits for ShareRowExclusiveLock on relation 56258 of database 16384; blocked by process 16601.
+Process 16601 waits for AccessShareLock on relation 56120 of database 16384; blocked by process 16602.
+HINT:  See server log for query details.
 DROP TABLE referenced_table CASCADE;
 DROP TABLE referencing_table;
 DROP SCHEMA validate_constraint CASCADE;
-NOTICE:  drop cascades to 3 other objects
+NOTICE:  drop cascades to 4 other objects
 DETAIL:  drop cascades to type constraint_validity
 drop cascades to view constraint_validations_in_workers
 drop cascades to view constraint_validations
+drop cascades to table constrained_table
 SET search_path TO DEFAULT;

```

Source:
https://github.com/citusdata/citus/actions/runs/6708383699?pr=7291

This change fixes that by not running together with the
foreign_key_to_reference_table test anymore. In passing it also
simplifies dropping of the test its resources.
2023-11-01 09:41:28 +01:00
gindibay 328e34969d Fixes review notes 2023-10-31 13:41:50 +03:00
gindibay 75f1e691c1 Merge branch 'create_alter_database' into alter_database_additional_options 2023-10-31 11:22:52 +03:00
gindibay d8639d58de Adds locale restrictions 2023-10-31 10:58:44 +03:00
Gürkan İndibay d99737e8b2
Merge branch 'main' into create_alter_database 2023-10-30 21:09:59 +03:00
Emel Şimşek ee8f4bb7e8
Start Maintenance Daemon for Main DB at the server start. (#7254)
DESCRIPTION: This change starts a maintenance deamon at the time of
server start if there is a designated main database.

This is the code flow:

1. User designates a main database:
   `ALTER SYSTEM SET citus.main_db =  "myadmindb";`

2. When postmaster starts, in _PG_Init, citus calls 
    `InitializeMaintenanceDaemonForMainDb`
  
This function registers a background worker to run
`CitusMaintenanceDaemonMain `with `databaseOid = 0 `

3. `CitusMaintenanceDaemonMain ` takes some special actions when
databaseOid is 0:
     - Gets the citus.main_db  value.
     - Connects to the  citus.main_db
     - Now the `MyDatabaseId `is available, creates a hash entry for it.
     - Then follows the same control flow as for a regular db,
2023-10-30 09:44:13 +03:00
gindibay 693eeedfaf Fixes pg15 test name 2023-10-27 19:08:09 +03:00
gindibay fe136886aa Changes pg15 test files 2023-10-27 18:43:51 +03:00
gindibay 89e2d63bd3 Adds pg15 create drop to minimal tests 2023-10-27 18:37:22 +03:00
gindibay dcae4c3486 Fixes python code format 2023-10-27 18:17:58 +03:00
gindibay 5381aa8fda Fixes flaky tests 2023-10-27 18:13:17 +03:00
gindibay cf7efca546 Fixes single_node for pg14 2023-10-27 18:01:07 +03:00
Benjamin O f9218d9780
Support replacing IPv6 Loopback in `normalize.sed` (#7269)
I had a test failure issue due to my machine using the IPv6 loopback
address. This change to the `normalize.sed` solves that issue.
2023-10-27 16:42:55 +02:00
gindibay 2b3a556f34 Fixes pg14 tests 2023-10-27 17:40:37 +03:00
gindibay 8c29444bbf Fixes pg14 tests 2023-10-27 17:25:56 +03:00
gindibay 6eeeddd549 Fixes pg14 tests 2023-10-27 17:11:01 +03:00
gindibay 8519e7d7fa Adds a dummy file for pg14 2023-10-27 16:56:25 +03:00
gindibay a0da426a78 Fixes tests 2023-10-27 16:51:31 +03:00
gindibay 736894472e Fixes pg15 tests 2023-10-27 16:02:09 +03:00
gindibay d323ab8c51 Fixes pg15 sql 2023-10-27 15:44:22 +03:00
gindibay 93dab80206 Moves pg15 tests 2023-10-27 15:33:55 +03:00
gindibay 66b433310c Moves pg15 tests to fix errors 2023-10-27 14:46:41 +03:00
gindibay b4dec6eee8 Fixes test 2023-10-27 14:15:43 +03:00
gindibay 3cb5cab8cd Fixes test problem 2023-10-27 14:01:23 +03:00
gindibay b28210c04f Adds shard selects to debug 2023-10-27 11:03:05 +03:00
gindibay 2a6c40d643 Fixes flaky tests 2023-10-27 10:10:42 +03:00
gindibay 72874a8623 Merge remote-tracking branch 'origin/main' into create_alter_database 2023-10-27 09:12:21 +03:00
gindibay a797584f1c Fixes tests 2023-10-27 09:07:19 +03:00
gindibay 473f6cbf05 Fixes metadata sync 2023-10-27 08:37:46 +03:00
gindibay c8fcf080c2 Fixes out files for transaction message 2023-10-24 20:44:43 +03:00
Gürkan İndibay c5c7705dbe
Merge branch 'main' into create_alter_database 2023-10-24 17:09:54 +03:00
gindibay 1dcee370e1 Fixes create_drop_database_test 2023-10-24 14:44:34 +03:00
Onur Tirtir db13afaa7b
Fix flaky columnar_create.sql test (#7266) 2023-10-17 16:58:17 +03:00
Jelte Fennema-Nio 788e09a39a
Add a test for citus_shards where table names have spaces (#7224)
There was a bug reported for previous versions of Citus where
shard\_size was returning NULL for tables with spaces in them. It works
fine on the main branch though, but I'm still adding a test for this to
the main branch because it seems a good test to have.
2023-10-16 11:38:24 +02:00
gindibay a497a78239 Fixes review comments 2023-10-14 20:39:39 +03:00
Gürkan İndibay c3a9a37ae2
Merge branch 'create_alter_database' into alter_database_additional_options 2023-10-16 14:44:32 +03:00
gindibay a274ffcb51 Adds If exists statement for drop database 2023-10-13 14:17:14 +03:00
gindibay 8cc67921cb Fixes review comments 2023-10-13 14:17:14 +03:00
gindibay 09d201d1a8 Fixes pg15 output 2023-10-13 14:17:13 +03:00
gindibay 7bccf93183 Fixes icu locale 2023-10-13 14:17:13 +03:00
gindibay d55ecc23ae Updates test results 2023-10-13 14:17:13 +03:00
gindibay 32d74d9521 Fixes collate and ctype 2023-10-13 14:17:13 +03:00
gindibay ddea1c897b Removes iculocale 2023-10-13 14:17:13 +03:00
gindibay da46878a8f Fixes Locale 2023-10-13 14:17:13 +03:00
gindibay 031b6480f2 Fixes locale 2023-10-13 14:17:13 +03:00
gindibay 576264ceca Fixes UTF error 2023-10-13 14:17:13 +03:00
gindibay 3050b0eab9 Fixes pg15 tests 2023-10-13 14:17:13 +03:00
gindibay 214ebc4374 Fixes encodings for pg16 2023-10-13 14:17:13 +03:00
gindibay 6f36556724 Revert "Removes pg15 changes to test unusal failures"
This reverts commit 85963e9cb5.
2023-10-13 14:17:13 +03:00
gindibay a7112fb965 Adds tablespace to test tablespace statement 2023-10-13 14:17:13 +03:00
gindibay 6913496f42 Fixes tests 2023-10-13 14:17:13 +03:00
gindibay 51d1560b34 Adds OID to see the error cause 2023-10-13 14:17:13 +03:00
gindibay c3d773ac6f Changes test order 2023-10-13 14:17:13 +03:00
gindibay 1d9c02fab9 Changes schedule location 2023-10-13 14:17:13 +03:00
gindibay 5eb87839b6 Rollbacks last test 2023-10-13 14:17:13 +03:00
gindibay acece9818c Rollbacks pg_regress_multi 2023-10-13 14:17:13 +03:00
gindibay c7304abd54 Fixes pg15 file 2023-10-13 14:17:13 +03:00
gindibay 14618878c8 Tests error cause 2023-10-13 14:17:13 +03:00
gindibay 29093e042a Removes pg15 changes to test unusal failures 2023-10-13 14:17:13 +03:00
gindibay aa47ca8bda Fixes tablespace results 2023-10-13 14:17:13 +03:00
gindibay 4c79788936 Fixes tablespace error 2023-10-13 14:17:13 +03:00
gindibay b01c9ffb45 Removes unnecessary fileds from selects 2023-10-13 14:17:13 +03:00
gindibay d0bd20c9b1 Fixes tests 2023-10-13 14:17:13 +03:00
gindibay 25488afccd Changes encoding 2023-10-13 14:17:13 +03:00
gindibay a5e0b9411a Adds tests for create and drop database 2023-10-13 14:17:13 +03:00
gindibay 8c98369e21 Fixes affected tests 2023-10-13 14:17:13 +03:00
Gürkan İndibay c38e856f13
Merge branch 'create_alter_database' into alter_database_additional_options 2023-10-14 08:15:45 +03:00
gindibay e5a6b7880c Adds If exists statement for drop database 2023-10-13 01:36:01 +03:00
gindibay 4087d1941d Fixes review comments 2023-10-13 00:12:38 +03:00
gindibay f8962380a1 Adds expected test result 2023-10-12 19:36:13 +03:00
gindibay 8d6d27a241 Adds set tablespace support 2023-10-12 19:06:27 +03:00
gindibay a72e474c3a Fixes test error 2023-10-11 21:25:49 +03:00
gindibay 7278968365 Adds additional tests for set tablespace 2023-10-11 20:40:26 +03:00
gindibay 80e450b860 Adds tests 2023-10-11 20:21:08 +03:00
Gürkan İndibay f7f768168b
Merge branch 'main' into create_alter_database 2023-10-10 11:02:40 +03:00
Onur Tirtir 858d99be33
Take improvement_threshold into the account in citus_add_rebalance_strategy() (#7247)
DESCRIPTION: Makes sure to take improvement_threshold into the account
in `citus_add_rebalance_strategy()`.

Fixes https://github.com/citusdata/citus/issues/7188.
2023-10-09 13:13:08 +03:00
gindibay 93ccbf74d8 Fixes pg15 output 2023-10-06 19:14:21 +03:00
gindibay 8d59e891f0 Fixes icu locale 2023-10-06 18:58:52 +03:00
gindibay c4f8acb0d9 Updates test results 2023-10-06 18:33:10 +03:00
gindibay 35c04c5d48 Fixes collate and ctype 2023-10-06 18:14:00 +03:00
gindibay 92c1b2bc2c Removes iculocale 2023-10-06 18:02:43 +03:00
gindibay 48359e5b3b Fixes Locale 2023-10-06 17:50:10 +03:00
gindibay a19b8216a2 Fixes locale 2023-10-06 17:03:57 +03:00
gindibay d218c31893 Fixes UTF error 2023-10-06 17:01:27 +03:00
gindibay 8251a22bee Fixes pg15 tests 2023-10-06 16:41:07 +03:00
gindibay fc67b6748d Fixes encodings for pg16 2023-10-06 16:10:47 +03:00
gindibay 2162c89efd Revert "Removes pg15 changes to test unusal failures"
This reverts commit 85963e9cb5.
2023-10-06 15:47:42 +03:00
gindibay 791fe0db48 Adds tablespace to test tablespace statement 2023-10-06 15:45:05 +03:00
gindibay 4dff8f3c67 Fixes tests 2023-10-06 15:24:23 +03:00