Commit Graph

3560 Commits (ea7c5f2b013d6d37901f7db49b5ba45c7f797571)

Author SHA1 Message Date
gindibay c1e9335fb7 Adds distributed check in metadata syncing 2023-11-14 09:01:00 +03:00
Gürkan İndibay 7780101619
Update src/backend/distributed/commands/database.c
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2023-11-13 19:00:40 +03:00
Gürkan İndibay 1e044a217d
Update src/backend/distributed/deparser/deparse_database_stmts.c
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2023-11-13 19:00:01 +03:00
Gürkan İndibay a956786bd8
Update src/backend/distributed/deparser/deparse_database_stmts.c
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2023-11-13 18:59:48 +03:00
Gürkan İndibay 32df3313d4
Update src/backend/distributed/metadata/metadata_sync.c
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2023-11-13 18:59:36 +03:00
Onur Tirtir c1dce6fc2b commit 2023-11-13 18:02:31 +03:00
Gürkan İndibay 7e15939e50
Update src/backend/distributed/commands/database.c
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2023-11-13 17:15:11 +03:00
gindibay fcdea98edd Removes drop in citus_internal_db_command udf 2023-11-13 15:58:09 +03:00
gindibay a9977e8840 Moves validation to preprocess for createdb 2023-11-13 15:49:19 +03:00
gindibay 712fd8ebf3 Fixes comments 2023-11-13 14:23:37 +03:00
gindibay 3731c45c29 Fixes drop force option 2023-11-13 14:19:19 +03:00
gindibay 52c9e92544 Adds IsAnyObjectDistributed check for db 2023-11-13 13:44:08 +03:00
Gürkan İndibay 8728871cc3
Apply suggestions from code review
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2023-11-13 14:56:24 +03:00
Onur Tirtir 1a80181a9c indent 2023-11-13 13:42:11 +03:00
Onur Tirtir 69217678b3 allow wal_log option only if it's set to default 2023-11-13 12:16:08 +03:00
gindibay a35cae0ed7 Fixes review issues 2023-11-13 12:07:40 +03:00
Onur Tirtir f5a3f4d351 Merge remote-tracking branch 'origin/create_alter_database' into create_alter_database 2023-11-13 11:43:51 +03:00
Onur Tirtir 2ca6e2c358 indent 2023-11-13 11:43:31 +03:00
gindibay 974e628884 Merge branch 'create_alter_database' of https://github.com/citusdata/citus into create_alter_database 2023-11-13 11:42:00 +03:00
gindibay 30e1a858d2 Removes oid support 2023-11-13 11:41:58 +03:00
Onur Tirtir 5b446b1137 make tests passing 2023-11-13 11:27:29 +03:00
Onur Tirtir 240313e286
Support role commands from any node (#7278)
DESCRIPTION: Adds support from issuing role management commands from worker nodes

It's unlikely to get into a distributed deadlock with role commands, we
don't care much about them at the moment.
There were several attempts to reduce the chances of a deadlock but we
didn't any of them merged into main branch yet, see:
#7325
#7016
#7009
2023-11-10 09:58:51 +00:00
gindibay f8b3f322aa Fixed review items 2023-11-10 08:33:51 +03:00
Gürkan İndibay 3067d1ef08
Apply suggestions from code review
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2023-11-10 17:34:09 +03:00
gindibay 1b9a8ea2db Fixes indentation 2023-11-10 06:11:43 +03:00
gindibay 2ebeea3ce3 Fixes compilation warnings 2023-11-10 06:10:24 +03:00
gindibay e31ca6e31e Merge remote-tracking branch 'origin/create_alter_database' into alter_database_additional_options 2023-11-10 05:53:07 +03:00
gindibay 8df30a2a2b Fixes EnsureCitusInitiatedOperation name change 2023-11-10 05:52:14 +03:00
Gürkan İndibay 0a73cb31b0
Merge branch 'main' into create_alter_database 2023-11-10 14:12:48 +03:00
gindibay b5424db419 Fixes compilation errors 2023-11-10 05:46:30 +03:00
gindibay b45543f51b Merge remote-tracking branch 'origin/create_alter_database' into alter_database_additional_options 2023-11-10 05:38:19 +03:00
gindibay 3ab91c91a3 Fixes review comments 2023-11-10 04:59:50 +03:00
Nils Dijk 0dac63afc0
move pg_version_constants.h to toplevel include (#7335)
In preparation of sorting and grouping all includes we wanted to move
this file to the toplevel includes for good grouping/sorting.
2023-11-09 15:09:39 +00:00
gindibay 5f4092db5b Adds validation for template 2023-11-09 12:11:22 +03:00
Gürkan İndibay 32c67963bd
Merge branch 'main' into create_alter_database 2023-11-09 11:37:58 +03:00
gindibay 4c9863c0fb Fixes review comments 2023-11-09 01:49:43 +03:00
gindibay afa60556fd Fixes review comments 2023-11-09 01:43:08 +03:00
Gürkan İndibay 75589d1c11
Apply suggestions from code review
Co-authored-by: Jelte Fennema-Nio <jelte.fennema@microsoft.com>
2023-11-08 17:38:43 +03:00
gindibay 65660db10d Fixes review items 2023-11-08 02:02:00 +03:00
Onur Tirtir 444e6cb7d6
Remove useless variables (#7327)
To fix warnings observed when using different compiler versions.
2023-11-07 16:39:08 +03:00
cvbhjkl e535f53ce5
Fix typo in local_executor.c (#7324)
Fix a typo 'remaning' -> 'remaining' in local_executor.c
2023-11-03 12:14:11 +00:00
Cédric Villemain 0678a2fd89
Fix #7242, CALL(@0) crash backend (#7288)
When executing a prepared CALL, which is not pure SQL but available with
some drivers like npgsql and jpgdbc, Citus entered a code path where a
plan is not defined, while trying to increase its cost. Thus SIG11 when
plan is a NULL pointer.

Fix by only increasing plan cost when plan is not null.

However, it is a bit suspicious to get here with a NULL plan and maybe a
better change will be to not call
ShardPlacementForFunctionColocatedWithDistTable() with a NULL plan at
all (in call.c:134)

bug hit with for example:
```
CallableStatement proc = con.prepareCall("{CALL p(?)}");
proc.registerOutParameter(1, java.sql.Types.BIGINT);
proc.setInt(1, -100);
proc.execute();
```

where `p(bigint)` is a distributed "function" and the param the
distribution key (also in a distributed table), see #7242 for details

Fixes #7242
2023-11-02 13:15:24 +01:00
Gürkan İndibay 184c8fc1ee
Enriches statement propagation document (#7267)
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
Co-authored-by: Hanefi Onaldi <Hanefi.Onaldi@microsoft.com>
Co-authored-by: Jelte Fennema-Nio <jelte.fennema@microsoft.com>
2023-11-02 09:59:34 +00: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
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 c72f5357e1 Fix PG16 assertion 2023-10-31 16:10:03 +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 2d9181a9ab Fixes indents 2023-10-31 11:00:40 +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 b41feadd97 Fixes indent 2023-10-27 10:39:16 +03:00
gindibay 8811d910a5 Fixes pg 14 compile errors 2023-10-27 10:28:09 +03:00
gindibay fe26aebf6c Fixes useless declarations 2023-10-27 09:52:58 +03:00
gindibay 569f4db60c Fixes pg 14 compile warnings 2023-10-27 09:51:15 +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 641e413676 Adds metadatasync for create database 2023-10-26 20:36:43 +03:00
gindibay c437850db5 Beatufies error message 2023-10-24 19:25:26 +03:00
gindibay 48d749e2e8 Fixes message for non-transaction-safe commands 2023-10-24 19:15:46 +03:00
gindibay c7da2cd122 Fixes cannotBeExecutedInTransction 2023-10-24 15:44:59 +03:00
Gürkan İndibay c5c7705dbe
Merge branch 'main' into create_alter_database 2023-10-24 17:09:54 +03:00
gindibay c7b040c3cd Fixes indentation 2023-10-24 15:19:50 +03:00
gindibay 2f52fbd13e Fixes missing ok issue 2023-10-24 15:14:05 +03:00
gindibay 3a0a5ae344 Fixes missin ok issue 2023-10-24 15:13:22 +03:00
gindibay b5cbc048b7 Fixes missing ok issue 2023-10-24 15:12:08 +03:00
gindibay f779947b2b Removes unnecessary logs 2023-10-24 14:57:36 +03:00
gindibay fb9f75bb24 Removes unnecessary logs 2023-10-24 14:43:12 +03:00
gindibay e9e64a69c1 Fixes indentation 2023-10-24 14:18:10 +03:00
gindibay 73f0db2aed Fixes create and drop database transaction use 2023-10-24 14:09:36 +03:00
gindibay c9dae2684f tests db as role 2023-10-24 10:09:13 +03:00
Naisila Puka 10198b18e8
Technical readme small fixes (#7261) 2023-10-23 13:43:43 +03:00
Naisila Puka 1fe16fa746
Remove unnecessary pre-fastpath code (#7262)
This code was here because we first implemented
`fast path planner` via
[#2606](https://github.com/citusdata/citus/pull/2606)
and then later `deferred pruning`
[#3369](https://github.com/citusdata/citus/pull/3369)
So, for some years, this code was useful.
2023-10-23 13:01:48 +03:00
gindibay 690276c516 Fixes indentation 2023-10-23 12:35:53 +03:00
gindibay ea0a908702 Fixes pg_dist_objects record in coordinators 2023-10-23 12:31:25 +03:00
gindibay dad81042a5 Adds undistribute sql 2023-10-23 10:01:18 +03:00
zhjwpku 2d1444188c
Fix wrong comments around HasDistributionKey() (#7223)
HasDistributionKey & HasDistributionKeyCacheEntry returns true when the
corresponding table has a distribution key, the comments state the
opposite,
which should be fixed.

Signed-off-by: Zhao Junwang <zhjwpku@gmail.com>
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2023-10-18 10:53:00 +02:00
Gürkan İndibay 71a4633dad
Fixes typo and renames multi_process_utility (#7259) 2023-10-17 16:39:37 +03:00
gindibay 1e91b144e2 Fixed review issues 2023-10-14 20:49:26 +03:00
gindibay c6d1ef9e41 Rollbacks enable_create_database_propagation 2023-10-14 20:19:18 +03:00
gindibay 674fd3226c Sets enable_create_database_propagation true 2023-10-14 19:50:32 +03:00
gindibay 3a6fdada11 Changes if to switch statements 2023-10-14 05:35:34 +03:00
gindibay 30bbfe444d Fixes review notes 2023-10-13 18:45:58 +03:00
gindibay ba3123455e Fixes review notes 2023-10-13 18:43:06 +03:00
gindibay ef920b0252 Fixes compile errors 2023-10-13 14:49:34 +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 ca5e234821 Adds EnableCreateDatabasePropagation for drop db 2023-10-13 14:17:14 +03:00
gindibay abf9dd9e59 Adds EnableCreateDatabasePropagation check 2023-10-13 14:17:14 +03:00
gindibay 333f77a267 Fixes distributed_object management 2023-10-13 14:17:14 +03:00
gindibay c31479d2eb Fixes review notes 2023-10-13 14:17:14 +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 875f347238 Fixes indentation 2023-10-13 14:17:14 +03:00
gindibay f2092d2f44 Clarifies the code 2023-10-13 14:17:14 +03:00
gindibay 7bdeb2f866 Fixes indentation 2023-10-13 14:17:14 +03:00
gindibay fb6dd413ad Fixes PostprocessCreateDatabaseStmt comment 2023-10-13 14:17:14 +03:00
gindibay d88a1e7785 Fixes compile error 2023-10-13 14:17:14 +03:00
gindibay d0ef13dc89 Fixes review comments 2023-10-13 14:17:14 +03:00