Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,10 @@ public void testFeConnection() throws Exception {
client.headBucket(b -> b.bucket(s3Uri.getBucket()));
}
}

@Override
public String getErrorHint() {
return "Please check S3 credentials (access_key and secret_key or IAM role), "
+ "region, and bucket (warehouse location) access permissions";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.doris.datasource.connectivity;

import org.apache.doris.common.DdlException;
import org.apache.doris.common.util.Util;
import org.apache.doris.datasource.property.metastore.HiveGlueMetaStoreProperties;
import org.apache.doris.datasource.property.metastore.HiveHMSProperties;
import org.apache.doris.datasource.property.metastore.IcebergGlueMetaStoreProperties;
Expand Down Expand Up @@ -94,8 +95,10 @@ private void testMetadataService() throws DdlException {
try {
metaTester.testConnection();
} catch (Exception e) {
throw new DdlException(metaTester.getTestType() + " connectivity test failed: "
+ e.getMessage());
String hint = metaTester.getErrorHint();
String errorMsg = metaTester.getTestType() + " connectivity test failed: " + hint
+ " Root cause: " + Util.getRootCauseMessage(e);
throw new DdlException(errorMsg);
}

// Store warehouse location for later use
Expand Down Expand Up @@ -142,15 +145,20 @@ private void testObjectStorageForWarehouse(StorageProperties testObjectStoragePr
try {
tester.testFeConnection();
} catch (Exception e) {
throw new DdlException(tester.getTestType() + " connectivity test failed: " + e.getMessage());
String hint = tester.getErrorHint();
String errorMsg = tester.getTestType() + " connectivity test failed: " + hint
+ " Root cause: " + Util.getRootCauseMessage(e);
throw new DdlException(errorMsg);
}

// Test BE connection
try {
tester.testBeConnection();
} catch (Exception e) {
throw new DdlException(tester.getTestType()
+ " connectivity test failed (compute node): " + e.getMessage());
String hint = tester.getErrorHint();
String errorMsg = tester.getTestType() + " connectivity test failed (compute node): " + hint
+ " Root cause: " + Util.getRootCauseMessage(e);
throw new DdlException(errorMsg);
}
}

Expand Down Expand Up @@ -240,14 +248,20 @@ private void testExplicitlyConfiguredHdfs() throws DdlException {
try {
tester.testFeConnection();
} catch (Exception e) {
throw new DdlException("HDFS connectivity test failed: " + e.getMessage());
String hint = tester.getErrorHint();
String errorMsg = "HDFS connectivity test failed: " + hint
+ " Root cause: " + Util.getRootCauseMessage(e);
throw new DdlException(errorMsg);
}

// Test BE connection
try {
tester.testBeConnection();
} catch (Exception e) {
throw new DdlException("HDFS connectivity test failed (compute node): " + e.getMessage());
String hint = tester.getErrorHint();
String errorMsg = "HDFS connectivity test failed (compute node): " + hint
+ " Root cause: " + Util.getRootCauseMessage(e);
throw new DdlException(errorMsg);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ public String getTestType() {
return "HDFS";
}

@Override
public String getErrorHint() {
return "Please check HDFS namenode connectivity (fs.defaultFS), user permissions, and "
+ "Kerberos configuration if applicable";
}

@Override
public void testFeConnection() throws Exception {
// TODO: Implement HDFS connectivity test in the future if needed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public String getTestType() {
return "Hive Glue";
}

@Override
public String getErrorHint() {
return "Please check AWS Glue credentials (access_key and secret_key or IAM role), region, "
+ "and endpoint";
}

@Override
public void testConnection() throws Exception {
glueTester.testConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public String getTestType() {
return "Hive HMS";
}

@Override
public String getErrorHint() {
return "Please check Hive Metastore Server connectivity (hive metastore uris)";
}

@Override
public void testConnection() throws Exception {
hmsTester.testConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
import org.apache.doris.datasource.property.metastore.AWSGlueMetaStoreBaseProperties;
import org.apache.doris.datasource.property.metastore.AbstractIcebergProperties;

import org.apache.commons.lang3.StringUtils;

import java.util.regex.Pattern;

public class IcebergGlueMetaStoreConnectivityTester extends AbstractIcebergConnectivityTester {
private static final Pattern S3_LOCATION_PATTERN = Pattern.compile("^(s3|s3a)://.+");
private final AWSGlueMetaStoreBaseConnectivityTester glueTester;

public IcebergGlueMetaStoreConnectivityTester(AbstractIcebergProperties properties,
Expand All @@ -34,8 +39,36 @@ public String getTestType() {
return "Iceberg Glue";
}

@Override
public String getErrorHint() {
return "Please check AWS Glue credentials (access_key and secret_key or IAM role), "
+ "region, warehouse location, and endpoint";
}

@Override
public void testConnection() throws Exception {
glueTester.testConnection();
}

@Override
public String getTestLocation() {
String warehouse = properties.getWarehouse();
if (StringUtils.isBlank(warehouse)) {
return null;
}

String location = validateS3Location(warehouse);
if (location == null) {
throw new IllegalArgumentException(
"Iceberg Glue warehouse location must be in S3 format (s3:// or s3a://), but got: " + warehouse);
}
return location;
}

private String validateS3Location(String location) {
if (StringUtils.isNotBlank(location) && S3_LOCATION_PATTERN.matcher(location).matches()) {
return location;
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public String getTestType() {
return "Iceberg HMS";
}

@Override
public String getErrorHint() {
return "Please check Hive Metastore Server connectivity (hive metastore uris)";
}

@Override
public void testConnection() throws Exception {
hmsTester.testConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ public String getTestType() {
return "Iceberg REST";
}

@Override
public String getErrorHint() {
return "Please check Iceberg REST Catalog URI, authentication credentials (OAuth2 or SigV4), "
+ "warehouse location, and endpoint connectivity";
}

@Override
public void testConnection() throws Exception {
Map<String, String> restProps = ((IcebergRestProperties) properties).getIcebergRestCatalogProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ protected IcebergS3TablesMetaStoreConnectivityTester(
super(properties);
}

@Override
public String getErrorHint() {
return "Please check S3 credentials (access_key and secret_key or IAM role), endpoint, region, "
+ "and warehouse location";
}

@Override
public void testConnection() throws Exception {
// TODO: Implement Iceberg S3 Tables connectivity test in the future if needed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,12 @@ default String getTestLocation() {
default String getTestType() {
return "Meta";
}

/**
* Returns error hint for this connectivity test.
* Subclasses can override to provide specific hints for troubleshooting.
*/
default String getErrorHint() {
return "";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ public MinioConnectivityTester(MinioProperties properties, String testLocation)
public String getTestType() {
return "Minio";
}

@Override
public String getErrorHint() {
return "Please check Minio credentials (access_key and secret_key), "
+ "endpoint, and bucket (warehouse location) access permissions";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ default String getTestType() {
return "Storage";
}

/**
* Returns error hint for this connectivity test.
* Subclasses can override to provide specific hints for troubleshooting.
*/
default String getErrorHint() {
return "";
}

default void testBeConnection() throws Exception {
List<Long> aliveBeIds = Env.getCurrentSystemInfo().getAllBackendIds(true);
if (aliveBeIds.isEmpty()) {
Expand Down
Loading