AWS: s3.preload-client-enabled no longer creates the S3 client in S3FileIO.initialize()
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start in S3FileIO.initialize() and clientByPrefix(), where the S3 client is created lazily, and compare with the PrefixedS3Client constructor that checks S3FileIOProperties.PRELOAD_CLIENT_ENABLED. Add the counting-factory test from the issue to TestS3FileIOProperties or the S3FileIO tests and confirm it fails. Before changing code, settle the open Lake Formation question with the maintainers, since it decides whether to restore the eager client() call in initialize() or deprecate the flag and stop setting it in GlueCatalog.newTableOps.
Written by the indexing model from the issue text.
Description
Problem
Since 1.10.0, s3.preload-client-enabled (S3FileIOProperties.PRELOAD_CLIENT_ENABLED) no longer creates the S3 client in S3FileIO.initialize(), although its Javadoc still says: "This flag controls whether the S3 client will be initialized during the S3FileIO initialization, instead of default lazy initialization upon use."
Up to 1.9.x, initialize() called client() when the flag was set. #12799 moved client creation into PrefixedS3Client and the flag check into its constructor, but S3FileIO creates its PrefixedS3Clients lazily in clientByPrefix() on the first file operation. So initialize() no longer creates any client, and the flag only makes the sync client get built together with the client map. Nothing tests the eager behavior: TestS3FileIOProperties only checks that the flag is parsed.
Reproduction
This test fails on main:
private static final AtomicInteger S3_CLIENTS = new AtomicInteger();
@Test
void preloadCreatesClientInInitialize() {
try (S3FileIO fileIO = new S3FileIO()) {
fileIO.initialize(
ImmutableMap.of(
S3FileIOProperties.CLIENT_FACTORY,
CountingFactory.class.getName(),
S3FileIOProperties.PRELOAD_CLIENT_ENABLED,
"true"));
assertThat(S3_CLIENTS).hasValue(1);
}
}
public static class CountingFactory implements S3FileIOAwsClientFactory {
@Override
public S3Client s3() {
S3_CLIENTS.incrementAndGet();
return Mockito.mock(S3Client.class);
}
@Override
public S3AsyncClient s3Async() {
return Mockito.mock(S3AsyncClient.class);
}
@Override
public void initialize(Map<String, String> properties) {}
}
java.lang.AssertionError:
Expecting AtomicInteger(0) to have value:
1
but did not.
Lake Formation
The only in-tree user is GlueCatalog.newTableOps, which sets the flag for every table when glue.lakeformation-enabled is true (#5756). The eager behavior is also what broke #10226 (create table) and #14766 (loading a missing table from Kafka Connect): newTableOps initializes the table's FileIO right away (today through FileIOTracker.track), so initialize() reached LakeFormationAwsClientFactory.isTableRegisteredWithLakeFormation() before the Glue table existed and threw Glue's EntityNotFoundException. Since #12799, S3FileIO.initialize() no longer calls the factory's s3(), so that path is gone.
Question
Does Lake Formation still need the client to be created in initialize()?
- If it does: restore the
client()call inS3FileIO.initialize()(storage credentials are already set by then, becauseCatalogUtil.loadFileIOcallssetCredentialsfirst), cover it with the test above, and keepGlueCatalogfrom requesting preload for a table that does not exist yet, so #10226 does not come back. - If it does not: deprecate the flag and stop setting it in
GlueCatalog.
cc @xiaoxuandev @jackye1995 @singhpk234
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 3.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 170
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/iceberg
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Spark: Test INSERT targets with computed IDENTIFIER expressionsPossibly taken @shivadarshan-devadiga claimed this 15 days ago. Openimprovement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
[Core] TestAvroPartitionStatsHandler fails on Windows due to unclosed partition statistics scanPossibly taken @Ankitkj1999 claimed this 17 days ago. Open
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Core: TableMetadata.Builder allows adding encryption keys to v1/v2 tablesPossibly taken @yusufyildiz34 claimed this 37 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/iceberg#18632 · 1 comment ·
Maintainers usually reply within 1 day
-
Kafka: Filter empty strings and whitespace in IcebergSinkConfig stringToListPossibly taken @mohamed-elbrik claimed this 42 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 92/100
HexaHexes/neoforge-mod-template#124 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
OpenLiberty/open-liberty#36410 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
erkamyaman/rust-anything#1153 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Card-Forge/forge#13173 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day