From 8ca2e60888bef068874ac59689b56109def02a43 Mon Sep 17 00:00:00 2001 From: chenjian2664 Date: Tue, 14 Oct 2025 17:12:21 +0800 Subject: [PATCH] Remove deprecated `gcs.use-access-token` from gcs filesystem --- .../sphinx/object-storage/file-system-gcs.md | 3 - .../filesystem/gcs/GcsFileSystemConfig.java | 21 ------ .../gcs/TestGcsFileSystemConfig.java | 73 +------------------ 3 files changed, 1 insertion(+), 96 deletions(-) diff --git a/docs/src/main/sphinx/object-storage/file-system-gcs.md b/docs/src/main/sphinx/object-storage/file-system-gcs.md index 49df7ca4a86f..eb1b74fb8d2e 100644 --- a/docs/src/main/sphinx/object-storage/file-system-gcs.md +++ b/docs/src/main/sphinx/object-storage/file-system-gcs.md @@ -68,9 +68,6 @@ Cloud Storage: * - Property - Description -* - `gcs.use-access-token` - - Flag to set usage of a client-provided OAuth 2.0 token to access Google - Cloud Storage. Defaults to `false`, deprecated to use `gcs.auth-type` instead. * - `gcs.auth-type` - Authentication type to use for Google Cloud Storage access. Default to `SERVICE_ACCOUNT`. Supported values are: diff --git a/lib/trino-filesystem-gcs/src/main/java/io/trino/filesystem/gcs/GcsFileSystemConfig.java b/lib/trino-filesystem-gcs/src/main/java/io/trino/filesystem/gcs/GcsFileSystemConfig.java index 1f94873a389e..21f6ca2c76c9 100644 --- a/lib/trino-filesystem-gcs/src/main/java/io/trino/filesystem/gcs/GcsFileSystemConfig.java +++ b/lib/trino-filesystem-gcs/src/main/java/io/trino/filesystem/gcs/GcsFileSystemConfig.java @@ -21,7 +21,6 @@ import io.airlift.units.Duration; import io.airlift.units.MinDuration; import jakarta.annotation.Nullable; -import jakarta.validation.constraints.AssertFalse; import jakarta.validation.constraints.AssertTrue; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotNull; @@ -158,20 +157,6 @@ public GcsFileSystemConfig setAuthType(AuthType authType) return this; } - @Deprecated - public boolean isUseGcsAccessToken() - { - return useGcsAccessToken.orElse(false); - } - - @Deprecated - @Config("gcs.use-access-token") - public GcsFileSystemConfig setUseGcsAccessToken(boolean useGcsAccessToken) - { - this.useGcsAccessToken = Optional.of(useGcsAccessToken); - return this; - } - @Nullable public String getJsonKey() { @@ -303,10 +288,4 @@ public boolean isAuthMethodValid() return (jsonKey == null) ^ (jsonKeyFilePath == null); } - - @AssertFalse(message = "Cannot set both gcs.use-access-token and gcs.auth-type") - public boolean isAuthTypeAndGcsAccessTokenConfigured() - { - return authType.isPresent() && useGcsAccessToken.isPresent(); - } } diff --git a/lib/trino-filesystem-gcs/src/test/java/io/trino/filesystem/gcs/TestGcsFileSystemConfig.java b/lib/trino-filesystem-gcs/src/test/java/io/trino/filesystem/gcs/TestGcsFileSystemConfig.java index 179bce9cb78c..c9bf3a34c878 100644 --- a/lib/trino-filesystem-gcs/src/test/java/io/trino/filesystem/gcs/TestGcsFileSystemConfig.java +++ b/lib/trino-filesystem-gcs/src/test/java/io/trino/filesystem/gcs/TestGcsFileSystemConfig.java @@ -17,7 +17,6 @@ import io.airlift.units.DataSize; import io.airlift.units.Duration; import io.trino.filesystem.gcs.GcsFileSystemConfig.AuthType; -import jakarta.validation.constraints.AssertFalse; import jakarta.validation.constraints.AssertTrue; import org.junit.jupiter.api.Test; @@ -43,7 +42,6 @@ void testDefaults() .setWriteBlockSize(DataSize.of(16, MEGABYTE)) .setPageSize(100) .setBatchSize(100) - .setUseGcsAccessToken(false) .setProjectId(null) .setEndpoint(Optional.empty()) .setAuthType(AuthType.SERVICE_ACCOUNT) @@ -90,44 +88,7 @@ void testExplicitPropertyMappings() .setMinBackoffDelay(new Duration(20, MILLISECONDS)) .setMaxBackoffDelay(new Duration(20, MILLISECONDS)) .setApplicationId("application id"); - assertFullMapping(properties, expected, Set.of("gcs.json-key", "gcs.json-key-file-path", "gcs.use-access-token")); - } - - // backwards compatibility test, remove if use-access-token is removed - @Test - void testExplicitPropertyMappingsWithDeprecatedUseAccessToken() - { - Map properties = ImmutableMap.builder() - .put("gcs.read-block-size", "51MB") - .put("gcs.write-block-size", "52MB") - .put("gcs.page-size", "10") - .put("gcs.batch-size", "11") - .put("gcs.project-id", "project") - .put("gcs.endpoint", "http://custom.dns.org:8000") - .put("gcs.use-access-token", "true") - .put("gcs.client.max-retries", "10") - .put("gcs.client.backoff-scale-factor", "4.0") - .put("gcs.client.max-retry-time", "10s") - .put("gcs.client.min-backoff-delay", "20ms") - .put("gcs.client.max-backoff-delay", "20ms") - .put("gcs.application-id", "application id") - .buildOrThrow(); - - GcsFileSystemConfig expected = new GcsFileSystemConfig() - .setReadBlockSize(DataSize.of(51, MEGABYTE)) - .setWriteBlockSize(DataSize.of(52, MEGABYTE)) - .setPageSize(10) - .setBatchSize(11) - .setProjectId("project") - .setEndpoint(Optional.of("http://custom.dns.org:8000")) - .setUseGcsAccessToken(true) - .setMaxRetries(10) - .setBackoffScaleFactor(4.0) - .setMaxRetryTime(new Duration(10, SECONDS)) - .setMinBackoffDelay(new Duration(20, MILLISECONDS)) - .setMaxBackoffDelay(new Duration(20, MILLISECONDS)) - .setApplicationId("application id"); - assertFullMapping(properties, expected, Set.of("gcs.json-key", "gcs.json-key-file-path", "gcs.auth-type")); + assertFullMapping(properties, expected, Set.of("gcs.json-key", "gcs.json-key-file-path")); } @Test @@ -165,37 +126,5 @@ public void testValidation() "retryDelayValid", "gcs.client.min-backoff-delay must be less than or equal to gcs.client.max-backoff-delay", AssertTrue.class); - - assertFailsValidation( - new GcsFileSystemConfig() - .setAuthType(AuthType.ACCESS_TOKEN) - .setUseGcsAccessToken(true), - "authTypeAndGcsAccessTokenConfigured", - "Cannot set both gcs.use-access-token and gcs.auth-type", - AssertFalse.class); - - assertFailsValidation( - new GcsFileSystemConfig() - .setAuthType(AuthType.ACCESS_TOKEN) - .setUseGcsAccessToken(false), - "authTypeAndGcsAccessTokenConfigured", - "Cannot set both gcs.use-access-token and gcs.auth-type", - AssertFalse.class); - - assertFailsValidation( - new GcsFileSystemConfig() - .setUseGcsAccessToken(true) - .setAuthType(AuthType.SERVICE_ACCOUNT), - "authTypeAndGcsAccessTokenConfigured", - "Cannot set both gcs.use-access-token and gcs.auth-type", - AssertFalse.class); - - assertFailsValidation( - new GcsFileSystemConfig() - .setUseGcsAccessToken(false) - .setAuthType(AuthType.SERVICE_ACCOUNT), - "authTypeAndGcsAccessTokenConfigured", - "Cannot set both gcs.use-access-token and gcs.auth-type", - AssertFalse.class); } }