Skip to content

Commit

Permalink
Use OkHttp client in AzureFileSystem
Browse files Browse the repository at this point in the history
Switch to using the OkHttp client for the AzureFileSystem as it is
lighter weight and serves the same purpose as the netty http client
that is currently being used
  • Loading branch information
charlesjmorgan committed Sep 7, 2023
1 parent 1aca030 commit a907801
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
25 changes: 25 additions & 0 deletions lib/trino-filesystem-azure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,19 @@
</exclusions>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-okhttp</artifactId>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<exclusions>
<exclusion>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
</exclusion>
<exclusion>
<groupId>com.nimbusds</groupId>
<artifactId>oauth2-oidc-sdk</artifactId>
Expand All @@ -48,6 +57,10 @@
<groupId>com.azure</groupId>
<artifactId>azure-storage-blob</artifactId>
<exclusions>
<exclusion>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
Expand All @@ -58,11 +71,23 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-common</artifactId>
<exclusions>
<exclusion>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-file-datalake</artifactId>
<exclusions>
<exclusion>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
package io.trino.filesystem.azure;

import com.azure.core.http.HttpClient;
import com.azure.core.http.okhttp.OkHttpAsyncClientProvider;
import com.azure.core.util.HttpClientOptions;
import com.google.inject.Inject;
import io.airlift.units.DataSize;
import io.trino.filesystem.TrinoFileSystem;
Expand All @@ -26,14 +28,12 @@
public class AzureFileSystemFactory
implements TrinoFileSystemFactory
{
// All file systems share a single HTTP client
private final HttpClient httpClient = HttpClient.createDefault();

private final AzureAuth auth;
private final DataSize readBlockSize;
private final DataSize writeBlockSize;
private final int maxWriteConcurrency;
private final DataSize maxSingleUploadSize;
private final HttpClient httpClient;

@Inject
public AzureFileSystemFactory(AzureAuth azureAuth, AzureFileSystemConfig config)
Expand All @@ -54,6 +54,7 @@ public AzureFileSystemFactory(AzureAuth azureAuth, DataSize readBlockSize, DataS
checkArgument(maxWriteConcurrency >= 0, "maxWriteConcurrency is negative");
this.maxWriteConcurrency = maxWriteConcurrency;
this.maxSingleUploadSize = requireNonNull(maxSingleUploadSize, "maxSingleUploadSize is null");
this.httpClient = HttpClient.createDefault(new HttpClientOptions().setHttpClientProvider(OkHttpAsyncClientProvider.class));
}

@Override
Expand Down

0 comments on commit a907801

Please sign in to comment.