Commit Graph

3255 Commits (f8b3f322aae794128cd808fe8919e5ad490c9fd1)

Author SHA1 Message Date
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 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
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
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 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