morningman commented on code in PR #57004: URL: https://github.com/apache/doris/pull/57004#discussion_r2467746685
########## fe/fe-core/src/main/java/org/apache/doris/datasource/connectivity/CatalogConnectivityTestCoordinator.java: ########## @@ -0,0 +1,319 @@ +// 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.connectivity; + +import org.apache.doris.common.DdlException; +import org.apache.doris.datasource.property.metastore.HiveGlueMetaStoreProperties; +import org.apache.doris.datasource.property.metastore.HiveHMSProperties; +import org.apache.doris.datasource.property.metastore.IcebergGlueMetaStoreProperties; +import org.apache.doris.datasource.property.metastore.IcebergHMSMetaStoreProperties; +import org.apache.doris.datasource.property.metastore.IcebergRestProperties; +import org.apache.doris.datasource.property.metastore.IcebergS3TablesMetaStoreProperties; +import org.apache.doris.datasource.property.metastore.MetastoreProperties; +import org.apache.doris.datasource.property.storage.HdfsProperties; +import org.apache.doris.datasource.property.storage.MinioProperties; +import org.apache.doris.datasource.property.storage.S3Properties; +import org.apache.doris.datasource.property.storage.StorageProperties; + +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.Map; + +/** + * Coordinator for catalog connectivity testing. + * This class orchestrates the testing of metadata services and storage systems + * when creating external catalogs with test_connection=true. + */ +public class CatalogConnectivityTestCoordinator { + private static final Logger LOG = LogManager.getLogger(CatalogConnectivityTestCoordinator.class); + + private final String catalogName; + private final MetastoreProperties metastoreProperties; + private final Map<StorageProperties.Type, StorageProperties> storagePropertiesMap; + + private String warehouseLocation; + + public CatalogConnectivityTestCoordinator( + String catalogName, + MetastoreProperties metastoreProperties, + Map<StorageProperties.Type, StorageProperties> storagePropertiesMap) { + this.catalogName = catalogName; + this.metastoreProperties = metastoreProperties; + this.storagePropertiesMap = storagePropertiesMap; + } + + /** + * Run all connectivity tests for the catalog. + * + * @throws DdlException if any test fails + */ + public void runTests() throws DdlException { + // 1. Test metadata service + testMetadataService(); + + // 2. Test object storage for warehouse (if applicable) + if (shouldTestObjectStorage()) { Review Comment: you call `findMatchingObjectStorage()` in both `shouldTestObjectStorage()` and `testObjectStorageForWarehouse()`. Can only call once -- 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]
