|
31 | 31 | #include "cdb/cdbgang.h"
|
32 | 32 |
|
33 | 33 |
|
34 |
| -static uint32 cdbconn_get_motion_listener_port(PGconn *conn); |
| 34 | +static int64 cdbconn_get_motion_listener_port(PGconn *conn); |
35 | 35 | static void cdbconn_disconnect(SegmentDatabaseDescriptor *segdbDesc);
|
36 | 36 |
|
37 | 37 | static void MPPnoticeReceiver(void *arg, const PGresult *res);
|
@@ -83,6 +83,7 @@ cdbconn_createSegmentDescriptor(struct CdbComponentDatabaseInfo *cdbinfo, int id
|
83 | 83 | /* Connection info, set in function cdbconn_doConnect */
|
84 | 84 | segdbDesc->conn = NULL;
|
85 | 85 | segdbDesc->motionListener = 0;
|
| 86 | + segdbDesc->motionExtListener = 0; |
86 | 87 | segdbDesc->backendPid = 0;
|
87 | 88 |
|
88 | 89 | /* whoami */
|
@@ -294,16 +295,19 @@ cdbconn_doConnectComplete(SegmentDatabaseDescriptor *segdbDesc)
|
294 | 295 | * giving us the TCP port number where it listens for connections from the
|
295 | 296 | * gang below.
|
296 | 297 | */
|
297 |
| - segdbDesc->motionListener = cdbconn_get_motion_listener_port(segdbDesc->conn); |
| 298 | + int64 ports = cdbconn_get_motion_listener_port(segdbDesc->conn); |
| 299 | + segdbDesc->motionListener = (uint32) (ports & 0xFFFFFFFF); |
| 300 | + segdbDesc->motionExtListener = ports >> 32; |
298 | 301 | segdbDesc->backendPid = PQbackendPID(segdbDesc->conn);
|
299 | 302 |
|
300 | 303 | if (segdbDesc->motionListener != 0 &&
|
301 | 304 | gp_log_gang >= GPVARS_VERBOSITY_DEBUG)
|
302 | 305 | {
|
303 |
| - elog(LOG, "Connected to %s motionListenerPorts=%u/%u with options %s", |
| 306 | + elog(LOG, "Connected to %s motionListenerPorts=%u/%u/%u with options %s", |
304 | 307 | segdbDesc->whoami,
|
305 | 308 | (segdbDesc->motionListener & 0x0ffff),
|
306 | 309 | ((segdbDesc->motionListener >> 16) & 0x0ffff),
|
| 310 | + segdbDesc->motionExtListener, |
307 | 311 | PQoptions(segdbDesc->conn));
|
308 | 312 | }
|
309 | 313 | }
|
@@ -483,25 +487,32 @@ cdbconn_signalQE(SegmentDatabaseDescriptor *segdbDesc,
|
483 | 487 |
|
484 | 488 |
|
485 | 489 | /* GPDB function to retrieve QE-backend details (motion listener) */
|
486 |
| -static uint32 |
| 490 | +static int64 |
487 | 491 | cdbconn_get_motion_listener_port(PGconn *conn)
|
488 | 492 | {
|
489 | 493 | const char *val;
|
490 | 494 | char *endptr;
|
491 |
| - uint32 result; |
| 495 | + int64 result; |
| 496 | + int64 ext_port; |
492 | 497 |
|
493 | 498 | val = PQparameterStatus(conn, "qe_listener_port");
|
494 | 499 | if (!val)
|
495 | 500 | return 0;
|
496 | 501 |
|
497 | 502 | errno = 0;
|
498 |
| - result = strtoul(val, &endptr, 10); |
| 503 | + result = strtol(val, &endptr, 10); |
| 504 | + if (endptr == val || *endptr != ':' || errno == ERANGE) |
| 505 | + return 0; |
| 506 | + |
| 507 | + val = endptr + 1; |
| 508 | + ext_port = strtol(val, &endptr, 10); |
499 | 509 | if (endptr == val || *endptr != '\0' || errno == ERANGE)
|
500 | 510 | return 0;
|
501 | 511 |
|
502 |
| - return result; |
503 |
| -} |
| 512 | + if (result < 0 || ext_port < 0) return 0; |
504 | 513 |
|
| 514 | + return (result | (ext_port << 32)); |
| 515 | +} |
505 | 516 |
|
506 | 517 | /*-------------------------------------------------------------------------
|
507 | 518 | * QE Notice receiver support
|
|
0 commit comments