github-actions[bot] commented on code in PR #70980:
URL: https://github.com/apache/doris/pull/70980#discussion_r4690435676
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/metastore/AbstractIcebergProperties.java:
##########
@@ -257,12 +295,42 @@ public void toFileIOProperties(List<StorageProperties>
storagePropertiesList,
fileIOProperties.put(AwsClientProperties.CLIENT_REGION,
region);
}
}
- if (IcebergExternalCatalog.ICEBERG_REST.equals(getIcebergCatalogType())
- &&
!Boolean.parseBoolean(origProps.get("iceberg.rest.vended-credentials-enabled"))
- && (s3Target instanceof GCSProperties
- || origProps.keySet().stream().anyMatch(key ->
key.startsWith("fs.gs.")))) {
- // Adding iceberg-gcp must not route HMAC-backed gs:// files to
GCSFileIO's ADC identity.
- fileIOProperties.putIfAbsent(CatalogProperties.FILE_IO_IMPL,
NativeGcsResolvingFileIO.class.getName());
+ preserveHadoopGcsFileIO(storagePropertiesList, fileIOProperties, conf);
+ }
+
+ protected void preserveHadoopGcsFileIO(List<StorageProperties>
storagePropertiesList,
+ Map<String, String> fileIOProperties, Configuration conf) {
+ boolean rest =
IcebergExternalCatalog.ICEBERG_REST.equals(getIcebergCatalogType());
+ String ioImpl = fileIOProperties.get(CatalogProperties.FILE_IO_IMPL);
+ if (!ResolvingFileIO.class.getName().equals(ioImpl) && !(rest &&
ioImpl == null)) {
+ return;
+ }
+ if (rest && ((IcebergRestProperties)
this).isIcebergRestVendedCredentialsEnabled()) {
+ return;
+ }
+ AbstractS3CompatibleProperties s3Target = null;
+ for (StorageProperties storage :
IcebergUtils.selectEffectiveStorageProperties(storagePropertiesList)) {
+ if (storage instanceof AbstractS3CompatibleProperties) {
+ s3Target = (AbstractS3CompatibleProperties) storage;
+ }
+ }
+ boolean hadoopGcs = s3Target instanceof GCSProperties
+ || origProps.keySet().stream().anyMatch(key ->
key.startsWith("fs.gs."));
+ if (!hadoopGcs && conf != null) {
+ // Resource files populate the effective configuration without
adding keys to the original properties.
+ for (Map.Entry<String, String> entry : conf) {
+ if (entry.getKey().startsWith("fs.gs.")) {
+ hadoopGcs = true;
+ break;
+ }
+ }
+ }
+ boolean nativeGcpCredentials = s3Target instanceof GCSProperties
+ && ((GCSProperties) s3Target).hasGcpCredential();
+ // Adding iceberg-gcp must preserve existing Hadoop identities,
including explicit non-REST resolvers.
+ if (hadoopGcs && ((rest && ioImpl == null)
+ || (!nativeGcpCredentials &&
ResolvingFileIO.class.getName().equals(ioImpl)))) {
Review Comment:
[P2] Preserve native SDK tokens before replacing a generic resolver
With `io-impl=org.apache.iceberg.io.ResolvingFileIO` (or the REST alias), a
valid `gcs.oauth2.token`, vending disabled, and an effective `fs.gs.impl`
setting, this now replaces the explicit resolver even when no HMAC credentials
exist. If there is no Doris `gs.*` selector or client-side `gs://` warehouse,
storage detection supplies the HDFS fallback, so `nativeGcpCredentials` is
false. The previous `putIfAbsent` preserved the explicit resolver.
The replacement routes `gs://` through `HadoopFileIO`, which never consumes
the supplied SDK bearer token; the normal SDK delegate does consume it ([token
selection](https://github.com/apache/iceberg/blob/apache-iceberg-1.11.0/gcp/src/main/java/org/apache/iceberg/gcp/gcs/PrefixedStorage.java#L140-L153)).
Consequently, metadata reads that worked with the supplied token fail when the
Hadoop identity lacks bucket access. This also occurs when `fs.gs.*` comes from
XML resources. Preserve explicit native SDK authentication before forcing the
Hadoop fallback, and cover this combination in the routing tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]