Commit Graph

3378 Commits (create_drop_db_gh)

Author SHA1 Message Date
gindibay 0fdb3384d9 Adds EnableCreateDatabasePropagation for drop db 2023-10-13 04:46:53 +03:00
gindibay 06050a1411 Adds EnableCreateDatabasePropagation check 2023-10-13 04:36:49 +03:00
gindibay bc0a283221 Fixes distributed_object management 2023-10-13 04:26:03 +03:00
gindibay 761fb13ac8 Fixes review notes 2023-10-13 03:10:17 +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
Gürkan İndibay f7f768168b
Merge branch 'main' into create_alter_database 2023-10-10 11:02:40 +03:00
Emel Şimşek e9035f6d32
Send keepalive messages in split decoder periodically to avoid wal receiver timeouts during large shard splits. (#7229)
DESCRIPTION: Send keepalive messages during the logical replication
phase of large shard splits to avoid timeouts.

During the logical replication part of the shard split process, split
decoder filters out the wal records produced by the initial copy. If the
number of wal records is big, then split decoder ends up processing for
a long time before sending out any wal records through pgoutput. Hence
the wal receiver may time out and restarts repeatedly causing our split
driver code catch up logic to fail.

Notes: 

1. If the wal_receiver_timeout is set to a very small number e.g. 600ms,
it may time out before receiving the keepalives. My tests show that this
code works best when the` wal_receiver_timeout `is set to 1minute, which
is the default value.

2. Once a logical replication worker time outs, a new one gets launched.
The new logical replication worker sets the pg_stat_subscription columns
to initial values. E.g. the latest_end_lsn is set to 0. Our driver logic
in `WaitForGroupedLogicalRepTargetsToCatchUp` can not handle LSN value
to go back. This is the main reason for it to get stuck in the infinite
loop.
2023-10-09 22:33:08 +03:00
gindibay 723c2b154f Fixes indentation 2023-10-09 20:27:50 +03:00
gindibay 78f8ae22c4 Clarifies the code 2023-10-09 20:24:34 +03:00
gindibay 1a26316cef Fixes indentation 2023-10-09 20:03:07 +03:00
gindibay be9f660fad Fixes PostprocessCreateDatabaseStmt comment 2023-10-09 20:01:29 +03:00
gindibay b04c52abb9 Fixes compile error 2023-10-09 19:44:36 +03:00
gindibay 5dd6ed6935 Fixes review comments 2023-10-09 19:42:17 +03:00
gindibay d573910f2a Fixes the comment 2023-10-09 18:10:28 +03:00
gindibay 3547eeeb6f Adds PG_VERSION_15 constant 2023-10-09 16:05:07 +03:00
gindibay 4b4aae2d4a Fixes compile error 2023-10-09 16:00:18 +03:00
gindibay 69ccf7dd97 Fixes indent 2023-10-09 15:57:34 +03:00
gindibay 45103629dc Fixes compile error for PG 14 2023-10-09 15:56:05 +03:00
gindibay 7022344870 Adds missing types 2023-10-09 15:14:13 +03:00
Nils Dijk 6d8725efb0
Fix leaking of memory and memory contexts in Foreign Constraint Graphs (#7236)
DESCRIPTION: Fix leaking of memory and memory contexts in Foreign
Constraint Graphs

Previously, every time we (re)created the Foreign Constraint
Relationship Graph, we created a new Memory Context while loosing a
reference to the previous context. This old context could still have
left over memory in there causing a memory leak.

With this patch we statically have one memory context that we lazily
initialize the first time we create our foreign constraint relationship
graph. On every subsequent creation, beside destroying our previous
hashmap we also reset our memory context to remove any left over
references.
2023-10-09 13:05:51 +02:00
gindibay b99674dcf9 Removes T_Boolean since it breaks pg14 compile 2023-10-09 13:46:54 +03:00
gindibay 2b04873159 Fixes indentation 2023-10-09 13:28:23 +03:00
gindibay 6846b7fbc7 Refactors the code to make more managable 2023-10-09 13:27:12 +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 6d429521b6 Fixes indentation 2023-10-06 15:22:15 +03:00
gindibay 8ded5bc256 Fixes pg_dist_object delete problem 2023-10-06 15:18:16 +03:00
Önder Kalacı 7d6c401dd3
Update technical readme (#7248)
Fix a wrong query, reported by @naisila
2023-10-06 13:37:37 +03:00
gindibay 236ea1d1b9 Adds tests for create and drop database 2023-10-04 21:20:19 +03:00
gindibay f25b173ad5 Changes EnableCreateDatabasePropagation to false
to fix failing tests
2023-10-04 15:06:22 +03:00
gindibay 1b8c400821 Fixes sql comments 2023-10-04 13:40:37 +03:00
gindibay 90ead5dd19 Fixes indentation 2023-10-04 13:32:39 +03:00
gindibay c1aca5ef89 Removes unnecessary code 2023-10-04 13:23:28 +03:00
gindibay 90547e6cd5 Removes unnecessary files 2023-10-04 13:23:28 +03:00
gindibay 84826dcc98 Fixes runtime and compile errors 2023-10-04 13:23:28 +03:00
gindibay 8435509347 Fix for Pg16 compile error 2023-10-04 13:23:28 +03:00
gindibay 8c93c65351 Fixes compile errors 2023-10-04 13:23:28 +03:00
gindibay ae9cd9c895 Fixes additional compile errors 2023-10-04 13:23:28 +03:00
gindibay 226696e42a Adds first commit 2023-10-04 13:23:28 +03:00
Önder Kalacı 0dca65c84d
Addd missing image to Technical Readme (#7243)
DESCRIPTION: PR description that will go into the change log, up to 78
characters
2023-09-29 22:24:10 +02:00
Önder Kalacı 185ac5e01e
Citus Technical Readme (#7207)
This commit aims to add a comprehensive guide that covers all essential
aspects of Citus, including planning, execution, locking mechanisms,
shard moves, 2PC, and many other major components of Citus.

Co-authored-by: Marco Slot <marco.slot@gmail.com>
2023-09-29 16:50:52 +03:00
Nils Dijk b87fbcbf79
Shard moves/isolate report LSN's in lsn format (#7227)
DESCRIPTION: Shard moves/isolate report LSN's in lsn format

While investigating an issue with our catchup mechanism on certain
postgres versions we noticed we print LSN's in the format of the native
long type. This is an uncommon representation for LSN's in postgres
logs.

This patch changes the output of our log message to go from the long
type representation to the native LSN type representation. Making it
easier for postgres users to recognize and compare LSN's with other
related reports.

example of new output:
```
2023-09-25 17:28:47.544 CEST [11345] LOG:  The LSN of the target subscriptions on node localhost:9701 have increased from 0/0 to 0/E1ED20F8 at 2023-09-25 17:28:47.544165+02 where the source LSN is 1/415DCAD0
```
2023-09-26 13:47:50 +02:00
Gürkan İndibay 7fa109c977
Adds alter user missing features (#7204)
DESCRIPTION: Adds alter user rename propagation and enriches alter user
tests

---------

Co-authored-by: Jelte Fennema <github-tech@jeltef.nl>
2023-09-26 12:28:07 +03:00
Onur Tirtir 111b4c19bc
Make sure to disallow creating a replicated distributed table concurrently (#7219)
See explanation in https://github.com/citusdata/citus/issues/7216.
Fixes https://github.com/citusdata/citus/issues/7216.

DESCRIPTION: Makes sure to disallow creating a replicated distributed
table concurrently
2023-09-25 11:14:35 +03:00
Nils Dijk 0f28a69f12
Use the $(DLSUFFIX) instead of hard coded extensions for cdc (#7221)
When cdc got added the makefiles hardcoded the `.so` extension instead
of using the platform specifc `$(DLSUFFIX)` variable used by `pgxs.mk`.
Also don't remove installed cdc artifacts on `make clean`.
2023-09-22 16:24:18 +02:00
Gürkan İndibay 7c0b289761
Adds alter database set option (#7181)
DESCRIPTION: Adds support for ALTER DATABASE <db_name> SET .. statement
propagation
SET statements in Postgres has a common structure which is already being
used in Alter Function
statement. 
In this PR, I added a util file; citus_setutils and made it usable for
both for
alter database<db_name>set .. and alter function ... set ... statements.
With this PR, below statements will be propagated
```sql
ALTER DATABASE name SET configuration_parameter { TO | = } { value | DEFAULT }
ALTER DATABASE name SET configuration_parameter FROM CURRENT
ALTER DATABASE name RESET configuration_parameter
ALTER DATABASE name RESET ALL
```
Additionally, there was a bug in processing float values in the common
code block.
I fixed this one as well

Previous
```C
case T_Float:
			{
				appendStringInfo(buf, " %s", strVal(value));
				break;
			}
```
Now
```C
case T_Float:
			{
				appendStringInfo(buf, " %s", nodeToString(value));
				break;
			}
```
2023-09-14 16:29:16 +03:00
aykut-bozkurt 26dc407f4a
bump citus and columnar into 12.2devel (#7200) 2023-09-14 12:03:09 +03:00
Gürkan İndibay e5e64b7454
Adds alter database propagation - with and refresh collation (#7172)
DESCRIPTION: Adds ALTER DATABASE WITH ... and REFRESH COLLATION VERSION
support

This PR adds supports for basic ALTER DATABASE statements propagation 
support. Below statements are supported:
ALTER DATABASE <database_name> with IS_TEMPLATE <true/false>;
ALTER DATABASE <database_name> with CONNECTION LIMIT <integer_value>;
ALTER DATABASE <database_name> REFRESH COLLATION VERSION;

---------

Co-authored-by: Jelte Fennema-Nio <jelte.fennema@microsoft.com>
2023-09-12 14:09:15 +03:00
Naisila Puka 1da99f8423
PG16 - Don't propagate GRANT ROLE with INHERIT/SET option (#7190)
We currently don't support propagating these options in Citus
Relevant PG commits:
https://github.com/postgres/postgres/commit/e3ce2de
https://github.com/postgres/postgres/commit/3d14e17

Limitation:
We also need to take care of generated GRANT statements by dependencies
in attempt to distribute something else. Specifically, this part of the
code in `GenerateGrantRoleStmtsOfRole`:
```
grantRoleStmt->admin_opt = membership->admin_option;
```
In PG16, membership also has `inherit_option` and `set_option` which
need to properly be part of the `grantRoleStmt`. We can skip for now
since #7164 will take care of this soon, and also this is not an
expected use-case.
2023-09-12 12:47:37 +03:00
Naisila Puka c1dc378504
Fix WITH ADMIN FALSE propagation (#7191) 2023-09-11 15:58:24 +03:00