You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by fa...@apache.org on 2024/12/12 03:53:16 UTC

(cloudberry) 01/01: Collect query info when 'ExecCheckXactReadOnly' reports error

This is an automated email from the ASF dual-hosted git repository.

fanfuxiaoran pushed a commit to branch query_info
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit e611af9b6aad46c7edc2f5258c0698f0630a7889
Author: wangxiaoran <fa...@gmail.com>
AuthorDate: Wed Dec 4 17:02:14 2024 +0800

    Collect query info when 'ExecCheckXactReadOnly' reports error
---
 src/backend/executor/execMain.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 6f85dc0a8b..430ed0ab27 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -323,7 +323,20 @@ standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
 	 */
 	if ((XactReadOnly || IsInParallelMode() || Gp_role == GP_ROLE_DISPATCH) &&
 		!(eflags & EXEC_FLAG_EXPLAIN_ONLY))
-		ExecCheckXactReadOnly(queryDesc->plannedstmt);
+	{
+		PG_TRY();
+		{
+			ExecCheckXactReadOnly(queryDesc->plannedstmt);
+		}
+		PG_CATCH();
+		{
+			/* GPDB hook for collecting query info */
+			if (query_info_collect_hook)
+				(*query_info_collect_hook)(QueryCancelCleanup ? METRICS_QUERY_CANCELED : METRICS_QUERY_ERROR, queryDesc);
+			PG_RE_THROW();
+		}
+		PG_END_TRY();
+	}
 
 	/*
 	 * Build EState, switch into per-query memory context for startup.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org