From: Pavan Deolasee Date: Mon, 3 Apr 2017 17:06:19 +0000 (+0530) Subject: Try to validate the combiner only when a RESPONSE_COPY is received during X-Git-Tag: XL_10_R1BETA1~325 X-Git-Url: http://git.postgresql.org/gitweb/-?a=commitdiff_plain;h=275ef1024983bd39dc07a6d73944ef7a8b9a9594;p=postgres-xl.git Try to validate the combiner only when a RESPONSE_COPY is received during running COPY protocol. We sometimes do see a 'M' message (command ID received from the remote node) from the datanode and that breaks the combiner validation message. So we only do that if we received a RESPONSE_COPY message during COPY IN protocol. --- diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c index 02bfb6c0d3..9cf3541ac7 100644 --- a/src/backend/pgxc/pool/execRemote.c +++ b/src/backend/pgxc/pool/execRemote.c @@ -2900,8 +2900,22 @@ DataNodeCopyIn(char *data_row, int len, * Make sure there are zeroes in unused fields */ memset(&combiner, 0, sizeof(ScanState)); - handle_response(handle, &combiner); - if (!ValidateAndCloseCombiner(&combiner)) + + /* + * Validate the combiner but only if we see a proper + * resposne for our COPY message. The problem is that + * sometimes we might receive async messages such as + * 'M' which is used to send back command ID generated and + * consumed by the datanode. While the message gets handled + * in handle_response(), we don't want to declare receipt + * of an invalid message below. + * + * If there is an actual error of some sort then the + * connection state is will be set appropriately and we + * shall catch that subsequently. + */ + if (handle_response(handle, &combiner) == RESPONSE_COPY && + !ValidateAndCloseCombiner(&combiner)) return EOF; }