Tim Armstrong has posted comments on this change. Change subject: IMPALA-5499: avoid ephemeral port conflicts ......................................................................
Patch Set 2: (4 comments) http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/statestore/statestore-test.cc File be/src/statestore/statestore-test.cc: Line 76: int subscriber_port = FindUnusedEphemeralPort(&used_ports); > you could assert that used_ports.back() == subscriber_port here and elsewhe Is this the right place for it? Seems more like a unit test for FindUnusedEphemeralPort() than an invariant of this function. I can add a unit test for the function but unsure if it's worth it. http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/util/network-util.cc File be/src/util/network-util.cc: Line 197: } > Should'nt we increment tries here? Changed back to a for() loop, which achieves the same thing. I was thinking that it was a bit weird to fail randomly because we picked numbers that were already used, but I guess it's no different from failing because the port was in use for other reasons. Line 206: close(sockfd); > Shouldn't this be above the continue, possibly at the start of the loop? Ot Done http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/util/network-util.h File be/src/util/network-util.h: Line 70: int FindUnusedEphemeralPort(std::vector<int>* used_ports); > You could make this default to nullptr. I hit a compile error that I couldn't get around. Unsure if it's a compiler bug or something else but my inclination is to not spend time digging into it. error: default argument given for parameter 1 of ‘int impala::FindUnusedEphemeralPort(std::vector<int>*)’ [-fpermissive] int FindUnusedEphemeralPort(std::vector<int>* used_ports = nullptr); -- To view, visit http://gerrit.cloudera.org:8080/7171 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835 Gerrit-PatchSet: 2 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Tim Armstrong <[email protected]> Gerrit-Reviewer: Lars Volker <[email protected]> Gerrit-Reviewer: Sailesh Mukil <[email protected]> Gerrit-Reviewer: Tim Armstrong <[email protected]> Gerrit-Reviewer: anujphadke <[email protected]> Gerrit-HasComments: Yes
