github-actions[bot] commented on code in PR #66913: URL: https://github.com/apache/doris/pull/66913#discussion_r3870564437
########## fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/DorisHiveCatalog.java: ########## @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.datasource.iceberg; + +import com.google.common.base.Throwables; +import org.apache.iceberg.hive.HiveCatalog; +import org.apache.iceberg.io.FileIO; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; + +/** Owns and closes the shared FileIO created by one Iceberg HiveCatalog generation. */ +public class DorisHiveCatalog extends HiveCatalog { + private final AtomicBoolean closed = new AtomicBoolean(); + private FileIO ownedFileIO; + + @Override + public void initialize(String name, Map<String, String> properties) { Review Comment: [P1] Close the shared FileIO when initialization fails Iceberg's `HiveCatalog.initialize()` assigns its shared `fileIO` before it constructs/parses `CachedClientPool`. If a later property error (for example an invalid `client.pool.cache.keys` value) throws, this override never reaches `ownedFileIO = extractFileIO()`; the factory discards the partial catalog, so neither the tracker nor `onClose` can release that IO. Repeated lazy initialization then leaks one FileIO per attempt. This is distinct from the existing close-path threads because this catalog never finishes initialization or reaches `close()`. Make initialization failure-atomic by recovering and closing the partial parent resource before rethrowing, and cover a close-tracking custom FileIO with a failing client-pool configuration. -- 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]
