forked from apache/cloudberry
-
Notifications
You must be signed in to change notification settings - Fork 0
Feature: add pg_query_state runtime API to gp_stats_collector #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
roaldm153
wants to merge
17
commits into
open-gpdb:REL_2_STABLE
Choose a base branch
from
roaldm153:pgqs-signal-only
base: REL_2_STABLE
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2615359
feat(gpsc): apply runtime query-state core patches to tree
roaldm153 9398d61
feat(gpsc): add pg_query_state signal API with owner/superuser gate
roaldm153 27d11b5
ci(gpsc): add gp_stats_collector build-and-test workflow
roaldm153 2700d20
test(gpsc): add regression and multi-session isolation2 suites
roaldm153 290faa5
chore(gpsc): attribute pg_query_state origin
roaldm153 2de35ff
fix(gpsc): call cdbexplain_showExecStatsBegin on the coordinator only
roaldm153 b2456b1
feat(gpsc): add trace_id to the pg_query_state signal API
roaldm153 5156ebf
style(gpsc): drop comments that only restate the code
roaldm153 59f3b71
fix(gpsc): gate executor_end walk and guard QE backendId
roaldm153 219d0c1
add: some diff from pgqs-proto-uds-sandbox
roaldm153 4672706
upd: gpsc documentation
roaldm153 7ed413e
fix: regression tests expected
roaldm153 98bad86
fix: gpsc_pgqs_running.out
roaldm153 5b49ab5
feat(gpsc): thread trace_id and push per-node stats to yagpcc over UDS
roaldm153 8fb33f7
build: ignore stale host build artifacts in the docker context
roaldm153 f006df9
chore: delete .dockerignore
roaldm153 a9c4313
fix: apache license check
roaldm153 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,316 @@ | ||
| # -------------------------------------------------------------------- | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed | ||
| # with this work for additional information regarding copyright | ||
| # ownership. The ASF licenses this file to You under the Apache | ||
| # License, Version 2.0 (the "License"); you may not use this file | ||
| # except in compliance with the License. You may obtain a copy of the | ||
| # License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
| # implied. See the License for the specific language governing | ||
| # permissions and limitations under the License. | ||
| # | ||
| # -------------------------------------------------------------------- | ||
| # gp_stats_collector CI Workflow | ||
| # | ||
| # Builds Cloudberry with --with-gp-stats-collector (the default in | ||
| # configure-cloudberry.sh), stands up a demo cluster with the extension | ||
| # preloaded, and runs the gp_stats_collector regression suites. | ||
| # | ||
| # Scoped to changes that can affect the extension or the core patches it | ||
| # depends on, so it does not run on every unrelated push. | ||
| # -------------------------------------------------------------------- | ||
| name: GPSC CI Pipeline | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - 'pgqs-**' | ||
| pull_request: | ||
| paths: | ||
| - 'gpcontrib/gp_stats_collector/**' | ||
| - '.github/workflows/gpsc-ci.yaml' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
|
|
||
| test-gpsc: | ||
| name: Build and Test gp_stats_collector (${{ matrix.os }}) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu22.04 | ||
| image: apache/incubator-cloudberry:cbdb-build-ubuntu22.04-latest | ||
| - os: rocky8 | ||
| image: apache/incubator-cloudberry:cbdb-build-rocky8-latest | ||
| - os: rocky9 | ||
| image: apache/incubator-cloudberry:cbdb-build-rocky9-latest | ||
| container: | ||
| image: ${{ matrix.image }} | ||
| options: >- | ||
| --user root | ||
| -h cdw | ||
|
|
||
| steps: | ||
| - name: Checkout Cloudberry source | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| # Init/build scripts hardcode a "cloudberry" source dir name | ||
| # (e.g. create-cloudberry-demo-cluster.sh uses ${SRC_DIR}/../cloudberry), | ||
| # so the checkout path must be "cloudberry", not the repo name. | ||
| path: cloudberry | ||
| submodules: recursive | ||
|
|
||
| - name: Cloudberry Environment Initialization | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| if ! su - gpadmin -c "/tmp/init_system.sh"; then | ||
| echo "::error::Container initialization failed" | ||
| exit 1 | ||
| fi | ||
| mkdir -p "${SRC_DIR}/build-logs" | ||
| chown -R gpadmin:gpadmin . | ||
| chmod -R 755 . | ||
|
|
||
| - name: Configure | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| chmod +x "${SRC_DIR}"/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh | ||
| if ! time su - gpadmin -c "cd ${SRC_DIR} && SRC_DIR=${SRC_DIR} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh"; then | ||
| echo "::error::Configure failed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Build | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| chmod +x "${SRC_DIR}"/devops/build/automation/cloudberry/scripts/build-cloudberry.sh | ||
| if ! time su - gpadmin -c "cd ${SRC_DIR} && SRC_DIR=${SRC_DIR} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/build-cloudberry.sh"; then | ||
| echo "::error::Build failed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Create demo cluster (gp_stats_collector preloaded) | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| chmod +x "${SRC_DIR}"/devops/build/automation/cloudberry/scripts/create-cloudberry-demo-cluster.sh | ||
| if ! time su - gpadmin -c "cd ${SRC_DIR} && SRC_DIR=${SRC_DIR} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/create-cloudberry-demo-cluster.sh"; then | ||
| echo "::error::Demo cluster creation failed" | ||
| exit 1 | ||
| fi | ||
| # pg_query_state requires the module in shared_preload_libraries. | ||
| su - gpadmin -c "cd ${SRC_DIR} && \ | ||
| source /usr/local/cloudberry-db/cloudberry-env.sh && \ | ||
| source gpAux/gpdemo/gpdemo-env.sh && \ | ||
| gpconfig -c shared_preload_libraries -v 'gp_stats_collector' && \ | ||
| gpstop -ra" | ||
|
|
||
| - name: Run gp_stats_collector regression suite | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| chmod +x "${SRC_DIR}"/devops/build/automation/cloudberry/scripts/test-cloudberry.sh | ||
| # Capture make output to an artifact file: the raw job log gets | ||
| # truncated by the huge Build step, so tail it here on failure. | ||
| if ! time su - gpadmin -c "cd ${SRC_DIR} && \ | ||
| source /usr/local/cloudberry-db/cloudberry-env.sh && \ | ||
| source gpAux/gpdemo/gpdemo-env.sh && \ | ||
| SRC_DIR=${SRC_DIR} \ | ||
| PGOPTIONS='' \ | ||
| MAKE_NAME='GPSC Regress' \ | ||
| MAKE_TARGET=installcheck \ | ||
| MAKE_DIRECTORY=--directory=${SRC_DIR}/gpcontrib/gp_stats_collector \ | ||
| ${SRC_DIR}/devops/build/automation/cloudberry/scripts/test-cloudberry.sh \ | ||
| > ${SRC_DIR}/build-logs/gpsc-regress-make.log 2>&1"; then | ||
| echo "::error::gp_stats_collector installcheck failed" | ||
| echo "===== gpsc-regress-make.log (tail) =====" | ||
| tail -120 ${SRC_DIR}/build-logs/gpsc-regress-make.log 2>/dev/null || true | ||
| echo "===== regression.diffs =====" | ||
| cat ${SRC_DIR}/gpcontrib/gp_stats_collector/regression.diffs 2>/dev/null || true | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Run pg_query_state suite | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| if ! time su - gpadmin -c "cd ${SRC_DIR} && \ | ||
| source /usr/local/cloudberry-db/cloudberry-env.sh && \ | ||
| source gpAux/gpdemo/gpdemo-env.sh && \ | ||
| SRC_DIR=${SRC_DIR} \ | ||
| PGOPTIONS='' \ | ||
| MAKE_NAME='GPSC pg_query_state' \ | ||
| MAKE_TARGET=installcheck \ | ||
| MAKE_DIRECTORY=--directory=${SRC_DIR}/gpcontrib/gp_stats_collector/test \ | ||
| ${SRC_DIR}/devops/build/automation/cloudberry/scripts/test-cloudberry.sh \ | ||
| > ${SRC_DIR}/build-logs/gpsc-pqs-make.log 2>&1"; then | ||
| echo "::error::pg_query_state suite failed" | ||
| echo "===== gpsc-pqs-make.log (tail) =====" | ||
| tail -120 ${SRC_DIR}/build-logs/gpsc-pqs-make.log 2>/dev/null || true | ||
| echo "===== test/regression.diffs =====" | ||
| cat ${SRC_DIR}/gpcontrib/gp_stats_collector/test/regression.diffs 2>/dev/null || true | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Upload regression artifacts | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: gpsc-results-${{ matrix.os }} | ||
| path: | | ||
| cloudberry/gpcontrib/gp_stats_collector/regression.out | ||
| cloudberry/gpcontrib/gp_stats_collector/regression.diffs | ||
| cloudberry/gpcontrib/gp_stats_collector/results/ | ||
| cloudberry/gpcontrib/gp_stats_collector/test/results/ | ||
| cloudberry/gpcontrib/gp_stats_collector/test/regression.diffs | ||
| cloudberry/build-logs/ | ||
| retention-days: 7 | ||
|
|
||
| # Runs the pg_query_state isolation2 suite (multi-session / happy-path checks | ||
| # that plain pg_regress cannot express). The fault injector (gp_inject_fault) | ||
| # is enabled by default (--enable-faultinjector=yes), so no debug build is | ||
| # needed. | ||
| test-gpsc-isolation2: | ||
| name: pg_query_state multi-session (gp_stats_collector) | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: apache/incubator-cloudberry:cbdb-build-ubuntu22.04-latest | ||
| options: >- | ||
| --user root | ||
| -h cdw | ||
|
|
||
| steps: | ||
| - name: Checkout Cloudberry source | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: cloudberry | ||
| submodules: recursive | ||
|
|
||
| - name: Cloudberry Environment Initialization | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| if ! su - gpadmin -c "/tmp/init_system.sh"; then | ||
| echo "::error::Container initialization failed" | ||
| exit 1 | ||
| fi | ||
| mkdir -p "${SRC_DIR}/build-logs" | ||
| chown -R gpadmin:gpadmin . | ||
| chmod -R 755 . | ||
|
|
||
| - name: Configure | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| chmod +x "${SRC_DIR}"/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh | ||
| if ! time su - gpadmin -c "cd ${SRC_DIR} && SRC_DIR=${SRC_DIR} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh"; then | ||
| echo "::error::Configure failed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Build | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| chmod +x "${SRC_DIR}"/devops/build/automation/cloudberry/scripts/build-cloudberry.sh | ||
| if ! time su - gpadmin -c "cd ${SRC_DIR} && SRC_DIR=${SRC_DIR} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/build-cloudberry.sh"; then | ||
| echo "::error::Build failed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Build isolation2 harness | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| if ! time su - gpadmin -c "cd ${SRC_DIR} && \ | ||
| source /usr/local/cloudberry-db/cloudberry-env.sh && \ | ||
| make -C src/test/isolation2 install"; then | ||
| echo "::error::isolation2 harness build failed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Create demo cluster (gp_stats_collector preloaded) | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| chmod +x "${SRC_DIR}"/devops/build/automation/cloudberry/scripts/create-cloudberry-demo-cluster.sh | ||
| if ! time su - gpadmin -c "cd ${SRC_DIR} && SRC_DIR=${SRC_DIR} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/create-cloudberry-demo-cluster.sh"; then | ||
| echo "::error::Demo cluster creation failed" | ||
| exit 1 | ||
| fi | ||
| su - gpadmin -c "cd ${SRC_DIR} && \ | ||
| source /usr/local/cloudberry-db/cloudberry-env.sh && \ | ||
| source gpAux/gpdemo/gpdemo-env.sh && \ | ||
| gpconfig -c shared_preload_libraries -v 'gp_stats_collector' && \ | ||
| gpstop -ra" | ||
|
|
||
| - name: Run pg_query_state isolation2 suite | ||
| shell: bash | ||
| env: | ||
| SRC_DIR: ${{ github.workspace }}/cloudberry | ||
| run: | | ||
| set -eo pipefail | ||
| if ! su - gpadmin -c "cd ${SRC_DIR} && \ | ||
| source /usr/local/cloudberry-db/cloudberry-env.sh && \ | ||
| source gpAux/gpdemo/gpdemo-env.sh && \ | ||
| make -C gpcontrib/gp_stats_collector/test/isolation2 installcheck \ | ||
| > ${SRC_DIR}/build-logs/gpsc-iso2.log 2>&1"; then | ||
| echo "::error::pg_query_state isolation2 suite failed" | ||
| echo "===== gpsc-iso2.log (tail) =====" | ||
| tail -100 ${SRC_DIR}/build-logs/gpsc-iso2.log 2>/dev/null || true | ||
| echo "===== isolation2 regression.diffs =====" | ||
| cat ${SRC_DIR}/gpcontrib/gp_stats_collector/test/isolation2/regression.diffs 2>/dev/null || true | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Upload isolation2 artifacts | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: gpsc-iso2-results | ||
| path: | | ||
| cloudberry/gpcontrib/gp_stats_collector/test/isolation2/results/ | ||
| cloudberry/gpcontrib/gp_stats_collector/test/isolation2/regression.diffs | ||
| cloudberry/build-logs/ | ||
| retention-days: 7 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.