diff --git a/contrib/storage-ipfs/pom.xml b/contrib/storage-ipfs/pom.xml index 4f4a0ddb4e5..a81f6985d7b 100644 --- a/contrib/storage-ipfs/pom.xml +++ b/contrib/storage-ipfs/pom.xml @@ -23,6 +23,12 @@ ${project.version} + + com.github.dbw9580 + java-ipfs-http-client + v1.3.3 + + org.apache.drill.exec @@ -40,27 +46,6 @@ test - - com.github.dbw9580 - java-ipfs-http-client - v1.3.3 - - - com.fasterxml.jackson.core - jackson-annotations - 2.9.0 - - - com.fasterxml.jackson.core - jackson-databind - 2.9.0 - - - com.fasterxml.jackson.core - jackson-core - 2.9.0 - - diff --git a/contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSHelper.java b/contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSHelper.java index b8956a9c749..080d6f341af 100644 --- a/contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSHelper.java +++ b/contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSHelper.java @@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; +import java.net.Inet6Address; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.List; @@ -144,6 +145,9 @@ public IPFSPeer getMyself() throws IOException { .filter(addr -> { try { InetAddress inetAddress = InetAddress.getByName(addr.getHost()); + if (inetAddress instanceof Inet6Address) { + return false; + } return inetAddress.isSiteLocalAddress() || inetAddress.isLinkLocalAddress() || inetAddress.isLoopbackAddress(); @@ -233,6 +237,10 @@ public static Optional pickPeerHost(List peerAddrs) { String host = addr.getHost(); try { InetAddress inetAddress = InetAddress.getByName(host); + if (inetAddress instanceof Inet6Address) { + // ignore IPv6 addresses + continue; + } if (inetAddress.isSiteLocalAddress() || inetAddress.isLinkLocalAddress()) { localAddr = host; } else { diff --git a/contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSSubScan.java b/contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSSubScan.java index 4b6f03db78f..1aa7ddbca1e 100644 --- a/contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSSubScan.java +++ b/contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSSubScan.java @@ -35,7 +35,6 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; import io.ipfs.multihash.Multihash; import org.apache.drill.common.PlanStringBuilder; -import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.physical.base.AbstractBase; import org.apache.drill.exec.physical.base.PhysicalOperator; @@ -65,7 +64,7 @@ public IPFSSubScan(@JacksonInject StoragePluginRegistry registry, @JsonProperty("IPFSSubScanSpec") @JsonDeserialize(using=MultihashDeserializer.class) List ipfsSubScanSpecList, @JsonProperty("format") IPFSScanSpec.Format format, @JsonProperty("columns") List columns - ) throws ExecutionSetupException { + ) { super((String) null); IPFSStoragePlugin plugin = registry.resolve(ipfsStoragePluginConfig, IPFSStoragePlugin.class); ipfsContext = plugin.getIPFSContext(); @@ -174,7 +173,7 @@ static class MultihashDeserializer extends JsonDeserializer> { @Override public List deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { - assert jp.nextToken() == JsonToken.START_ARRAY; + assert jp.currentToken() == JsonToken.START_ARRAY; List multihashList = new ArrayList<>(); while (jp.nextToken() != JsonToken.END_ARRAY) { diff --git a/contrib/storage-ipfs/src/test/resources/bootstrap-storage-plugins.json b/contrib/storage-ipfs/src/test/resources/bootstrap-storage-plugins.json index 4a17ce7f8fa..87922f7ca49 100644 --- a/contrib/storage-ipfs/src/test/resources/bootstrap-storage-plugins.json +++ b/contrib/storage-ipfs/src/test/resources/bootstrap-storage-plugins.json @@ -6,11 +6,11 @@ "port": 5001, "max-nodes-per-leaf": 1, "ipfs-timeouts": { - "find-provider": 2, - "find-peer-info": 2, - "fetch-data": 2 + "find-provider": 1, + "find-peer-info": 1, + "fetch-data": 1 }, - "groupscan-worker-threads": 50, + "groupscan-worker-threads": 5, "formats": null, "enabled": true }