Skip to content

Make yagp_hooks_collector compile and run#14

Merged
NJrslv merged 10 commits intoyagp-hooks-collectorfrom
compilable-yagp-hooks-collector
Jan 19, 2026
Merged

Make yagp_hooks_collector compile and run#14
NJrslv merged 10 commits intoyagp-hooks-collectorfrom
compilable-yagp-hooks-collector

Conversation

@NJrslv
Copy link
Copy Markdown

@NJrslv NJrslv commented Jan 19, 2026

Add minimal changes to make yagp_hooks_collector from open-gpdb/yagp_hooks_collector running on cloudberry.

DO NOT SQUASH/REBASE THIS BRANCH. I want to preserve commits and merge this branch directly into yagp_hooks_collector, then, eventually, merge yagp_hooks_collector directly into main.

Please see the commits with their messages, for the reference, they are listed below:

1. Port workfile stats from gpdb

Copy of https://github.com/open-gpdb/gpdb/commit/8813a55193bbce1d16fa0a851692ee5faea0d358 from gpdb to collect workfile stats in yagp-hooks-collector.

2. Port YagpQueryState from gpdb

Copy of https://github.com/open-gpdb/gpdb/commit/476b54071cc5bf88fd9f396a81688be51688d419 from gpdb to create a global QueryState for unique hashing for yagp-hooks-collector.

3. Use updated names and func's interfaces

Update usage of
- heap_create_with_catalog()
- standard_ExecutorRun()
- standard_ProcessUtility()
- InstrAlloc()
- CreateTemplateTupleDesc()
- ExplainInitState() -> NewExplainState()
- gpmon_gettmid() ->  gp_gettmid()
- Gp_session_role -> Gp_role
- strerror(errno) -> "%m"
- Include "utils/varlena.h" for SplitIdentifierString() in gpdbwrappers.cpp.

4. Del redundant funcs of stat_statements_ya_parser

Remove unnecessary copies of the core jumbling functions from yagp_hooks_collector/stat_statements_parser.
In commit [1] query jumbling moved to core, thus there is no need to keep a copy of jumbling functions in yagp_hooks_collector.

[1] https://github.com/open-gpdb/cloudberry/commit/5fd9dfa5f50e4906c35133a414ebec5b6d518493


5. Change test functions to SRF

In yagp_hooks_collector we need control over place where function is executed, and Cloudberry supports only set-returning functions to execute on COORDINATOR so change type of the functions. We can see the error below without this change: ERROR:  EXECUTE ON COORDINATOR is only supported for set-returning functions.


6. Change expected test out for partitioned table

In gpdb create table was executed for each partition. Now one single create table is executed. Thus only one create table query goes through executor. Change the test accordingly.

7. Add test to CI

Change makefile, test and add it to CI of yagp_hooks_collector. Similarly to
https://github.com/open-gpdb/gpdb/commit/7be8893ef5453e248bd758a47d847e2217f1ae00.

8. Change greenplum_path.sh to cloudberry-env.sh

Copy of open-gpdb/gpdb@8813a55 from gpdb to collect workfile stats in yagp-hooks-collector.
Copy of open-gpdb/gpdb@476b540 from gpdb to create a global QueryState for unique hashing for yagp-hooks-collector.
Update usage in yagp_hooks_collector of
- heap_create_with_catalog()
- standard_ExecutorRun()
- standard_ProcessUtility()
- InstrAlloc()
- CreateTemplateTupleDesc()
- ExplainInitState() -> NewExplainState()
- gpmon_gettmid() ->  gp_gettmid()
- Gp_session_role -> Gp_role
- strerror(errno) -> "%m"
- Include utils/varlena.h for SplitIdentifierString() in gpdbwrappers.cpp.
Remove unnecessary copies of the core jumbling functions from yagp_hooks_collector/stat_statements_parser.
In commit [1] query jumbling moved to core, thus there is no need to keep a copy of jumbling functions in yagp_hooks_collector.

[1] 5fd9dfa
In yagp_hooks_collector we need control over place where function is executed, and Cloudberry supports only set-returning functions to execute on COORDINATOR so change the type of the functions. We can see the error below without this change: ERROR:  EXECUTE ON COORDINATOR is only supported for set-returning functions.
In gpdb create table was executed for each partition. Now one single create table is executed. Thus only one create table query goes through executor. Change the test accordingly.
Change makefile, test and add it to CI of yagp_hooks_collector. Similarly to
open-gpdb/gpdb@7be8893.
@NJrslv NJrslv changed the title Compilable yagp hooks collector Make yagp_hooks_collector compile and run Jan 19, 2026
@NJrslv
Copy link
Copy Markdown
Author

NJrslv commented Jan 19, 2026

Comment thread gpcontrib/yagp_hooks_collector/src/log/LogOps.cpp
@NJrslv NJrslv merged commit 50c17ba into yagp-hooks-collector Jan 19, 2026
6 checks passed
NJrslv added a commit that referenced this pull request Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants