| 4033 | } |
| 4034 | |
| 4035 | static void |
| 4036 | SendCopyFromForwardedError(CopyFromState cstate, CdbCopy *cdbCopy, char *errormsg) |
| 4037 | { |
| 4038 | copy_from_dispatch_error *errframe; |
| 4039 | StringInfo msgbuf; |
| 4040 | int target_seg; |
| 4041 | int errormsg_len = strlen(errormsg); |
| 4042 | |
| 4043 | msgbuf = cstate->dispatch_msgbuf; |
| 4044 | resetStringInfo(msgbuf); |
| 4045 | enlargeStringInfo(msgbuf, SizeOfCopyFromDispatchError); |
| 4046 | /* allocate space for the header (we'll fill it in last). */ |
| 4047 | msgbuf->len = SizeOfCopyFromDispatchError; |
| 4048 | |
| 4049 | appendBinaryStringInfo(msgbuf, errormsg, errormsg_len); |
| 4050 | appendBinaryStringInfo(msgbuf, cstate->line_buf.data, cstate->line_buf.len); |
| 4051 | |
| 4052 | errframe = (copy_from_dispatch_error *) msgbuf->data; |
| 4053 | |
| 4054 | errframe->error_marker = -1; |
| 4055 | errframe->lineno = cstate->cur_lineno; |
| 4056 | errframe->line_len = cstate->line_buf.len; |
| 4057 | errframe->errmsg_len = errormsg_len; |
| 4058 | |
| 4059 | /* send the bad data row to a random QE (via roundrobin) */ |
| 4060 | if (cstate->lastsegid == cdbCopy->total_segs) |
| 4061 | cstate->lastsegid = 0; /* start over from first segid */ |
| 4062 | |
| 4063 | target_seg = (cstate->lastsegid++ % cdbCopy->total_segs); |
| 4064 | |
| 4065 | cdbCopySendData(cdbCopy, target_seg, msgbuf->data, msgbuf->len); |
| 4066 | } |
| 4067 | |
| 4068 | static void |
| 4069 | EndCopyFromDirectoryTable(CopyFromState cstate) |
no test coverage detected