[repository-azure] Update to the latest Azure Storage SDK v12, remove privileged runnable wrapper in favor of access helper (#1521)

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
This commit is contained in:
Andriy Redko 2021-11-11 15:57:34 -05:00 committed by GitHub
parent 37233a9280
commit 0e6b0c5b4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 24 additions and 24 deletions

View File

@ -44,9 +44,9 @@ opensearchplugin {
}
dependencies {
api 'com.azure:azure-core:1.20.0'
api 'com.azure:azure-storage-common:12.12.0'
api 'com.azure:azure-core-http-netty:1.11.0'
api 'com.azure:azure-core:1.22.0'
api 'com.azure:azure-storage-common:12.14.0'
api 'com.azure:azure-core-http-netty:1.11.2'
api "io.netty:netty-codec-dns:${versions.netty}"
api "io.netty:netty-codec-socks:${versions.netty}"
api "io.netty:netty-codec-http2:${versions.netty}"
@ -54,12 +54,12 @@ dependencies {
api "io.netty:netty-resolver-dns:${versions.netty}"
api "io.netty:netty-transport-native-unix-common:${versions.netty}"
implementation project(':modules:transport-netty4')
api 'com.azure:azure-storage-blob:12.13.0'
api 'com.azure:azure-storage-blob:12.14.1'
api 'org.reactivestreams:reactive-streams:1.0.3'
api 'io.projectreactor:reactor-core:3.4.11'
api 'io.projectreactor.netty:reactor-netty:1.0.12'
api 'io.projectreactor.netty:reactor-netty-core:1.0.12'
api 'io.projectreactor.netty:reactor-netty-http:1.0.12'
api 'io.projectreactor.netty:reactor-netty:1.0.13'
api 'io.projectreactor.netty:reactor-netty-core:1.0.13'
api 'io.projectreactor.netty:reactor-netty-http:1.0.13'
api "org.slf4j:slf4j-api:${versions.slf4j}"
api "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}"
api "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}"

View File

@ -1 +0,0 @@
a98c6bd18aa2066ecd8b39bf7ac51bd8e7307851

View File

@ -0,0 +1 @@
194b21b804c20c85f7d2a6199280075f6747e188

View File

@ -1 +0,0 @@
2177ae2dc9cff849e49f9180bf6b95b8e2c78e1b

View File

@ -0,0 +1 @@
7d84ec31d73a7b51bc72044789768b25fb2b14f4

View File

@ -1 +0,0 @@
2743c7489761b18da1f578d934bb0b0363c2b2db

View File

@ -0,0 +1 @@
384763aef32d779ee22ef3faa03049fee7e0f6de

View File

@ -1 +0,0 @@
3657650e3e17ce1f82b3a6fc5b68ba1005b869f9

View File

@ -0,0 +1 @@
ed58d3438a7fa3a2a5e9f60c0111795101dc8bf6

View File

@ -1 +0,0 @@
4765023130d1dc1e8ec3e5e7842564953cf549db

View File

@ -0,0 +1 @@
cf216a9ba6b50210664761add9db744c9c3f51d8

View File

@ -1 +0,0 @@
2b5b9fee56a6e492db277cd27e8baa7e1988e3cd

View File

@ -0,0 +1 @@
a67949c5946dd66c7ab0a3b059213c23345c32b1

View File

@ -1 +0,0 @@
494c9d45bc4de180e2eb911d1af7077c80740276

View File

@ -0,0 +1 @@
de7a38101098db9438c18fdd09acc5b79a2ec02a

View File

@ -46,6 +46,7 @@ import com.azure.core.http.ProxyOptions;
import com.azure.core.http.ProxyOptions.Type;
import com.azure.core.http.netty.NettyAsyncHttpClientBuilder;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.util.Configuration;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.BlobServiceClient;
@ -67,9 +68,7 @@ import org.opensearch.common.unit.ByteSizeValue;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URISyntaxException;
import java.security.AccessController;
import java.security.InvalidKeyException;
import java.security.PrivilegedAction;
import java.time.Duration;
import java.util.Arrays;
import java.util.HashMap;
@ -103,6 +102,14 @@ public class AzureStorageService implements AutoCloseable {
volatile Map<String, AzureStorageSettings> storageSettings = emptyMap();
private final Map<AzureStorageSettings, ClientState> clients = new ConcurrentHashMap<>();
static {
// See please:
// - https://github.com/Azure/azure-sdk-for-java/issues/24373
// - https://github.com/Azure/azure-sdk-for-java/pull/25004
// - https://github.com/Azure/azure-sdk-for-java/pull/24374
Configuration.getGlobalConfiguration().put("AZURE_JACKSON_ADAPTER_USE_ACCESS_HELPER", "true");
}
public AzureStorageService(Settings settings) {
// eagerly load client settings so that secure settings are read
final Map<String, AzureStorageSettings> clientsSettings = AzureStorageSettings.load(settings);
@ -366,14 +373,7 @@ public class AzureStorageService implements AutoCloseable {
}
public Thread newThread(Runnable r) {
// See please: https://github.com/Azure/azure-sdk-for-java/pull/24374
final Runnable priviledged = () -> {
AccessController.doPrivileged((PrivilegedAction<?>) () -> {
r.run();
return null;
});
};
final Thread t = new Thread(group, priviledged, namePrefix + threadNumber.getAndIncrement(), 0);
final Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
if (t.isDaemon()) {
t.setDaemon(false);