You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by st...@apache.org on 2023/09/22 09:04:02 UTC
[phoenix-omid] 02/02: OMID-248 Transactional Phoenix tests fail on Java 17 in getDefaultNetworkInterface
This is an automated email from the ASF dual-hosted git repository.
stoty pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix-omid.git
commit b78e9a95f80188ddf57172f39caa57411ddc0a38
Author: Istvan Toth <st...@apache.org>
AuthorDate: Thu Sep 21 07:30:01 2023 +0200
OMID-248 Transactional Phoenix tests fail on Java 17 in getDefaultNetworkInterface
---
common/src/main/java/org/apache/omid/NetworkUtils.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/common/src/main/java/org/apache/omid/NetworkUtils.java b/common/src/main/java/org/apache/omid/NetworkUtils.java
index c78f7ea6..e29fdb03 100644
--- a/common/src/main/java/org/apache/omid/NetworkUtils.java
+++ b/common/src/main/java/org/apache/omid/NetworkUtils.java
@@ -29,13 +29,19 @@ public class NetworkUtils {
private static final Logger LOG = LoggerFactory.getLogger(NetworkUtils.class);
+ //FIXME Popular distros haven't called their network interfaces ethX for a long time
private static final String LINUX_TSO_NET_IFACE_PREFIX = "eth";
+ //Modern Linux typically uses an en prefix
private static final String MAC_TSO_NET_IFACE_PREFIX = "en";
+ // FIXME This seems to be only used for determining the host and port when registering TSO
+ // to ZK for HA.
+ // We should get the TSO IP from the ZK TCP connection on demand, and not worry about the
+ // default network interface at all
public static String getDefaultNetworkInterface() {
try (DatagramSocket s=new DatagramSocket()) {
- s.connect(InetAddress.getByAddress(new byte[]{1,1,1,1}), 0);
+ s.connect(InetAddress.getByAddress(new byte[]{1,1,1,1}), 53);
return NetworkInterface.getByInetAddress(s.getLocalAddress()).getName();
} catch (Exception e) {
//fall through
@@ -49,7 +55,7 @@ public class NetworkUtils {
NetworkInterface nextElement = networkInterfaces.nextElement();
String name = nextElement.getDisplayName();
LOG.info("Iterating over network interfaces, found '{}'", name);
- boolean hasInet = Collections.list(nextElement.getInetAddresses()).size() > 1; // Checking that inet exists, to avoid taking iBridge
+ boolean hasInet = Collections.list(nextElement.getInetAddresses()).size() > 0; // Checking that inet exists, to avoid taking iBridge
if (hasInet && fallBackName == null) {
fallBackName = name;
}