You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by dj...@apache.org on 2026/04/02 08:25:37 UTC
(cloudberry) 47/49: [gp_stats_collector] Wrap hook call in try/catch on error path
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 5cfde24dc4e2897bf5c58437be97c7ab93c476aa
Author: NJrslv <ja...@gmail.com>
AuthorDate: Tue Mar 31 14:15:58 2026 +0300
[gp_stats_collector] Wrap hook call in try/catch on error path
Add PG_TRY/PG_CATCH around query_info_collect_hook in PortalCleanup
error path to prevent exceptions from propagating during cleanup.
---
src/backend/commands/portalcmds.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/backend/commands/portalcmds.c b/src/backend/commands/portalcmds.c
index 0ea5874e884..e23dc1d9c43 100644
--- a/src/backend/commands/portalcmds.c
+++ b/src/backend/commands/portalcmds.c
@@ -374,10 +374,22 @@ PortalCleanup(Portal portal)
FreeQueryDesc(queryDesc);
CurrentResourceOwner = saveResourceOwner;
- } else {
+ }
+ else
+ {
/* GPDB hook for collecting query info */
if (queryDesc->gpsc_query_key && query_info_collect_hook)
- (*query_info_collect_hook)(METRICS_QUERY_ERROR, queryDesc);
+ {
+ PG_TRY();
+ {
+ (*query_info_collect_hook)(METRICS_QUERY_ERROR, queryDesc);
+ }
+ PG_CATCH();
+ {
+ FlushErrorState();
+ }
+ PG_END_TRY();
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org