Skip to content

Commit

Permalink
Fix TestIPFSQueries not passing.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbw9580 committed Aug 14, 2020
1 parent 39bab37 commit 9494a30
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 28 deletions.
27 changes: 6 additions & 21 deletions contrib/storage-ipfs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.github.dbw9580</groupId>
<artifactId>java-ipfs-http-client</artifactId>
<version>v1.3.3</version>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.apache.drill.exec</groupId>
Expand All @@ -40,27 +46,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.github.dbw9580</groupId>
<artifactId>java-ipfs-http-client</artifactId>
<version>v1.3.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.0</version>
</dependency>

</dependencies>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -233,6 +237,10 @@ public static Optional<String> pickPeerHost(List<MultiAddress> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -65,7 +64,7 @@ public IPFSSubScan(@JacksonInject StoragePluginRegistry registry,
@JsonProperty("IPFSSubScanSpec") @JsonDeserialize(using=MultihashDeserializer.class) List<Multihash> ipfsSubScanSpecList,
@JsonProperty("format") IPFSScanSpec.Format format,
@JsonProperty("columns") List<SchemaPath> columns
) throws ExecutionSetupException {
) {
super((String) null);
IPFSStoragePlugin plugin = registry.resolve(ipfsStoragePluginConfig, IPFSStoragePlugin.class);
ipfsContext = plugin.getIPFSContext();
Expand Down Expand Up @@ -174,7 +173,7 @@ static class MultihashDeserializer extends JsonDeserializer<List<Multihash>> {
@Override
public List<Multihash> deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException {
assert jp.nextToken() == JsonToken.START_ARRAY;
assert jp.currentToken() == JsonToken.START_ARRAY;

List<Multihash> multihashList = new ArrayList<>();
while (jp.nextToken() != JsonToken.END_ARRAY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 9494a30

Please sign in to comment.