[Postgres-xl-developers] [patch]catch and report error when init connection on coord

Jov amutu at amutu.com
Sun Dec 28 21:26:02 PST 2014


Any one review this?

Jov
blog: http:amutu.com/blog <http://amutu.com/blog>

2014-12-19 12:53 GMT+08:00 Jov <amutu at amutu.com>:

> problem desc:
> pgxl init datanode connection with set global_session,this set stmt can be
> failed on datanode(for example:if the datanode do not have the coord info
> on it's pgxc_node,it will report error such as ""node ""coord1_2118""
> does not exist"" when running the set cmd),but the error on datanode do
> not catch on the coord.So if you run a insert stmt on the coord,it will not
> report error,but the data do in the table.
>
> this patch fix it by catch and report error:
>
>> postgres=# insert into kv values(11,'3_11');
>> ERROR:  Could not begin transaction on data node.
>
>
> diff --git a/src/backend/pgxc/pool/pgxcnode.c
> b/src/backend/pgxc/pool/pgxcnode.c
> index 7a01b18..7b816bb 100644
> --- a/src/backend/pgxc/pool/pgxcnode.c
> +++ b/src/backend/pgxc/pool/pgxcnode.c
> @@ -2885,9 +2885,18 @@ pgxc_node_set_query(PGXCNodeHandle *handle, const
> char *set_query)
>                         continue;
>                 }
>                 msgtype = get_message(handle, &msglen, &msg);
> +
>                 /*
> -                * Ignore any response except ReadyForQuery, it allows to
> go on.
> +                * Ignore any response except ErrorResponse and
> ReadyForQuery, it allows to go on.
>                  */
> +
> +               if (msgtype == 'E')         /* ErrorResponse */
> +               {
> +                   handle->error = pstrdup(msg);
> +                   handle->state = DN_CONNECTION_STATE_ERROR_FATAL;
> +                   break;
> +               }
> +
>                 if (msgtype == 'Z') /* ReadyForQuery */
>                 {
>                         handle->transaction_status = msg[0];
>
> Jov
> blog: http:amutu.com/blog <http://amutu.com/blog>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.postgres-xl.org/private.cgi/postgres-xl-developers-postgres-xl.org/attachments/20141229/c5911145/attachment.htm>


More information about the Postgres-xl-developers mailing list