Print current trusted_uri_pattern is error msg
(cherry picked from commit ac18bbf5ca41248435fbab42ee16ded910685fef)
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index 930c005..81128bd 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -1084,6 +1084,11 @@
loadIoTConsensusProps(properties);
loadPipeConsensusProps(properties);
+
+ // update query_sample_throughput_bytes_per_sec
+ loadQuerySampleThroughput(properties);
+ // update trusted_uri_pattern
+ loadTrustedUriPattern(properties);
}
private void reloadConsensusProps(Properties properties) throws IOException {
@@ -2006,48 +2011,9 @@
}
// update query_sample_throughput_bytes_per_sec
- String querySamplingRateLimitNumber =
- Optional.ofNullable(
- properties.getProperty(
- "query_sample_throughput_bytes_per_sec",
- ConfigurationFileUtils.getConfigurationDefaultValue(
- "query_sample_throughput_bytes_per_sec")))
- .map(String::trim)
- .orElse(
- ConfigurationFileUtils.getConfigurationDefaultValue(
- "query_sample_throughput_bytes_per_sec"));
- if (querySamplingRateLimitNumber != null) {
- try {
- int rateLimit = Integer.parseInt(querySamplingRateLimitNumber);
- commonDescriptor.getConfig().setQuerySamplingRateLimit(rateLimit);
- } catch (Exception e) {
- LOGGER.warn(
- "Failed to parse query_sample_throughput_bytes_per_sec {} to integer",
- querySamplingRateLimitNumber);
- }
- }
-
+ loadQuerySampleThroughput(properties);
// update trusted_uri_pattern
- String trustedUriPattern =
- Optional.ofNullable(
- properties.getProperty(
- "trusted_uri_pattern",
- ConfigurationFileUtils.getConfigurationDefaultValue("trusted_uri_pattern")))
- .map(String::trim)
- .orElse(ConfigurationFileUtils.getConfigurationDefaultValue("trusted_uri_pattern"));
- Pattern pattern;
- if (trustedUriPattern != null) {
- try {
- pattern = Pattern.compile(trustedUriPattern);
- } catch (Exception e) {
- LOGGER.warn("Failed to parse trusted_uri_pattern {}", trustedUriPattern);
- pattern = commonDescriptor.getConfig().getTrustedUriPattern();
- }
- } else {
- pattern = commonDescriptor.getConfig().getTrustedUriPattern();
- }
- commonDescriptor.getConfig().setTrustedUriPattern(pattern);
-
+ loadTrustedUriPattern(properties);
} catch (Exception e) {
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
@@ -2056,6 +2022,51 @@
}
}
+ private void loadQuerySampleThroughput(Properties properties) throws IOException {
+ String querySamplingRateLimitNumber =
+ Optional.ofNullable(
+ properties.getProperty(
+ "query_sample_throughput_bytes_per_sec",
+ ConfigurationFileUtils.getConfigurationDefaultValue(
+ "query_sample_throughput_bytes_per_sec")))
+ .map(String::trim)
+ .orElse(
+ ConfigurationFileUtils.getConfigurationDefaultValue(
+ "query_sample_throughput_bytes_per_sec"));
+ if (querySamplingRateLimitNumber != null) {
+ try {
+ int rateLimit = Integer.parseInt(querySamplingRateLimitNumber);
+ commonDescriptor.getConfig().setQuerySamplingRateLimit(rateLimit);
+ } catch (Exception e) {
+ LOGGER.warn(
+ "Failed to parse query_sample_throughput_bytes_per_sec {} to integer",
+ querySamplingRateLimitNumber);
+ }
+ }
+ }
+
+ private void loadTrustedUriPattern(Properties properties) throws IOException {
+ String trustedUriPattern =
+ Optional.ofNullable(
+ properties.getProperty(
+ "trusted_uri_pattern",
+ ConfigurationFileUtils.getConfigurationDefaultValue("trusted_uri_pattern")))
+ .map(String::trim)
+ .orElse(ConfigurationFileUtils.getConfigurationDefaultValue("trusted_uri_pattern"));
+ Pattern pattern;
+ if (trustedUriPattern != null) {
+ try {
+ pattern = Pattern.compile(trustedUriPattern);
+ } catch (Exception e) {
+ LOGGER.warn("Failed to parse trusted_uri_pattern {}", trustedUriPattern);
+ pattern = commonDescriptor.getConfig().getTrustedUriPattern();
+ }
+ } else {
+ pattern = commonDescriptor.getConfig().getTrustedUriPattern();
+ }
+ commonDescriptor.getConfig().setTrustedUriPattern(pattern);
+ }
+
public synchronized void loadHotModifiedProps() throws QueryProcessException {
URL url = getPropsUrl(CommonConfig.SYSTEM_CONFIG_NAME);
if (url == null) {
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/ConfigTaskVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/ConfigTaskVisitor.java
index 2f3b758..91b539e 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/ConfigTaskVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/ConfigTaskVisitor.java
@@ -172,6 +172,7 @@
import org.apache.tsfile.exception.NotImplementedException;
+import static org.apache.iotdb.commons.executable.ExecutableManager.getUnTrustedUriErrorMsg;
import static org.apache.iotdb.commons.executable.ExecutableManager.isUriTrusted;
public class ConfigTaskVisitor extends StatementVisitor<IConfigTask, MPPQueryContext> {
@@ -327,7 +328,7 @@
return new CreateFunctionTask(createFunctionStatement);
} else {
// user specified uri and that uri is not trusted
- throw new SemanticException("Untrusted uri " + createFunctionStatement.getUriString());
+ throw new SemanticException(getUnTrustedUriErrorMsg(createFunctionStatement.getUriString()));
}
}
@@ -354,7 +355,7 @@
return new CreateTriggerTask(createTriggerStatement);
} else {
// user specified uri and that uri is not trusted
- throw new SemanticException("Untrusted uri " + createTriggerStatement.getUriString());
+ throw new SemanticException(getUnTrustedUriErrorMsg(createTriggerStatement.getUriString()));
}
}
@@ -380,7 +381,8 @@
return new CreatePipePluginTask(createPipePluginStatement);
} else {
// user specified uri and that uri is not trusted
- throw new SemanticException("Untrusted uri " + createPipePluginStatement.getUriString());
+ throw new SemanticException(
+ getUnTrustedUriErrorMsg(createPipePluginStatement.getUriString()));
}
}
@@ -633,7 +635,7 @@
return new CreateModelTask(createModelStatement, context);
} else {
// user specified uri and that uri is not trusted
- throw new SemanticException("Untrusted uri " + createModelStatement.getUri());
+ throw new SemanticException(getUnTrustedUriErrorMsg(createModelStatement.getUri()));
}
}
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/executable/ExecutableManager.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/executable/ExecutableManager.java
index b00276d..093e094 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/executable/ExecutableManager.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/executable/ExecutableManager.java
@@ -287,4 +287,10 @@
public static boolean isUriTrusted(String uri) {
return CommonDescriptor.getInstance().getConfig().getTrustedUriPattern().matcher(uri).matches();
}
+
+ public static String getUnTrustedUriErrorMsg(String uri) {
+ return String.format(
+ "Untrusted uri %s, current trusted_uri_pattern is %s",
+ uri, CommonDescriptor.getInstance().getConfig().getTrustedUriPattern());
+ }
}