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 a6eae44277d10a8f0c51d188589282159f522349
Author: Maxim Smyatkin <[email protected]>
AuthorDate: Mon Apr 7 14:15:39 2025 +0300

    [yagp_hooks_collector] Ignore EXPLAIN VERBOSE errors for unsupported node 
types
---
 src/PgUtils.cpp | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/PgUtils.cpp b/src/PgUtils.cpp
index 528426e6c64..5982ff77c1c 100644
--- a/src/PgUtils.cpp
+++ b/src/PgUtils.cpp
@@ -88,7 +88,24 @@ ExplainState get_explain_state(QueryDesc *query_desc, bool 
costs) {
   es.verbose = true;
   es.format = EXPLAIN_FORMAT_TEXT;
   ExplainBeginOutput(&es);
-  ExplainPrintPlan(&es, query_desc);
+  PG_TRY();
+  { ExplainPrintPlan(&es, query_desc); }
+  PG_CATCH();
+  {
+    // PG and GP both have known and yet unknown bugs in EXPLAIN VERBOSE
+    // implementation. We don't want any queries to fail due to those bugs, so
+    // we report the bug here for future investigatin and continue collecting
+    // metrics w/o reporting any plans
+    resetStringInfo(es.str);
+    appendStringInfo(
+        es.str,
+        "Unable to restore query plan due to PostgreSQL internal error. "
+        "See logs for more information");
+    ereport(INFO,
+            (errmsg("YAGPCC failed to reconstruct explain text for query: %s",
+                    query_desc->sourceText)));
+  }
+  PG_END_TRY();
   ExplainEndOutput(&es);
   return es;
 }


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

Reply via email to