This is an automated email from the ASF dual-hosted git repository. djwang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 7e12a9379e61690a287de371b6c302f3a5d8fe8a Author: NJrslv <[email protected]> AuthorDate: Tue Mar 31 08:34:53 2026 +0300 [gp_stats_collector] Build by default with extension disabled via GUCs Enable building gp_stats_collector by default in configure. Add missing check in verify_query() to ensure the extension does not execute main code while disabled. Always verify protobuf version once the shared library is preloaded. --- .github/workflows/build-cloudberry-rocky8.yml | 3 +-- .github/workflows/build-cloudberry.yml | 3 +-- .github/workflows/build-deb-cloudberry.yml | 3 +-- .../cloudberry/scripts/configure-cloudberry.sh | 1 + gpcontrib/gp_stats_collector/src/Config.cpp | 6 +++--- gpcontrib/gp_stats_collector/src/EventSender.cpp | 16 +++++++++------- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-cloudberry-rocky8.yml b/.github/workflows/build-cloudberry-rocky8.yml index 39175753a99..dd4d10ab115 100644 --- a/.github/workflows/build-cloudberry-rocky8.yml +++ b/.github/workflows/build-cloudberry-rocky8.yml @@ -544,11 +544,10 @@ jobs: if: needs.check-skip.outputs.should_skip != 'true' env: SRC_DIR: ${{ github.workspace }} - CONFIGURE_EXTRA_OPTS: --with-gp-stats-collector 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} ENABLE_DEBUG=${{ env.ENABLE_DEBUG }} CONFIGURE_EXTRA_OPTS=${{ env.CONFIGURE_EXTRA_OPTS }} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh"; then + if ! time su - gpadmin -c "cd ${SRC_DIR} && SRC_DIR=${SRC_DIR} ENABLE_DEBUG=${{ env.ENABLE_DEBUG }} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh"; then echo "::error::Configure script failed" exit 1 fi diff --git a/.github/workflows/build-cloudberry.yml b/.github/workflows/build-cloudberry.yml index cbd4fd753dc..cc99a997c3f 100644 --- a/.github/workflows/build-cloudberry.yml +++ b/.github/workflows/build-cloudberry.yml @@ -539,11 +539,10 @@ jobs: if: needs.check-skip.outputs.should_skip != 'true' env: SRC_DIR: ${{ github.workspace }} - CONFIGURE_EXTRA_OPTS: --with-gp-stats-collector 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} ENABLE_DEBUG=${{ env.ENABLE_DEBUG }} CONFIGURE_EXTRA_OPTS=${{ env.CONFIGURE_EXTRA_OPTS }} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh"; then + if ! time su - gpadmin -c "cd ${SRC_DIR} && SRC_DIR=${SRC_DIR} ENABLE_DEBUG=${{ env.ENABLE_DEBUG }} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh"; then echo "::error::Configure script failed" exit 1 fi diff --git a/.github/workflows/build-deb-cloudberry.yml b/.github/workflows/build-deb-cloudberry.yml index bf85a107b31..52db1819194 100644 --- a/.github/workflows/build-deb-cloudberry.yml +++ b/.github/workflows/build-deb-cloudberry.yml @@ -452,14 +452,13 @@ jobs: shell: bash env: SRC_DIR: ${{ github.workspace }} - CONFIGURE_EXTRA_OPTS: --with-gp-stats-collector run: | set -eo pipefail export BUILD_DESTINATION=${SRC_DIR}/debian/build chmod +x "${SRC_DIR}"/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh - if ! time su - gpadmin -c "cd ${SRC_DIR} && SRC_DIR=${SRC_DIR} ENABLE_DEBUG=${{ env.ENABLE_DEBUG }} CONFIGURE_EXTRA_OPTS=${{ env.CONFIGURE_EXTRA_OPTS }} BUILD_DESTINATION=${BUILD_DESTINATION} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh"; then + if ! time su - gpadmin -c "cd ${SRC_DIR} && SRC_DIR=${SRC_DIR} ENABLE_DEBUG=${{ env.ENABLE_DEBUG }} BUILD_DESTINATION=${BUILD_DESTINATION} ${SRC_DIR}/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh"; then echo "::error::Configure script failed" exit 1 fi diff --git a/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh b/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh index d30a0b794f0..a9086a434fb 100755 --- a/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh +++ b/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh @@ -163,6 +163,7 @@ execute_cmd ./configure --prefix=${BUILD_DESTINATION} \ --disable-pxf \ --enable-tap-tests \ ${CONFIGURE_DEBUG_OPTS} \ + --with-gp-stats-collector \ --with-gssapi \ --with-ldap \ --with-libxml \ diff --git a/gpcontrib/gp_stats_collector/src/Config.cpp b/gpcontrib/gp_stats_collector/src/Config.cpp index e117aa941fd..2f40b30e922 100644 --- a/gpcontrib/gp_stats_collector/src/Config.cpp +++ b/gpcontrib/gp_stats_collector/src/Config.cpp @@ -40,7 +40,7 @@ extern "C" { static char *guc_uds_path = nullptr; static bool guc_enable_analyze = true; static bool guc_enable_cdbstats = true; -static bool guc_enable_collector = true; +static bool guc_enable_collector = false; static bool guc_report_nested_queries = true; static char *guc_ignored_users = nullptr; static int guc_max_text_size = 1 << 20; // in bytes (1MB) @@ -68,7 +68,7 @@ void Config::init_gucs() { DefineCustomBoolVariable( "gpsc.enable", "Enable metrics collector", 0LL, &guc_enable_collector, - true, PGC_SUSET, GUC_NOT_IN_SAMPLE | GUC_GPDB_NEED_SYNC, 0LL, 0LL, 0LL); + false, PGC_SUSET, GUC_NOT_IN_SAMPLE | GUC_GPDB_NEED_SYNC, 0LL, 0LL, 0LL); DefineCustomBoolVariable( "gpsc.enable_analyze", "Collect analyze metrics in gpsc", 0LL, @@ -88,7 +88,7 @@ void Config::init_gucs() { DefineCustomStringVariable("gpsc.ignored_users_list", "Make gpsc ignore queries issued by given users", 0LL, &guc_ignored_users, - "gpadmin,repl,gpperfmon,monitor", PGC_SUSET, + "", PGC_SUSET, GUC_NOT_IN_SAMPLE | GUC_GPDB_NEED_SYNC, 0LL, assign_ignored_users_hook, 0LL); diff --git a/gpcontrib/gp_stats_collector/src/EventSender.cpp b/gpcontrib/gp_stats_collector/src/EventSender.cpp index b28ceba175a..c0faaf0ad0e 100644 --- a/gpcontrib/gp_stats_collector/src/EventSender.cpp +++ b/gpcontrib/gp_stats_collector/src/EventSender.cpp @@ -68,6 +68,10 @@ bool EventSender::verify_query(QueryDesc *query_desc, QueryState state, // not executed yet, causing DONE to be skipped/added. config.sync(); + if (!config.enable_collector()) { + return false; + } + if (utility && !config.enable_utility()) { return false; } @@ -409,13 +413,11 @@ EventSender::EventSender() { // Perform initial sync to get default GUC values config.sync(); - if (config.enable_collector()) { - try { - GOOGLE_PROTOBUF_VERIFY_VERSION; - proto_verified = true; - } catch (const std::exception &e) { - ereport(INFO, (errmsg("Unable to start query tracing %s", e.what()))); - } + try { + GOOGLE_PROTOBUF_VERIFY_VERSION; + proto_verified = true; + } catch (const std::exception &e) { + ereport(INFO, (errmsg("GPSC protobuf version mismatch is detected %s", e.what()))); } #ifdef IC_TEARDOWN_HOOK memset(&ic_statistics, 0, sizeof(ICStatistics)); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
