voonhous commented on code in PR #18837:
URL: https://github.com/apache/hudi/pull/18837#discussion_r3340114462
##########
hudi-trino-plugin/src/main/java/io/trino/plugin/hudi/HudiSplitSource.java:
##########
@@ -104,9 +104,24 @@ public HudiSplitSource(
HoodieTableMetaClient metaClient = tableHandle.getMetaClient();
HoodieEngineContext engineContext = new
HoodieLocalEngineContext(metaClient.getStorage().getConf());
- HoodieTableMetadata tableMetadata = HoodieTableMetadata.create(
- engineContext,
- tableHandle.getMetaClient().getStorage(), metadataConfig,
metaClient.getBasePath().toString(), true);
+ HoodieTableMetadata tableMetadata;
Review Comment:
Addressed in 8b6ff2d. The inlined branch is now a single
`NativeTableMetadataFactory.getInstance().create(engineContext, storage,
metadataConfig, basePath, true)` call, which performs the identical create-MDT
/ check-`isMetadataTableInitialized` /
fall-back-to-`FileSystemBackedTableMetadata` logic (its
`metadataConfig.isEnabled()` check subsumes the old `enableMetadataTable`
branch). Note: there is no static `HoodieTableMetadata.create(...)`; the
factory is the actual entrypoint.
##########
hudi-trino-plugin/src/main/java/io/trino/plugin/hudi/HudiSplitSource.java:
##########
@@ -104,9 +104,24 @@ public HudiSplitSource(
HoodieTableMetaClient metaClient = tableHandle.getMetaClient();
HoodieEngineContext engineContext = new
HoodieLocalEngineContext(metaClient.getStorage().getConf());
- HoodieTableMetadata tableMetadata = HoodieTableMetadata.create(
- engineContext,
- tableHandle.getMetaClient().getStorage(), metadataConfig,
metaClient.getBasePath().toString(), true);
+ HoodieTableMetadata tableMetadata;
+ if (enableMetadataTable) {
+ HoodieBackedTableMetadata mdt = new HoodieBackedTableMetadata(
+ engineContext, metaClient.getStorage(),
metadataConfig, metaClient.getBasePath().toString(), true);
+ if (mdt.isMetadataTableInitialized()) {
+ tableMetadata = mdt;
+ }
+ else {
+ log.warn("Metadata table not initialized on disk for %s;
falling back to FileSystemBackedTableMetadata",
+ tableHandle.getSchemaTableName());
Review Comment:
Now routed through `NativeTableMetadataFactory` in 8b6ff2d. On the
not-initialized path there is effectively nothing to leak:
`HoodieBackedTableMetadata`'s constructor (`initIfNeeded`) leaves
`metadataFileSystemView` null and opens reader caches lazily (only on first
read, which never happens since we fall back), so `close()` is a near no-op
here. The factory follows the same pattern (it also discards the MDT without
closing), so this is no behavior change; centralizing it means any future close
fix in the factory is inherited automatically.
--
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]