mirror of https://github.com/citusdata/citus.git
Compare commits
73 Commits
Author | SHA1 | Date |
---|---|---|
|
32225367ec | |
|
552e5e19e3 | |
|
ba2088a1d9 | |
|
2779c424ee | |
|
5ec2501e7b | |
|
1bac9cb0c1 | |
|
2d3bd5b3a3 | |
|
1a8e2c8479 | |
|
f3cb3d99ee | |
|
bae20578d4 | |
|
02b3c009e7 | |
|
352516e619 | |
|
66d35b35f8 | |
|
296b623093 | |
|
71d921707d | |
|
39e890d9ce | |
|
cb31a649e9 | |
|
c44682a7d0 | |
|
d4f1635775 | |
|
0f1aa0e16a | |
|
686d2b46ca | |
|
15ecc37ecd | |
|
5c2ef8e2d8 | |
|
6349f2d52d | |
|
f60c4cbd19 | |
|
f0ea07a813 | |
|
9dcfcb92ff | |
|
caee20ad7c | |
|
d9635609f4 | |
|
4f0053ed6d | |
|
3594bd7ac0 | |
|
7e0dc18b22 | |
|
4e838a471a | |
|
035aa6eada | |
|
75ff237340 | |
|
40e9e2614d | |
|
bac95cc523 | |
|
38967491ef | |
|
fc09e1cfdc | |
|
7513061057 | |
|
f4af59ab4b | |
|
5708fca1ea | |
|
2a6164d2d9 | |
|
db391c0bb7 | |
|
146725fc9b | |
|
94ab1dc240 | |
|
812a2b759f | |
|
452564c19b | |
|
9b06d02c43 | |
|
2ee43fd00c | |
|
f2d102d54b | |
|
82637f3e13 | |
|
79616bc7db | |
|
364e8ece14 | |
|
62c32067f1 | |
|
d9069b1e01 | |
|
fa6743d436 | |
|
26178fb538 | |
|
48c62095ff | |
|
f1b1d7579c | |
|
75df19b616 | |
|
e2d18c5472 | |
|
c12a4f7626 | |
|
a945971f48 | |
|
4c110faf1b | |
|
2c630eca50 | |
|
b421479d46 | |
|
2502e7e754 | |
|
a4fe969947 | |
|
e59ffbf549 | |
|
3b908eec2a | |
|
9b6ffece5e | |
|
1b4d7a51f8 |
1131
.circleci/config.yml
1131
.circleci/config.yml
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,23 @@
|
|||
name: 'Parallelization matrix'
|
||||
inputs:
|
||||
count:
|
||||
required: false
|
||||
default: 32
|
||||
outputs:
|
||||
json:
|
||||
value: ${{ steps.generate_matrix.outputs.json }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Generate parallelization matrix
|
||||
id: generate_matrix
|
||||
shell: bash
|
||||
run: |-
|
||||
json_array="{\"include\": ["
|
||||
for ((i = 1; i <= ${{ inputs.count }}; i++)); do
|
||||
json_array+="{\"id\":\"$i\"},"
|
||||
done
|
||||
json_array=${json_array%,}
|
||||
json_array+=" ]}"
|
||||
echo "json=$json_array" >> "$GITHUB_OUTPUT"
|
||||
echo "json=$json_array"
|
|
@ -0,0 +1,38 @@
|
|||
name: save_logs_and_results
|
||||
inputs:
|
||||
folder:
|
||||
required: false
|
||||
default: "log"
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- uses: actions/upload-artifact@v4.6.0
|
||||
name: Upload logs
|
||||
with:
|
||||
name: ${{ inputs.folder }}
|
||||
if-no-files-found: ignore
|
||||
path: |
|
||||
src/test/**/proxy.output
|
||||
src/test/**/results/
|
||||
src/test/**/tmp_check/master/log
|
||||
src/test/**/tmp_check/worker.57638/log
|
||||
src/test/**/tmp_check/worker.57637/log
|
||||
src/test/**/*.diffs
|
||||
src/test/**/out/ddls.sql
|
||||
src/test/**/out/queries.sql
|
||||
src/test/**/logfile_*
|
||||
/tmp/pg_upgrade_newData_logs
|
||||
- name: Publish regression.diffs
|
||||
run: |-
|
||||
diffs="$(find src/test/regress -name "*.diffs" -exec cat {} \;)"
|
||||
if ! [ -z "$diffs" ]; then
|
||||
echo '```diff' >> $GITHUB_STEP_SUMMARY
|
||||
echo -E "$diffs" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
echo -E $diffs
|
||||
fi
|
||||
shell: bash
|
||||
- name: Print stack traces
|
||||
run: "./ci/print_stack_trace.sh"
|
||||
if: failure()
|
||||
shell: bash
|
|
@ -0,0 +1,35 @@
|
|||
name: setup_extension
|
||||
inputs:
|
||||
pg_major:
|
||||
required: false
|
||||
skip_installation:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Expose $PG_MAJOR to Github Env
|
||||
run: |-
|
||||
if [ -z "${{ inputs.pg_major }}" ]; then
|
||||
echo "PG_MAJOR=${PG_MAJOR}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "PG_MAJOR=${{ inputs.pg_major }}" >> $GITHUB_ENV
|
||||
fi
|
||||
shell: bash
|
||||
- uses: actions/download-artifact@v4.1.8
|
||||
with:
|
||||
name: build-${{ env.PG_MAJOR }}
|
||||
- name: Install Extension
|
||||
if: ${{ inputs.skip_installation == 'false' }}
|
||||
run: tar xfv "install-$PG_MAJOR.tar" --directory /
|
||||
shell: bash
|
||||
- name: Configure
|
||||
run: |-
|
||||
chown -R circleci .
|
||||
git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
gosu circleci ./configure --without-pg-version-check
|
||||
shell: bash
|
||||
- name: Enable core dumps
|
||||
run: ulimit -c unlimited
|
||||
shell: bash
|
|
@ -0,0 +1,27 @@
|
|||
name: coverage
|
||||
inputs:
|
||||
flags:
|
||||
required: false
|
||||
codecov_token:
|
||||
required: true
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- uses: codecov/codecov-action@v3
|
||||
with:
|
||||
flags: ${{ inputs.flags }}
|
||||
token: ${{ inputs.codecov_token }}
|
||||
verbose: true
|
||||
gcov: true
|
||||
- name: Create codeclimate coverage
|
||||
run: |-
|
||||
lcov --directory . --capture --output-file lcov.info
|
||||
lcov --remove lcov.info -o lcov.info '/usr/*'
|
||||
sed "s=^SF:$PWD/=SF:=g" -i lcov.info # relative pats are required by codeclimate
|
||||
mkdir -p /tmp/codeclimate
|
||||
cc-test-reporter format-coverage -t lcov -o /tmp/codeclimate/${{ inputs.flags }}.json lcov.info
|
||||
shell: bash
|
||||
- uses: actions/upload-artifact@v4.6.0
|
||||
with:
|
||||
path: "/tmp/codeclimate/*.json"
|
||||
name: codeclimate-${{ inputs.flags }}
|
|
@ -32,7 +32,10 @@ python3 -m pip install -r tools/packaging_automation/requirements.txt
|
|||
echo "Package type: ${package_type}"
|
||||
echo "OS version: $(get_rpm_os_version)"
|
||||
|
||||
# if os version is centos 7 or oracle linux 7, then remove urllib3 with pip uninstall and install urllib3<2.0.0 with pip install
|
||||
# For RHEL 7, we need to install urllib3<2 due to below execution error
|
||||
# ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl'
|
||||
# module is compiled with 'OpenSSL 1.0.2k-fips 26 Jan 2017'.
|
||||
# See: https://github.com/urllib3/urllib3/issues/2168
|
||||
if [[ ${package_type} == "rpm" && $(get_rpm_os_version) == 7* ]]; then
|
||||
python3 -m pip uninstall -y urllib3
|
||||
python3 -m pip install 'urllib3<2'
|
||||
|
|
|
@ -0,0 +1,518 @@
|
|||
name: Build & Test
|
||||
run-name: Build & Test - ${{ github.event.pull_request.title || github.ref_name }}
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
skip_test_flakyness:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
pull_request:
|
||||
types: [opened, reopened,synchronize]
|
||||
jobs:
|
||||
# Since GHA does not interpolate env varibles in matrix context, we need to
|
||||
# define them in a separate job and use them in other jobs.
|
||||
params:
|
||||
runs-on: ubuntu-latest
|
||||
name: Initialize parameters
|
||||
outputs:
|
||||
build_image_name: "ghcr.io/citusdata/extbuilder"
|
||||
test_image_name: "ghcr.io/citusdata/exttester"
|
||||
citusupgrade_image_name: "ghcr.io/citusdata/citusupgradetester"
|
||||
fail_test_image_name: "ghcr.io/citusdata/failtester"
|
||||
pgupgrade_image_name: "ghcr.io/citusdata/pgupgradetester"
|
||||
style_checker_image_name: "ghcr.io/citusdata/stylechecker"
|
||||
style_checker_tools_version: "0.8.18"
|
||||
sql_snapshot_pg_version: "16.3"
|
||||
image_suffix: "-v13fd57c"
|
||||
pg14_version: '{ "major": "14", "full": "14.12" }'
|
||||
pg15_version: '{ "major": "15", "full": "15.7" }'
|
||||
pg16_version: '{ "major": "16", "full": "16.3" }'
|
||||
upgrade_pg_versions: "14.12-15.7-16.3"
|
||||
steps:
|
||||
# Since GHA jobs needs at least one step we use a noop step here.
|
||||
- name: Set up parameters
|
||||
run: echo 'noop'
|
||||
check-sql-snapshots:
|
||||
needs: params
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ needs.params.outputs.build_image_name }}:${{ needs.params.outputs.sql_snapshot_pg_version }}${{ needs.params.outputs.image_suffix }}
|
||||
options: --user root
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- name: Check Snapshots
|
||||
run: |
|
||||
git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
ci/check_sql_snapshots.sh
|
||||
check-style:
|
||||
needs: params
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ needs.params.outputs.style_checker_image_name }}:${{ needs.params.outputs.style_checker_tools_version }}${{ needs.params.outputs.image_suffix }}
|
||||
steps:
|
||||
- name: Check Snapshots
|
||||
run: |
|
||||
git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
- uses: actions/checkout@v3.5.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Check C Style
|
||||
run: citus_indent --check
|
||||
- name: Check Python style
|
||||
run: black --check .
|
||||
- name: Check Python import order
|
||||
run: isort --check .
|
||||
- name: Check Python lints
|
||||
run: flake8 .
|
||||
- name: Fix whitespace
|
||||
run: ci/editorconfig.sh && git diff --exit-code
|
||||
- name: Remove useless declarations
|
||||
run: ci/remove_useless_declarations.sh && git diff --cached --exit-code
|
||||
- name: Sort and group includes
|
||||
run: ci/sort_and_group_includes.sh && git diff --exit-code
|
||||
- name: Normalize test output
|
||||
run: ci/normalize_expected.sh && git diff --exit-code
|
||||
- name: Check for C-style comments in migration files
|
||||
run: ci/disallow_c_comments_in_migrations.sh && git diff --exit-code
|
||||
- name: 'Check for comment--cached ns that start with # character in spec files'
|
||||
run: ci/disallow_hash_comments_in_spec_files.sh && git diff --exit-code
|
||||
- name: Check for gitignore entries .for source files
|
||||
run: ci/fix_gitignore.sh && git diff --exit-code
|
||||
- name: Check for lengths of changelog entries
|
||||
run: ci/disallow_long_changelog_entries.sh
|
||||
- name: Check for banned C API usage
|
||||
run: ci/banned.h.sh
|
||||
- name: Check for tests missing in schedules
|
||||
run: ci/check_all_tests_are_run.sh
|
||||
- name: Check if all CI scripts are actually run
|
||||
run: ci/check_all_ci_scripts_are_run.sh
|
||||
- name: Check if all GUCs are sorted alphabetically
|
||||
run: ci/check_gucs_are_alphabetically_sorted.sh
|
||||
- name: Check for missing downgrade scripts
|
||||
run: ci/check_migration_files.sh
|
||||
build:
|
||||
needs: params
|
||||
name: Build for PG${{ fromJson(matrix.pg_version).major }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image_name:
|
||||
- ${{ needs.params.outputs.build_image_name }}
|
||||
image_suffix:
|
||||
- ${{ needs.params.outputs.image_suffix}}
|
||||
pg_version:
|
||||
- ${{ needs.params.outputs.pg14_version }}
|
||||
- ${{ needs.params.outputs.pg15_version }}
|
||||
- ${{ needs.params.outputs.pg16_version }}
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: "${{ matrix.image_name }}:${{ fromJson(matrix.pg_version).full }}${{ matrix.image_suffix }}"
|
||||
options: --user root
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- name: Expose $PG_MAJOR to Github Env
|
||||
run: echo "PG_MAJOR=${PG_MAJOR}" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
- name: Build
|
||||
run: "./ci/build-citus.sh"
|
||||
shell: bash
|
||||
- uses: actions/upload-artifact@v4.6.0
|
||||
with:
|
||||
name: build-${{ env.PG_MAJOR }}
|
||||
path: |-
|
||||
./build-${{ env.PG_MAJOR }}/*
|
||||
./install-${{ env.PG_MAJOR }}.tar
|
||||
test-citus:
|
||||
name: PG${{ fromJson(matrix.pg_version).major }} - ${{ matrix.make }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
suite:
|
||||
- regress
|
||||
image_name:
|
||||
- ${{ needs.params.outputs.test_image_name }}
|
||||
pg_version:
|
||||
- ${{ needs.params.outputs.pg14_version }}
|
||||
- ${{ needs.params.outputs.pg15_version }}
|
||||
- ${{ needs.params.outputs.pg16_version }}
|
||||
make:
|
||||
- check-split
|
||||
- check-multi
|
||||
- check-multi-1
|
||||
- check-multi-mx
|
||||
- check-vanilla
|
||||
- check-isolation
|
||||
- check-operations
|
||||
- check-follower-cluster
|
||||
- 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
|
||||
include:
|
||||
- make: check-failure
|
||||
pg_version: ${{ needs.params.outputs.pg14_version }}
|
||||
suite: regress
|
||||
image_name: ${{ needs.params.outputs.fail_test_image_name }}
|
||||
- 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-enterprise-failure
|
||||
pg_version: ${{ needs.params.outputs.pg14_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-pytest
|
||||
pg_version: ${{ needs.params.outputs.pg14_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: 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: check-query-generator
|
||||
pg_version: ${{ needs.params.outputs.pg14_version }}
|
||||
suite: regress
|
||||
image_name: ${{ needs.params.outputs.fail_test_image_name }}
|
||||
- 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 }}
|
||||
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
|
||||
# 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.
|
||||
needs:
|
||||
- params
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- uses: "./.github/actions/setup_extension"
|
||||
- name: Run Test
|
||||
run: 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 }}
|
||||
- uses: "./.github/actions/upload_coverage"
|
||||
if: always()
|
||||
with:
|
||||
flags: ${{ env.PG_MAJOR }}_${{ matrix.suite }}_${{ matrix.make }}
|
||||
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"]
|
||||
container:
|
||||
image: "${{ matrix.image_name }}:${{ fromJson(matrix.pg_version).full }}${{ needs.params.outputs.image_suffix }}"
|
||||
options: --user root
|
||||
needs:
|
||||
- params
|
||||
- build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image_name:
|
||||
- ${{ needs.params.outputs.fail_test_image_name }}
|
||||
pg_version:
|
||||
- ${{ needs.params.outputs.pg14_version }}
|
||||
- ${{ needs.params.outputs.pg15_version }}
|
||||
- ${{ needs.params.outputs.pg16_version }}
|
||||
parallel: [0,1,2,3,4,5] # workaround for running 6 parallel jobs
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- uses: "./.github/actions/setup_extension"
|
||||
- name: Test arbitrary configs
|
||||
run: |-
|
||||
# we use parallel jobs to split the tests into 6 parts and run them in parallel
|
||||
# the script below extracts the tests for the current job
|
||||
N=6 # Total number of jobs (see matrix.parallel)
|
||||
X=${{ matrix.parallel }} # Current job number
|
||||
TESTS=$(src/test/regress/citus_tests/print_test_names.py |
|
||||
tr '\n' ',' | awk -v N="$N" -v X="$X" -F, '{
|
||||
split("", parts)
|
||||
for (i = 1; i <= NF; i++) {
|
||||
parts[i % N] = parts[i % N] $i ","
|
||||
}
|
||||
print substr(parts[X], 1, length(parts[X])-1)
|
||||
}')
|
||||
echo $TESTS
|
||||
gosu circleci \
|
||||
make -C src/test/regress \
|
||||
check-arbitrary-configs parallel=4 CONFIGS=$TESTS
|
||||
- uses: "./.github/actions/save_logs_and_results"
|
||||
if: always()
|
||||
with:
|
||||
folder: ${{ env.PG_MAJOR }}_arbitrary_configs_${{ matrix.parallel }}
|
||||
- uses: "./.github/actions/upload_coverage"
|
||||
if: always()
|
||||
with:
|
||||
flags: ${{ env.PG_MAJOR }}_arbitrary_configs_${{ matrix.parallel }}
|
||||
codecov_token: ${{ secrets.CODECOV_TOKEN }}
|
||||
test-pg-upgrade:
|
||||
name: PG${{ matrix.old_pg_major }}-PG${{ matrix.new_pg_major }} - check-pg-upgrade
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: "${{ needs.params.outputs.pgupgrade_image_name }}:${{ needs.params.outputs.upgrade_pg_versions }}${{ needs.params.outputs.image_suffix }}"
|
||||
options: --user root
|
||||
needs:
|
||||
- params
|
||||
- build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- old_pg_major: 14
|
||||
new_pg_major: 15
|
||||
- old_pg_major: 15
|
||||
new_pg_major: 16
|
||||
- old_pg_major: 14
|
||||
new_pg_major: 16
|
||||
env:
|
||||
old_pg_major: ${{ matrix.old_pg_major }}
|
||||
new_pg_major: ${{ matrix.new_pg_major }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- uses: "./.github/actions/setup_extension"
|
||||
with:
|
||||
pg_major: "${{ env.old_pg_major }}"
|
||||
- uses: "./.github/actions/setup_extension"
|
||||
with:
|
||||
pg_major: "${{ env.new_pg_major }}"
|
||||
- name: Install and test postgres upgrade
|
||||
run: |-
|
||||
gosu circleci \
|
||||
make -C src/test/regress \
|
||||
check-pg-upgrade \
|
||||
old-bindir=/usr/lib/postgresql/${{ env.old_pg_major }}/bin \
|
||||
new-bindir=/usr/lib/postgresql/${{ env.new_pg_major }}/bin
|
||||
- name: Copy pg_upgrade logs for newData dir
|
||||
run: |-
|
||||
mkdir -p /tmp/pg_upgrade_newData_logs
|
||||
if ls src/test/regress/tmp_upgrade/newData/*.log 1> /dev/null 2>&1; then
|
||||
cp src/test/regress/tmp_upgrade/newData/*.log /tmp/pg_upgrade_newData_logs
|
||||
fi
|
||||
if: failure()
|
||||
- uses: "./.github/actions/save_logs_and_results"
|
||||
if: always()
|
||||
with:
|
||||
folder: ${{ env.old_pg_major }}_${{ env.new_pg_major }}_upgrade
|
||||
- uses: "./.github/actions/upload_coverage"
|
||||
if: always()
|
||||
with:
|
||||
flags: ${{ env.old_pg_major }}_${{ env.new_pg_major }}_upgrade
|
||||
codecov_token: ${{ secrets.CODECOV_TOKEN }}
|
||||
test-citus-upgrade:
|
||||
name: PG${{ fromJson(needs.params.outputs.pg14_version).major }} - check-citus-upgrade
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: "${{ needs.params.outputs.citusupgrade_image_name }}:${{ fromJson(needs.params.outputs.pg14_version).full }}${{ needs.params.outputs.image_suffix }}"
|
||||
options: --user root
|
||||
needs:
|
||||
- params
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- uses: "./.github/actions/setup_extension"
|
||||
with:
|
||||
skip_installation: true
|
||||
- name: Install and test citus upgrade
|
||||
run: |-
|
||||
# run make check-citus-upgrade for all citus versions
|
||||
# the image has ${CITUS_VERSIONS} set with all verions it contains the binaries of
|
||||
for citus_version in ${CITUS_VERSIONS}; do \
|
||||
gosu circleci \
|
||||
make -C src/test/regress \
|
||||
check-citus-upgrade \
|
||||
bindir=/usr/lib/postgresql/${PG_MAJOR}/bin \
|
||||
citus-old-version=${citus_version} \
|
||||
citus-pre-tar=/install-pg${PG_MAJOR}-citus${citus_version}.tar \
|
||||
citus-post-tar=${GITHUB_WORKSPACE}/install-$PG_MAJOR.tar; \
|
||||
done;
|
||||
# run make check-citus-upgrade-mixed for all citus versions
|
||||
# the image has ${CITUS_VERSIONS} set with all verions it contains the binaries of
|
||||
for citus_version in ${CITUS_VERSIONS}; do \
|
||||
gosu circleci \
|
||||
make -C src/test/regress \
|
||||
check-citus-upgrade-mixed \
|
||||
citus-old-version=${citus_version} \
|
||||
bindir=/usr/lib/postgresql/${PG_MAJOR}/bin \
|
||||
citus-pre-tar=/install-pg${PG_MAJOR}-citus${citus_version}.tar \
|
||||
citus-post-tar=${GITHUB_WORKSPACE}/install-$PG_MAJOR.tar; \
|
||||
done;
|
||||
- uses: "./.github/actions/save_logs_and_results"
|
||||
if: always()
|
||||
with:
|
||||
folder: ${{ env.PG_MAJOR }}_citus_upgrade
|
||||
- uses: "./.github/actions/upload_coverage"
|
||||
if: always()
|
||||
with:
|
||||
flags: ${{ env.PG_MAJOR }}_citus_upgrade
|
||||
codecov_token: ${{ secrets.CODECOV_TOKEN }}
|
||||
upload-coverage:
|
||||
if: always()
|
||||
env:
|
||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ needs.params.outputs.test_image_name }}:${{ fromJson(needs.params.outputs.pg16_version).full }}${{ needs.params.outputs.image_suffix }}
|
||||
needs:
|
||||
- params
|
||||
- test-citus
|
||||
- test-arbitrary-configs
|
||||
- test-citus-upgrade
|
||||
- test-pg-upgrade
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4.1.8
|
||||
with:
|
||||
pattern: codeclimate*
|
||||
path: codeclimate
|
||||
merge-multiple: true
|
||||
- name: Upload coverage results to Code Climate
|
||||
run: |-
|
||||
cc-test-reporter sum-coverage codeclimate/*.json -o total.json
|
||||
cc-test-reporter upload-coverage -i total.json
|
||||
ch_benchmark:
|
||||
name: CH Benchmark
|
||||
if: startsWith(github.ref, 'refs/heads/ch_benchmark/')
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- uses: azure/login@v1
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
- name: install dependencies and run ch_benchmark tests
|
||||
uses: azure/CLI@v1
|
||||
with:
|
||||
inlineScript: |
|
||||
cd ./src/test/hammerdb
|
||||
chmod +x run_hammerdb.sh
|
||||
run_hammerdb.sh citusbot_ch_benchmark_rg
|
||||
tpcc_benchmark:
|
||||
name: TPCC Benchmark
|
||||
if: startsWith(github.ref, 'refs/heads/tpcc_benchmark/')
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- uses: azure/login@v1
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
- name: install dependencies and run tpcc_benchmark tests
|
||||
uses: azure/CLI@v1
|
||||
with:
|
||||
inlineScript: |
|
||||
cd ./src/test/hammerdb
|
||||
chmod +x run_hammerdb.sh
|
||||
run_hammerdb.sh citusbot_tpcc_benchmark_rg
|
||||
prepare_parallelization_matrix_32:
|
||||
name: Parallel 32
|
||||
if: ${{ needs.test-flakyness-pre.outputs.tests != ''}}
|
||||
needs: test-flakyness-pre
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
json: ${{ steps.parallelization.outputs.json }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- uses: "./.github/actions/parallelization"
|
||||
id: parallelization
|
||||
with:
|
||||
count: 32
|
||||
test-flakyness-pre:
|
||||
name: Detect regression tests need to be ran
|
||||
if: ${{ !inputs.skip_test_flakyness }}}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
outputs:
|
||||
tests: ${{ steps.detect-regression-tests.outputs.tests }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Detect regression tests need to be ran
|
||||
id: detect-regression-tests
|
||||
run: |-
|
||||
detected_changes=$(git diff origin/release-12.1... --name-only --diff-filter=AM | (grep 'src/test/regress/sql/.*\.sql\|src/test/regress/spec/.*\.spec\|src/test/regress/citus_tests/test/test_.*\.py' || true))
|
||||
tests=${detected_changes}
|
||||
if [ -z "$tests" ]; then
|
||||
echo "No test found."
|
||||
else
|
||||
echo "Detected tests " $tests
|
||||
fi
|
||||
|
||||
echo 'tests<<EOF' >> $GITHUB_OUTPUT
|
||||
echo "$tests" >> "$GITHUB_OUTPUT"
|
||||
echo 'EOF' >> $GITHUB_OUTPUT
|
||||
test-flakyness:
|
||||
if: false
|
||||
name: Test flakyness
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ needs.params.outputs.fail_test_image_name }}:${{ needs.params.outputs.pg16_version }}${{ needs.params.outputs.image_suffix }}
|
||||
options: --user root
|
||||
env:
|
||||
runs: 8
|
||||
needs:
|
||||
- params
|
||||
- build
|
||||
- test-flakyness-pre
|
||||
- prepare_parallelization_matrix_32
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJson(needs.prepare_parallelization_matrix_32.outputs.json) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- uses: actions/download-artifact@v4.1.8
|
||||
- uses: "./.github/actions/setup_extension"
|
||||
- name: Run minimal tests
|
||||
run: |-
|
||||
tests="${{ needs.test-flakyness-pre.outputs.tests }}"
|
||||
tests_array=($tests)
|
||||
for test in "${tests_array[@]}"
|
||||
do
|
||||
test_name=$(echo "$test" | sed -r "s/.+\/(.+)\..+/\1/")
|
||||
gosu circleci src/test/regress/citus_tests/run_test.py $test_name --repeat ${{ env.runs }} --use-base-schedule --use-whole-schedule-line
|
||||
done
|
||||
shell: bash
|
||||
- uses: "./.github/actions/save_logs_and_results"
|
||||
if: always()
|
|
@ -0,0 +1,79 @@
|
|||
name: Flaky test debugging
|
||||
run-name: Flaky test debugging - ${{ inputs.flaky_test }} (${{ inputs.flaky_test_runs_per_job }}x${{ inputs.flaky_test_parallel_jobs }})
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
flaky_test:
|
||||
required: true
|
||||
type: string
|
||||
description: Test to run
|
||||
flaky_test_runs_per_job:
|
||||
required: false
|
||||
default: 8
|
||||
type: number
|
||||
description: Number of times to run the test
|
||||
flaky_test_parallel_jobs:
|
||||
required: false
|
||||
default: 32
|
||||
type: number
|
||||
description: Number of parallel jobs to run
|
||||
jobs:
|
||||
build:
|
||||
name: Build Citus
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ vars.build_image_name }}:${{ vars.pg15_version }}${{ vars.image_suffix }}
|
||||
options: --user root
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- name: Configure, Build, and Install
|
||||
run: |
|
||||
echo "PG_MAJOR=${PG_MAJOR}" >> $GITHUB_ENV
|
||||
./ci/build-citus.sh
|
||||
shell: bash
|
||||
- uses: actions/upload-artifact@v4.6.0
|
||||
with:
|
||||
name: build-${{ env.PG_MAJOR }}
|
||||
path: |-
|
||||
./build-${{ env.PG_MAJOR }}/*
|
||||
./install-${{ env.PG_MAJOR }}.tar
|
||||
prepare_parallelization_matrix:
|
||||
name: Prepare parallelization matrix
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
json: ${{ steps.parallelization.outputs.json }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- uses: "./.github/actions/parallelization"
|
||||
id: parallelization
|
||||
with:
|
||||
count: ${{ inputs.flaky_test_parallel_jobs }}
|
||||
test_flakyness:
|
||||
name: Test flakyness
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ vars.fail_test_image_name }}:${{ vars.pg15_version }}${{ vars.image_suffix }}
|
||||
options: --user root
|
||||
needs:
|
||||
[build, prepare_parallelization_matrix]
|
||||
env:
|
||||
test: "${{ inputs.flaky_test }}"
|
||||
runs: "${{ inputs.flaky_test_runs_per_job }}"
|
||||
skip: false
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJson(needs.prepare_parallelization_matrix.outputs.json) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
- uses: "./.github/actions/setup_extension"
|
||||
- name: Run minimal tests
|
||||
run: |-
|
||||
gosu circleci src/test/regress/citus_tests/run_test.py ${{ env.test }} --repeat ${{ env.runs }} --use-base-schedule --use-whole-schedule-line
|
||||
shell: bash
|
||||
- uses: "./.github/actions/save_logs_and_results"
|
||||
if: always()
|
||||
with:
|
||||
folder: ${{ matrix.id }}
|
|
@ -18,20 +18,22 @@ jobs:
|
|||
pg_versions: ${{ steps.get-postgres-versions.outputs.pg_versions }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- name: Get Postgres Versions
|
||||
id: get-postgres-versions
|
||||
run: |
|
||||
# Postgres versions are stored in .circleci/config.yml file in "build-[pg-version] format. Below command
|
||||
# extracts the versions and get the unique values.
|
||||
pg_versions=`grep -Eo 'build-[[:digit:]]{2}' .circleci/config.yml|sed -e "s/^build-//"|sort|uniq|tr '\n' ','| head -c -1`
|
||||
set -euxo pipefail
|
||||
# Postgres versions are stored in .github/workflows/build_and_test.yml
|
||||
# file in json strings with major and full keys.
|
||||
# Below command extracts the versions and get the unique values.
|
||||
pg_versions=$(cat .github/workflows/build_and_test.yml | grep -oE '"major": "[0-9]+", "full": "[0-9.]+"' | sed -E 's/"major": "([0-9]+)", "full": "([0-9.]+)"/\1/g' | sort | uniq | tr '\n', ',')
|
||||
pg_versions_array="[ ${pg_versions} ]"
|
||||
echo "Supported PG Versions: ${pg_versions_array}"
|
||||
# Below line is needed to set the output variable to be used in the next job
|
||||
echo "pg_versions=${pg_versions_array}" >> $GITHUB_OUTPUT
|
||||
|
||||
shell: bash
|
||||
rpm_build_tests:
|
||||
name: rpm_build_tests
|
||||
needs: get_postgres_versions_from_file
|
||||
|
@ -44,9 +46,7 @@ jobs:
|
|||
# For this reason, we need to use a "matrix" to generate names of
|
||||
# rpm images, e.g. citus/packaging:centos-7-pg12
|
||||
packaging_docker_image:
|
||||
- oraclelinux-7
|
||||
- oraclelinux-8
|
||||
- centos-7
|
||||
- almalinux-8
|
||||
- almalinux-9
|
||||
POSTGRES_VERSION: ${{ fromJson(needs.get_postgres_versions_from_file.outputs.pg_versions) }}
|
||||
|
@ -57,7 +57,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set Postgres and python parameters for rpm based distros
|
||||
run: |
|
||||
|
@ -99,11 +99,6 @@ jobs:
|
|||
PACKAGING_DOCKER_IMAGE: ${{ matrix.packaging_docker_image }}
|
||||
run: |
|
||||
echo "Postgres version: ${POSTGRES_VERSION}"
|
||||
|
||||
## Install required packages to execute packaging tools for rpm based distros
|
||||
yum install python3-pip python3-devel postgresql-devel -y
|
||||
python3 -m pip install wheel
|
||||
|
||||
./.github/packaging/validate_build_output.sh "rpm"
|
||||
|
||||
deb_build_tests:
|
||||
|
@ -179,9 +174,4 @@ jobs:
|
|||
PACKAGING_DOCKER_IMAGE: ${{ matrix.packaging_docker_image }}
|
||||
run: |
|
||||
echo "Postgres version: ${POSTGRES_VERSION}"
|
||||
|
||||
apt-get update -y
|
||||
## Install required packages to execute packaging tools for deb based distros
|
||||
apt-get install python3-dev python3-pip -y
|
||||
apt-get purge -y python3-yaml
|
||||
./.github/packaging/validate_build_output.sh "deb"
|
||||
|
|
92
CHANGELOG.md
92
CHANGELOG.md
|
@ -1,3 +1,91 @@
|
|||
### citus v12.1.8 (May 29, 2025) ###
|
||||
|
||||
* Fixes a crash in left outer joins that can happen when there is an an
|
||||
aggregate on a column from the inner side of the join (#7904)
|
||||
|
||||
* Fixes an issue detected using address sanitizer (#7965)
|
||||
|
||||
* Fixes a crash when executing a prepared CALL, which is not pure SQL but
|
||||
available with some drivers like npgsql and jpgdbc (#7288)
|
||||
|
||||
### citus v12.1.7 (Feb 6, 2025) ###
|
||||
|
||||
* Fixes a crash that happens because of unsafe catalog access when re-assigning
|
||||
the global pid after `application_name` changes (#7791)
|
||||
|
||||
* Prevents crashes when another extension skips executing the
|
||||
`ClientAuthentication_hook` of Citus. (#7836)
|
||||
|
||||
### citus v12.1.6 (Nov 14, 2024) ###
|
||||
|
||||
* Propagates `SECURITY LABEL .. ON ROLE` statements (#7304)
|
||||
|
||||
* Fixes crash caused by running queries with window partition (#7718)
|
||||
|
||||
### citus v12.1.5 (July 17, 2024) ###
|
||||
|
||||
* Adds support for MERGE commands with single shard distributed target tables
|
||||
(#7643)
|
||||
|
||||
* Fixes an error with MERGE commands when insert value does not have source
|
||||
distribution column (#7627)
|
||||
|
||||
### citus v12.1.4 (May 28, 2024) ###
|
||||
|
||||
* Adds null check for node in HasRangeTableRef (#7604)
|
||||
|
||||
### citus v12.1.3 (April 18, 2024) ###
|
||||
|
||||
* Allows overwriting host name for all inter-node connections by
|
||||
supporting "host" parameter in citus.node_conninfo (#7541)
|
||||
|
||||
* Changes the order in which the locks are acquired for the target and
|
||||
reference tables, when a modify request is initiated from a worker
|
||||
node that is not the "FirstWorkerNode" (#7542)
|
||||
|
||||
* Fixes a performance issue when distributing a table that depends on an
|
||||
extension (#7574)
|
||||
|
||||
* Fixes a performance issue when using "\d tablename" on a server with
|
||||
many tables (#7577)
|
||||
|
||||
* Fixes a crash caused by some form of ALTER TABLE ADD COLUMN
|
||||
statements. When adding multiple columns, if one of the ADD COLUMN
|
||||
statements contains a FOREIGN constraint omitting the referenced
|
||||
columns in the statement, a SEGFAULT was occurring. (#7522)
|
||||
|
||||
* Fixes a performance issue when creating distributed tables if many
|
||||
already exist (#7575, #7579)
|
||||
|
||||
* Fixes a bug when hostname in pg_dist_node resolves to multiple IPs
|
||||
(#7377)
|
||||
|
||||
* Fixes performance issue when tracking foreign key constraints on
|
||||
systems with many constraints (#7578)
|
||||
|
||||
* Fixes segmentation fault when using CASE WHEN in DO block within
|
||||
functions. (#7554)
|
||||
|
||||
* Fixes undefined behavior in master_disable_node due to argument
|
||||
mismatch (#7492)
|
||||
|
||||
* Fixes some potential bugs by correctly marking some variables as
|
||||
volatile (#7570)
|
||||
|
||||
* Logs username in the failed connection message (#7432)
|
||||
|
||||
### citus v12.1.2 (February 12, 2024) ###
|
||||
|
||||
* Fixes the incorrect column count after ALTER TABLE (#7379)
|
||||
|
||||
### citus v12.1.1 (November 9, 2023) ###
|
||||
|
||||
* Fixes leaking of memory and memory contexts in Citus foreign key cache
|
||||
(#7236)
|
||||
|
||||
* Makes sure to disallow creating a replicated distributed table concurrently
|
||||
(#7219)
|
||||
|
||||
### citus v12.1.0 (September 12, 2023) ###
|
||||
|
||||
* Adds support for PostgreSQL 16.0 (#7173)
|
||||
|
@ -5,8 +93,8 @@
|
|||
* Add `citus_schema_move()` function which moves tables within a
|
||||
distributed schema to another node (#7180)
|
||||
|
||||
* Adds `citus_pause_node()` UDF that allows pausing the node with given id
|
||||
(#7089)
|
||||
* Adds `citus_pause_node_within_txn()` UDF that allows pausing the node with
|
||||
given id (#7089)
|
||||
|
||||
* Makes sure to enforce shard level colocation with the GUC
|
||||
`citus.enable_non_colocated_router_query_pushdown` (#7076)
|
||||
|
|
15
ci/README.md
15
ci/README.md
|
@ -385,3 +385,18 @@ definitions are in alphabetical order.
|
|||
## `print_stack_trace.sh`
|
||||
|
||||
This script prints stack traces for failed tests, if they left core files.
|
||||
|
||||
## `sort_and_group_includes.sh`
|
||||
|
||||
This script checks and fixes issues with include grouping and sorting in C files.
|
||||
|
||||
Includes are grouped in the following groups:
|
||||
- System includes (eg. `#include <math>`)
|
||||
- Postgres.h include (eg. `#include "postgres.h"`)
|
||||
- Toplevel postgres includes (includes not in a directory eg. `#include "miscadmin.h`)
|
||||
- Postgres includes in a directory (eg. `#include "catalog/pg_type.h"`)
|
||||
- Toplevel citus includes (includes not in a directory eg. `#include "pg_version_constants.h"`)
|
||||
- Columnar includes (eg. `#include "columnar/columnar.h"`)
|
||||
- Distributed includes (eg. `#include "distributed/maintenanced.h"`)
|
||||
|
||||
Within every group the include lines are sorted alphabetically.
|
||||
|
|
|
@ -15,9 +15,6 @@ PG_MAJOR=${PG_MAJOR:?please provide the postgres major version}
|
|||
codename=${VERSION#*(}
|
||||
codename=${codename%)*}
|
||||
|
||||
# get project from argument
|
||||
project="${CIRCLE_PROJECT_REPONAME}"
|
||||
|
||||
# we'll do everything with absolute paths
|
||||
basedir="$(pwd)"
|
||||
|
||||
|
@ -28,7 +25,7 @@ build_ext() {
|
|||
pg_major="$1"
|
||||
|
||||
builddir="${basedir}/build-${pg_major}"
|
||||
echo "Beginning build of ${project} for PostgreSQL ${pg_major}..." >&2
|
||||
echo "Beginning build for PostgreSQL ${pg_major}..." >&2
|
||||
|
||||
# do everything in a subdirectory to avoid clutter in current directory
|
||||
mkdir -p "${builddir}" && cd "${builddir}"
|
||||
|
|
|
@ -14,8 +14,8 @@ ci_scripts=$(
|
|||
grep -v -E '^(ci_helpers.sh|fix_style.sh)$'
|
||||
)
|
||||
for script in $ci_scripts; do
|
||||
if ! grep "\\bci/$script\\b" .circleci/config.yml > /dev/null; then
|
||||
echo "ERROR: CI script with name \"$script\" is not actually used in .circleci/config.yml"
|
||||
if ! grep "\\bci/$script\\b" -r .github > /dev/null; then
|
||||
echo "ERROR: CI script with name \"$script\" is not actually used in .github folder"
|
||||
exit 1
|
||||
fi
|
||||
if ! grep "^## \`$script\`\$" ci/README.md > /dev/null; then
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Testing this script locally requires you to set the following environment
|
||||
# variables:
|
||||
# CIRCLE_BRANCH, GIT_USERNAME and GIT_TOKEN
|
||||
|
||||
# fail if trying to reference a variable that is not set.
|
||||
set -u
|
||||
# exit immediately if a command fails
|
||||
set -e
|
||||
# Fail on pipe failures
|
||||
set -o pipefail
|
||||
|
||||
PR_BRANCH="${CIRCLE_BRANCH}"
|
||||
ENTERPRISE_REMOTE="https://${GIT_USERNAME}:${GIT_TOKEN}@github.com/citusdata/citus-enterprise"
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source ci/ci_helpers.sh
|
||||
|
||||
# List executed commands. This is done so debugging this script is easier when
|
||||
# it fails. It's explicitly done after git remote add so username and password
|
||||
# are not shown in CI output (even though it's also filtered out by CircleCI)
|
||||
set -x
|
||||
|
||||
check_compile () {
|
||||
echo "INFO: checking if merged code can be compiled"
|
||||
./configure --without-libcurl
|
||||
make -j10
|
||||
}
|
||||
|
||||
# Clone current git repo (which should be community) to a temporary working
|
||||
# directory and go there
|
||||
GIT_DIR_ROOT="$(git rev-parse --show-toplevel)"
|
||||
TMP_GIT_DIR="$(mktemp --directory -t citus-merge-check.XXXXXXXXX)"
|
||||
git clone "$GIT_DIR_ROOT" "$TMP_GIT_DIR"
|
||||
cd "$TMP_GIT_DIR"
|
||||
|
||||
# Fails in CI without this
|
||||
git config user.email "citus-bot@microsoft.com"
|
||||
git config user.name "citus bot"
|
||||
|
||||
# Disable "set -x" temporarily, because $ENTERPRISE_REMOTE contains passwords
|
||||
{ set +x ; } 2> /dev/null
|
||||
git remote add enterprise "$ENTERPRISE_REMOTE"
|
||||
set -x
|
||||
|
||||
git remote set-url --push enterprise no-pushing
|
||||
|
||||
# Fetch enterprise-master
|
||||
git fetch enterprise enterprise-master
|
||||
|
||||
|
||||
git checkout "enterprise/enterprise-master"
|
||||
|
||||
if git merge --no-commit "origin/$PR_BRANCH"; then
|
||||
echo "INFO: community PR branch could be merged into enterprise-master"
|
||||
# check that we can compile after the merge
|
||||
if check_compile; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "WARN: Failed to compile after community PR branch was merged into enterprise"
|
||||
fi
|
||||
|
||||
# undo partial merge
|
||||
git merge --abort
|
||||
|
||||
# If we have a conflict on enterprise merge on the master branch, we have a problem.
|
||||
# Provide an error message to indicate that enterprise merge is needed to fix this check.
|
||||
if [[ $PR_BRANCH = master ]]; then
|
||||
echo "ERROR: Master branch has merge conflicts with enterprise-master."
|
||||
echo "Try re-running this CI job after merging your changes into enterprise-master."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! git fetch enterprise "$PR_BRANCH" ; then
|
||||
echo "ERROR: enterprise/$PR_BRANCH was not found and community PR branch could not be merged into enterprise-master"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Show the top commit of the enterprise PR branch to make debugging easier
|
||||
git log -n 1 "enterprise/$PR_BRANCH"
|
||||
|
||||
# Check that this branch contains the top commit of the current community PR
|
||||
# branch. If it does not it means it's not up to date with the current PR, so
|
||||
# the enterprise branch should be updated.
|
||||
if ! git merge-base --is-ancestor "origin/$PR_BRANCH" "enterprise/$PR_BRANCH" ; then
|
||||
echo "ERROR: enterprise/$PR_BRANCH is not up to date with community PR branch"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Now check if we can merge the enterprise PR into enterprise-master without
|
||||
# issues.
|
||||
git merge --no-commit "enterprise/$PR_BRANCH"
|
||||
# check that we can compile after the merge
|
||||
check_compile
|
|
@ -5,6 +5,6 @@ set -euo pipefail
|
|||
source ci/ci_helpers.sh
|
||||
|
||||
# extract citus gucs in the form of "citus.X"
|
||||
grep -o -E "(\.*\"citus.\w+\")," src/backend/distributed/shared_library_init.c > gucs.out
|
||||
grep -o -E "(\.*\"citus\.\w+\")," src/backend/distributed/shared_library_init.c > gucs.out
|
||||
sort -c gucs.out
|
||||
rm gucs.out
|
||||
|
|
|
@ -19,3 +19,4 @@ ci/disallow_long_changelog_entries.sh
|
|||
ci/normalize_expected.sh
|
||||
ci/fix_gitignore.sh
|
||||
ci/print_stack_trace.sh
|
||||
ci/sort_and_group_includes.sh
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
easy command line to run against all citus-style checked files:
|
||||
|
||||
$ git ls-files \
|
||||
| git check-attr --stdin citus-style \
|
||||
| grep 'citus-style: set' \
|
||||
| awk '{print $1}' \
|
||||
| cut -d':' -f1 \
|
||||
| xargs -n1 ./ci/include_grouping.py
|
||||
"""
|
||||
|
||||
import collections
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main(args):
|
||||
if len(args) < 2:
|
||||
print("Usage: include_grouping.py <file>")
|
||||
return
|
||||
|
||||
file = args[1]
|
||||
if not os.path.isfile(file):
|
||||
sys.exit(f"File '{file}' does not exist")
|
||||
|
||||
with open(file, "r") as in_file:
|
||||
with open(file + ".tmp", "w") as out_file:
|
||||
includes = []
|
||||
skipped_lines = []
|
||||
|
||||
# This calls print_sorted_includes on a set of consecutive #include lines.
|
||||
# This implicitly keeps separation of any #include lines that are contained in
|
||||
# an #ifdef, because it will order the #include lines inside and after the
|
||||
# #ifdef completely separately.
|
||||
for line in in_file:
|
||||
# if a line starts with #include we don't want to print it yet, instead we
|
||||
# want to collect all consecutive #include lines
|
||||
if line.startswith("#include"):
|
||||
includes.append(line)
|
||||
skipped_lines = []
|
||||
continue
|
||||
|
||||
# if we have collected any #include lines, we want to print them sorted
|
||||
# before printing the current line. However, if the current line is empty
|
||||
# we want to perform a lookahead to see if the next line is an #include.
|
||||
# To maintain any separation between #include lines and their subsequent
|
||||
# lines we keep track of all lines we have skipped inbetween.
|
||||
if len(includes) > 0:
|
||||
if len(line.strip()) == 0:
|
||||
skipped_lines.append(line)
|
||||
continue
|
||||
|
||||
# we have includes that need to be grouped before printing the current
|
||||
# line.
|
||||
print_sorted_includes(includes, file=out_file)
|
||||
includes = []
|
||||
|
||||
# print any skipped lines
|
||||
print("".join(skipped_lines), end="", file=out_file)
|
||||
skipped_lines = []
|
||||
|
||||
print(line, end="", file=out_file)
|
||||
|
||||
# move out_file to file
|
||||
os.rename(file + ".tmp", file)
|
||||
|
||||
|
||||
def print_sorted_includes(includes, file=sys.stdout):
|
||||
default_group_key = 1
|
||||
groups = collections.defaultdict(set)
|
||||
|
||||
# define the groups that we separate correctly. The matchers are tested in the order
|
||||
# of their priority field. The first matcher that matches the include is used to
|
||||
# assign the include to a group.
|
||||
# The groups are printed in the order of their group_key.
|
||||
matchers = [
|
||||
{
|
||||
"name": "system includes",
|
||||
"matcher": lambda x: x.startswith("<"),
|
||||
"group_key": -2,
|
||||
"priority": 0,
|
||||
},
|
||||
{
|
||||
"name": "toplevel postgres includes",
|
||||
"matcher": lambda x: "/" not in x,
|
||||
"group_key": 0,
|
||||
"priority": 9,
|
||||
},
|
||||
{
|
||||
"name": "postgres.h",
|
||||
"matcher": lambda x: x.strip() in ['"postgres.h"'],
|
||||
"group_key": -1,
|
||||
"priority": -1,
|
||||
},
|
||||
{
|
||||
"name": "toplevel citus inlcudes",
|
||||
"matcher": lambda x: x.strip()
|
||||
in [
|
||||
'"citus_version.h"',
|
||||
'"pg_version_compat.h"',
|
||||
'"pg_version_constants.h"',
|
||||
],
|
||||
"group_key": 3,
|
||||
"priority": 0,
|
||||
},
|
||||
{
|
||||
"name": "columnar includes",
|
||||
"matcher": lambda x: x.startswith('"columnar/'),
|
||||
"group_key": 4,
|
||||
"priority": 1,
|
||||
},
|
||||
{
|
||||
"name": "distributed includes",
|
||||
"matcher": lambda x: x.startswith('"distributed/'),
|
||||
"group_key": 5,
|
||||
"priority": 1,
|
||||
},
|
||||
]
|
||||
matchers.sort(key=lambda x: x["priority"])
|
||||
|
||||
# throughout our codebase we have some includes where either postgres or citus
|
||||
# includes are wrongfully included with the syntax for system includes. Before we
|
||||
# try to match those we will change the <> to "" to make them match our system. This
|
||||
# will also rewrite the include to the correct syntax.
|
||||
common_system_include_error_prefixes = ["<nodes/", "<distributed/"]
|
||||
|
||||
# assign every include to a group
|
||||
for include in includes:
|
||||
# extract the group key from the include
|
||||
include_content = include.split(" ")[1]
|
||||
|
||||
# fix common system includes which are secretly postgres or citus includes
|
||||
for common_prefix in common_system_include_error_prefixes:
|
||||
if include_content.startswith(common_prefix):
|
||||
include_content = '"' + include_content.strip()[1:-1] + '"'
|
||||
include = include.split(" ")[0] + " " + include_content + "\n"
|
||||
break
|
||||
|
||||
group_key = default_group_key
|
||||
for matcher in matchers:
|
||||
if matcher["matcher"](include_content):
|
||||
group_key = matcher["group_key"]
|
||||
break
|
||||
|
||||
groups[group_key].add(include)
|
||||
|
||||
# iterate over all groups in the natural order of its keys
|
||||
for i, group in enumerate(sorted(groups.items())):
|
||||
if i > 0:
|
||||
print(file=file)
|
||||
includes = group[1]
|
||||
print("".join(sorted(includes)), end="", file=file)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
# shellcheck disable=SC1091
|
||||
source ci/ci_helpers.sh
|
||||
|
||||
git ls-files \
|
||||
| git check-attr --stdin citus-style \
|
||||
| grep 'citus-style: set' \
|
||||
| awk '{print $1}' \
|
||||
| cut -d':' -f1 \
|
||||
| xargs -n1 ./ci/include_grouping.py
|
|
@ -5,7 +5,7 @@
|
|||
# everyone needing autoconf installed, the resulting files are checked
|
||||
# into the SCM.
|
||||
|
||||
AC_INIT([Citus], [12.1devel])
|
||||
AC_INIT([Citus], [12.1.8])
|
||||
AC_COPYRIGHT([Copyright (c) Citus Data, Inc.])
|
||||
|
||||
# we'll need sed and awk for some of the version commands
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
"citus.all_modifications_commutative",
|
||||
"citus.allow_modifications_from_workers_to_replicated_tables",
|
||||
"citus.allow_nested_distributed_execution",
|
||||
"citus.allow_unsafe_constraints",
|
||||
"citus.allow_unsafe_locks_from_workers",
|
||||
"citus.background_task_queue_interval",
|
||||
"citus.check_available_space_before_move",
|
||||
"citus.cluster_name",
|
||||
"citus.coordinator_aggregation_strategy",
|
||||
"citus.copy_switchover_threshold",
|
||||
"citus.count_distinct_error_rate",
|
||||
"citus.cpu_priority",
|
||||
"citus.cpu_priority_for_logical_replication_senders",
|
||||
"citus.create_object_propagation",
|
||||
"citus.defer_drop_after_shard_move",
|
||||
"citus.defer_drop_after_shard_split",
|
||||
"citus.defer_shard_delete_interval",
|
||||
"citus.desired_percent_disk_available_after_move",
|
||||
"citus.distributed_deadlock_detection_factor",
|
||||
"citus.enable_alter_database_owner",
|
||||
"citus.enable_alter_role_propagation",
|
||||
"citus.enable_alter_role_set_propagation",
|
||||
"citus.enable_binary_protocol",
|
||||
"citus.enable_change_data_capture",
|
||||
"citus.enable_cluster_clock",
|
||||
"citus.enable_cost_based_connection_establishment",
|
||||
"citus.enable_create_role_propagation",
|
||||
"citus.enable_create_type_propagation",
|
||||
"citus.enable_ddl_propagation",
|
||||
"citus.enable_deadlock_prevention",
|
||||
"citus.enable_fast_path_router_planner",
|
||||
"citus.enable_local_execution",
|
||||
"citus.enable_local_reference_table_foreign_keys",
|
||||
"citus.enable_manual_changes_to_shards",
|
||||
"citus.enable_manual_metadata_changes_for_user",
|
||||
"citus.enable_metadata_sync",
|
||||
"citus.enable_non_colocated_router_query_pushdown",
|
||||
"citus.enable_repartition_joins",
|
||||
"citus.enable_repartitioned_insert_select",
|
||||
"citus.enable_router_execution",
|
||||
"citus.enable_schema_based_sharding",
|
||||
"citus.enable_single_hash_repartition_joins",
|
||||
"citus.enable_statistics_collection",
|
||||
"citus.enable_unique_job_ids",
|
||||
"citus.enable_unsafe_triggers",
|
||||
"citus.enable_unsupported_feature_messages",
|
||||
"citus.enable_version_checks",
|
||||
"citus.enforce_foreign_key_restrictions",
|
||||
"citus.enforce_object_restrictions_for_local_objects",
|
||||
"citus.executor_slow_start_interval",
|
||||
"citus.explain_all_tasks",
|
||||
"citus.explain_analyze_sort_method",
|
||||
"citus.explain_distributed_queries",
|
||||
"citus.force_max_query_parallelization",
|
||||
"citus.function_opens_transaction_block",
|
||||
"citus.grep_remote_commands",
|
||||
"citus.hide_citus_dependent_objects",
|
||||
"citus.hide_shards_from_app_name_prefixes",
|
||||
"citus.isolation_test_session_process_id",
|
||||
"citus.isolation_test_session_remote_process_id",
|
||||
"citus.limit_clause_row_fetch_count",
|
||||
"citus.local_copy_flush_threshold",
|
||||
"citus.local_hostname",
|
||||
"citus.local_shared_pool_size",
|
||||
"citus.local_table_join_policy",
|
||||
"citus.log_distributed_deadlock_detection",
|
||||
"citus.log_intermediate_results",
|
||||
"citus.log_local_commands",
|
||||
"citus.log_multi_join_order",
|
||||
"citus.log_remote_commands",
|
||||
"citus.logical_replication_timeout",
|
||||
"citus.main_db",
|
||||
"citus.max_adaptive_executor_pool_size",
|
||||
"citus.max_background_task_executors",
|
||||
"citus.max_background_task_executors_per_node",
|
||||
"citus.max_cached_connection_lifetime",
|
||||
"citus.max_cached_conns_per_worker",
|
||||
"citus.max_client_connections",
|
||||
"citus.max_high_priority_background_processes",
|
||||
"citus.max_intermediate_result_size",
|
||||
"citus.max_matview_size_to_auto_recreate",
|
||||
"citus.max_rebalancer_logged_ignored_moves",
|
||||
"citus.max_shared_pool_size",
|
||||
"citus.max_worker_nodes_tracked",
|
||||
"citus.metadata_sync_interval",
|
||||
"citus.metadata_sync_mode",
|
||||
"citus.metadata_sync_retry_interval",
|
||||
"citus.mitmfifo",
|
||||
"citus.multi_shard_modify_mode",
|
||||
"citus.multi_task_query_log_level",
|
||||
"citus.next_cleanup_record_id",
|
||||
"citus.next_operation_id",
|
||||
"citus.next_placement_id",
|
||||
"citus.next_shard_id",
|
||||
"citus.node_connection_timeout",
|
||||
"citus.node_conninfo",
|
||||
"citus.override_table_visibility",
|
||||
"citus.prevent_incomplete_connection_establishment",
|
||||
"citus.propagate_session_settings_for_loopback_connection",
|
||||
"citus.propagate_set_commands",
|
||||
"citus.rebalancer_by_disk_size_base_cost",
|
||||
"citus.recover_2pc_interval",
|
||||
"citus.remote_copy_flush_threshold",
|
||||
"citus.remote_task_check_interval",
|
||||
"citus.repartition_join_bucket_count_per_node",
|
||||
"citus.replicate_reference_tables_on_activate",
|
||||
"citus.replication_model",
|
||||
"citus.running_under_citus_test_suite",
|
||||
"citus.select_opens_transaction_block",
|
||||
"citus.shard_count",
|
||||
"citus.shard_replication_factor",
|
||||
"citus.show_shards_for_app_name_prefixes",
|
||||
"citus.skip_advisory_lock_permission_checks",
|
||||
"citus.skip_constraint_validation",
|
||||
"citus.skip_jsonb_validation_in_copy",
|
||||
"citus.sort_returning",
|
||||
"citus.stat_statements_max",
|
||||
"citus.stat_statements_purge_interval",
|
||||
"citus.stat_statements_track",
|
||||
"citus.stat_tenants_limit",
|
||||
"citus.stat_tenants_log_level",
|
||||
"citus.stat_tenants_period",
|
||||
"citus.stat_tenants_track",
|
||||
"citus.stat_tenants_untracked_sample_rate",
|
||||
"citus.subquery_pushdown",
|
||||
"citus.task_assignment_policy",
|
||||
"citus.task_executor_type",
|
||||
"citus.use_citus_managed_tables",
|
||||
"citus.use_secondary_nodes",
|
||||
"citus.values_materialization_threshold",
|
||||
"citus.version",
|
||||
"citus.worker_min_messages",
|
||||
"citus.writable_standby_coordinator",
|
|
@ -11,16 +11,18 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "utils/guc.h"
|
||||
#include "utils/rel.h"
|
||||
|
||||
#include "citus_version.h"
|
||||
|
||||
#include "columnar/columnar.h"
|
||||
#include "columnar/columnar_tableam.h"
|
||||
|
||||
|
|
|
@ -13,12 +13,13 @@
|
|||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "citus_version.h"
|
||||
#include "common/pg_lzcompress.h"
|
||||
#include "lib/stringinfo.h"
|
||||
|
||||
#include "citus_version.h"
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "columnar/columnar_compression.h"
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#if HAVE_CITUS_LIBLZ4
|
||||
#include <lz4.h>
|
||||
|
|
|
@ -10,18 +10,17 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "citus_version.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/amapi.h"
|
||||
#include "access/skey.h"
|
||||
#include "catalog/pg_am.h"
|
||||
#include "catalog/pg_statistic.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "miscadmin.h"
|
||||
#include "nodes/extensible.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/nodeFuncs.h"
|
||||
|
@ -33,6 +32,8 @@
|
|||
#include "optimizer/paths.h"
|
||||
#include "optimizer/plancat.h"
|
||||
#include "optimizer/restrictinfo.h"
|
||||
|
||||
#include "citus_version.h"
|
||||
#if PG_VERSION_NUM >= PG_VERSION_16
|
||||
#include "parser/parse_relation.h"
|
||||
#include "parser/parsetree.h"
|
||||
|
@ -48,6 +49,7 @@
|
|||
#include "columnar/columnar_customscan.h"
|
||||
#include "columnar/columnar_metadata.h"
|
||||
#include "columnar/columnar_tableam.h"
|
||||
|
||||
#include "distributed/listutils.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
#include "postgres.h"
|
||||
|
||||
#include "funcapi.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/nbtree.h"
|
||||
#include "access/table.h"
|
||||
#include "catalog/pg_am.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "miscadmin.h"
|
||||
#include "storage/fd.h"
|
||||
#include "storage/smgr.h"
|
||||
#include "utils/guc.h"
|
||||
|
@ -25,6 +25,8 @@
|
|||
#include "utils/tuplestore.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "columnar/columnar.h"
|
||||
#include "columnar/columnar_storage.h"
|
||||
#include "columnar/columnar_version_compat.h"
|
||||
|
|
|
@ -19,46 +19,50 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
#include "safe_lib.h"
|
||||
|
||||
#include "citus_version.h"
|
||||
#include "columnar/columnar.h"
|
||||
#include "columnar/columnar_storage.h"
|
||||
#include "columnar/columnar_version_compat.h"
|
||||
#include "distributed/listutils.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include "access/heapam.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/nbtree.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/indexing.h"
|
||||
#include "catalog/pg_namespace.h"
|
||||
#include "catalog/pg_collation.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "catalog/pg_collation.h"
|
||||
#include "catalog/pg_namespace.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/sequence.h"
|
||||
#include "commands/trigger.h"
|
||||
#include "executor/executor.h"
|
||||
#include "executor/spi.h"
|
||||
#include "miscadmin.h"
|
||||
#include "nodes/execnodes.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/execnodes.h"
|
||||
|
||||
#include "citus_version.h"
|
||||
|
||||
#include "columnar/columnar.h"
|
||||
#include "columnar/columnar_storage.h"
|
||||
#include "columnar/columnar_version_compat.h"
|
||||
|
||||
#include "distributed/listutils.h"
|
||||
#if PG_VERSION_NUM >= PG_VERSION_16
|
||||
#include "parser/parse_relation.h"
|
||||
#endif
|
||||
#include "port.h"
|
||||
|
||||
#include "storage/fd.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "storage/procarray.h"
|
||||
#include "storage/smgr.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/rel.h"
|
||||
#if PG_VERSION_NUM >= PG_VERSION_16
|
||||
#include "storage/relfilelocator.h"
|
||||
|
|
|
@ -22,16 +22,15 @@
|
|||
#include "access/xact.h"
|
||||
#include "catalog/pg_am.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/nodeFuncs.h"
|
||||
#include "optimizer/optimizer.h"
|
||||
#include "optimizer/clauses.h"
|
||||
#include "optimizer/optimizer.h"
|
||||
#include "optimizer/restrictinfo.h"
|
||||
#include "storage/fd.h"
|
||||
#include "utils/guc.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/rel.h"
|
||||
|
||||
#include "columnar/columnar.h"
|
||||
|
@ -39,6 +38,8 @@
|
|||
#include "columnar/columnar_tableam.h"
|
||||
#include "columnar/columnar_version_compat.h"
|
||||
|
||||
#include "distributed/listutils.h"
|
||||
|
||||
#define UNEXPECTED_STRIPE_READ_ERR_MSG \
|
||||
"attempted to read an unexpected stripe while reading columnar " \
|
||||
"table %s, stripe with id=" UINT64_FORMAT " is not flushed"
|
||||
|
|
|
@ -36,11 +36,11 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
#include "safe_lib.h"
|
||||
|
||||
#include "access/generic_xlog.h"
|
||||
#include "catalog/storage.h"
|
||||
#include "miscadmin.h"
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/lmgr.h"
|
||||
|
||||
|
|
|
@ -1,42 +1,38 @@
|
|||
#include "citus_version.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "miscadmin.h"
|
||||
#include "pgstat.h"
|
||||
#include "safe_lib.h"
|
||||
|
||||
#include "access/detoast.h"
|
||||
#include "access/genam.h"
|
||||
#include "access/heapam.h"
|
||||
#include "access/multixact.h"
|
||||
#include "access/rewriteheap.h"
|
||||
#include "access/tableam.h"
|
||||
#include "access/tsmapi.h"
|
||||
#include "access/detoast.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/catalog.h"
|
||||
#include "catalog/index.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "catalog/objectaccess.h"
|
||||
#include "catalog/pg_am.h"
|
||||
#include "catalog/pg_extension.h"
|
||||
#include "catalog/pg_publication.h"
|
||||
#include "catalog/pg_trigger.h"
|
||||
#include "catalog/pg_extension.h"
|
||||
#include "catalog/storage.h"
|
||||
#include "catalog/storage_xlog.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/extension.h"
|
||||
#include "commands/progress.h"
|
||||
#include "commands/vacuum.h"
|
||||
#include "commands/extension.h"
|
||||
#include "executor/executor.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "optimizer/plancat.h"
|
||||
#include "pg_version_compat.h"
|
||||
#include "pgstat.h"
|
||||
#include "safe_lib.h"
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/bufpage.h"
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "storage/predicate.h"
|
||||
#include "storage/procarray.h"
|
||||
|
@ -44,17 +40,22 @@
|
|||
#include "tcop/utility.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/pg_rusage.h"
|
||||
#include "utils/rel.h"
|
||||
#include "utils/relcache.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "citus_version.h"
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "columnar/columnar.h"
|
||||
#include "columnar/columnar_customscan.h"
|
||||
#include "columnar/columnar_storage.h"
|
||||
#include "columnar/columnar_tableam.h"
|
||||
#include "columnar/columnar_version_compat.h"
|
||||
|
||||
#include "distributed/listutils.h"
|
||||
|
||||
/*
|
||||
|
@ -2945,7 +2946,7 @@ MajorVersionsCompatibleColumnar(char *leftVersion, char *rightVersion)
|
|||
}
|
||||
else
|
||||
{
|
||||
rightComparisionLimit = strlen(leftVersion);
|
||||
rightComparisionLimit = strlen(rightVersion);
|
||||
}
|
||||
|
||||
/* we can error out early if hypens are not in the same position */
|
||||
|
|
|
@ -16,18 +16,19 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
#include "safe_lib.h"
|
||||
|
||||
#include "access/heapam.h"
|
||||
#include "access/nbtree.h"
|
||||
#include "catalog/pg_am.h"
|
||||
#include "miscadmin.h"
|
||||
#include "pg_version_compat.h"
|
||||
#include "storage/fd.h"
|
||||
#include "storage/smgr.h"
|
||||
#include "utils/guc.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/rel.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
#if PG_VERSION_NUM >= PG_VERSION_16
|
||||
#include "storage/relfilelocator.h"
|
||||
#include "utils/relfilenumbermap.h"
|
||||
|
|
|
@ -1,21 +1,17 @@
|
|||
|
||||
#include "citus_version.h"
|
||||
|
||||
#include "postgres.h"
|
||||
#include "columnar/columnar.h"
|
||||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
#include "pgstat.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/heapam.h"
|
||||
#include "access/heaptoast.h"
|
||||
#include "access/multixact.h"
|
||||
#include "access/rewriteheap.h"
|
||||
#include "access/tsmapi.h"
|
||||
#include "access/heaptoast.h"
|
||||
#include "common/hashfn.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/catalog.h"
|
||||
#include "catalog/index.h"
|
||||
|
@ -26,14 +22,12 @@
|
|||
#include "catalog/storage_xlog.h"
|
||||
#include "commands/progress.h"
|
||||
#include "commands/vacuum.h"
|
||||
#include "common/hashfn.h"
|
||||
#include "executor/executor.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "optimizer/plancat.h"
|
||||
#include "pg_version_compat.h"
|
||||
#include "pgstat.h"
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/bufpage.h"
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "storage/predicate.h"
|
||||
#include "storage/procarray.h"
|
||||
|
@ -44,6 +38,10 @@
|
|||
#include "utils/rel.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "citus_version.h"
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "columnar/columnar.h"
|
||||
#include "columnar/columnar_customscan.h"
|
||||
#include "columnar/columnar_tableam.h"
|
||||
#include "columnar/columnar_version_compat.h"
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "cdc_decoder_utils.h"
|
||||
#include "postgres.h"
|
||||
|
||||
#include "cdc_decoder_utils.h"
|
||||
#include "fmgr.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
|
|
|
@ -8,18 +8,21 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
#include "commands/extension.h"
|
||||
|
||||
#include "cdc_decoder_utils.h"
|
||||
#include "fmgr.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/heapam.h"
|
||||
#include "catalog/pg_namespace.h"
|
||||
#include "commands/extension.h"
|
||||
#include "common/hashfn.h"
|
||||
#include "common/string.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/typcache.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "catalog/pg_namespace.h"
|
||||
#include "cdc_decoder_utils.h"
|
||||
#include "utils/typcache.h"
|
||||
|
||||
#include "distributed/pg_dist_partition.h"
|
||||
#include "distributed/pg_dist_shard.h"
|
||||
#include "distributed/relay_utility.h"
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
#define CITUS_CDC_DECODER_H
|
||||
|
||||
#include "postgres.h"
|
||||
#include "fmgr.h"
|
||||
#include "replication/logical.h"
|
||||
|
||||
#include "c.h"
|
||||
#include "fmgr.h"
|
||||
|
||||
#include "replication/logical.h"
|
||||
|
||||
#define InvalidRepOriginId 0
|
||||
#define INVALID_SHARD_ID 0
|
||||
|
|
|
@ -11,36 +11,37 @@
|
|||
#include <sys/time.h>
|
||||
|
||||
#include "postgres.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "fmgr.h"
|
||||
#include "funcapi.h"
|
||||
#include "libpq-fe.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/datum.h"
|
||||
#include "utils/numeric.h"
|
||||
#include "utils/typcache.h"
|
||||
#include "nodes/pg_list.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "commands/extension.h"
|
||||
#include "commands/sequence.h"
|
||||
#include "executor/spi.h"
|
||||
#include "nodes/pg_list.h"
|
||||
#include "postmaster/postmaster.h"
|
||||
#include "storage/ipc.h"
|
||||
#include "storage/lwlock.h"
|
||||
#include "storage/s_lock.h"
|
||||
#include "storage/shmem.h"
|
||||
#include "storage/spin.h"
|
||||
#include "storage/s_lock.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/datum.h"
|
||||
#include "utils/numeric.h"
|
||||
#include "utils/typcache.h"
|
||||
|
||||
#include "distributed/causal_clock.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/lock_graph.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/placement_connection.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/lock_graph.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/placement_connection.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
|
||||
#define SAVE_AND_PERSIST(c) \
|
||||
do { \
|
||||
|
|
|
@ -34,9 +34,16 @@
|
|||
#include "catalog/pg_am.h"
|
||||
#include "catalog/pg_depend.h"
|
||||
#include "catalog/pg_rewrite_d.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "executor/spi.h"
|
||||
#include "nodes/pg_list.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "columnar/columnar.h"
|
||||
#include "columnar/columnar_tableam.h"
|
||||
#include "commands/defrem.h"
|
||||
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
|
@ -57,16 +64,11 @@
|
|||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/replication_origin_session_utils.h"
|
||||
#include "distributed/shared_library_init.h"
|
||||
#include "distributed/shard_utils.h"
|
||||
#include "distributed/shared_library_init.h"
|
||||
#include "distributed/tenant_schema_metadata.h"
|
||||
#include "distributed/worker_protocol.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "executor/spi.h"
|
||||
#include "nodes/pg_list.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
|
||||
/* Table Conversion Types */
|
||||
|
|
|
@ -9,12 +9,14 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "c.h"
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/transaction_management.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -11,12 +11,23 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "funcapi.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "funcapi.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "catalog/pg_proc.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "nodes/nodeFuncs.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "nodes/primnodes.h"
|
||||
#include "optimizer/clauses.h"
|
||||
#include "tcop/dest.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/adaptive_executor.h"
|
||||
#include "distributed/backend_data.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
|
@ -26,27 +37,17 @@
|
|||
#include "distributed/connection_management.h"
|
||||
#include "distributed/deparse_shard_query.h"
|
||||
#include "distributed/function_call_delegation.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/multi_physical_planner.h"
|
||||
#include "distributed/adaptive_executor.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/shard_pruning.h"
|
||||
#include "distributed/tuple_destination.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
#include "distributed/worker_log_messages.h"
|
||||
#include "optimizer/clauses.h"
|
||||
#include "nodes/nodeFuncs.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "nodes/primnodes.h"
|
||||
#include "miscadmin.h"
|
||||
#include "tcop/dest.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
|
||||
|
||||
/* global variable tracking whether we are in a delegated procedure call */
|
||||
|
|
|
@ -12,12 +12,19 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/xact.h"
|
||||
#include "catalog/pg_constraint.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "executor/spi.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/foreign_key_relationship.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/local_executor.h"
|
||||
|
@ -26,11 +33,6 @@
|
|||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/worker_protocol.h"
|
||||
#include "executor/spi.h"
|
||||
#include "miscadmin.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
|
||||
static void EnsureSequentialModeForCitusTableCascadeFunction(List *relationIdList);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
|
@ -25,29 +26,30 @@
|
|||
#include "catalog/pg_constraint.h"
|
||||
#include "catalog/pg_statistic_ext.h"
|
||||
#include "catalog/pg_trigger.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "foreign/foreign.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/ruleutils.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/sequence.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/foreign_key_relationship.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/worker_protocol.h"
|
||||
#include "distributed/worker_shard_visibility.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/ruleutils.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "foreign/foreign.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -11,14 +11,16 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "signal.h"
|
||||
|
||||
#include "lib/stringinfo.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/backend_data.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "signal.h"
|
||||
|
||||
static bool CitusSignalBackend(uint64 globalPID, uint64 timeout, int sig);
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#include "catalog/namespace.h"
|
||||
#include "commands/defrem.h"
|
||||
|
||||
#include "catalog/namespace.h"
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/listutils.h"
|
||||
|
|
|
@ -10,30 +10,32 @@
|
|||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/htup_details.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/pg_collation.h"
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/worker_create_or_replace.h"
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
#include "parser/parse_type.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/worker_create_or_replace.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
|
||||
|
||||
static char * CreateCollationDDLInternal(Oid collationId, Oid *collowner,
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
|
||||
|
|
|
@ -9,10 +9,8 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/hash.h"
|
||||
|
@ -24,6 +22,7 @@
|
|||
#include "catalog/dependency.h"
|
||||
#include "catalog/index.h"
|
||||
#include "catalog/pg_am.h"
|
||||
#include "catalog/pg_attrdef.h"
|
||||
#include "catalog/pg_attribute.h"
|
||||
#include "catalog/pg_enum.h"
|
||||
#include "catalog/pg_extension.h"
|
||||
|
@ -37,42 +36,6 @@
|
|||
#include "commands/sequence.h"
|
||||
#include "commands/tablecmds.h"
|
||||
#include "commands/trigger.h"
|
||||
#include "distributed/commands/multi_copy.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/distributed_execution_locks.h"
|
||||
#include "distributed/distribution_column.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/multi_logical_planner.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/pg_dist_colocation.h"
|
||||
#include "distributed/pg_dist_partition.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/replicate_none_dist_table_shard.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/shard_cleaner.h"
|
||||
#include "distributed/shard_rebalancer.h"
|
||||
#include "distributed/shard_split.h"
|
||||
#include "distributed/shard_transfer.h"
|
||||
#include "distributed/shared_library_init.h"
|
||||
#include "distributed/shard_rebalancer.h"
|
||||
#include "distributed/worker_protocol.h"
|
||||
#include "distributed/worker_shard_visibility.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "distributed/utils/distribution_column_map.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "executor/executor.h"
|
||||
#include "executor/spi.h"
|
||||
#include "nodes/execnodes.h"
|
||||
|
@ -88,12 +51,52 @@
|
|||
#include "tcop/pquery.h"
|
||||
#include "tcop/tcopprot.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/inval.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/rel.h"
|
||||
#include "utils/snapmgr.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "utils/inval.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/multi_copy.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/distributed_execution_locks.h"
|
||||
#include "distributed/distribution_column.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/multi_logical_planner.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/pg_dist_colocation.h"
|
||||
#include "distributed/pg_dist_partition.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/replicate_none_dist_table_shard.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/shard_cleaner.h"
|
||||
#include "distributed/shard_rebalancer.h"
|
||||
#include "distributed/shard_split.h"
|
||||
#include "distributed/shard_transfer.h"
|
||||
#include "distributed/shared_library_init.h"
|
||||
#include "distributed/utils/distribution_column_map.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_protocol.h"
|
||||
#include "distributed/worker_shard_visibility.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
|
||||
|
||||
/* common params that apply to all Citus table types */
|
||||
|
@ -445,6 +448,19 @@ CreateDistributedTableConcurrently(Oid relationId, char *distributionColumnName,
|
|||
if (!IsColocateWithDefault(colocateWithTableName) && !IsColocateWithNone(
|
||||
colocateWithTableName))
|
||||
{
|
||||
if (replicationModel != REPLICATION_MODEL_STREAMING)
|
||||
{
|
||||
ereport(ERROR, (errmsg("cannot create distributed table "
|
||||
"concurrently because Citus allows "
|
||||
"concurrent table distribution only when "
|
||||
"citus.shard_replication_factor = 1"),
|
||||
errhint("table %s is requested to be colocated "
|
||||
"with %s which has "
|
||||
"citus.shard_replication_factor > 1",
|
||||
get_rel_name(relationId),
|
||||
colocateWithTableName)));
|
||||
}
|
||||
|
||||
EnsureColocateWithTableIsValid(relationId, distributionMethod,
|
||||
distributionColumnName,
|
||||
colocateWithTableName);
|
||||
|
@ -1685,52 +1701,39 @@ PropagatePrerequisiteObjectsForDistributedTable(Oid relationId)
|
|||
void
|
||||
EnsureSequenceTypeSupported(Oid seqOid, Oid attributeTypeId, Oid ownerRelationId)
|
||||
{
|
||||
List *citusTableIdList = CitusTableTypeIdList(ANY_CITUS_TABLE_TYPE);
|
||||
citusTableIdList = list_append_unique_oid(citusTableIdList, ownerRelationId);
|
||||
Oid attrDefOid;
|
||||
List *attrDefOids = GetAttrDefsFromSequence(seqOid);
|
||||
|
||||
Oid citusTableId = InvalidOid;
|
||||
foreach_oid(citusTableId, citusTableIdList)
|
||||
foreach_oid(attrDefOid, attrDefOids)
|
||||
{
|
||||
List *seqInfoList = NIL;
|
||||
GetDependentSequencesWithRelation(citusTableId, &seqInfoList, 0, DEPENDENCY_AUTO);
|
||||
ObjectAddress columnAddress = GetAttrDefaultColumnAddress(attrDefOid);
|
||||
|
||||
SequenceInfo *seqInfo = NULL;
|
||||
foreach_ptr(seqInfo, seqInfoList)
|
||||
/*
|
||||
* If another distributed table is using the same sequence
|
||||
* in one of its column defaults, make sure the types of the
|
||||
* columns match.
|
||||
*
|
||||
* We skip non-distributed tables, but we need to check the current
|
||||
* table as it might reference the same sequence multiple times.
|
||||
*/
|
||||
if (columnAddress.objectId != ownerRelationId &&
|
||||
!IsCitusTable(columnAddress.objectId))
|
||||
{
|
||||
AttrNumber currentAttnum = seqInfo->attributeNumber;
|
||||
Oid currentSeqOid = seqInfo->sequenceOid;
|
||||
|
||||
if (!seqInfo->isNextValDefault)
|
||||
{
|
||||
/*
|
||||
* If a sequence is not on the nextval, we don't need any check.
|
||||
* This is a dependent sequence via ALTER SEQUENCE .. OWNED BY col
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* If another distributed table is using the same sequence
|
||||
* in one of its column defaults, make sure the types of the
|
||||
* columns match
|
||||
*/
|
||||
if (currentSeqOid == seqOid)
|
||||
{
|
||||
Oid currentAttributeTypId = GetAttributeTypeOid(citusTableId,
|
||||
currentAttnum);
|
||||
if (attributeTypeId != currentAttributeTypId)
|
||||
{
|
||||
char *sequenceName = generate_qualified_relation_name(
|
||||
seqOid);
|
||||
char *citusTableName =
|
||||
generate_qualified_relation_name(citusTableId);
|
||||
ereport(ERROR, (errmsg(
|
||||
"The sequence %s is already used for a different"
|
||||
" type in column %d of the table %s",
|
||||
sequenceName, currentAttnum,
|
||||
citusTableName)));
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
Oid currentAttributeTypId = GetAttributeTypeOid(columnAddress.objectId,
|
||||
columnAddress.objectSubId);
|
||||
if (attributeTypeId != currentAttributeTypId)
|
||||
{
|
||||
char *sequenceName = generate_qualified_relation_name(
|
||||
seqOid);
|
||||
char *citusTableName =
|
||||
generate_qualified_relation_name(columnAddress.objectId);
|
||||
ereport(ERROR, (errmsg(
|
||||
"The sequence %s is already used for a different"
|
||||
" type in column %d of the table %s",
|
||||
sequenceName, columnAddress.objectSubId,
|
||||
citusTableName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/htup_details.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/objectaddress.h"
|
||||
#include "catalog/pg_database.h"
|
||||
#include "commands/dbcommands.h"
|
||||
#include "miscadmin.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
|
|
|
@ -10,9 +10,14 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "catalog/dependency.h"
|
||||
#include "catalog/objectaddress.h"
|
||||
#include "commands/extension.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/connection_management.h"
|
||||
|
@ -25,9 +30,6 @@
|
|||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "miscadmin.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
|
||||
static void EnsureDependenciesCanBeDistributed(const ObjectAddress *relationAddress);
|
||||
|
|
|
@ -12,11 +12,12 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/version_compat.h"
|
||||
|
||||
static DistributeObjectOps NoDistributeOps = {
|
||||
.deparse = NULL,
|
||||
|
@ -363,6 +364,15 @@ static DistributeObjectOps Any_Rename = {
|
|||
.address = NULL,
|
||||
.markDistributed = false,
|
||||
};
|
||||
static DistributeObjectOps Any_SecLabel = {
|
||||
.deparse = DeparseSecLabelStmt,
|
||||
.qualify = NULL,
|
||||
.preprocess = NULL,
|
||||
.postprocess = PostprocessSecLabelStmt,
|
||||
.operationType = DIST_OPS_ALTER,
|
||||
.address = SecLabelStmtObjectAddress,
|
||||
.markDistributed = false,
|
||||
};
|
||||
static DistributeObjectOps Attribute_Rename = {
|
||||
.deparse = DeparseRenameAttributeStmt,
|
||||
.qualify = QualifyRenameAttributeStmt,
|
||||
|
@ -1990,6 +2000,11 @@ GetDistributeObjectOps(Node *node)
|
|||
return &Vacuum_Analyze;
|
||||
}
|
||||
|
||||
case T_SecLabelStmt:
|
||||
{
|
||||
return &Any_SecLabel;
|
||||
}
|
||||
|
||||
case T_RenameStmt:
|
||||
{
|
||||
RenameStmt *stmt = castNode(RenameStmt, node);
|
||||
|
|
|
@ -9,20 +9,21 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/tenant_schema_metadata.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
|
||||
/* local function forward declarations */
|
||||
|
|
|
@ -12,32 +12,35 @@
|
|||
|
||||
#include "access/genam.h"
|
||||
#include "access/xact.h"
|
||||
#include "citus_version.h"
|
||||
#include "catalog/dependency.h"
|
||||
#include "catalog/pg_depend.h"
|
||||
#include "catalog/pg_extension_d.h"
|
||||
#include "columnar/columnar.h"
|
||||
#include "catalog/pg_foreign_data_wrapper.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/extension.h"
|
||||
#include "foreign/foreign.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "citus_version.h"
|
||||
|
||||
#include "columnar/columnar.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/transaction_management.h"
|
||||
#include "foreign/foreign.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
|
||||
/* Local functions forward declarations for helper functions */
|
||||
|
@ -773,7 +776,7 @@ PreprocessCreateExtensionStmtForCitusColumnar(Node *parsetree)
|
|||
/*create extension citus version xxx*/
|
||||
if (newVersionValue)
|
||||
{
|
||||
char *newVersion = strdup(defGetString(newVersionValue));
|
||||
char *newVersion = pstrdup(defGetString(newVersionValue));
|
||||
versionNumber = GetExtensionVersionNumber(newVersion);
|
||||
}
|
||||
|
||||
|
@ -793,7 +796,7 @@ PreprocessCreateExtensionStmtForCitusColumnar(Node *parsetree)
|
|||
Oid citusOid = get_extension_oid("citus", true);
|
||||
if (citusOid != InvalidOid)
|
||||
{
|
||||
char *curCitusVersion = strdup(get_extension_version(citusOid));
|
||||
char *curCitusVersion = pstrdup(get_extension_version(citusOid));
|
||||
int curCitusVersionNum = GetExtensionVersionNumber(curCitusVersion);
|
||||
if (curCitusVersionNum < 1110)
|
||||
{
|
||||
|
@ -888,7 +891,7 @@ PreprocessAlterExtensionCitusStmtForCitusColumnar(Node *parseTree)
|
|||
if (newVersionValue)
|
||||
{
|
||||
char *newVersion = defGetString(newVersionValue);
|
||||
double newVersionNumber = GetExtensionVersionNumber(strdup(newVersion));
|
||||
double newVersionNumber = GetExtensionVersionNumber(pstrdup(newVersion));
|
||||
|
||||
/*alter extension citus update to version >= 11.1-1, and no citus_columnar installed */
|
||||
if (newVersionNumber >= 1110 && citusColumnarOid == InvalidOid)
|
||||
|
@ -932,7 +935,7 @@ PostprocessAlterExtensionCitusStmtForCitusColumnar(Node *parseTree)
|
|||
if (newVersionValue)
|
||||
{
|
||||
char *newVersion = defGetString(newVersionValue);
|
||||
double newVersionNumber = GetExtensionVersionNumber(strdup(newVersion));
|
||||
double newVersionNumber = GetExtensionVersionNumber(pstrdup(newVersion));
|
||||
if (newVersionNumber >= 1110 && citusColumnarOid != InvalidOid)
|
||||
{
|
||||
/*upgrade citus, after "ALTER EXTENSION citus update to xxx" updates citus_columnar Y to version Z. */
|
||||
|
@ -1090,33 +1093,26 @@ List *
|
|||
GetDependentFDWsToExtension(Oid extensionId)
|
||||
{
|
||||
List *extensionFDWs = NIL;
|
||||
ScanKeyData key[3];
|
||||
int scanKeyCount = 3;
|
||||
ScanKeyData key[1];
|
||||
HeapTuple tup;
|
||||
|
||||
Relation pgDepend = table_open(DependRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&key[0],
|
||||
Anum_pg_depend_refclassid,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(ExtensionRelationId));
|
||||
ScanKeyInit(&key[1],
|
||||
Anum_pg_depend_refobjid,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(extensionId));
|
||||
ScanKeyInit(&key[2],
|
||||
Anum_pg_depend_classid,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(ForeignDataWrapperRelationId));
|
||||
|
||||
SysScanDesc scan = systable_beginscan(pgDepend, InvalidOid, false,
|
||||
NULL, scanKeyCount, key);
|
||||
SysScanDesc scan = systable_beginscan(pgDepend, DependDependerIndexId, true,
|
||||
NULL, lengthof(key), key);
|
||||
|
||||
while (HeapTupleIsValid(tup = systable_getnext(scan)))
|
||||
{
|
||||
Form_pg_depend pgDependEntry = (Form_pg_depend) GETSTRUCT(tup);
|
||||
|
||||
if (pgDependEntry->deptype == DEPENDENCY_EXTENSION)
|
||||
if (pgDependEntry->deptype == DEPENDENCY_EXTENSION &&
|
||||
pgDependEntry->refclassid == ExtensionRelationId &&
|
||||
pgDependEntry->refobjid == extensionId)
|
||||
{
|
||||
extensionFDWs = lappend_oid(extensionFDWs, pgDependEntry->objid);
|
||||
}
|
||||
|
|
|
@ -12,27 +12,16 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/sysattr.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "catalog/pg_constraint.h"
|
||||
#include "access/genam.h"
|
||||
#include "catalog/pg_depend.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/sequence.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/multi_join_order.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/utils/array_type.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "miscadmin.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/inval.h"
|
||||
|
@ -42,6 +31,20 @@
|
|||
#include "utils/ruleutils.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/sequence.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/hash_helpers.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/multi_join_order.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/utils/array_type.h"
|
||||
#include "distributed/version_compat.h"
|
||||
|
||||
|
||||
#define BehaviorIsRestrictOrNoAction(x) \
|
||||
((x) == FKCONSTR_ACTION_NOACTION || (x) == FKCONSTR_ACTION_RESTRICT)
|
||||
|
@ -1197,6 +1200,114 @@ TableHasExternalForeignKeys(Oid relationId)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* ForeignConstraintMatchesFlags is a function with logic that's very specific
|
||||
* to GetForeignKeyOids. There's no reason to use it in any other context.
|
||||
*/
|
||||
static bool
|
||||
ForeignConstraintMatchesFlags(Form_pg_constraint constraintForm,
|
||||
int flags)
|
||||
{
|
||||
if (constraintForm->contype != CONSTRAINT_FOREIGN)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool inheritedConstraint = OidIsValid(constraintForm->conparentid);
|
||||
if (inheritedConstraint)
|
||||
{
|
||||
/*
|
||||
* We only consider the constraints that are explicitly created on
|
||||
* the table as we already process the constraints from parent tables
|
||||
* implicitly when a command is issued
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
bool excludeSelfReference = (flags & EXCLUDE_SELF_REFERENCES);
|
||||
bool isSelfReference = (constraintForm->conrelid == constraintForm->confrelid);
|
||||
if (excludeSelfReference && isSelfReference)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Oid otherTableId = InvalidOid;
|
||||
if (flags & INCLUDE_REFERENCING_CONSTRAINTS)
|
||||
{
|
||||
otherTableId = constraintForm->confrelid;
|
||||
}
|
||||
else
|
||||
{
|
||||
otherTableId = constraintForm->conrelid;
|
||||
}
|
||||
|
||||
return IsTableTypeIncluded(otherTableId, flags);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* GetForeignKeyOidsForReferencedTable returns a list of foreign key OIDs that
|
||||
* reference the relationId and match the given flags.
|
||||
*
|
||||
* This is separated from GetForeignKeyOids because we need to scan pg_depend
|
||||
* instead of pg_constraint directly. The reason for this is that there is no
|
||||
* index on the confrelid of pg_constraint, so searching by that column
|
||||
* requires a seqscan.
|
||||
*/
|
||||
static List *
|
||||
GetForeignKeyOidsForReferencedTable(Oid relationId, int flags)
|
||||
{
|
||||
HTAB *foreignKeyOidsSet = CreateSimpleHashSetWithName(
|
||||
Oid, "ReferencingForeignKeyOidsSet");
|
||||
List *foreignKeyOidsList = NIL;
|
||||
ScanKeyData key[2];
|
||||
HeapTuple dependTup;
|
||||
Relation depRel = table_open(DependRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&key[0],
|
||||
Anum_pg_depend_refclassid,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(RelationRelationId));
|
||||
ScanKeyInit(&key[1],
|
||||
Anum_pg_depend_refobjid,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(relationId));
|
||||
SysScanDesc scan = systable_beginscan(depRel, DependReferenceIndexId, true,
|
||||
NULL, lengthof(key), key);
|
||||
while (HeapTupleIsValid(dependTup = systable_getnext(scan)))
|
||||
{
|
||||
Form_pg_depend deprec = (Form_pg_depend) GETSTRUCT(dependTup);
|
||||
|
||||
if (deprec->classid != ConstraintRelationId ||
|
||||
deprec->deptype != DEPENDENCY_NORMAL ||
|
||||
hash_search(foreignKeyOidsSet, &deprec->objid, HASH_FIND, NULL))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
HeapTuple constraintTup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(
|
||||
deprec->objid));
|
||||
if (!HeapTupleIsValid(constraintTup)) /* can happen during DROP TABLE */
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Form_pg_constraint constraint = (Form_pg_constraint) GETSTRUCT(constraintTup);
|
||||
if (constraint->confrelid == relationId &&
|
||||
ForeignConstraintMatchesFlags(constraint, flags))
|
||||
{
|
||||
foreignKeyOidsList = lappend_oid(foreignKeyOidsList, constraint->oid);
|
||||
hash_search(foreignKeyOidsSet, &constraint->oid, HASH_ENTER, NULL);
|
||||
}
|
||||
ReleaseSysCache(constraintTup);
|
||||
}
|
||||
systable_endscan(scan);
|
||||
table_close(depRel, AccessShareLock);
|
||||
return foreignKeyOidsList;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* GetForeignKeyOids takes in a relationId, and returns a list of OIDs for
|
||||
* foreign constraints that the relation with relationId is involved according
|
||||
|
@ -1206,9 +1317,8 @@ TableHasExternalForeignKeys(Oid relationId)
|
|||
List *
|
||||
GetForeignKeyOids(Oid relationId, int flags)
|
||||
{
|
||||
AttrNumber pgConstraintTargetAttrNumber = InvalidAttrNumber;
|
||||
|
||||
bool extractReferencing = (flags & INCLUDE_REFERENCING_CONSTRAINTS);
|
||||
bool extractReferencing PG_USED_FOR_ASSERTS_ONLY = (flags &
|
||||
INCLUDE_REFERENCING_CONSTRAINTS);
|
||||
bool extractReferenced = (flags & INCLUDE_REFERENCED_CONSTRAINTS);
|
||||
|
||||
/*
|
||||
|
@ -1219,22 +1329,10 @@ GetForeignKeyOids(Oid relationId, int flags)
|
|||
Assert(!(extractReferencing && extractReferenced));
|
||||
Assert(extractReferencing || extractReferenced);
|
||||
|
||||
bool useIndex = false;
|
||||
Oid indexOid = InvalidOid;
|
||||
|
||||
if (extractReferencing)
|
||||
if (extractReferenced)
|
||||
{
|
||||
pgConstraintTargetAttrNumber = Anum_pg_constraint_conrelid;
|
||||
|
||||
useIndex = true;
|
||||
indexOid = ConstraintRelidTypidNameIndexId;
|
||||
return GetForeignKeyOidsForReferencedTable(relationId, flags);
|
||||
}
|
||||
else if (extractReferenced)
|
||||
{
|
||||
pgConstraintTargetAttrNumber = Anum_pg_constraint_confrelid;
|
||||
}
|
||||
|
||||
bool excludeSelfReference = (flags & EXCLUDE_SELF_REFERENCES);
|
||||
|
||||
List *foreignKeyOids = NIL;
|
||||
|
||||
|
@ -1242,62 +1340,22 @@ GetForeignKeyOids(Oid relationId, int flags)
|
|||
int scanKeyCount = 1;
|
||||
|
||||
Relation pgConstraint = table_open(ConstraintRelationId, AccessShareLock);
|
||||
ScanKeyInit(&scanKey[0], pgConstraintTargetAttrNumber,
|
||||
ScanKeyInit(&scanKey[0], Anum_pg_constraint_conrelid,
|
||||
BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(relationId));
|
||||
SysScanDesc scanDescriptor = systable_beginscan(pgConstraint, indexOid, useIndex,
|
||||
|
||||
SysScanDesc scanDescriptor = systable_beginscan(pgConstraint,
|
||||
ConstraintRelidTypidNameIndexId, true,
|
||||
NULL, scanKeyCount, scanKey);
|
||||
|
||||
HeapTuple heapTuple = systable_getnext(scanDescriptor);
|
||||
while (HeapTupleIsValid(heapTuple))
|
||||
HeapTuple heapTuple;
|
||||
while (HeapTupleIsValid(heapTuple = systable_getnext(scanDescriptor)))
|
||||
{
|
||||
Form_pg_constraint constraintForm = (Form_pg_constraint) GETSTRUCT(heapTuple);
|
||||
|
||||
if (constraintForm->contype != CONSTRAINT_FOREIGN)
|
||||
if (ForeignConstraintMatchesFlags(constraintForm, flags))
|
||||
{
|
||||
heapTuple = systable_getnext(scanDescriptor);
|
||||
continue;
|
||||
foreignKeyOids = lappend_oid(foreignKeyOids, constraintForm->oid);
|
||||
}
|
||||
|
||||
bool inheritedConstraint = OidIsValid(constraintForm->conparentid);
|
||||
if (inheritedConstraint)
|
||||
{
|
||||
/*
|
||||
* We only consider the constraints that are explicitly created on
|
||||
* the table as we already process the constraints from parent tables
|
||||
* implicitly when a command is issued
|
||||
*/
|
||||
heapTuple = systable_getnext(scanDescriptor);
|
||||
continue;
|
||||
}
|
||||
|
||||
Oid constraintId = constraintForm->oid;
|
||||
|
||||
bool isSelfReference = (constraintForm->conrelid == constraintForm->confrelid);
|
||||
if (excludeSelfReference && isSelfReference)
|
||||
{
|
||||
heapTuple = systable_getnext(scanDescriptor);
|
||||
continue;
|
||||
}
|
||||
|
||||
Oid otherTableId = InvalidOid;
|
||||
if (extractReferencing)
|
||||
{
|
||||
otherTableId = constraintForm->confrelid;
|
||||
}
|
||||
else if (extractReferenced)
|
||||
{
|
||||
otherTableId = constraintForm->conrelid;
|
||||
}
|
||||
|
||||
if (!IsTableTypeIncluded(otherTableId, flags))
|
||||
{
|
||||
heapTuple = systable_getnext(scanDescriptor);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreignKeyOids = lappend_oid(foreignKeyOids, constraintId);
|
||||
|
||||
heapTuple = systable_getnext(scanDescriptor);
|
||||
}
|
||||
|
||||
systable_endscan(scanDescriptor);
|
||||
|
|
|
@ -11,17 +11,18 @@
|
|||
#include "postgres.h"
|
||||
|
||||
#include "catalog/pg_foreign_data_wrapper.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "foreign/foreign.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
|
||||
static bool NameListHasFDWOwnedByDistributedExtension(List *FDWNames);
|
||||
static ObjectAddress GetObjectAddressByFDWName(char *FDWName, bool missing_ok);
|
||||
|
||||
|
|
|
@ -9,11 +9,18 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "catalog/pg_foreign_server.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "foreign/foreign.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "nodes/primnodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/log_utils.h"
|
||||
|
@ -21,11 +28,6 @@
|
|||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "foreign/foreign.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "nodes/primnodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
static char * GetForeignServerAlterOwnerCommand(Oid serverId);
|
||||
static Node * RecreateForeignServerStmt(Oid serverId);
|
||||
|
|
|
@ -18,43 +18,19 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "miscadmin.h"
|
||||
#include "funcapi.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "funcapi.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/pg_aggregate.h"
|
||||
#include "catalog/dependency.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "catalog/pg_aggregate.h"
|
||||
#include "catalog/pg_proc.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/extension.h"
|
||||
#include "distributed/citus_depended_object.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/maintenanced.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata/pg_dist_object.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/pg_dist_node.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_create_or_replace.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "parser/parse_coerce.h"
|
||||
#include "parser/parse_type.h"
|
||||
|
@ -63,8 +39,34 @@
|
|||
#include "utils/fmgroids.h"
|
||||
#include "utils/fmgrprotos.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "utils/regproc.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/citus_depended_object.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/maintenanced.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata/pg_dist_object.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/pg_dist_node.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_create_or_replace.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
|
||||
#define DISABLE_LOCAL_CHECK_FUNCTION_BODIES "SET LOCAL check_function_bodies TO off;"
|
||||
#define RESET_CHECK_FUNCTION_BODIES "RESET check_function_bodies;"
|
||||
|
|
|
@ -10,15 +10,16 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
|
||||
/* Local functions forward declarations for helper functions */
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "access/genam.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/xact.h"
|
||||
|
@ -18,32 +17,16 @@
|
|||
#include "catalog/index.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "catalog/pg_class.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
#if PG_VERSION_NUM >= PG_VERSION_16
|
||||
#include "catalog/pg_namespace.h"
|
||||
#endif
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/tablecmds.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparse_shard_query.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/distributed_planner.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/multi_physical_planner.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/relation_utils.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "miscadmin.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "parser/parse_utilcmd.h"
|
||||
#include "storage/lmgr.h"
|
||||
|
@ -53,6 +36,26 @@
|
|||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/deparse_shard_query.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/distributed_planner.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/multi_physical_planner.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/relation_utils.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
|
||||
|
||||
/* Local functions forward declarations for helper functions */
|
||||
static void ErrorIfCreateIndexHasTooManyColumns(IndexStmt *createIndexStatement);
|
||||
|
|
|
@ -19,24 +19,27 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "commands/copy.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "parser/parse_relation.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "safe_lib.h"
|
||||
#include <netinet/in.h> /* for htons */
|
||||
|
||||
#include "distributed/transmit.h"
|
||||
#include "postgres.h"
|
||||
|
||||
#include "safe_lib.h"
|
||||
|
||||
#include "catalog/namespace.h"
|
||||
#include "commands/copy.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "parser/parse_relation.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
#include "distributed/commands/multi_copy.h"
|
||||
#include "distributed/intermediate_results.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/local_multi_copy.h"
|
||||
#include "distributed/shard_utils.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/replication_origin_session_utils.h"
|
||||
#include "distributed/shard_utils.h"
|
||||
#include "distributed/transmit.h"
|
||||
#include "distributed/version_compat.h"
|
||||
|
||||
/* managed via GUC, default is 512 kB */
|
||||
int LocalCopyFlushThresholdByte = 512 * 1024;
|
||||
|
|
|
@ -43,19 +43,18 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "libpq-fe.h"
|
||||
#include "miscadmin.h"
|
||||
#include "pgstat.h"
|
||||
|
||||
#include <arpa/inet.h> /* for htons */
|
||||
#include <netinet/in.h> /* for htons */
|
||||
#include <string.h>
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "postgres.h"
|
||||
|
||||
#include "libpq-fe.h"
|
||||
#include "miscadmin.h"
|
||||
#include "pgstat.h"
|
||||
|
||||
#include "access/htup_details.h"
|
||||
#include "access/htup.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/sdir.h"
|
||||
#include "access/sysattr.h"
|
||||
#include "access/xact.h"
|
||||
|
@ -65,41 +64,30 @@
|
|||
#include "commands/copy.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/progress.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/commands/multi_copy.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/intermediate_results.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/locally_reserved_shared_connections.h"
|
||||
#include "distributed/log_utils.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/multi_physical_planner.h"
|
||||
#include "distributed/multi_router_planner.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/locally_reserved_shared_connections.h"
|
||||
#include "distributed/placement_connection.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#if PG_VERSION_NUM >= PG_VERSION_16
|
||||
#include "distributed/relation_utils.h"
|
||||
#endif
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/remote_transaction.h"
|
||||
#include "distributed/replication_origin_session_utils.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/shard_pruning.h"
|
||||
#include "distributed/shared_connection_stats.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_protocol.h"
|
||||
#include "distributed/local_multi_copy.h"
|
||||
#include "distributed/hash_helpers.h"
|
||||
#include "distributed/transmit.h"
|
||||
#include "executor/executor.h"
|
||||
#include "foreign/foreign.h"
|
||||
|
||||
#include "libpq/libpq.h"
|
||||
#include "libpq/pqformat.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
|
@ -110,9 +98,21 @@
|
|||
#include "tsearch/ts_locale.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/rel.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "utils/memutils.h"
|
||||
|
||||
#include "distributed/hash_helpers.h"
|
||||
#include "distributed/local_multi_copy.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/remote_transaction.h"
|
||||
#include "distributed/replication_origin_session_utils.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/shard_pruning.h"
|
||||
#include "distributed/shared_connection_stats.h"
|
||||
#include "distributed/transmit.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_protocol.h"
|
||||
|
||||
|
||||
/* constant used in binary protocol */
|
||||
|
@ -2572,7 +2572,7 @@ ShardIdForTuple(CitusCopyDestReceiver *copyDest, Datum *columnValues, bool *colu
|
|||
* Find the shard interval and id for the partition column value for
|
||||
* non-reference tables.
|
||||
*
|
||||
* For reference table, this function blindly returns the tables single
|
||||
* For reference table, and single shard distributed table this function blindly returns the tables single
|
||||
* shard.
|
||||
*/
|
||||
ShardInterval *shardInterval = FindShardInterval(partitionColumnValue, cacheEntry);
|
||||
|
|
|
@ -10,33 +10,20 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/heapam.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/genam.h"
|
||||
#include "access/table.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/catalog.h"
|
||||
#include "catalog/objectaddress.h"
|
||||
#include "catalog/pg_auth_members.h"
|
||||
#include "catalog/pg_authid.h"
|
||||
#include "catalog/pg_db_role_setting.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "catalog/objectaddress.h"
|
||||
#include "commands/dbcommands.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "miscadmin.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "nodes/pg_list.h"
|
||||
|
@ -44,8 +31,22 @@
|
|||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/rel.h"
|
||||
#include "utils/varlena.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "utils/varlena.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
|
||||
/*
|
||||
* PreprocessDropOwnedStmt finds the distributed role out of the ones
|
||||
|
|
|
@ -10,15 +10,10 @@
|
|||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "catalog/namespace.h"
|
||||
#include "commands/policy.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "miscadmin.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "parser/parse_clause.h"
|
||||
#include "parser/parse_relation.h"
|
||||
|
@ -27,6 +22,13 @@
|
|||
#include "utils/builtins.h"
|
||||
#include "utils/ruleutils.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
|
||||
|
||||
static const char * unparse_policy_command(const char aclchar);
|
||||
static RowSecurityPolicy * GetPolicyByName(Oid relationId, const char *policyName);
|
||||
|
|
|
@ -9,18 +9,11 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "catalog/pg_publication.h"
|
||||
#include "catalog/pg_publication_rel.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/worker_create_or_replace.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
@ -29,6 +22,15 @@
|
|||
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/worker_create_or_replace.h"
|
||||
|
||||
|
||||
static CreatePublicationStmt * BuildCreatePublicationStmt(Oid publicationId);
|
||||
#if (PG_VERSION_NUM >= PG_VERSION_15)
|
||||
|
|
|
@ -12,11 +12,12 @@
|
|||
|
||||
#include "catalog/index.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -10,37 +10,21 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/heapam.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/genam.h"
|
||||
#include "access/table.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/catalog.h"
|
||||
#include "catalog/objectaddress.h"
|
||||
#include "catalog/pg_auth_members.h"
|
||||
#include "catalog/pg_authid.h"
|
||||
#include "catalog/pg_db_role_setting.h"
|
||||
#include "catalog/pg_shseclabel.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "catalog/objectaddress.h"
|
||||
#include "commands/dbcommands.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "miscadmin.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "nodes/pg_list.h"
|
||||
|
@ -48,11 +32,28 @@
|
|||
#include "utils/acl.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/guc_tables.h"
|
||||
#include "utils/guc.h"
|
||||
#include "utils/guc_tables.h"
|
||||
#include "utils/rel.h"
|
||||
#include "utils/varlena.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "utils/varlena.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
|
||||
static const char * ExtractEncryptedPassword(Oid roleOid);
|
||||
static const char * CreateAlterRoleIfExistsCommand(AlterRoleStmt *stmt);
|
||||
|
@ -65,6 +66,7 @@ static DefElem * makeDefElemBool(char *name, bool value);
|
|||
static List * GenerateRoleOptionsList(HeapTuple tuple);
|
||||
static List * GenerateGrantRoleStmtsFromOptions(RoleSpec *roleSpec, List *options);
|
||||
static List * GenerateGrantRoleStmtsOfRole(Oid roleid);
|
||||
static List * GenerateSecLabelOnRoleStmts(Oid roleid, char *rolename);
|
||||
static void EnsureSequentialModeForRoleDDL(void);
|
||||
|
||||
static char * GetRoleNameFromDbRoleSetting(HeapTuple tuple,
|
||||
|
@ -515,13 +517,14 @@ GenerateCreateOrAlterRoleCommand(Oid roleOid)
|
|||
{
|
||||
HeapTuple roleTuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleOid));
|
||||
Form_pg_authid role = ((Form_pg_authid) GETSTRUCT(roleTuple));
|
||||
char *rolename = pstrdup(NameStr(role->rolname));
|
||||
|
||||
CreateRoleStmt *createRoleStmt = NULL;
|
||||
if (EnableCreateRolePropagation)
|
||||
{
|
||||
createRoleStmt = makeNode(CreateRoleStmt);
|
||||
createRoleStmt->stmt_type = ROLESTMT_ROLE;
|
||||
createRoleStmt->role = pstrdup(NameStr(role->rolname));
|
||||
createRoleStmt->role = rolename;
|
||||
createRoleStmt->options = GenerateRoleOptionsList(roleTuple);
|
||||
}
|
||||
|
||||
|
@ -532,7 +535,7 @@ GenerateCreateOrAlterRoleCommand(Oid roleOid)
|
|||
alterRoleStmt->role = makeNode(RoleSpec);
|
||||
alterRoleStmt->role->roletype = ROLESPEC_CSTRING;
|
||||
alterRoleStmt->role->location = -1;
|
||||
alterRoleStmt->role->rolename = pstrdup(NameStr(role->rolname));
|
||||
alterRoleStmt->role->rolename = rolename;
|
||||
alterRoleStmt->action = 1;
|
||||
alterRoleStmt->options = GenerateRoleOptionsList(roleTuple);
|
||||
}
|
||||
|
@ -544,7 +547,7 @@ GenerateCreateOrAlterRoleCommand(Oid roleOid)
|
|||
{
|
||||
/* add a worker_create_or_alter_role command if any of them are set */
|
||||
char *createOrAlterRoleQuery = CreateCreateOrAlterRoleCommand(
|
||||
pstrdup(NameStr(role->rolname)),
|
||||
rolename,
|
||||
createRoleStmt,
|
||||
alterRoleStmt);
|
||||
|
||||
|
@ -566,6 +569,20 @@ GenerateCreateOrAlterRoleCommand(Oid roleOid)
|
|||
{
|
||||
completeRoleList = lappend(completeRoleList, DeparseTreeNode(stmt));
|
||||
}
|
||||
|
||||
/*
|
||||
* append SECURITY LABEL ON ROLE commands for this specific user
|
||||
* When we propagate user creation, we also want to make sure that we propagate
|
||||
* all the security labels it has been given. For this, we check pg_shseclabel
|
||||
* for the ROLE entry corresponding to roleOid, and generate the relevant
|
||||
* SecLabel stmts to be run in the new node.
|
||||
*/
|
||||
List *secLabelOnRoleStmts = GenerateSecLabelOnRoleStmts(roleOid, rolename);
|
||||
stmt = NULL;
|
||||
foreach_ptr(stmt, secLabelOnRoleStmts)
|
||||
{
|
||||
completeRoleList = lappend(completeRoleList, DeparseTreeNode(stmt));
|
||||
}
|
||||
}
|
||||
|
||||
return completeRoleList;
|
||||
|
@ -895,6 +912,54 @@ GenerateGrantRoleStmtsOfRole(Oid roleid)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* GenerateSecLabelOnRoleStmts generates the SecLabelStmts for the role
|
||||
* whose oid is roleid.
|
||||
*/
|
||||
static List *
|
||||
GenerateSecLabelOnRoleStmts(Oid roleid, char *rolename)
|
||||
{
|
||||
List *secLabelStmts = NIL;
|
||||
|
||||
/*
|
||||
* Note that roles are shared database objects, therefore their
|
||||
* security labels are stored in pg_shseclabel instead of pg_seclabel.
|
||||
*/
|
||||
Relation pg_shseclabel = table_open(SharedSecLabelRelationId, AccessShareLock);
|
||||
ScanKeyData skey[1];
|
||||
ScanKeyInit(&skey[0], Anum_pg_shseclabel_objoid, BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(roleid));
|
||||
SysScanDesc scan = systable_beginscan(pg_shseclabel, SharedSecLabelObjectIndexId,
|
||||
true, NULL, 1, &skey[0]);
|
||||
|
||||
HeapTuple tuple = NULL;
|
||||
while (HeapTupleIsValid(tuple = systable_getnext(scan)))
|
||||
{
|
||||
SecLabelStmt *secLabelStmt = makeNode(SecLabelStmt);
|
||||
secLabelStmt->objtype = OBJECT_ROLE;
|
||||
secLabelStmt->object = (Node *) makeString(pstrdup(rolename));
|
||||
|
||||
Datum datumArray[Natts_pg_shseclabel];
|
||||
bool isNullArray[Natts_pg_shseclabel];
|
||||
|
||||
heap_deform_tuple(tuple, RelationGetDescr(pg_shseclabel), datumArray,
|
||||
isNullArray);
|
||||
|
||||
secLabelStmt->provider = TextDatumGetCString(
|
||||
datumArray[Anum_pg_shseclabel_provider - 1]);
|
||||
secLabelStmt->label = TextDatumGetCString(
|
||||
datumArray[Anum_pg_shseclabel_label - 1]);
|
||||
|
||||
secLabelStmts = lappend(secLabelStmts, secLabelStmt);
|
||||
}
|
||||
|
||||
systable_endscan(scan);
|
||||
table_close(pg_shseclabel, AccessShareLock);
|
||||
|
||||
return secLabelStmts;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* PreprocessCreateRoleStmt creates a worker_create_or_alter_role query for the
|
||||
* role that is being created. With that query we can create the role in the
|
||||
|
|
|
@ -19,28 +19,28 @@
|
|||
#include "catalog/namespace.h"
|
||||
#include "catalog/pg_class.h"
|
||||
#include "catalog/pg_namespace.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include <distributed/connection_management.h>
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include <distributed/metadata_sync.h>
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include <distributed/remote_commands.h>
|
||||
#include <distributed/remote_commands.h>
|
||||
#include "distributed/tenant_schema_metadata.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/relcache.h"
|
||||
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/connection_management.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/tenant_schema_metadata.h"
|
||||
#include "distributed/version_compat.h"
|
||||
|
||||
|
||||
static List * GetObjectAddressBySchemaName(char *schemaName, bool missing_ok);
|
||||
static List * FilterDistributedSchemas(List *schemas);
|
||||
|
|
|
@ -7,27 +7,29 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "catalog/catalog.h"
|
||||
#include "catalog/pg_namespace_d.h"
|
||||
#include "commands/extension.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "distributed/argutils.h"
|
||||
#include "distributed/backend_data.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/shard_transfer.h"
|
||||
#include "distributed/tenant_schema_metadata.h"
|
||||
#include "distributed/worker_shard_visibility.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
|
||||
/* return value of CreateCitusMoveSchemaParams() */
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* seclabel.c
|
||||
*
|
||||
* This file contains the logic of SECURITY LABEL statement propagation.
|
||||
*
|
||||
* Copyright (c) Citus Data, Inc.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/log_utils.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
|
||||
|
||||
/*
|
||||
* PostprocessSecLabelStmt prepares the commands that need to be run on all workers to assign
|
||||
* security labels on distributed objects, currently supporting just Role objects.
|
||||
* It also ensures that all object dependencies exist on all
|
||||
* nodes for the object in the SecLabelStmt.
|
||||
*/
|
||||
List *
|
||||
PostprocessSecLabelStmt(Node *node, const char *queryString)
|
||||
{
|
||||
if (!ShouldPropagate())
|
||||
{
|
||||
return NIL;
|
||||
}
|
||||
|
||||
SecLabelStmt *secLabelStmt = castNode(SecLabelStmt, node);
|
||||
|
||||
List *objectAddresses = GetObjectAddressListFromParseTree(node, false, true);
|
||||
if (!IsAnyObjectDistributed(objectAddresses))
|
||||
{
|
||||
return NIL;
|
||||
}
|
||||
|
||||
if (secLabelStmt->objtype != OBJECT_ROLE)
|
||||
{
|
||||
/*
|
||||
* If we are not in the coordinator, we don't want to interrupt the security
|
||||
* label command with notices, the user expects that from the worker node
|
||||
* the command will not be propagated
|
||||
*/
|
||||
if (EnableUnsupportedFeatureMessages && IsCoordinator())
|
||||
{
|
||||
ereport(NOTICE, (errmsg("not propagating SECURITY LABEL commands whose "
|
||||
"object type is not role"),
|
||||
errhint("Connect to worker nodes directly to manually "
|
||||
"run the same SECURITY LABEL command.")));
|
||||
}
|
||||
return NIL;
|
||||
}
|
||||
|
||||
if (!EnableCreateRolePropagation)
|
||||
{
|
||||
return NIL;
|
||||
}
|
||||
|
||||
EnsureCoordinator();
|
||||
EnsureAllObjectDependenciesExistOnAllNodes(objectAddresses);
|
||||
|
||||
const char *sql = DeparseTreeNode((Node *) secLabelStmt);
|
||||
|
||||
List *commandList = list_make3(DISABLE_DDL_PROPAGATION,
|
||||
(void *) sql,
|
||||
ENABLE_DDL_PROPAGATION);
|
||||
|
||||
return NodeDDLTaskList(NON_COORDINATOR_NODES, commandList);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SecLabelStmtObjectAddress returns the object address of the object on
|
||||
* which this statement operates (secLabelStmt->object). Note that it has no limitation
|
||||
* on the object type being OBJECT_ROLE. This is intentionally implemented like this
|
||||
* since it is fairly simple to implement and we might extend SECURITY LABEL propagation
|
||||
* in the future to include more object types.
|
||||
*/
|
||||
List *
|
||||
SecLabelStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess)
|
||||
{
|
||||
SecLabelStmt *secLabelStmt = castNode(SecLabelStmt, node);
|
||||
|
||||
Relation rel = NULL;
|
||||
ObjectAddress address = get_object_address(secLabelStmt->objtype,
|
||||
secLabelStmt->object, &rel,
|
||||
AccessShareLock, missing_ok);
|
||||
if (rel != NULL)
|
||||
{
|
||||
relation_close(rel, AccessShareLock);
|
||||
}
|
||||
|
||||
ObjectAddress *addressPtr = palloc0(sizeof(ObjectAddress));
|
||||
*addressPtr = address;
|
||||
return list_make1(addressPtr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* citus_test_object_relabel is a dummy function for check_object_relabel_type hook.
|
||||
* It is meant to be used in tests combined with citus_test_register_label_provider
|
||||
*/
|
||||
void
|
||||
citus_test_object_relabel(const ObjectAddress *object, const char *seclabel)
|
||||
{
|
||||
if (seclabel == NULL ||
|
||||
strcmp(seclabel, "citus_unclassified") == 0 ||
|
||||
strcmp(seclabel, "citus_classified") == 0 ||
|
||||
strcmp(seclabel, "citus '!unclassified") == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_NAME),
|
||||
errmsg("'%s' is not a valid security label for Citus tests.", seclabel)));
|
||||
}
|
|
@ -14,8 +14,15 @@
|
|||
#include "access/xact.h"
|
||||
#include "catalog/dependency.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "catalog/pg_attrdef.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/extension.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "rewrite/rewriteHandler.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/sequence.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
|
@ -24,12 +31,7 @@
|
|||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "distributed/worker_create_or_replace.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "rewrite/rewriteHandler.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
/* Local functions forward declarations for helper functions */
|
||||
static bool OptionsSpecifyOwnedBy(List *optionList, Oid *ownedByTableId);
|
||||
|
@ -506,22 +508,14 @@ PreprocessAlterSequenceStmt(Node *node, const char *queryString,
|
|||
static Oid
|
||||
SequenceUsedInDistributedTable(const ObjectAddress *sequenceAddress, char depType)
|
||||
{
|
||||
List *citusTableIdList = CitusTableTypeIdList(ANY_CITUS_TABLE_TYPE);
|
||||
Oid citusTableId = InvalidOid;
|
||||
foreach_oid(citusTableId, citusTableIdList)
|
||||
Oid relationId;
|
||||
List *relations = GetDependentRelationsWithSequence(sequenceAddress->objectId,
|
||||
depType);
|
||||
foreach_oid(relationId, relations)
|
||||
{
|
||||
List *seqInfoList = NIL;
|
||||
GetDependentSequencesWithRelation(citusTableId, &seqInfoList, 0, depType);
|
||||
SequenceInfo *seqInfo = NULL;
|
||||
foreach_ptr(seqInfo, seqInfoList)
|
||||
if (IsCitusTable(relationId))
|
||||
{
|
||||
/*
|
||||
* This sequence is used in a distributed table
|
||||
*/
|
||||
if (seqInfo->sequenceOid == sequenceAddress->objectId)
|
||||
{
|
||||
return citusTableId;
|
||||
}
|
||||
return relationId;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/xact.h"
|
||||
|
@ -26,8 +28,16 @@
|
|||
#include "catalog/pg_namespace.h"
|
||||
#include "catalog/pg_statistic_ext.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/fmgrprotos.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/relcache.h"
|
||||
#include "utils/ruleutils.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparse_shard_query.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
|
@ -37,14 +47,6 @@
|
|||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "miscadmin.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/fmgrprotos.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/relcache.h"
|
||||
#include "utils/ruleutils.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#define DEFAULT_STATISTICS_TARGET -1
|
||||
#define ALTER_INDEX_COLUMN_SET_STATS_COMMAND \
|
||||
|
|
|
@ -8,21 +8,23 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "safe_lib.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "commands/defrem.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/connection_management.h"
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "postgres.h"
|
||||
|
||||
#include "libpq-fe.h"
|
||||
#include "safe_lib.h"
|
||||
|
||||
#include "commands/defrem.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/connection_management.h"
|
||||
#include "distributed/version_compat.h"
|
||||
|
||||
|
||||
static char * GenerateConninfoWithAuth(char *conninfo);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/xact.h"
|
||||
|
@ -20,28 +20,6 @@
|
|||
#include "catalog/pg_depend.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/tablecmds.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/deparse_shard_query.h"
|
||||
#include "distributed/distribution_column.h"
|
||||
#include "distributed/foreign_key_relationship.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_shard_visibility.h"
|
||||
#include "distributed/tenant_schema_metadata.h"
|
||||
#include "foreign/foreign.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
|
@ -53,6 +31,31 @@
|
|||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/deparse_shard_query.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/distribution_column.h"
|
||||
#include "distributed/foreign_key_relationship.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/tenant_schema_metadata.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_shard_visibility.h"
|
||||
|
||||
|
||||
/* controlled via GUC, should be accessed via GetEnableLocalReferenceForeignKeys() */
|
||||
bool EnableLocalReferenceForeignKeys = true;
|
||||
|
@ -3050,11 +3053,15 @@ ErrorUnsupportedAlterTableAddColumn(Oid relationId, AlterTableCmd *command,
|
|||
else if (constraint->contype == CONSTR_FOREIGN)
|
||||
{
|
||||
RangeVar *referencedTable = constraint->pktable;
|
||||
char *referencedColumn = strVal(lfirst(list_head(constraint->pk_attrs)));
|
||||
Oid referencedRelationId = RangeVarGetRelid(referencedTable, NoLock, false);
|
||||
|
||||
appendStringInfo(errHint, "FOREIGN KEY (%s) REFERENCES %s(%s)", colName,
|
||||
get_rel_name(referencedRelationId), referencedColumn);
|
||||
appendStringInfo(errHint, "FOREIGN KEY (%s) REFERENCES %s", colName,
|
||||
get_rel_name(referencedRelationId));
|
||||
|
||||
if (list_length(constraint->pk_attrs) > 0)
|
||||
{
|
||||
AppendColumnNameList(errHint, constraint->pk_attrs);
|
||||
}
|
||||
|
||||
if (constraint->fk_del_action == FKCONSTR_ACTION_SETNULL)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "fmgr.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/namespace.h"
|
||||
|
@ -22,7 +24,6 @@
|
|||
#include "commands/comment.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/extension.h"
|
||||
#include "fmgr.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "tsearch/ts_cache.h"
|
||||
#include "tsearch/ts_public.h"
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/table.h"
|
||||
|
@ -18,6 +17,14 @@
|
|||
#include "catalog/pg_trigger.h"
|
||||
#include "commands/extension.h"
|
||||
#include "commands/trigger.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/fmgrprotos.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
|
@ -29,11 +36,6 @@
|
|||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/shard_utils.h"
|
||||
#include "distributed/worker_protocol.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgrprotos.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
|
||||
/* appropriate lock modes for the owner relation according to postgres */
|
||||
|
|
|
@ -9,12 +9,19 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "catalog/namespace.h"
|
||||
#include "catalog/pg_class.h"
|
||||
#include "commands/tablecmds.h"
|
||||
#include "commands/trigger.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/regproc.h"
|
||||
#include "utils/rel.h"
|
||||
|
||||
#include "distributed/adaptive_executor.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
|
@ -31,13 +38,8 @@
|
|||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/transaction_management.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "distributed/worker_shard_visibility.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/regproc.h"
|
||||
#include "utils/rel.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
|
||||
|
||||
/* Local functions forward declarations for unsupported command checks */
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/htup_details.h"
|
||||
|
@ -52,6 +52,18 @@
|
|||
#include "catalog/pg_enum.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/extension.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "parser/parse_type.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/regproc.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "utils/typcache.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
|
@ -64,20 +76,10 @@
|
|||
#include "distributed/relation_access_tracking.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/transaction_management.h"
|
||||
#include "distributed/worker_create_or_replace.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_create_or_replace.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "miscadmin.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "parser/parse_type.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/regproc.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "utils/typcache.h"
|
||||
|
||||
#define AlterEnumIsRename(stmt) (stmt->oldVal != NULL)
|
||||
#define AlterEnumIsAddValue(stmt) (stmt->oldVal == NULL)
|
||||
|
|
|
@ -25,9 +25,8 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/attnum.h"
|
||||
|
@ -35,11 +34,25 @@
|
|||
#include "access/htup_details.h"
|
||||
#include "catalog/catalog.h"
|
||||
#include "catalog/dependency.h"
|
||||
#include "citus_version.h"
|
||||
#include "commands/dbcommands.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/extension.h"
|
||||
#include "commands/tablecmds.h"
|
||||
#include "foreign/foreign.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "nodes/pg_list.h"
|
||||
#include "tcop/utility.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/inval.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "citus_version.h"
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/adaptive_executor.h"
|
||||
#include "distributed/backend_data.h"
|
||||
#include "distributed/citus_depended_object.h"
|
||||
|
@ -48,19 +61,19 @@
|
|||
#include "distributed/commands/multi_copy.h"
|
||||
#include "distributed/commands/utility_hook.h" /* IWYU pragma: keep */
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/deparse_shard_query.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/executor_util.h"
|
||||
#include "distributed/foreign_key_relationship.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/local_executor.h"
|
||||
#include "distributed/maintenanced.h"
|
||||
#include "distributed/multi_logical_replication.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/multi_explain.h"
|
||||
#include "distributed/multi_logical_replication.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/multi_physical_planner.h"
|
||||
#include "distributed/reference_table_utils.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
|
@ -69,17 +82,6 @@
|
|||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_shard_visibility.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "foreign/foreign.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "nodes/pg_list.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "tcop/utility.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/inval.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
|
||||
bool EnableDDLPropagation = true; /* ddl propagation is enabled */
|
||||
|
|
|
@ -10,10 +10,16 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#include "access/xact.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/vacuum.h"
|
||||
#include "postmaster/bgworker_internals.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/adaptive_executor.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
|
@ -24,11 +30,6 @@
|
|||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/transaction_management.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "postmaster/bgworker_internals.h"
|
||||
#include "access/xact.h"
|
||||
|
||||
|
||||
#define VACUUM_PARALLEL_NOTSET -2
|
||||
|
|
|
@ -9,21 +9,23 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "c.h"
|
||||
|
||||
#include "common/string.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/transaction_management.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "lib/ilist.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "lib/ilist.h"
|
||||
#include "utils/varlena.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/resource_lock.h"
|
||||
#include "distributed/transaction_management.h"
|
||||
#include "distributed/version_compat.h"
|
||||
|
||||
/*
|
||||
* ShouldPropagateSetCommand determines whether a SET or RESET command should be
|
||||
|
|
|
@ -9,23 +9,12 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "fmgr.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "catalog/objectaddress.h"
|
||||
#include "commands/extension.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/errormessage.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "executor/spi.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "nodes/pg_list.h"
|
||||
|
@ -35,6 +24,19 @@
|
|||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/errormessage.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata/dependency.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
|
||||
/*
|
||||
* GUC controls some restrictions for local objects. For example,
|
||||
* if it is disabled, a local view with no distributed relation dependency
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
|
||||
#include "access/transam.h"
|
||||
#include "access/xact.h"
|
||||
#include "mb/pg_wchar.h"
|
||||
#include "postmaster/postmaster.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "distributed/backend_data.h"
|
||||
#include "distributed/citus_safe_lib.h"
|
||||
#include "distributed/connection_management.h"
|
||||
|
@ -19,10 +23,6 @@
|
|||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
|
||||
#include "postmaster/postmaster.h"
|
||||
#include "mb/pg_wchar.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
/* stores the string representation of our node connection GUC */
|
||||
#ifdef USE_SSL
|
||||
char *NodeConninfo = "sslmode=require";
|
||||
|
@ -123,6 +123,10 @@ AddConnParam(const char *keyword, const char *value)
|
|||
errmsg("ConnParams arrays bound check failed")));
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't use pstrdup here to avoid being tied to a memory context, we free
|
||||
* these later using ResetConnParams
|
||||
*/
|
||||
ConnParams.keywords[ConnParams.size] = strdup(keyword);
|
||||
ConnParams.values[ConnParams.size] = strdup(value);
|
||||
ConnParams.size++;
|
||||
|
@ -267,9 +271,24 @@ GetConnParams(ConnectionHashKey *key, char ***keywords, char ***values,
|
|||
* We allocate everything in the provided context so as to facilitate using
|
||||
* pfree on all runtime parameters when connections using these entries are
|
||||
* invalidated during config reloads.
|
||||
*
|
||||
* Also, when "host" is already provided in global parameters, we use hostname
|
||||
* from the key as "hostaddr" instead of "host" to avoid host name lookup. In
|
||||
* that case, the value for "host" becomes useful only if the authentication
|
||||
* method requires it.
|
||||
*/
|
||||
bool gotHostParamFromGlobalParams = false;
|
||||
for (Size paramIndex = 0; paramIndex < ConnParams.size; paramIndex++)
|
||||
{
|
||||
if (strcmp(ConnParams.keywords[paramIndex], "host") == 0)
|
||||
{
|
||||
gotHostParamFromGlobalParams = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const char *runtimeKeywords[] = {
|
||||
"host",
|
||||
gotHostParamFromGlobalParams ? "hostaddr" : "host",
|
||||
"port",
|
||||
"dbname",
|
||||
"user",
|
||||
|
|
|
@ -9,39 +9,39 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "pgstat.h"
|
||||
|
||||
#include "libpq-fe.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "pg_config.h"
|
||||
#include "pgstat.h"
|
||||
#include "safe_lib.h"
|
||||
#include "postmaster/postmaster.h"
|
||||
|
||||
#include "access/hash.h"
|
||||
#include "commands/dbcommands.h"
|
||||
#include "mb/pg_wchar.h"
|
||||
#include "portability/instr_time.h"
|
||||
#include "postmaster/postmaster.h"
|
||||
#include "storage/ipc.h"
|
||||
#include "utils/hsearch.h"
|
||||
#include "utils/memutils.h"
|
||||
|
||||
#include "distributed/backend_data.h"
|
||||
#include "distributed/cancel_utils.h"
|
||||
#include "distributed/connection_management.h"
|
||||
#include "distributed/errormessage.h"
|
||||
#include "distributed/error_codes.h"
|
||||
#include "distributed/errormessage.h"
|
||||
#include "distributed/hash_helpers.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/log_utils.h"
|
||||
#include "distributed/memutils.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/hash_helpers.h"
|
||||
#include "distributed/placement_connection.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/run_from_same_connection.h"
|
||||
#include "distributed/shared_connection_stats.h"
|
||||
#include "distributed/cancel_utils.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/time_constants.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_log_messages.h"
|
||||
#include "mb/pg_wchar.h"
|
||||
#include "pg_config.h"
|
||||
#include "portability/instr_time.h"
|
||||
#include "storage/ipc.h"
|
||||
#include "utils/hsearch.h"
|
||||
#include "utils/memutils.h"
|
||||
|
||||
|
||||
int NodeConnectionTimeout = 30000;
|
||||
|
@ -1046,8 +1046,15 @@ FinishConnectionListEstablishment(List *multiConnectionList)
|
|||
|
||||
continue;
|
||||
}
|
||||
|
||||
bool beforePollSocket = PQsocket(connectionState->connection->pgConn);
|
||||
bool connectionStateChanged = MultiConnectionStatePoll(connectionState);
|
||||
|
||||
if (beforePollSocket != PQsocket(connectionState->connection->pgConn))
|
||||
{
|
||||
/* rebuild the wait events if MultiConnectionStatePoll() changed the socket */
|
||||
waitEventSetRebuild = true;
|
||||
}
|
||||
|
||||
if (connectionStateChanged)
|
||||
{
|
||||
if (connectionState->phase != MULTI_CONNECTION_PHASE_CONNECTING)
|
||||
|
|
|
@ -33,12 +33,15 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/hash.h"
|
||||
#include "commands/dbcommands.h"
|
||||
#include "common/hashfn.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/locally_reserved_shared_connections.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
|
@ -47,8 +50,6 @@
|
|||
#include "distributed/shared_connection_stats.h"
|
||||
#include "distributed/tuplestore.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "common/hashfn.h"
|
||||
|
||||
|
||||
#define RESERVED_CONNECTION_COLUMNS 4
|
||||
|
|
|
@ -11,23 +11,24 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#include "access/hash.h"
|
||||
#include "common/hashfn.h"
|
||||
#include "utils/hsearch.h"
|
||||
#include "utils/memutils.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/connection_management.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/distributed_planner.h"
|
||||
#include "distributed/hash_helpers.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/coordinator_protocol.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/distributed_planner.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/placement_connection.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
#include "utils/hsearch.h"
|
||||
#include "common/hashfn.h"
|
||||
#include "utils/memutils.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -9,23 +9,23 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "pgstat.h"
|
||||
|
||||
#include "libpq-fe.h"
|
||||
#include "miscadmin.h"
|
||||
#include "pgstat.h"
|
||||
|
||||
#include "lib/stringinfo.h"
|
||||
#include "storage/latch.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgrprotos.h"
|
||||
#include "utils/palloc.h"
|
||||
|
||||
#include "distributed/cancel_utils.h"
|
||||
#include "distributed/connection_management.h"
|
||||
#include "distributed/errormessage.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/log_utils.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/errormessage.h"
|
||||
#include "distributed/cancel_utils.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "miscadmin.h"
|
||||
#include "storage/latch.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgrprotos.h"
|
||||
#include "utils/palloc.h"
|
||||
|
||||
|
||||
/*
|
||||
|
@ -246,6 +246,7 @@ ClearResultsIfReady(MultiConnection *connection)
|
|||
void
|
||||
ReportConnectionError(MultiConnection *connection, int elevel)
|
||||
{
|
||||
char *userName = connection->user;
|
||||
char *nodeName = connection->hostname;
|
||||
int nodePort = connection->port;
|
||||
PGconn *pgConn = connection->pgConn;
|
||||
|
@ -264,15 +265,15 @@ ReportConnectionError(MultiConnection *connection, int elevel)
|
|||
if (messageDetail)
|
||||
{
|
||||
ereport(elevel, (errcode(ERRCODE_CONNECTION_FAILURE),
|
||||
errmsg("connection to the remote node %s:%d failed with the "
|
||||
"following error: %s", nodeName, nodePort,
|
||||
errmsg("connection to the remote node %s@%s:%d failed with the "
|
||||
"following error: %s", userName, nodeName, nodePort,
|
||||
messageDetail)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ereport(elevel, (errcode(ERRCODE_CONNECTION_FAILURE),
|
||||
errmsg("connection to the remote node %s:%d failed",
|
||||
nodeName, nodePort)));
|
||||
errmsg("connection to the remote node %s@%s:%d failed",
|
||||
userName, nodeName, nodePort)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -882,7 +883,7 @@ WaitForAllConnections(List *connectionList, bool raiseInterrupts)
|
|||
palloc(totalConnectionCount * sizeof(MultiConnection *));
|
||||
WaitEvent *events = palloc(totalConnectionCount * sizeof(WaitEvent));
|
||||
bool *connectionReady = palloc(totalConnectionCount * sizeof(bool));
|
||||
WaitEventSet *waitEventSet = NULL;
|
||||
WaitEventSet *volatile waitEventSet = NULL;
|
||||
|
||||
/* convert connection list to an array such that we can move items around */
|
||||
MultiConnection *connectionItem = NULL;
|
||||
|
|
|
@ -11,18 +11,21 @@
|
|||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "pgstat.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#include "libpq-fe.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
#include "pgstat.h"
|
||||
|
||||
#include "access/hash.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "catalog/pg_authid.h"
|
||||
#include "commands/dbcommands.h"
|
||||
#include "common/hashfn.h"
|
||||
#include "storage/ipc.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/backend_data.h"
|
||||
#include "distributed/cancel_utils.h"
|
||||
#include "distributed/connection_management.h"
|
||||
|
@ -32,12 +35,9 @@
|
|||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/placement_connection.h"
|
||||
#include "distributed/shared_connection_stats.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
#include "distributed/time_constants.h"
|
||||
#include "distributed/tuplestore.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "common/hashfn.h"
|
||||
#include "storage/ipc.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
|
||||
|
||||
#define REMOTE_CONNECTION_STATS_COLUMNS 4
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "utils/elog.h"
|
||||
|
||||
#include "distributed/connection_management.h"
|
||||
#include "distributed/error_codes.h"
|
||||
#include "distributed/errormessage.h"
|
||||
#include "distributed/log_utils.h"
|
||||
#include "distributed/worker_log_messages.h"
|
||||
#include "utils/elog.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include "postgres.h"
|
||||
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "distributed/deparser.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
|
||||
/*
|
||||
* Append the 'WITH GRANT OPTION' clause to the given buffer if the given
|
||||
|
|
|
@ -7,13 +7,12 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "access/attnum.h"
|
||||
#include "access/genam.h"
|
||||
#include "access/heapam.h"
|
||||
|
@ -39,21 +38,11 @@
|
|||
#include "catalog/pg_type.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/extension.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/relay_utility.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_protocol.h"
|
||||
#include "commands/sequence.h"
|
||||
#include "foreign/foreign.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "nodes/nodeFuncs.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "nodes/pg_list.h"
|
||||
#include "parser/parse_utilcmd.h"
|
||||
|
@ -71,7 +60,20 @@
|
|||
#include "utils/relcache.h"
|
||||
#include "utils/ruleutils.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "commands/sequence.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/metadata_utility.h"
|
||||
#include "distributed/multi_partitioning_utils.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "distributed/relay_utility.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "distributed/worker_protocol.h"
|
||||
|
||||
|
||||
static void deparse_index_columns(StringInfo buffer, List *indexParameterList,
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#include "nodes/value.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
|
||||
static void AppendDropCollationStmt(StringInfo buf, DropStmt *stmt);
|
||||
static void AppendRenameCollationStmt(StringInfo buf, RenameStmt *stmt);
|
||||
|
|
|
@ -11,16 +11,15 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "catalog/namespace.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "distributed/deparser.h"
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/log_utils.h"
|
||||
|
||||
|
|
|
@ -14,13 +14,14 @@
|
|||
|
||||
#include "catalog/namespace.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "nodes/pg_list.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
|
||||
/* Local functions forward declarations for helper functions */
|
||||
static void AppendCreateExtensionStmt(StringInfo buf, CreateExtensionStmt *stmt);
|
||||
static void AppendCreateExtensionStmtOptions(StringInfo buf, List *options);
|
||||
|
|
|
@ -10,13 +10,14 @@
|
|||
#include "postgres.h"
|
||||
|
||||
#include "commands/defrem.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/relay_utility.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
static void AppendGrantOnFDWStmt(StringInfo buf, GrantStmt *stmt);
|
||||
static void AppendGrantOnFDWNames(StringInfo buf, GrantStmt *stmt);
|
||||
|
|
|
@ -10,13 +10,14 @@
|
|||
#include "postgres.h"
|
||||
|
||||
#include "commands/defrem.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/relay_utility.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
static void AppendCreateForeignServerStmt(StringInfo buf, CreateForeignServerStmt *stmt);
|
||||
static void AppendAlterForeignServerStmt(StringInfo buf, AlterForeignServerStmt *stmt);
|
||||
|
|
|
@ -22,10 +22,6 @@
|
|||
#include "catalog/pg_proc.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/nodes.h"
|
||||
|
@ -38,8 +34,13 @@
|
|||
#include "utils/guc.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "utils/regproc.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/version_compat.h"
|
||||
|
||||
|
||||
/* forward declaration for deparse functions */
|
||||
|
|
|
@ -11,13 +11,14 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
static void AppendDropOwnedStmt(StringInfo buf, DropOwnedStmt *stmt);
|
||||
static void AppendRoleList(StringInfo buf, List *roleList);
|
||||
|
|
|
@ -13,20 +13,21 @@
|
|||
#include "access/relation.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/value.h"
|
||||
#include "parser/parse_clause.h"
|
||||
#include "parser/parse_collate.h"
|
||||
#include "parser/parse_node.h"
|
||||
#include "parser/parse_relation.h"
|
||||
#include "nodes/value.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/ruleutils.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/namespace_utils.h"
|
||||
|
||||
|
||||
static void AppendCreatePublicationStmt(StringInfo buf, CreatePublicationStmt *stmt,
|
||||
bool whereClauseNeedsTransform,
|
||||
|
|
|
@ -13,16 +13,17 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "commands/defrem.h"
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
|
||||
static void AppendAlterRoleStmt(StringInfo buf, AlterRoleStmt *stmt);
|
||||
static void AppendAlterRoleSetStmt(StringInfo buf, AlterRoleSetStmt *stmt);
|
||||
static void AppendCreateRoleStmt(StringInfo buf, CreateRoleStmt *stmt);
|
||||
|
|
|
@ -12,13 +12,14 @@
|
|||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
|
||||
static void AppendCreateSchemaStmt(StringInfo buf, CreateSchemaStmt *stmt);
|
||||
static void AppendDropSchemaStmt(StringInfo buf, DropStmt *stmt);
|
||||
static void AppendGrantOnSchemaStmt(StringInfo buf, GrantStmt *stmt);
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* deparse_seclabel_stmts.c
|
||||
* All routines to deparse SECURITY LABEL statements.
|
||||
*
|
||||
* Copyright (c), Citus Data, Inc.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "distributed/deparser.h"
|
||||
|
||||
static void AppendSecLabelStmt(StringInfo buf, SecLabelStmt *stmt);
|
||||
|
||||
/*
|
||||
* DeparseSecLabelStmt builds and returns a string representing of the
|
||||
* SecLabelStmt for application on a remote server.
|
||||
*/
|
||||
char *
|
||||
DeparseSecLabelStmt(Node *node)
|
||||
{
|
||||
SecLabelStmt *secLabelStmt = castNode(SecLabelStmt, node);
|
||||
StringInfoData buf = { 0 };
|
||||
initStringInfo(&buf);
|
||||
|
||||
AppendSecLabelStmt(&buf, secLabelStmt);
|
||||
|
||||
return buf.data;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* AppendSecLabelStmt generates the string representation of the
|
||||
* SecLabelStmt and appends it to the buffer.
|
||||
*/
|
||||
static void
|
||||
AppendSecLabelStmt(StringInfo buf, SecLabelStmt *stmt)
|
||||
{
|
||||
appendStringInfoString(buf, "SECURITY LABEL ");
|
||||
|
||||
if (stmt->provider != NULL)
|
||||
{
|
||||
appendStringInfo(buf, "FOR %s ", quote_identifier(stmt->provider));
|
||||
}
|
||||
|
||||
appendStringInfoString(buf, "ON ");
|
||||
|
||||
switch (stmt->objtype)
|
||||
{
|
||||
case OBJECT_ROLE:
|
||||
{
|
||||
appendStringInfo(buf, "ROLE %s ", quote_identifier(strVal(stmt->object)));
|
||||
break;
|
||||
}
|
||||
|
||||
/* normally, we shouldn't reach this */
|
||||
default:
|
||||
{
|
||||
ereport(ERROR, (errmsg("unsupported security label statement for"
|
||||
" deparsing")));
|
||||
}
|
||||
}
|
||||
|
||||
appendStringInfoString(buf, "IS ");
|
||||
|
||||
if (stmt->label != NULL)
|
||||
{
|
||||
appendStringInfo(buf, "%s", quote_literal_cstr(stmt->label));
|
||||
}
|
||||
else
|
||||
{
|
||||
appendStringInfoString(buf, "NULL");
|
||||
}
|
||||
}
|
|
@ -14,12 +14,13 @@
|
|||
#include "postgres.h"
|
||||
|
||||
#include "catalog/namespace.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/version_compat.h"
|
||||
#include "utils/acl.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/version_compat.h"
|
||||
|
||||
|
||||
/* forward declaration for deparse functions */
|
||||
static void AppendDropSequenceStmt(StringInfo buf, DropStmt *stmt);
|
||||
|
|
|
@ -12,16 +12,17 @@
|
|||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#include "catalog/namespace.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/relay_utility.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
static void AppendCreateStatisticsStmt(StringInfo buf, CreateStatsStmt *stmt);
|
||||
static void AppendDropStatisticsStmt(StringInfo buf, List *nameList, bool ifExists);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue