Commit Graph

5913 Commits (41285b5ef67d812d198ed1e3a0d5307dda869f05)

Author SHA1 Message Date
Jelte Fennema-Nio 41285b5ef6 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.

(cherry picked from commit a6e86884f6)
2025-02-04 18:41:05 +03:00
Naisila Puka e492647dbe Fix flaky multi_mx_insert_select_repartition test (#7331)
https://github.com/citusdata/citus/actions/runs/6745019678/attempts/1#summary-18336188930
```diff
     insert into target_table SELECT a*2 FROM source_table RETURNING a;
-NOTICE:  executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartitioned_results_xxxxx_from_4213582_to_0','repartitioned_results_xxxxx_from_4213584_to_0']::text[],'localhost',57638) bytes
+NOTICE:  executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartitioned_results_3940758121873413_from_4213584_to_0','repartitioned_results_3940758121873413_from_4213582_to_0']::text[],'localhost',57638) bytes
```

The elements in the array passed to `fetch_intermediate_results` are the
same, but in the opposite order than expected.

To fix this flakiness, we can omit the `"SELECT bytes FROM
fetch_intermediate_results..."` line. From the following logs, it is
understandable that the intermediate results have been fetched.

(cherry picked from commit 0dc41ee5a0)
2025-02-04 18:41:04 +03:00
Onur Tirtir d75b3aac04 Workaround the the runner issue in check-sql-snapshots
(cherry picked from commit 4bf9a7b7f0)
2025-02-04 18:40:11 +03:00
Gürkan İndibay ae93a3b9af Updates github checkout actions to v4 (#7611)
(cherry picked from commit 3fe22406e62fb40da12a0d91f3ecc0cba81cdb24)
2025-02-04 18:40:10 +03:00
Gürkan İndibay 5a7d1d8519 Removes ubuntu/bionic from packaging pipelines (#7142)
DESCRIPTION: Removes ubuntu/bionic from packaging pipelines

Since pg16 beta is not available for ubuntu/bionic and ubuntu/bionic
support is EOL, I need to remove this os from pipeline
https://ubuntu.com/blog/ubuntu-18-04-eol-for-devices

Additionally, added concurrency support for GH Actions Packaging
pipeline

(cherry picked from commit 553780e3f1)
2025-02-04 18:39:27 +03:00
Gürkan İndibay 09c938dc02 Removes el/7 and ol/7 as runners (#7650)
Removes el/7 and ol/7 as runners and update checkout action to v4

We use EL/7 and OL/7 runners to test packaging for these distributions.
However, for the past two weeks, we've encountered errors during the
checkout step in the pipelines. The error message is as follows:
```
/__e/node20/bin/node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /__e/node20/bin/node)
/__e/node20/bin/node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /__e/node20/bin/node)
/__e/node20/bin/node: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /__e/node20/bin/node)
/__e/node20/bin/node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /__e/node20/bin/node)
/__e/node20/bin/node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /__e/node20/bin/node)
/__e/node20/bin/node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by /__e/node20/bin/node)
```
The GCC version within the EL/7 and OL/7 Docker images is 2.17, and we
cannot upgrade it. Therefore, we need to remove these images from the
packaging test pipelines. Consequently, we will no longer verify if the
code builds for EL/7 and OL/7.

However, we are not using these packaging images as runners within the
packaging infrastructure, so we can continue to use these images for
packaging.

Additional Info: I learned that Marlin team fully dropped the el/7
support so we will drop in further releases as well

(cherry picked from commit c603c3ed74)
2025-02-04 18:39:27 +03:00
Onur Tirtir 01ae05833c Avoid publishing artifacts with conflicting names
.. as documented in actions/upload-artifact#480.

(cherry picked from commit 26f16a7654)
2025-02-04 18:39:27 +03:00
Onur Tirtir c4edaf3de3 Upgrade download-artifacts action to 4.1.8
(cherry picked from commit cbe0de33a6)
2025-02-04 18:39:26 +03:00
Onur Tirtir 6a17dcde90 Upgrade upload-artifacts action to 4.6.0
(cherry picked from commit b886cfa223)
2025-02-04 18:38:55 +03:00
Gürkan İndibay f44248c1d5
Bump Citus version to 11.0.10 (#7512) 2024-02-16 13:01:35 +03:00
Gürkan İndibay dcecefce68
Adds changelog for version 11.0.10 (#7510)
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2024-02-15 14:13:24 +00:00
Gürkan İndibay 23290bee6b
Removes pg_send_cancellation and all references (#7509)
Cherry pick from 371f094b68
2024-02-15 15:50:32 +03:00
Gürkan İndibay 5ea5da8ef5
Bump Citus version to 11.0.9 (#7501) 2024-02-13 16:39:50 +03:00
Gürkan İndibay 1dc16c7cd6
Adds changelog for version 11.0.9 (#7493)
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
2024-02-12 12:28:20 +00:00
Teja Mupparti 0ae0a86d42 Fix the incorrect column count after ALTER TABLE, this fixes the bug #7378 (please read the analysis in the bug for more information)
(cherry picked from commit 00068e07c5)
2024-01-26 18:16:20 -08:00
Gokhan Gulbiz eca999d6fe
Backport GHA Migration to release-11.0 (#7300)
DESCRIPTION: PR description that will go into the change log, up to 78
characters

---------

Co-authored-by: Jelte Fennema-Nio <jelte.fennema@microsoft.com>
2023-11-07 11:22:23 +02:00
Nils Dijk 76655957fd
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:13:52 +02:00
Hanefi Onaldi df50a2c0ea
Create a new colocation properly after braking one
When braking a colocation, we need to create a new colocation group
record in pg_dist_colocation for the relation. It is not sufficient to
have a new colocationid value in pg_dist_partition only.

This patch also fixes a bug when deleting a colocation group if no
tables are left in it. Previously we passed a relation id as a parameter
to DeleteColocationGroupIfNoTablesBelong function, where we should have
passed a colocation id.

(cherry picked from commit c22547d221)
2023-09-05 11:45:27 +03:00
zhjwpku 57e8bb3891 PQputCopyData's return value 0 should be considered fail (#7152) 2023-08-29 11:57:42 +02:00
onderkalaci 01c9ee30b5 Improve failure handling of distributed execution
Prior to this commit, the code would skip processing the
    errors happened for local commands.

    Prior to https://github.com/citusdata/citus/pull/5379, it might
    make sense to allow the execution continue. But, as of today,
    if a modification fails on any placement, we can safely fail
    the execution.

(cherry picked from commit b4008bc872)
2023-08-01 13:43:07 +03:00
Hanefi Onaldi 7603fe510a
Bump Citus version to 11.0.8 2023-04-25 14:23:44 +03:00
Hanefi Onaldi 367c22ac11
Add changelog entries for 11.0.8
(cherry picked from commit 214bc39a5a)
2023-04-25 14:23:43 +03:00
Gürkan İndibay f9b02ae2c7
Fix packaging test pipelines
We had #6737 fix the same issue on main branch, but we need to fix it on
release branches as well. As the patch does not really apply to earlier
release branches, we just added the fix manually.

(cherry picked from commit 4f9a344085)
2023-04-25 14:23:43 +03:00
Jelte Fennema 360537bc42 Use pg_total_relation_size in citus_shards (#6748)
DESCRIPTION: Correctly report shard size in citus_shards view

When looking at citus_shards, people are interested in the actual size
that all the data related to the shard takes up on disk.
`pg_total_relation_size` is the function to use for that purpose. The
previously used `pg_relation_size` does not include indexes or TOAST.
Especially the missing toast can have enormous impact on the size of the
shown data.

(cherry picked from commit b489d763e1)
2023-03-06 11:39:21 +01:00
aykut-bozkurt 01506e8a57 fix single tuple result memory leak (#6724)
We should not omit to free PGResult when we receive single tuple result
from an internal backend.
Single tuple results are normally freed by our ReceiveResults for
`tupleDescriptor != NULL` flow but not for those with `tupleDescriptor
== NULL`. See PR #6722 for details.

DESCRIPTION: Fixes memory leak issue with query results that returns
single row.

(cherry picked from commit 9e69dd0e7f)
2023-02-17 14:37:06 +03:00
Jelte Fennema 5729f9e690 Quote all identifiers that we use for logical replication (#6604)
In #6598 it was noticed that Citus could generate syntactically invalid
statements during logical replication. With #6603 we resolved the direct
issue, by only generating valid subscription names. But there was also
the underlying problem that we did not escape certain identifier
strings. While in theory this should be okay since we should only
generate names that are valid, this issue reiterated that we should not
take this for granted. As an extra line of defense this quotes all
identifiers we use during logical replication setup.

(cherry picked from commit c2b4087ff0)
2023-02-10 16:26:46 +01:00
Gürkan İndibay be8cd00d3f Fixes validate Output phase of packaging pipeline (#6678)
Pyenv is installed in our container images but I found out that pyenv is
not being activated since it is activated from ~/bashrc script and in
GitHub Actions (GHA) this script is not being executed
Since pyenv is not activated, default python versions comes from docker
images is being used and in this case we get errors for python version
3.11.
Additionally, $HOME directory is /github/home for containers executed
under GHA and our pyenv installation is under /root directory which is
normally home directory for our packaging containers
This PR activates usage of pyenv and additionally uses pyenv virtualenv
feature to execute validate_output function in isolation

---------

Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
(cherry picked from commit d919506076)
2023-01-31 14:01:05 +03:00
Onur Tirtir b9e18406fa Fall-back to seq-scan when accessing columnar metadata if the index doesn't exist
Fixes #6570.

In the past, having columnar tables in the cluster was causing pg
upgrades to fail when attempting to access columnar metadata. This is
because, pg_dump doesn't see objects that we use for columnar-am related
booking as the dependencies of the tables using columnar-am.
To fix that; in #5456, we inserted some "normal dependency" edges (from
those objects to columnar-am) into pg_depend.

This helped us ensuring the existency of a class of metadata objects
--such as columnar.storageid_seq-- and helped fixing #5437.

However, the normal-dependency edges that we added for indexes on
columnar metadata tables --such columnar.stripe_pkey-- didn't help at
all because they were indeed causing dependency loops (#5510) and
pg_dump was not able to take those dependency edges into the account.

For this reason, instead of inserting such dependency edges from indexes
to columnar-am, we allow columnar metadata accessors to fall-back to
sequential scan during pg upgrades.

(cherry picked from commit 1c51ddae49)
2023-01-30 19:13:58 +03:00
aykut-bozkurt 3eab345b67 fix dropping table_name option from foreign table (#6669)
We should disallow dropping table_name option if foreign table is in
metadata. Otherwise, we get table not found error which contains
shardid.

DESCRIPTION: Fixes an unexpected foreign table error by disallowing to drop the table_name option.

Fixes #6663

(cherry picked from commit 8a9bb272e4)
2023-01-30 17:48:47 +03:00
Gokhan Gulbiz 9b441c21da Allow plain pg foreign tables without a table_name option (#6652)
(cherry picked from commit 4e26464969)
2023-01-30 17:48:07 +03:00
Ahmet Gedemenli 2027d592a1 Fix crash when trying to replicate a ref table that is actually dropped (#6595)
DESCRIPTION: Fix crash when trying to replicate a ref table that is actually dropped

see #6592
We should have a real solution for it.

(cherry picked from commit bc3383170e)
(cherry picked from commit 9e32e34313)
2023-01-10 14:50:01 +03:00
Ahmet Gedemenli 1f03f13665 Use %u instead of %i for naming subscriptions & roles 2023-01-06 17:01:39 +03:00
Gürkan İndibay db7bd8e1a3
Add jobs to test builds on different distros (release-11.0) (#6542)
With this PR, citus code will be tested in all packaging environments.
Sometimes, there can be compile errors which blocks packaging and in
this case unplanned delays may occur.
By testing the code in packaging environments, I'm aiming to detect any
compilation errors before packaging.

Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
Co-authored-by: Hanefi Onaldi <Hanefi.Onaldi@microsoft.com>

DESCRIPTION: PR description that will go into the change log, up to 78
characters

Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
Co-authored-by: Hanefi Onaldi <Hanefi.Onaldi@microsoft.com>
2022-12-05 14:23:42 +03:00
Jelte Fennema bd7ee60991 Correctly fix OpenSSL 3.0 warnings (#6502)
In #6038 I tried to fix OpenSSL 3.0 warnings with PG13, but I had made a
mistake when doing that. This actually fixes these warnings.

(cherry picked from commit a477ffdf4b)
2022-12-05 09:30:57 +01:00
Jelte Fennema a9a9aa1098 Fix compilation warning on PG13 + OpenSSL 3.0 (#6038)
This removes some warnings that are present when building on Ubuntu 22.04.
It removes warnings on PG13 + OpenSSL 3.0. OpenSSL 3.0 has marked some
functions that we use as deprecated, but we want to continue support OpenSSL
1.0.1 for the time being too. This indicates that to OpenSSL 3.0, so it doesn't
show warnings.

(cherry picked from commit 3fadb98380)
2022-12-05 09:30:54 +01:00
Teja Mupparti 9aea377ce5 Fix the dangling pointer bug in get_merged_argument_list()
(cherry picked from commit edaf88e0ff)
2022-11-22 10:49:04 -08:00
Onur Tirtir 96e20ee42e Fix dangling pointer warning in AnyTableReplicated (#6504)
DESCRIPTION: Fixes a potential dangling pointer issue

Need to backport to 11.0 & 11.1 since we might want to release packages
for debian/bookworm based on those branches in future.

(cherry picked from commit 80faf47ab5)
2022-11-21 16:43:28 +03:00
Hanefi Onaldi a005db871a
Bump Citus version to 11.0.7 2022-11-08 12:12:17 +03:00
Hanefi Onaldi 011f5cfa83
Add changelog entries for 11.0.7 2022-11-08 12:11:16 +03:00
Naisila Puka b1a72bb822 Fixes empty password issue (#6417)
(cherry picked from commit 89aa9a015f)
2022-10-11 15:59:12 +03:00
Onur Tirtir 39225963c7 Use memcpy instead of memcpy_s to avoid pointless limits in columnar (#6419)
DESCRIPTION: Raises memory limits in columnar from 256MB to 1GB for
reads and writes

This doesn't completely fix #5918 but at least increases the
buffer limits that might cause throwing an error when reading
from or writing into into columnar storage. A way better approach
to fix this is documented in #6420.

Replacing memcpy_s with memcpy is quite safe in those places
since we anyway make sure to allocate enough amount of memory
before writing into related buffers.

(cherry picked from commit 0b81f68def)
2022-10-11 15:01:12 +03:00
Onur Tirtir 99697fb1e5 Fix use-after-free in GetAlterTriggerStateCommand() (#6413)
Fix use-after-free in GetAlterTriggerStateCommand() introduced in #6398.

(cherry picked from commit 517b72a9d5)
2022-10-10 16:38:52 +03:00
Onur Tirtir 9929d9240e Retain trigger settings when re-creating the triggers (on shards) (#6398)
Fixes https://github.com/citusdata/citus/issues/6394.

DESCRIPTION: Fixes a bug that causes creating disabled-triggers on
shards as enabled

Since CREATE TRIGGER doesn't have syntax support to specify
whether the trigger should be enabled/disabled, the underlying
PG function (`pg_get_triggerdef()`) that we use to generate the
command to create the trigger is not enough. For this reason, we
append a second command to enable/disable trigger, right after
creating it.

We don't retain explicit extension dependencies set by using
`ALTER trigger DEPENDS ON EXTENSION` commands too, but apparently
right fix for that is to throw an error as in
`PreprocessAlterTriggerDependsStmt()`; so, opened a separate PR
to fix that #6399.

(cherry picked from commit 86e186f671)
2022-10-10 11:24:01 +03:00
Ying Xu d3757ff15d
[Columnar] 11.0 Cherry-Pick Bugfix for Columnar: options ignored during ALTER TABLE (#6410)
DESCRIPTION: Fixes a bug that prevents retaining columnar table options
after a table-rewrite A fix for this issue: Columnar: options ignored
during ALTER TABLE rewrite #5927
The OID for the temporary table created during ALTER TABLE was not the
same as the original table's OID so the columnar options were not being
applied during rewrite.

The change is that I applied the original table's columnar options to
the new table so that it has the correct options during write. I also
added a test.

cherry-pick from commit f21cbe68f8
2022-10-09 22:30:59 -07:00
Naisila Puka 51da46c021 Use original relation to retrieve column name because of syscache (#6387)
During alter_distributed_table, we create a new table like the
original table but with the altered options.

To retrieve the name of the distribution column, we were using
the attribute syscache of the new table, since we already created
the new table as identical to the original table.

However, the attribute syscaches of these two tables are not
the same if the original table has dropped columns. The reason
is that dropped columns are all still present in the cache.
Hence, for example, the attnos would be different in the syscaches.

So, let's use the attribute syscache of the original table.
2022-10-06 12:11:35 +03:00
Hanefi Onaldi ff6358749d
Ensure no dependencies to index before drop
(cherry picked from commit 11a9a3771f)
2022-10-04 21:08:39 +03:00
Hanefi Onaldi 628908e990
Document failing downgrades from 10.2-4 to 10.2-2
(cherry picked from commit 5ddd4754a2)
2022-10-04 21:08:39 +03:00
Hanefi Onaldi 3efafe49ba
Fix tests for missing downgrades
(cherry picked from commit 0efd6f7829)
2022-10-04 21:08:39 +03:00
Onur Tirtir b14bae6311 Not allow ON DELETE/UPDATE SET DEFAULT actions on columns that default to sequences (#6340)
Given that we drop DEFAULT nextval('sequence') expressions from
shard relation columns, allowing `ON DELETE/UPDATE SET DEFAULT`
on such columns might cause inserting NULL values as a result
of a delete/update operation.

For this reason, we disallow ON DELETE/UPDATE SET DEFAULT actions
on columns that default to sequences.

DESCRIPTION: Disallows having ON DELETE/UPDATE SET DEFAULT actions on
columns that default to sequences

Fixes #6339.

(cherry picked from commit a868cc049a)

 Conflicts (dropped those changes since pg15 is not supported on 11.0):
	src/test/regress/expected/pg15.out
	src/test/regress/sql/pg15.sql
2022-09-23 14:24:29 +03:00
Onur Tirtir 308f9298d7 Include IntegerArrayTypeToList from worker_protocol.h instead of array_type.h
On Citus versions <= 11.0, IntegerArrayTypeToList() doesn't exist and
its helpers (DeconstructArrayObject() & ArrayObjectCount()) are defined
in worker_protocol.h. (See 9476f377b5).

So we add IntegerArrayTypeToList() into worker_protocol.c and include
IntegerArrayTypeToList from worker_protocol.h instead of array_type.h
in foreign_constraint.c.

This is needed to backport a868cc049a into
this (release-11.0) branch, see the next commit.
2022-09-23 14:24:22 +03:00