From: Pavan Deolasee Date: Sun, 8 May 2016 09:14:41 +0000 (+0530) Subject: Properly deallocate prepared statements on the remote node when user makes such X-Git-Tag: XL9_5_R1_1~8 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=d60cb3dd07118b02c31cfbd9dcff8d735bcec27f;p=postgres-xl.git Properly deallocate prepared statements on the remote node when user makes such request Per report by Vamshi Reddy --- diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c index fa90742b7f..c42c791ce4 100644 --- a/src/backend/commands/prepare.c +++ b/src/backend/commands/prepare.c @@ -721,6 +721,7 @@ DropPreparedStatement(const char *stmt_name, bool showError) /* Now we can remove the hash table entry */ hash_search(prepared_queries, entry->stmt_name, HASH_REMOVE, NULL); #ifdef XCP + DropDatanodeStatement(entry->stmt_name); if (entry->use_resowner) ResourceOwnerForgetPreparedStmt(CurTransactionResourceOwner, entry->stmt_name); diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c index e277a77f0b..ac5fa800ff 100644 --- a/src/backend/pgxc/pool/execRemote.c +++ b/src/backend/pgxc/pool/execRemote.c @@ -3645,6 +3645,7 @@ ExecCloseRemoteStatement(const char *stmt_name, List *nodelist) (errcode(ERRCODE_INTERNAL_ERROR), errmsg("Failed to close Datanode statement"))); } + PGXCNodeSetConnectionState(connections[i], DN_CONNECTION_STATE_CLOSE); } InitResponseCombiner(&combiner, conn_count, COMBINE_TYPE_NONE); @@ -3657,7 +3658,7 @@ ExecCloseRemoteStatement(const char *stmt_name, List *nodelist) { if (pgxc_node_receive(conn_count, connections, NULL)) { - for (i = 0; i <= conn_count; i++) + for (i = 0; i < conn_count; i++) PGXCNodeSetConnectionState(connections[i], DN_CONNECTION_STATE_ERROR_FATAL);