From: Pavan Deolasee Date: Fri, 10 Jun 2016 13:09:05 +0000 (+0530) Subject: Show originating coordinator name:pid and remote node name:pid in the ps output X-Git-Tag: XL9_5_R1_2~47 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=5693d69554963327df001802eb0247f33f0ae234;p=postgres-xl.git Show originating coordinator name:pid and remote node name:pid in the ps output while running REMOTE SUBPLAN This should help administrator to quickly find the originating session and remote session, which can be immensely useful for debugging --- diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 42c0077f19..a229445988 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -1755,6 +1755,9 @@ exec_plan_message(const char *query_string, /* source of the query */ Oid *paramTypes = NULL; CachedPlanSource *psrc; + /* coord name + remote node + whatever */ + static char commandTag[NAMEDATALEN + NAMEDATALEN + 128]; + /* Statement name should not be empty */ Assert(stmt_name[0]); @@ -1819,7 +1822,15 @@ exec_plan_message(const char *query_string, /* source of the query */ /* If we got a cancel signal, quit */ CHECK_FOR_INTERRUPTS(); - psrc = CreateCachedPlan(NULL, query_string, stmt_name, "REMOTE SUBPLAN"); + snprintf(commandTag, sizeof (commandTag), + "REMOTE SUBPLAN (%s:%d) (%c:%s:%d)", + MyCoordName, MyCoordPid, + remoteConnType == REMOTE_CONN_APP ? 'A' : + remoteConnType == REMOTE_CONN_DATANODE ? 'D' : + remoteConnType == REMOTE_CONN_COORD ? 'C' : 'U', + parentPGXCNode, parentPGXCPid + ); + psrc = CreateCachedPlan(NULL, query_string, stmt_name, commandTag); CompleteCachedPlan(psrc, NIL, NULL, paramTypes, numParams, NULL, NULL, CURSOR_OPT_GENERIC_PLAN, false);