This is an automated email from the ASF dual-hosted git repository.
jiangtian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new a70575f6fdc Correct error messages when encountered
IllegalPathException (#15559)
a70575f6fdc is described below
commit a70575f6fdc07eccce2582dda3cdb18116d0e724
Author: libo <[email protected]>
AuthorDate: Tue May 27 10:26:21 2025 +0800
Correct error messages when encountered IllegalPathException (#15559)
* Addresses an issue where the error log message is inaccurate when an
IllegalPathException occurs.
Addresses an issue where the error log message is inaccurate when an
IllegalPathException occurs cause by a insert sql is executed.
A create sql is added in order to validate if the exception message is
legal when IllegalPathExeption occurs.
* format code
* Fix the issue it scripts can not be past.
---
.../java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java | 12 +++++++++++-
.../plan/analyze/cache/partition/PartitionCache.java | 6 +++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java
index 4df8f79af15..d8bf5466865 100644
---
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java
@@ -165,7 +165,7 @@ public class IoTDBSetConfigurationIT {
statement.execute("INSERT INTO root.fail(timestamp, s1) VALUES (1,
1)");
} catch (SQLException e) {
assertEquals(
- "509: root.fail is not a legal path, because it is no longer than
default sg level: 3",
+ "509: An error occurred when executing
getDeviceToDatabase():root.fail is not a legal path, because it is no longer
than default sg level: 3",
e.getMessage());
}
@@ -176,6 +176,7 @@ public class IoTDBSetConfigurationIT {
assertTrue(e.getMessage().contains("Illegal defaultStorageGroupLevel:
-1, should >= 1"));
}
+ // Failed updates will not change the files.
// Failed updates will not change the files.
assertFalse(
checkConfigFileContains(
@@ -197,6 +198,15 @@ public class IoTDBSetConfigurationIT {
// the default value should take effect
Assert.assertEquals("root.a", databases.getString(1));
assertFalse(databases.next());
+
+ // create timeseries with an illegal path
+ try {
+ statement.execute("CREATE TIMESERIES root.db1.s3 WITH datatype=INT32");
+ } catch (SQLException e) {
+ assertEquals(
+ "509: An error occurred when executing
getDeviceToDatabase():root.db1 is not a legal path, because it is no longer
than default sg level: 3",
+ e.getMessage());
+ }
}
}
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
index cedc295ffed..35e8484bcc9 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
@@ -481,7 +481,11 @@ public class PartitionCache {
throw new StatementAnalyzeException("Failed to get database Map");
}
}
- } catch (final TException | MetadataException | ClientManagerException
e) {
+ } catch (MetadataException e) {
+ throw new IoTDBRuntimeException(
+ "An error occurred when executing getDeviceToDatabase():" +
e.getMessage(),
+ e.getErrorCode());
+ } catch (TException | ClientManagerException e) {
throw new StatementAnalyzeException(
"An error occurred when executing getDeviceToDatabase():" +
e.getMessage(), e);
}