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 4e5de6cb9ab37caa5ce28b419138c1e36278e055
Author: NJrslv <[email protected]>
AuthorDate: Mon Jan 19 11:13:00 2026 +0300

    [yagp_hooks_collector] Add --with-yagp-hooks-collector configure option and 
CI
    
    Add configure.ac option with protobuf dependency.  Add CI test
    configuration.  Change env script from greenplum_path.sh to
    cloudberry-env.sh.
---
 .github/workflows/build-cloudberry.yml             | 32 +++++++++-
 configure                                          | 28 +++++++++
 configure.ac                                       |  7 +++
 .../cloudberry/scripts/configure-cloudberry.sh     |  4 +-
 expected/yagp_cursors.out                          | 10 +--
 expected/yagp_dist.out                             |  2 +
 expected/yagp_select.out                           |  2 +
 expected/yagp_utf8_trim.out                        |  2 +
 expected/yagp_utility.out                          | 72 +++++++++++-----------
 gpcontrib/Makefile                                 |  3 +
 gpcontrib/yagp_hooks_collector/Makefile            | 41 ++++++++++++
 sql/yagp_cursors.sql                               |  2 +
 sql/yagp_dist.sql                                  |  2 +
 sql/yagp_select.sql                                |  2 +
 sql/yagp_utf8_trim.sql                             |  2 +
 sql/yagp_utility.sql                               |  2 +
 src/Makefile.global.in                             |  1 +
 17 files changed, 173 insertions(+), 41 deletions(-)

diff --git a/.github/workflows/build-cloudberry.yml 
b/.github/workflows/build-cloudberry.yml
index adb57fb85ec..8484331998f 100644
--- a/.github/workflows/build-cloudberry.yml
+++ b/.github/workflows/build-cloudberry.yml
@@ -271,6 +271,10 @@ jobs:
                 },
                 "enable_core_check":false
               },
+              {"test":"gpcontrib-yagp-hooks-collector",
+               "make_configs":["gpcontrib/yagp_hooks_collector:installcheck"],
+               "extension":"yagp_hooks_collector"
+              },
               {"test":"ic-expandshrink",
                "make_configs":["src/test/isolation2:installcheck-expandshrink"]
               },
@@ -535,10 +539,11 @@ jobs:
         if: needs.check-skip.outputs.should_skip != 'true'
         env:
           SRC_DIR: ${{ github.workspace }}
+          CONFIGURE_EXTRA_OPTS: --with-yagp-hooks-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 }} 
${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 }} CONFIGURE_EXTRA_OPTS=${{ 
env.CONFIGURE_EXTRA_OPTS }} 
${SRC_DIR}/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh"; 
then
             echo "::error::Configure script failed"
             exit 1
           fi
@@ -1403,6 +1408,7 @@ jobs:
         if: success() && needs.check-skip.outputs.should_skip != 'true'
         env:
           SRC_DIR: ${{ github.workspace }}
+          BUILD_DESTINATION: /usr/local/cloudberry-db
         shell: bash {0}
         run: |
           set -o pipefail
@@ -1432,6 +1438,30 @@ jobs:
             PG_OPTS="$PG_OPTS -c optimizer=${{ matrix.pg_settings.optimizer }}"
           fi
 
+          # Create extension if required
+          if [[ "${{ matrix.extension != '' }}" == "true" ]]; then
+            case "${{ matrix.extension }}" in
+              yagp_hooks_collector)
+                if ! su - gpadmin -c "source 
${BUILD_DESTINATION}/cloudberry-env.sh && \
+                  source ${SRC_DIR}/gpAux/gpdemo/gpdemo-env.sh && \
+                  gpconfig -c shared_preload_libraries -v 
'yagp_hooks_collector' && \
+                  gpstop -ra && \
+                  echo 'CREATE EXTENSION IF NOT EXISTS yagp_hooks_collector; \
+                        SHOW shared_preload_libraries; \
+                        TABLE pg_extension;' | \
+                    psql postgres"
+                then
+                    echo "Error creating yagp_hooks_collector extension"
+                    exit 1
+                fi
+                ;;
+              *)
+                echo "Unknown extension: ${{ matrix.extension }}"
+                exit 1
+                ;;
+            esac
+          fi
+
           if [[ "${{ matrix.pg_settings.default_table_access_method != '' }}" 
== "true" ]]; then
             PG_OPTS="$PG_OPTS -c default_table_access_method=${{ 
matrix.pg_settings.default_table_access_method }}"
           fi
diff --git a/configure b/configure
index c9ce3d46302..598114a4b7f 100755
--- a/configure
+++ b/configure
@@ -722,6 +722,7 @@ with_apr_config
 with_libcurl
 with_rt
 with_zstd
+with_yagp_hooks_collector
 with_libbz2
 LZ4_LIBS
 LZ4_CFLAGS
@@ -942,6 +943,7 @@ with_zlib
 with_lz4
 with_libbz2
 with_zstd
+with_yagp_hooks_collector
 with_rt
 with_libcurl
 with_apr_config
@@ -11150,6 +11152,32 @@ $as_echo "yes" >&6; }
 fi
 fi
 
+#
+# yagp_hooks_collector
+#
+
+
+
+# Check whether --with-yagp-hooks-collector was given.
+if test "${with_yagp_hooks_collector+set}" = set; then :
+  withval=$with_yagp_hooks_collector;
+  case $withval in
+    yes)
+      :
+      ;;
+    no)
+      :
+      ;;
+    *)
+      as_fn_error $? "no argument expected for --with-yagp-hooks-collector 
option" "$LINENO" 5
+      ;;
+  esac
+
+else
+  with_yagp_hooks_collector=no
+
+fi
+
 #
 # Realtime library
 #
diff --git a/configure.ac b/configure.ac
index 246edc4846e..792878fde4b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1365,6 +1365,13 @@ PGAC_ARG_BOOL(with, zstd, yes, [do not build with 
Zstandard],
 AC_MSG_RESULT([$with_zstd])
 AC_SUBST(with_zstd)
 
+#
+# yagp_hooks_collector
+#
+PGAC_ARG_BOOL(with, yagp_hooks_collector, no,
+              [build with YAGP hooks collector extension])
+AC_SUBST(with_yagp_hooks_collector)
+
 if test "$with_zstd" = yes; then
   dnl zstd_errors.h was renamed from error_public.h in v1.4.0
   PKG_CHECK_MODULES([ZSTD], [libzstd >= 1.4.0])
diff --git a/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh 
b/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh
index 2d7ad04aed8..d30a0b794f0 100755
--- a/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh
+++ b/devops/build/automation/cloudberry/scripts/configure-cloudberry.sh
@@ -53,6 +53,7 @@
 #
 # Optional Environment Variables:
 #   LOG_DIR - Directory for logs (defaults to ${SRC_DIR}/build-logs)
+#   CONFIGURE_EXTRA_OPTS - Args to pass to configure command
 #   ENABLE_DEBUG - Enable debug build options (true/false, defaults to
 #                  false)
 #
@@ -177,7 +178,8 @@ execute_cmd ./configure --prefix=${BUILD_DESTINATION} \
             --with-uuid=e2fs \
             ${CONFIGURE_MDBLOCALES_OPTS} \
             --with-includes=/usr/local/xerces-c/include \
-            --with-libraries=${BUILD_DESTINATION}/lib || exit 4
+            --with-libraries=${BUILD_DESTINATION}/lib \
+            ${CONFIGURE_EXTRA_OPTS:-""} || exit 4
 log_section_end "Configure"
 
 # Capture version information
diff --git a/expected/yagp_cursors.out b/expected/yagp_cursors.out
index d251ddd3e1c..46e124df5e8 100644
--- a/expected/yagp_cursors.out
+++ b/expected/yagp_cursors.out
@@ -12,6 +12,7 @@ BEGIN
     END;
 END;
 $$ LANGUAGE plpgsql IMMUTABLE;
+SET yagpcc.ignored_users_list TO '';
 SET yagpcc.enable TO TRUE;
 SET yagpcc.enable_utility TO TRUE;
 SET yagpcc.report_nested_queries TO TRUE;
@@ -25,7 +26,7 @@ RESET yagpcc.logging_mode;
 SELECT segid, query_text, query_status FROM yagpcc.log WHERE segid = -1 AND 
utility = true ORDER BY segid, ccnt, yagp_status_order(query_status) ASC;
  segid |                 query_text                  |    query_status     
 -------+---------------------------------------------+---------------------
-    -1 |                                             | QUERY_STATUS_DONE
+    -1 | SET yagpcc.logging_mode to 'TBL';           | QUERY_STATUS_DONE
     -1 | BEGIN;                                      | QUERY_STATUS_SUBMIT
     -1 | BEGIN;                                      | QUERY_STATUS_DONE
     -1 | DECLARE cursor_stats_0 CURSOR FOR SELECT 0; | QUERY_STATUS_SUBMIT
@@ -54,7 +55,7 @@ RESET yagpcc.logging_mode;
 SELECT segid, query_text, query_status FROM yagpcc.log WHERE segid = -1 AND 
utility = true ORDER BY segid, ccnt, yagp_status_order(query_status) ASC;
  segid |                      query_text                       |    
query_status     
 
-------+-------------------------------------------------------+---------------------
-    -1 |                                                       | 
QUERY_STATUS_DONE
+    -1 | SET yagpcc.logging_mode to 'TBL';                     | 
QUERY_STATUS_DONE
     -1 | BEGIN;                                                | 
QUERY_STATUS_SUBMIT
     -1 | BEGIN;                                                | 
QUERY_STATUS_DONE
     -1 | DECLARE cursor_stats_1 CURSOR WITH HOLD FOR SELECT 1; | 
QUERY_STATUS_SUBMIT
@@ -86,7 +87,7 @@ RESET yagpcc.logging_mode;
 SELECT segid, query_text, query_status FROM yagpcc.log WHERE segid = -1 AND 
utility = true ORDER BY segid, ccnt, yagp_status_order(query_status) ASC;
  segid |                 query_text                  |    query_status     
 -------+---------------------------------------------+---------------------
-    -1 |                                             | QUERY_STATUS_DONE
+    -1 | SET yagpcc.logging_mode to 'TBL';           | QUERY_STATUS_DONE
     -1 | BEGIN;                                      | QUERY_STATUS_SUBMIT
     -1 | BEGIN;                                      | QUERY_STATUS_DONE
     -1 | DECLARE cursor_stats_3 CURSOR FOR SELECT 1; | QUERY_STATUS_SUBMIT
@@ -129,7 +130,7 @@ RESET yagpcc.logging_mode;
 SELECT segid, query_text, query_status FROM yagpcc.log WHERE segid = -1 AND 
utility = true ORDER BY segid, ccnt, yagp_status_order(query_status) ASC;
  segid |                      query_text                       |    
query_status     
 
-------+-------------------------------------------------------+---------------------
-    -1 |                                                       | 
QUERY_STATUS_DONE
+    -1 | SET yagpcc.logging_mode to 'TBL';                     | 
QUERY_STATUS_DONE
     -1 | BEGIN;                                                | 
QUERY_STATUS_SUBMIT
     -1 | BEGIN;                                                | 
QUERY_STATUS_DONE
     -1 | DECLARE cursor_stats_5 CURSOR WITH HOLD FOR SELECT 2; | 
QUERY_STATUS_SUBMIT
@@ -159,3 +160,4 @@ DROP EXTENSION yagp_hooks_collector;
 RESET yagpcc.enable;
 RESET yagpcc.report_nested_queries;
 RESET yagpcc.enable_utility;
+RESET yagpcc.ignored_users_list;
diff --git a/expected/yagp_dist.out b/expected/yagp_dist.out
index 5fd5ea5fb3e..3b1e3504923 100644
--- a/expected/yagp_dist.out
+++ b/expected/yagp_dist.out
@@ -12,6 +12,7 @@ BEGIN
     END;
 END;
 $$ LANGUAGE plpgsql IMMUTABLE;
+SET yagpcc.ignored_users_list TO '';
 SET yagpcc.enable TO TRUE;
 SET yagpcc.report_nested_queries TO TRUE;
 SET yagpcc.enable_utility TO FALSE;
@@ -171,3 +172,4 @@ DROP EXTENSION yagp_hooks_collector;
 RESET yagpcc.enable;
 RESET yagpcc.report_nested_queries;
 RESET yagpcc.enable_utility;
+RESET yagpcc.ignored_users_list;
diff --git a/expected/yagp_select.out b/expected/yagp_select.out
index b6e18dc862f..af08f2d1def 100644
--- a/expected/yagp_select.out
+++ b/expected/yagp_select.out
@@ -12,6 +12,7 @@ BEGIN
     END;
 END;
 $$ LANGUAGE plpgsql IMMUTABLE;
+SET yagpcc.ignored_users_list TO '';
 SET yagpcc.enable TO TRUE;
 SET yagpcc.report_nested_queries TO TRUE;
 SET yagpcc.enable_utility TO FALSE;
@@ -132,3 +133,4 @@ DROP EXTENSION yagp_hooks_collector;
 RESET yagpcc.enable;
 RESET yagpcc.report_nested_queries;
 RESET yagpcc.enable_utility;
+RESET yagpcc.ignored_users_list;
diff --git a/expected/yagp_utf8_trim.out b/expected/yagp_utf8_trim.out
index 194ee6b3609..9de126dd882 100644
--- a/expected/yagp_utf8_trim.out
+++ b/expected/yagp_utf8_trim.out
@@ -7,6 +7,7 @@ RETURNS TEXT AS $$
     ORDER BY datetime DESC
     LIMIT 1
 $$ LANGUAGE sql VOLATILE;
+SET yagpcc.ignored_users_list TO '';
 SET yagpcc.enable TO TRUE;
 -- Test 1: 1 byte chars
 SET yagpcc.max_text_size to 19;
@@ -63,4 +64,5 @@ DROP FUNCTION get_marked_query(TEXT);
 RESET yagpcc.max_text_size;
 RESET yagpcc.logging_mode;
 RESET yagpcc.enable;
+RESET yagpcc.ignored_users_list;
 DROP EXTENSION yagp_hooks_collector;
diff --git a/expected/yagp_utility.out b/expected/yagp_utility.out
index 057f7d7a556..0a77859d8d4 100644
--- a/expected/yagp_utility.out
+++ b/expected/yagp_utility.out
@@ -12,6 +12,7 @@ BEGIN
     END;
 END;
 $$ LANGUAGE plpgsql IMMUTABLE;
+SET yagpcc.ignored_users_list TO '';
 SET yagpcc.enable TO TRUE;
 SET yagpcc.enable_utility TO TRUE;
 SET yagpcc.report_nested_queries TO TRUE;
@@ -26,7 +27,7 @@ RESET yagpcc.logging_mode;
 SELECT segid, query_text, query_status FROM yagpcc.log WHERE segid = -1 AND 
utility = true ORDER BY segid, ccnt, yagp_status_order(query_status) ASC;
  segid |                     query_text                     |    query_status  
   
 
-------+----------------------------------------------------+---------------------
-    -1 |                                                    | QUERY_STATUS_DONE
+    -1 | SET yagpcc.logging_mode to 'TBL';                  | QUERY_STATUS_DONE
     -1 | CREATE TABLE test_table (a int, b text);           | 
QUERY_STATUS_SUBMIT
     -1 | CREATE TABLE test_table (a int, b text);           | QUERY_STATUS_DONE
     -1 | CREATE INDEX test_idx ON test_table(a);            | 
QUERY_STATUS_SUBMIT
@@ -83,7 +84,7 @@ RESET yagpcc.logging_mode;
 SELECT segid, query_text, query_status FROM yagpcc.log WHERE segid = -1 AND 
utility = true ORDER BY segid, ccnt, yagp_status_order(query_status) ASC;
  segid |                                     query_text                        
             |    query_status     
 
-------+------------------------------------------------------------------------------------+---------------------
-    -1 |                                                                       
             | QUERY_STATUS_DONE
+    -1 | SET yagpcc.logging_mode to 'TBL';                                     
             | QUERY_STATUS_DONE
     -1 | CREATE VIEW test_view AS SELECT 1 AS a;                               
             | QUERY_STATUS_SUBMIT
     -1 | CREATE VIEW test_view AS SELECT 1 AS a;                               
             | QUERY_STATUS_DONE
     -1 | CREATE FUNCTION test_func(i int) RETURNS int AS $$ SELECT $1 + 1; $$ 
LANGUAGE SQL; | QUERY_STATUS_SUBMIT
@@ -113,26 +114,26 @@ BEGIN;
 ROLLBACK;
 RESET yagpcc.logging_mode;
 SELECT segid, query_text, query_status FROM yagpcc.log WHERE segid = -1 AND 
utility = true ORDER BY segid, ccnt, yagp_status_order(query_status) ASC;
- segid |         query_text         |    query_status     
--------+----------------------------+---------------------
-    -1 |                            | QUERY_STATUS_DONE
-    -1 | BEGIN;                     | QUERY_STATUS_SUBMIT
-    -1 | BEGIN;                     | QUERY_STATUS_DONE
-    -1 | SAVEPOINT sp1;             | QUERY_STATUS_SUBMIT
-    -1 | ROLLBACK TO sp1;           | QUERY_STATUS_SUBMIT
-    -1 | ROLLBACK TO sp1;           | QUERY_STATUS_DONE
-    -1 | COMMIT;                    | QUERY_STATUS_SUBMIT
-    -1 | COMMIT;                    | QUERY_STATUS_DONE
-    -1 | BEGIN;                     | QUERY_STATUS_SUBMIT
-    -1 | BEGIN;                     | QUERY_STATUS_DONE
-    -1 | SAVEPOINT sp2;             | QUERY_STATUS_SUBMIT
-    -1 | ABORT;                     | QUERY_STATUS_SUBMIT
-    -1 | ABORT;                     | QUERY_STATUS_DONE
-    -1 | BEGIN;                     | QUERY_STATUS_SUBMIT
-    -1 | BEGIN;                     | QUERY_STATUS_DONE
-    -1 | ROLLBACK;                  | QUERY_STATUS_SUBMIT
-    -1 | ROLLBACK;                  | QUERY_STATUS_DONE
-    -1 | RESET yagpcc.logging_mode; | QUERY_STATUS_SUBMIT
+ segid |            query_text             |    query_status     
+-------+-----------------------------------+---------------------
+    -1 | SET yagpcc.logging_mode to 'TBL'; | QUERY_STATUS_DONE
+    -1 | BEGIN;                            | QUERY_STATUS_SUBMIT
+    -1 | BEGIN;                            | QUERY_STATUS_DONE
+    -1 | SAVEPOINT sp1;                    | QUERY_STATUS_SUBMIT
+    -1 | ROLLBACK TO sp1;                  | QUERY_STATUS_SUBMIT
+    -1 | ROLLBACK TO sp1;                  | QUERY_STATUS_DONE
+    -1 | COMMIT;                           | QUERY_STATUS_SUBMIT
+    -1 | COMMIT;                           | QUERY_STATUS_DONE
+    -1 | BEGIN;                            | QUERY_STATUS_SUBMIT
+    -1 | BEGIN;                            | QUERY_STATUS_DONE
+    -1 | SAVEPOINT sp2;                    | QUERY_STATUS_SUBMIT
+    -1 | ABORT;                            | QUERY_STATUS_SUBMIT
+    -1 | ABORT;                            | QUERY_STATUS_DONE
+    -1 | BEGIN;                            | QUERY_STATUS_SUBMIT
+    -1 | BEGIN;                            | QUERY_STATUS_DONE
+    -1 | ROLLBACK;                         | QUERY_STATUS_SUBMIT
+    -1 | ROLLBACK;                         | QUERY_STATUS_DONE
+    -1 | RESET yagpcc.logging_mode;        | QUERY_STATUS_SUBMIT
 (18 rows)
 
 SELECT yagpcc.truncate_log() IS NOT NULL AS t;
@@ -153,7 +154,7 @@ RESET yagpcc.logging_mode;
 SELECT segid, query_text, query_status FROM yagpcc.log WHERE segid = -1 AND 
utility = true ORDER BY segid, ccnt, yagp_status_order(query_status) ASC;
  segid |               query_text               |    query_status     
 -------+----------------------------------------+---------------------
-    -1 |                                        | QUERY_STATUS_DONE
+    -1 | SET yagpcc.logging_mode to 'TBL';      | QUERY_STATUS_DONE
     -1 | CREATE TABLE dml_test (a int, b text); | QUERY_STATUS_SUBMIT
     -1 | CREATE TABLE dml_test (a int, b text); | QUERY_STATUS_DONE
     -1 | DROP TABLE dml_test;                   | QUERY_STATUS_SUBMIT
@@ -176,16 +177,16 @@ COPY (SELECT 1) TO STDOUT;
 DROP TABLE copy_test;
 RESET yagpcc.logging_mode;
 SELECT segid, query_text, query_status FROM yagpcc.log WHERE segid = -1 AND 
utility = true ORDER BY segid, ccnt, yagp_status_order(query_status) ASC;
- segid |           query_text            |    query_status     
--------+---------------------------------+---------------------
-    -1 |                                 | QUERY_STATUS_DONE
-    -1 | CREATE TABLE copy_test (a int); | QUERY_STATUS_SUBMIT
-    -1 | CREATE TABLE copy_test (a int); | QUERY_STATUS_DONE
-    -1 | COPY (SELECT 1) TO STDOUT;      | QUERY_STATUS_SUBMIT
-    -1 | COPY (SELECT 1) TO STDOUT;      | QUERY_STATUS_DONE
-    -1 | DROP TABLE copy_test;           | QUERY_STATUS_SUBMIT
-    -1 | DROP TABLE copy_test;           | QUERY_STATUS_DONE
-    -1 | RESET yagpcc.logging_mode;      | QUERY_STATUS_SUBMIT
+ segid |            query_text             |    query_status     
+-------+-----------------------------------+---------------------
+    -1 | SET yagpcc.logging_mode to 'TBL'; | QUERY_STATUS_DONE
+    -1 | CREATE TABLE copy_test (a int);   | QUERY_STATUS_SUBMIT
+    -1 | CREATE TABLE copy_test (a int);   | QUERY_STATUS_DONE
+    -1 | COPY (SELECT 1) TO STDOUT;        | QUERY_STATUS_SUBMIT
+    -1 | COPY (SELECT 1) TO STDOUT;        | QUERY_STATUS_DONE
+    -1 | DROP TABLE copy_test;             | QUERY_STATUS_SUBMIT
+    -1 | DROP TABLE copy_test;             | QUERY_STATUS_DONE
+    -1 | RESET yagpcc.logging_mode;        | QUERY_STATUS_SUBMIT
 (8 rows)
 
 SELECT yagpcc.truncate_log() IS NOT NULL AS t;
@@ -203,7 +204,7 @@ RESET yagpcc.logging_mode;
 SELECT segid, query_text, query_status FROM yagpcc.log WHERE segid = -1 AND 
utility = true ORDER BY segid, ccnt, yagp_status_order(query_status) ASC;
  segid |                   query_text                    |    query_status     
 -------+-------------------------------------------------+---------------------
-    -1 |                                                 | QUERY_STATUS_DONE
+    -1 | SET yagpcc.logging_mode to 'TBL';               | QUERY_STATUS_DONE
     -1 | PREPARE test_prep(int) AS SELECT $1/0 AS value; | QUERY_STATUS_SUBMIT
     -1 | PREPARE test_prep(int) AS SELECT $1/0 AS value; | QUERY_STATUS_DONE
     -1 | EXECUTE test_prep(0::int);                      | QUERY_STATUS_SUBMIT
@@ -226,7 +227,7 @@ RESET yagpcc.logging_mode;
 SELECT segid, query_text, query_status FROM yagpcc.log WHERE segid = -1 AND 
utility = true ORDER BY segid, ccnt, yagp_status_order(query_status) ASC;
  segid |                 query_text                 |    query_status     
 -------+--------------------------------------------+---------------------
-    -1 |                                            | QUERY_STATUS_DONE
+    -1 | SET yagpcc.logging_mode to 'TBL';          | QUERY_STATUS_DONE
     -1 | SET yagpcc.report_nested_queries TO FALSE; | QUERY_STATUS_SUBMIT
     -1 | SET yagpcc.report_nested_queries TO FALSE; | QUERY_STATUS_DONE
     -1 | RESET yagpcc.report_nested_queries;        | QUERY_STATUS_SUBMIT
@@ -244,3 +245,4 @@ DROP EXTENSION yagp_hooks_collector;
 RESET yagpcc.enable;
 RESET yagpcc.report_nested_queries;
 RESET yagpcc.enable_utility;
+RESET yagpcc.ignored_users_list;
diff --git a/gpcontrib/Makefile b/gpcontrib/Makefile
index 8d95a14f876..8b98dc9142c 100644
--- a/gpcontrib/Makefile
+++ b/gpcontrib/Makefile
@@ -35,6 +35,9 @@ else
                diskquota
 endif
 
+ifeq "$(with_yagp_hooks_collector)" "yes"
+       recurse_targets += yagp_hooks_collector
+endif
 ifeq "$(with_zstd)" "yes"
        recurse_targets += zstd
 endif
diff --git a/gpcontrib/yagp_hooks_collector/Makefile 
b/gpcontrib/yagp_hooks_collector/Makefile
new file mode 100644
index 00000000000..be46eb7149c
--- /dev/null
+++ b/gpcontrib/yagp_hooks_collector/Makefile
@@ -0,0 +1,41 @@
+MODULE_big = yagp_hooks_collector
+EXTENSION  = yagp_hooks_collector
+DATA       = $(wildcard *--*.sql)
+REGRESS    = yagp_cursors yagp_dist yagp_select yagp_utf8_trim yagp_utility
+
+PROTO_BASES = yagpcc_plan yagpcc_metrics yagpcc_set_service
+PROTO_OBJS  = $(patsubst %,src/protos/%.pb.o,$(PROTO_BASES))
+
+C_OBJS   = $(patsubst %.c,%.o,$(wildcard src/*.c src/*/*.c))
+CPP_OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp src/*/*.cpp))
+OBJS     = $(C_OBJS) $(CPP_OBJS) $(PROTO_OBJS)
+
+override CXXFLAGS = -fPIC -g3 -Wall -Wpointer-arith -Wendif-labels \
+       -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing 
-fwrapv \
+       -Wno-unused-but-set-variable -Wno-address -Wno-format-truncation \
+       -Wno-stringop-truncation -g -ggdb -std=c++17 -Iinclude -Isrc/protos 
-Isrc -DGPBUILD
+
+PG_CXXFLAGS += -Isrc -Iinclude
+SHLIB_LINK += -lprotobuf -lpthread -lstdc++
+EXTRA_CLEAN = src/protos
+
+ifdef USE_PGXS
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
+else
+subdir = gpcontrib/yagp_hooks_collector
+top_builddir = ../..
+include $(top_builddir)/src/Makefile.global
+include $(top_srcdir)/contrib/contrib-global.mk
+endif
+
+src/protos/%.pb.cpp src/protos/%.pb.h: protos/%.proto
+       @mkdir -p src/protos
+       sed -i 's/optional //g' $^
+       sed -i 's|cloud/mdb/yagpcc/api/proto/common/|protos/|g' $^
+       protoc -I /usr/include -I /usr/local/include -I . --cpp_out=src $^
+       mv src/protos/$*.pb.cc src/protos/$*.pb.cpp
+
+$(CPP_OBJS): src/protos/yagpcc_metrics.pb.h src/protos/yagpcc_plan.pb.h 
src/protos/yagpcc_set_service.pb.h
+src/protos/yagpcc_set_service.pb.o: src/protos/yagpcc_metrics.pb.h
diff --git a/sql/yagp_cursors.sql b/sql/yagp_cursors.sql
index 5d5bde58110..f56351e0d43 100644
--- a/sql/yagp_cursors.sql
+++ b/sql/yagp_cursors.sql
@@ -14,6 +14,7 @@ BEGIN
 END;
 $$ LANGUAGE plpgsql IMMUTABLE;
 
+SET yagpcc.ignored_users_list TO '';
 SET yagpcc.enable TO TRUE;
 SET yagpcc.enable_utility TO TRUE;
 SET yagpcc.report_nested_queries TO TRUE;
@@ -81,3 +82,4 @@ DROP EXTENSION yagp_hooks_collector;
 RESET yagpcc.enable;
 RESET yagpcc.report_nested_queries;
 RESET yagpcc.enable_utility;
+RESET yagpcc.ignored_users_list;
diff --git a/sql/yagp_dist.sql b/sql/yagp_dist.sql
index b837ef05335..d5519d0cd96 100644
--- a/sql/yagp_dist.sql
+++ b/sql/yagp_dist.sql
@@ -14,6 +14,7 @@ BEGIN
 END;
 $$ LANGUAGE plpgsql IMMUTABLE;
 
+SET yagpcc.ignored_users_list TO '';
 SET yagpcc.enable TO TRUE;
 SET yagpcc.report_nested_queries TO TRUE;
 SET yagpcc.enable_utility TO FALSE;
@@ -84,3 +85,4 @@ DROP EXTENSION yagp_hooks_collector;
 RESET yagpcc.enable;
 RESET yagpcc.report_nested_queries;
 RESET yagpcc.enable_utility;
+RESET yagpcc.ignored_users_list;
diff --git a/sql/yagp_select.sql b/sql/yagp_select.sql
index 4038c6b7b63..90e972ae4c1 100644
--- a/sql/yagp_select.sql
+++ b/sql/yagp_select.sql
@@ -14,6 +14,7 @@ BEGIN
 END;
 $$ LANGUAGE plpgsql IMMUTABLE;
 
+SET yagpcc.ignored_users_list TO '';
 SET yagpcc.enable TO TRUE;
 SET yagpcc.report_nested_queries TO TRUE;
 SET yagpcc.enable_utility TO FALSE;
@@ -65,3 +66,4 @@ DROP EXTENSION yagp_hooks_collector;
 RESET yagpcc.enable;
 RESET yagpcc.report_nested_queries;
 RESET yagpcc.enable_utility;
+RESET yagpcc.ignored_users_list;
diff --git a/sql/yagp_utf8_trim.sql b/sql/yagp_utf8_trim.sql
index c0fdcce24a5..c3053e4af0c 100644
--- a/sql/yagp_utf8_trim.sql
+++ b/sql/yagp_utf8_trim.sql
@@ -9,6 +9,7 @@ RETURNS TEXT AS $$
     LIMIT 1
 $$ LANGUAGE sql VOLATILE;
 
+SET yagpcc.ignored_users_list TO '';
 SET yagpcc.enable TO TRUE;
 
 -- Test 1: 1 byte chars
@@ -39,5 +40,6 @@ DROP FUNCTION get_marked_query(TEXT);
 RESET yagpcc.max_text_size;
 RESET yagpcc.logging_mode;
 RESET yagpcc.enable;
+RESET yagpcc.ignored_users_list;
 
 DROP EXTENSION yagp_hooks_collector;
diff --git a/sql/yagp_utility.sql b/sql/yagp_utility.sql
index b4cca6f5421..cf9c1d253d0 100644
--- a/sql/yagp_utility.sql
+++ b/sql/yagp_utility.sql
@@ -14,6 +14,7 @@ BEGIN
 END;
 $$ LANGUAGE plpgsql IMMUTABLE;
 
+SET yagpcc.ignored_users_list TO '';
 SET yagpcc.enable TO TRUE;
 SET yagpcc.enable_utility TO TRUE;
 SET yagpcc.report_nested_queries TO TRUE;
@@ -131,3 +132,4 @@ DROP EXTENSION yagp_hooks_collector;
 RESET yagpcc.enable;
 RESET yagpcc.report_nested_queries;
 RESET yagpcc.enable_utility;
+RESET yagpcc.ignored_users_list;
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 062ec75b039..edc49b72e05 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -271,6 +271,7 @@ with_zstd           = @with_zstd@
 ZSTD_CFLAGS            = @ZSTD_CFLAGS@
 ZSTD_LIBS              = @ZSTD_LIBS@
 EVENT_LIBS             = @EVENT_LIBS@
+with_yagp_hooks_collector              = @with_yagp_hooks_collector@
 
 ##########################################################################
 #


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to