From 243dcb599358859e3e7c7a7281f3eabe2b8cc8e2 Mon Sep 17 00:00:00 2001 From: eaydingol Date: Fri, 21 Nov 2025 15:19:17 +0300 Subject: [PATCH 1/6] Run citus tests on latest so, specified sql --- .github/workflows/build_and_test.yml | 9 ++++++--- src/test/regress/Makefile | 6 +++++- src/test/regress/pg_regress_multi.pl | 27 +++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 98e012179..0c313fb79 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -132,7 +132,7 @@ jobs: ./build-${{ env.PG_MAJOR }}/* ./install-${{ env.PG_MAJOR }}.tar test-citus: - name: PG${{ fromJson(matrix.pg_version).major }} - ${{ matrix.make }} + name: PG${{ fromJson(matrix.pg_version).major }} - ${{ matrix.make }} - ${{ matrix.citus_version}} strategy: fail-fast: false matrix: @@ -161,6 +161,9 @@ jobs: - check-enterprise-isolation-logicalrep-1 - check-enterprise-isolation-logicalrep-2 - check-enterprise-isolation-logicalrep-3 + citus_version: + - + - 13.2-1 include: - make: check-failure pg_version: ${{ needs.params.outputs.pg15_version }} @@ -242,12 +245,12 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup_extension" - name: Run Test - run: gosu circleci make -C src/test/${{ matrix.suite }} ${{ matrix.make }} + run: CITUSVERSION=${{ matrix.citus_version }} gosu circleci make -C src/test/${{ matrix.suite }} ${{ matrix.make }} timeout-minutes: 20 - uses: "./.github/actions/save_logs_and_results" if: always() with: - folder: ${{ fromJson(matrix.pg_version).major }}_${{ matrix.make }} + folder: ${{ fromJson(matrix.pg_version).major }}_${{ matrix.make }}_${{ matrix.citus_version }} - uses: "./.github/actions/upload_coverage" if: always() with: diff --git a/src/test/regress/Makefile b/src/test/regress/Makefile index e9949ecce..ba5cf58b1 100644 --- a/src/test/regress/Makefile +++ b/src/test/regress/Makefile @@ -10,6 +10,9 @@ ifndef MAJORVERSION MAJORVERSION := $(basename $(VERSION)) endif +ifndef CITUSVERSION +CITUSVERSION := "" +endif # Add ./bin to $PATH so we use our custom diff instead of the default diff tool. # We do this to be able to mask shard Ids, placement Ids, node ports, etc. MAKEFILE_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) @@ -28,7 +31,7 @@ export PGISOLATIONTIMEOUT = 60 ## Citus regression support ## MULTI_INSTALLDIR=$(CURDIR)/tmp_check/install -pg_regress_multi_check = $(PERL) $(citus_abs_srcdir)/pg_regress_multi.pl --pgxsdir="$(pgxsdir)" --bindir="$(bindir)" --libdir="$(libdir)" --majorversion="$(MAJORVERSION)" --postgres-builddir="$(postgres_abs_builddir)" --postgres-srcdir="$(postgres_abs_srcdir)" --citus_abs_srcdir="$(citus_abs_srcdir)" +pg_regress_multi_check = $(PERL) $(citus_abs_srcdir)/pg_regress_multi.pl --pgxsdir="$(pgxsdir)" --bindir="$(bindir)" --libdir="$(libdir)" --majorversion="$(MAJORVERSION)" --postgres-builddir="$(postgres_abs_builddir)" --postgres-srcdir="$(postgres_abs_srcdir)" --citus_abs_srcdir="$(citus_abs_srcdir)" --citus-version=$(CITUSVERSION) MULTI_REGRESS_OPTS = --inputdir=$(citus_abs_srcdir) $(pg_regress_locale_flags) --launcher="$(citus_abs_srcdir)/log_test_times" pg_upgrade_check = $(citus_abs_srcdir)/citus_tests/upgrade/pg_upgrade_test.py @@ -157,6 +160,7 @@ check-multi: all check-enterprise: all $(pg_regress_multi_check) --load-extension=citus \ -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/enterprise_schedule $(EXTRA_TESTS) + check-multi-1: all $(pg_regress_multi_check) --load-extension=citus \ -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/multi_1_schedule $(EXTRA_TESTS) diff --git a/src/test/regress/pg_regress_multi.pl b/src/test/regress/pg_regress_multi.pl index efe5e71b7..7d760a2eb 100755 --- a/src/test/regress/pg_regress_multi.pl +++ b/src/test/regress/pg_regress_multi.pl @@ -50,6 +50,7 @@ sub Usage() print " --connection-timeout Timeout for connecting to worker nodes\n"; print " --mitmproxy Start a mitmproxy for one of the workers\n"; print " --worker-count Number of workers in Citus cluster (default: 2)\n"; + print " --citus-version Citus version being tested (used for during extension create)\n"; exit 1; } @@ -87,6 +88,7 @@ my $conninfo = ""; my $publicWorker1Host = "localhost"; my $publicWorker2Host = "localhost"; my $workerCount = 2; +my $citusversion = ""; my $serversAreShutdown = "TRUE"; my $usingWindows = 0; @@ -121,6 +123,7 @@ GetOptions( 'worker-1-public-hostname=s' => \$publicWorker1Host, 'worker-2-public-hostname=s' => \$publicWorker2Host, 'worker-count=i' => \$workerCount, + 'citus-version=s' => \$citusversion, 'help' => sub { Usage() }); my $fixopen = "$bindir/postgres.fixopen"; @@ -590,6 +593,12 @@ if($isolationtester) push(@pgOptions, "citus.background_task_queue_interval=-1"); } +if($citusversion) +{ + push(@pgOptions, "citus.enable_version_checks=off"); + push(@pgOptions, "columnar.enable_version_checks=off"); +} + # Add externally added options last, so they overwrite the default ones above for my $option (@userPgOptions) { @@ -990,10 +999,20 @@ if (!$conninfo) for my $extension (@extensions) { - system(catfile($bindir, "psql"), - ('-X', '-h', $host, '-p', $port, '-U', $user, "-d", "regression", - '-c', "CREATE EXTENSION IF NOT EXISTS $extension;")) == 0 - or die "Could not create extension $extension on worker port $port."; + if ($extension eq "citus" && $citusversion ne "") + { + system(catfile($bindir, "psql"), + ('-X', '-h', $host, '-p', $port, '-U', $user, "-d", "regression", + '-c', "CREATE EXTENSION IF NOT EXISTS $extension VERSION '$citusversion';")) == 0 + or die "Could not create extension $extension on worker port $port."; + } + else + { + system(catfile($bindir, "psql"), + ('-X', '-h', $host, '-p', $port, '-U', $user, "-d", "regression", + '-c', "CREATE EXTENSION IF NOT EXISTS $extension;")) == 0 + or die "Could not create extension $extension on worker port $port."; + } } foreach my $function (keys %functions) From b4a4d898547605c2105739cee16f0d48a4d59d72 Mon Sep 17 00:00:00 2001 From: eaydingol Date: Tue, 25 Nov 2025 10:12:56 +0300 Subject: [PATCH 2/6] test workflow --- .github/workflows/build_and_test.yml | 14 ++++++- .github/workflows/run_tests.yml | 59 ++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/run_tests.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0c313fb79..5c5fa2725 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -131,6 +131,19 @@ jobs: path: |- ./build-${{ env.PG_MAJOR }}/* ./install-${{ env.PG_MAJOR }}.tar + test-citus-new: + uses: ./.github/workflows/run_tests.yml + needs: + - params + - build + with: + pg_versions: '[${{ needs.params.outputs.pg16_version }}, ${{ needs.params.outputs.pg17_version }}]' + make_targets: '["check-split", "check-multi"]' + image_suffix: ${{ needs.params.outputs.image_suffix }} + image_name: ${{ needs.params.outputs.test_image_name }} + secrets: + codecov_token: ${{ secrets.CODECOV_TOKEN }} + test-citus: name: PG${{ fromJson(matrix.pg_version).major }} - ${{ matrix.make }} - ${{ matrix.citus_version}} strategy: @@ -163,7 +176,6 @@ jobs: - check-enterprise-isolation-logicalrep-3 citus_version: - - - 13.2-1 include: - make: check-failure pg_version: ${{ needs.params.outputs.pg15_version }} diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml new file mode 100644 index 000000000..00f275822 --- /dev/null +++ b/.github/workflows/run_tests.yml @@ -0,0 +1,59 @@ +name: Run Tests +on: + workflow_call: + inputs: + pg_versions: + required: true + type: string + make_targets: + required: true + type: string + image_suffix: + required: true + type: string + image_name: + required: true + type: string + suite: + required: false + type: string + default: "regress" + citus_version: + required: false + type: string + default: "" + secrets: + codecov_token: + required: false + +jobs: + test: + name: PG${{ fromJson(matrix.pg_version).major }} - ${{ matrix.make }}${{ inputs.citus_version && format(' - {0}', inputs.citus_version) || '' }} + strategy: + fail-fast: false + matrix: + pg_version: ${{ fromJson(inputs.pg_versions) }} + make: ${{ fromJson(inputs.make_targets) }} + runs-on: ubuntu-latest + container: + image: "${{ inputs.image_name }}:${{ fromJson(matrix.pg_version).full }}${{ inputs.image_suffix }}" + options: >- + --user root + --dns=8.8.8.8 + --cap-add=SYS_NICE + --security-opt seccomp=unconfined + steps: + - uses: actions/checkout@v4 + - uses: "./.github/actions/setup_extension" + - name: Run Test + run: CITUSVERSION=${{ inputs.citus_version }} gosu circleci make -C src/test/${{ inputs.suite }} ${{ matrix.make }} + timeout-minutes: 20 + - uses: "./.github/actions/save_logs_and_results" + if: always() + with: + folder: ${{ fromJson(matrix.pg_version).major }}_${{ matrix.make }}${{ inputs.citus_version && format('_{0}', inputs.citus_version) || '' }} + - uses: "./.github/actions/upload_coverage" + if: always() + with: + flags: ${{ env.PG_MAJOR }}_${{ inputs.suite }}_${{ matrix.make }} + codecov_token: ${{ secrets.codecov_token }} From 80f05bcefc5666619375db07f96c19ab05a119ce Mon Sep 17 00:00:00 2001 From: eaydingol Date: Tue, 25 Nov 2025 10:55:59 +0300 Subject: [PATCH 3/6] fix --- .github/workflows/build_and_test.yml | 6 +++++- .github/workflows/run_tests.yml | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 5c5fa2725..46b8565e9 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -137,7 +137,11 @@ jobs: - params - build with: - pg_versions: '[${{ needs.params.outputs.pg16_version }}, ${{ needs.params.outputs.pg17_version }}]' + pg_versions: > + [ + ${{ needs.params.outputs.pg16_version }}, + ${{ needs.params.outputs.pg17_version }} + ] make_targets: '["check-split", "check-multi"]' image_suffix: ${{ needs.params.outputs.image_suffix }} image_name: ${{ needs.params.outputs.test_image_name }} diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 00f275822..e8ac81fa9 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -28,7 +28,7 @@ on: jobs: test: - name: PG${{ fromJson(matrix.pg_version).major }} - ${{ matrix.make }}${{ inputs.citus_version && format(' - {0}', inputs.citus_version) || '' }} + name: PG${{ matrix.pg_version.major }} - ${{ matrix.make }}${{ inputs.citus_version && format(' - {0}', inputs.citus_version) || '' }} - New strategy: fail-fast: false matrix: @@ -36,7 +36,7 @@ jobs: make: ${{ fromJson(inputs.make_targets) }} runs-on: ubuntu-latest container: - image: "${{ inputs.image_name }}:${{ fromJson(matrix.pg_version).full }}${{ inputs.image_suffix }}" + image: "${{ inputs.image_name }}:${{ matrix.pg_version.full }}${{ inputs.image_suffix }}" options: >- --user root --dns=8.8.8.8 @@ -51,7 +51,7 @@ jobs: - uses: "./.github/actions/save_logs_and_results" if: always() with: - folder: ${{ fromJson(matrix.pg_version).major }}_${{ matrix.make }}${{ inputs.citus_version && format('_{0}', inputs.citus_version) || '' }} + folder: ${{ matrix.pg_version.major }}_${{ matrix.make }}${{ inputs.citus_version && format('_{0}', inputs.citus_version) || '' }} - uses: "./.github/actions/upload_coverage" if: always() with: From 958695551db6e1561bdac3ee1476d67ec6272c6d Mon Sep 17 00:00:00 2001 From: eaydingol Date: Tue, 25 Nov 2025 16:13:55 +0300 Subject: [PATCH 4/6] Refactor citus tests --- .github/workflows/build_and_test.yml | 183 +++++++++------------------ .github/workflows/run_tests.yml | 2 +- 2 files changed, 58 insertions(+), 127 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 46b8565e9..4350671aa 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -131,7 +131,8 @@ jobs: path: |- ./build-${{ env.PG_MAJOR }}/* ./install-${{ env.PG_MAJOR }}.tar - test-citus-new: + test-citus: + name: Test Citus uses: ./.github/workflows/run_tests.yml needs: - params @@ -139,139 +140,69 @@ jobs: with: pg_versions: > [ + ${{ needs.params.outputs.pg15_version }}, ${{ needs.params.outputs.pg16_version }}, ${{ needs.params.outputs.pg17_version }} ] - make_targets: '["check-split", "check-multi"]' + make_targets: '["check-split", "check-multi", "check-multi-1", "check-multi-mx", "check-vanilla", "check-isolation", "check-operations", "check-follower-cluster", "check-add-backup-node", "check-columnar", "check-columnar-isolation", "check-enterprise", "check-enterprise-isolation", "check-enterprise-isolation-logicalrep-1", "check-enterprise-isolation-logicalrep-2", "check-enterprise-isolation-logicalrep-3"]' image_suffix: ${{ needs.params.outputs.image_suffix }} image_name: ${{ needs.params.outputs.test_image_name }} secrets: codecov_token: ${{ secrets.CODECOV_TOKEN }} - - test-citus: - name: PG${{ fromJson(matrix.pg_version).major }} - ${{ matrix.make }} - ${{ matrix.citus_version}} - strategy: - fail-fast: false - matrix: - suite: - - regress - image_name: - - ${{ needs.params.outputs.test_image_name }} - pg_version: - - ${{ needs.params.outputs.pg15_version }} - - ${{ needs.params.outputs.pg16_version }} - - ${{ needs.params.outputs.pg17_version }} - make: - - check-split - - check-multi - - check-multi-1 - - check-multi-mx - - check-vanilla - - check-isolation - - check-operations - - check-follower-cluster - - check-add-backup-node - - check-columnar - - check-columnar-isolation - - check-enterprise - - check-enterprise-isolation - - check-enterprise-isolation-logicalrep-1 - - check-enterprise-isolation-logicalrep-2 - - check-enterprise-isolation-logicalrep-3 - citus_version: - - - include: - - make: check-failure - pg_version: ${{ needs.params.outputs.pg15_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - - make: check-failure - pg_version: ${{ needs.params.outputs.pg16_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - - make: check-failure - pg_version: ${{ needs.params.outputs.pg17_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - - make: check-enterprise-failure - pg_version: ${{ needs.params.outputs.pg15_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - - make: check-enterprise-failure - pg_version: ${{ needs.params.outputs.pg16_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - - make: check-enterprise-failure - pg_version: ${{ needs.params.outputs.pg17_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - - make: check-pytest - pg_version: ${{ needs.params.outputs.pg15_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - - make: check-pytest - pg_version: ${{ needs.params.outputs.pg16_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - - make: check-pytest - pg_version: ${{ needs.params.outputs.pg17_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - - make: installcheck - suite: cdc - image_name: ${{ needs.params.outputs.test_image_name }} - pg_version: ${{ needs.params.outputs.pg15_version }} - - make: installcheck - suite: cdc - image_name: ${{ needs.params.outputs.test_image_name }} - pg_version: ${{ needs.params.outputs.pg16_version }} - - make: installcheck - suite: cdc - image_name: ${{ needs.params.outputs.test_image_name }} - pg_version: ${{ needs.params.outputs.pg17_version }} - - make: check-query-generator - pg_version: ${{ needs.params.outputs.pg15_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - - make: check-query-generator - pg_version: ${{ needs.params.outputs.pg16_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - - make: check-query-generator - pg_version: ${{ needs.params.outputs.pg17_version }} - suite: regress - image_name: ${{ needs.params.outputs.fail_test_image_name }} - runs-on: ubuntu-latest - container: - image: "${{ matrix.image_name }}:${{ fromJson(matrix.pg_version).full }}${{ needs.params.outputs.image_suffix }}" - options: >- - --user root - --dns=8.8.8.8 - --cap-add=SYS_NICE - --security-opt seccomp=unconfined - # Due to Github creates a default network for each job, we need to use - # --dns= to have similar DNS settings as our other CI systems or local - # machines. Otherwise, we may see different results. - # and grant caps so PG18's NUMA introspection (pg_shmem_allocations_numa -> move_pages) - # doesn't fail with EPERM in CI. + test-citus-schema-compatibility: + name: Test Citus Schema Compatibility + uses: ./.github/workflows/run_tests.yml needs: - - params - - build - steps: - - uses: actions/checkout@v4 - - uses: "./.github/actions/setup_extension" - - name: Run Test - run: CITUSVERSION=${{ matrix.citus_version }} gosu circleci make -C src/test/${{ matrix.suite }} ${{ matrix.make }} - timeout-minutes: 20 - - uses: "./.github/actions/save_logs_and_results" - if: always() - with: - folder: ${{ fromJson(matrix.pg_version).major }}_${{ matrix.make }}_${{ matrix.citus_version }} - - uses: "./.github/actions/upload_coverage" - if: always() - with: - flags: ${{ env.PG_MAJOR }}_${{ matrix.suite }}_${{ matrix.make }} - codecov_token: ${{ secrets.CODECOV_TOKEN }} + - params + - build + with: + pg_versions: > + [ + ${{ needs.params.outputs.pg17_version }} + ] + make_targets: '["check-split", "check-multi", "check-multi-1", "check-multi-mx", "check-vanilla", "check-isolation", "check-operations", "check-follower-cluster", "check-add-backup-node", "check-columnar", "check-columnar-isolation", "check-enterprise", "check-enterprise-isolation", "check-enterprise-isolation-logicalrep-1", "check-enterprise-isolation-logicalrep-2", "check-enterprise-isolation-logicalrep-3"]' + image_suffix: ${{ needs.params.outputs.image_suffix }} + image_name: ${{ needs.params.outputs.test_image_name }} + citus_version: 13.2-1 + secrets: + codecov_token: ${{ secrets.CODECOV_TOKEN }} + test-citus-failure: + name: Test Citus Failure + uses: ./.github/workflows/run_tests.yml + needs: + - params + - build + with: + pg_versions: > + [ + ${{ needs.params.outputs.pg15_version }}, + ${{ needs.params.outputs.pg16_version }}, + ${{ needs.params.outputs.pg17_version }} + ] + make_targets: '["check-failure", "check-enterprise-failure", "check-pytest", "check-query-generator"]' + image_suffix: ${{ needs.params.outputs.image_suffix }} + image_name: ${{ needs.params.outputs.fail_test_image_name }} + secrets: + codecov_token: ${{ secrets.CODECOV_TOKEN }} + test-citus-cdc: + name: Test Citus CDC + uses: ./.github/workflows/run_tests.yml + needs: + - params + - build + with: + pg_versions: > + [ + ${{ needs.params.outputs.pg15_version }}, + ${{ needs.params.outputs.pg16_version }}, + ${{ needs.params.outputs.pg17_version }} + ] + make_targets: '["installcheck"]' + image_suffix: ${{ needs.params.outputs.image_suffix }} + image_name: ${{ needs.params.outputs.test_image_name }} + suite: cdc + secrets: + codecov_token: ${{ secrets.CODECOV_TOKEN }} test-arbitrary-configs: name: PG${{ fromJson(matrix.pg_version).major }} - check-arbitrary-configs-${{ matrix.parallel }} runs-on: ["self-hosted", "1ES.Pool=1es-gha-citusdata-pool"] diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index e8ac81fa9..a88b9fa7c 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -28,7 +28,7 @@ on: jobs: test: - name: PG${{ matrix.pg_version.major }} - ${{ matrix.make }}${{ inputs.citus_version && format(' - {0}', inputs.citus_version) || '' }} - New + name: PG${{ matrix.pg_version.major }} - ${{ matrix.make }}${{ inputs.citus_version && format(' - {0}', inputs.citus_version) || '' }} strategy: fail-fast: false matrix: From efbbce4ff84e6d87c7b57fb214d266b2700c64f6 Mon Sep 17 00:00:00 2001 From: eaydingol Date: Tue, 25 Nov 2025 16:57:11 +0300 Subject: [PATCH 5/6] Remove the schema compatiblity check --- .github/workflows/build_and_test.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4350671aa..bd644395f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -149,23 +149,6 @@ jobs: image_name: ${{ needs.params.outputs.test_image_name }} secrets: codecov_token: ${{ secrets.CODECOV_TOKEN }} - test-citus-schema-compatibility: - name: Test Citus Schema Compatibility - uses: ./.github/workflows/run_tests.yml - needs: - - params - - build - with: - pg_versions: > - [ - ${{ needs.params.outputs.pg17_version }} - ] - make_targets: '["check-split", "check-multi", "check-multi-1", "check-multi-mx", "check-vanilla", "check-isolation", "check-operations", "check-follower-cluster", "check-add-backup-node", "check-columnar", "check-columnar-isolation", "check-enterprise", "check-enterprise-isolation", "check-enterprise-isolation-logicalrep-1", "check-enterprise-isolation-logicalrep-2", "check-enterprise-isolation-logicalrep-3"]' - image_suffix: ${{ needs.params.outputs.image_suffix }} - image_name: ${{ needs.params.outputs.test_image_name }} - citus_version: 13.2-1 - secrets: - codecov_token: ${{ secrets.CODECOV_TOKEN }} test-citus-failure: name: Test Citus Failure uses: ./.github/workflows/run_tests.yml From 2f349ce456d1fadcee0c6ead9c68d0bc00d0dcec Mon Sep 17 00:00:00 2001 From: eaydingol Date: Fri, 5 Dec 2025 14:18:06 +0300 Subject: [PATCH 6/6] Support loading citus and columnar so files from a given directory. --- src/test/regress/Makefile | 6 ++- src/test/regress/pg_regress_multi.pl | 56 +++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/test/regress/Makefile b/src/test/regress/Makefile index ba5cf58b1..9b9c0425a 100644 --- a/src/test/regress/Makefile +++ b/src/test/regress/Makefile @@ -13,6 +13,10 @@ endif ifndef CITUSVERSION CITUSVERSION := "" endif + +ifndef CITUSLIBDIR +CITUSLIBDIR := "" +endif # Add ./bin to $PATH so we use our custom diff instead of the default diff tool. # We do this to be able to mask shard Ids, placement Ids, node ports, etc. MAKEFILE_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) @@ -31,7 +35,7 @@ export PGISOLATIONTIMEOUT = 60 ## Citus regression support ## MULTI_INSTALLDIR=$(CURDIR)/tmp_check/install -pg_regress_multi_check = $(PERL) $(citus_abs_srcdir)/pg_regress_multi.pl --pgxsdir="$(pgxsdir)" --bindir="$(bindir)" --libdir="$(libdir)" --majorversion="$(MAJORVERSION)" --postgres-builddir="$(postgres_abs_builddir)" --postgres-srcdir="$(postgres_abs_srcdir)" --citus_abs_srcdir="$(citus_abs_srcdir)" --citus-version=$(CITUSVERSION) +pg_regress_multi_check = $(PERL) $(citus_abs_srcdir)/pg_regress_multi.pl --pgxsdir="$(pgxsdir)" --bindir="$(bindir)" --libdir="$(libdir)" --majorversion="$(MAJORVERSION)" --postgres-builddir="$(postgres_abs_builddir)" --postgres-srcdir="$(postgres_abs_srcdir)" --citus_abs_srcdir="$(citus_abs_srcdir)" --citus-version=$(CITUSVERSION) --citus-libdir="$(CITUSLIBDIR)" MULTI_REGRESS_OPTS = --inputdir=$(citus_abs_srcdir) $(pg_regress_locale_flags) --launcher="$(citus_abs_srcdir)/log_test_times" pg_upgrade_check = $(citus_abs_srcdir)/citus_tests/upgrade/pg_upgrade_test.py diff --git a/src/test/regress/pg_regress_multi.pl b/src/test/regress/pg_regress_multi.pl index 7d760a2eb..bd2917ba0 100755 --- a/src/test/regress/pg_regress_multi.pl +++ b/src/test/regress/pg_regress_multi.pl @@ -51,6 +51,7 @@ sub Usage() print " --mitmproxy Start a mitmproxy for one of the workers\n"; print " --worker-count Number of workers in Citus cluster (default: 2)\n"; print " --citus-version Citus version being tested (used for during extension create)\n"; + print " --citus-libdir Absolute path to alternative Citus library directory\n"; exit 1; } @@ -89,6 +90,7 @@ my $publicWorker1Host = "localhost"; my $publicWorker2Host = "localhost"; my $workerCount = 2; my $citusversion = ""; +my $citusLibdir = ""; my $serversAreShutdown = "TRUE"; my $usingWindows = 0; @@ -124,6 +126,7 @@ GetOptions( 'worker-2-public-hostname=s' => \$publicWorker2Host, 'worker-count=i' => \$workerCount, 'citus-version=s' => \$citusversion, + 'citus-libdir=s' => \$citusLibdir, 'help' => sub { Usage() }); my $fixopen = "$bindir/postgres.fixopen"; @@ -310,6 +313,40 @@ sub generate_hba close $fh; } +sub setup_symlink +{ + my ($originalfile, $targetfile) = @_; + + # Only proceed if not on Windows and both files are defined and non-empty + return if $usingWindows; + return unless (defined $originalfile && $originalfile ne ""); + return unless (defined $targetfile && $targetfile ne ""); + + -e $targetfile or die "Target is not found at $targetfile"; + + my $backup = $originalfile . ".bak"; + rename($originalfile, $backup) or die "Failed to copy $originalfile to $backup: $!"; + + symlink($targetfile, $originalfile) or die "Failed to create symlink $originalfile -> $targetfile: $!"; +} + +sub restore_original +{ + my ($originalfile) = @_; + + # Only proceed if not on Windows and file is defined and non-empty + return if $usingWindows; + return unless (defined $originalfile && $originalfile ne ""); + + my $backup = $originalfile . ".bak"; + + # Return silently if backup doesn't exist + return unless -e $backup; + + unlink($originalfile) or die "Failed to remove symlink at $originalfile: $!"; + rename($backup, $originalfile) or die "Failed to restore original file from $backup to $originalfile: $!"; +} + # always want to call initdb under normal postgres, so revert from a # partial run, even if we're now not using valgrind. revert_replace_postgres(); @@ -593,7 +630,7 @@ if($isolationtester) push(@pgOptions, "citus.background_task_queue_interval=-1"); } -if($citusversion) +if($citusversion || $citusLibdir) { push(@pgOptions, "citus.enable_version_checks=off"); push(@pgOptions, "columnar.enable_version_checks=off"); @@ -783,6 +820,9 @@ if (!$conninfo) # Routine to shutdown servers at failure/exit sub ShutdownServers() { + restore_original(catfile($libdir, "citus.so")); + restore_original(catfile($libdir, "citus_columnar.so")); + if (!$conninfo && $serversAreShutdown eq "FALSE") { system(catfile("$bindir", "pg_ctl"), @@ -908,6 +948,13 @@ if ($followercluster && $backupnodetest == 0) $synchronousReplication = "-c synchronous_standby_names='FIRST 1 (*)' -c synchronous_commit=remote_apply"; } +# Ensure citus.so points to alternative library if provided +if ($citusLibdir) +{ + setup_symlink(catfile($libdir, "citus.so"), catfile($citusLibdir, "citus.so")); + setup_symlink(catfile($libdir, "citus_columnar.so"), catfile($citusLibdir, "citus_columnar.so")); +} + # Start servers if (!$conninfo) { @@ -979,6 +1026,13 @@ if ($followercluster) } } +# Restore original citus.so if we modified it +if ($citusLibdir) +{ + restore_original(catfile($libdir, "citus.so")); + restore_original(catfile($libdir, "citus_columnar.so")); +} + ### # Create database, extensions, types, functions and fdws on the workers, # pg_regress won't know to create them for us.