This is an automated email from the ASF dual-hosted git repository.
jt2594838 pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/dev/1.3 by this push:
new 3f9a0de93be Fix schema existence check fail-open behavior (#18755)
(#18827)
3f9a0de93be is described below
commit 3f9a0de93be6dc9b5e98fa5333c0fded7e3d5af2
Author: Caideyipi <[email protected]>
AuthorDate: Mon Oct 12 17:25:12 2026 +0800
Fix schema existence check fail-open behavior (#18755) (#18827)
* Fix schema existence check fail-open behavior
* Fix PR 18755 encoding and compilation issues
(cherry picked from commit 0f91bed7544464f3fcb7f46d3bdf8c50669ed9b8)
---
.../iotdb/db/schemaengine/schemaregion/ISchemaRegion.java | 10 ++++------
.../schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java | 10 +++-------
.../schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java | 10 +++-------
.../schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java | 4 +++-
4 files changed, 13 insertions(+), 21 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java
index 7248fe26046..0b1041d3646 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java
@@ -62,7 +62,7 @@ import java.util.Set;
* <p>The interfaces are divided as following:
*
* <ol>
- * <li>Interfaces for initialization、recover and clear
+ * <li>Interfaces for initialization, recover and clear
* <li>Interfaces for schema region Info query and operation
* <li>Interfaces for Timeseries operation
* <li>Interfaces for metadata info Query
@@ -76,7 +76,7 @@ import java.util.Set;
*/
public interface ISchemaRegion {
- // region Interfaces for initialization、recover and clear
+ // region Interfaces for initialization, recover and clear
void init() throws MetadataException;
/** clear all metadata components of this schemaRegion */
@@ -131,10 +131,8 @@ public interface ISchemaRegion {
* @param aliasList a list of alias that you want to check
* @return returns a map contains index of the measurements or alias that
threw the exception, and
* exception details. The exceptions describe whether the measurement or
alias exists. For
- * example, a MeasurementAlreadyExistException means this measurement
exists. If there are
- * exceptions during check, this may return an empty map, then all the
measurements will be
- * re-checked under consensus layer, which guarantees safety(Yet may
cause unnecessary replay
- * of raft log)
+ * example, a MeasurementAlreadyExistException means this measurement
exists. An empty map
+ * means that no measurement exists and can be created.
*/
Map<Integer, MetadataException> checkMeasurementExistence(
PartialPath devicePath, List<String> measurementList, List<String>
aliasList);
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java
index 0f6490eceb4..1c89a9b613b 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java
@@ -125,7 +125,7 @@ import static
org.apache.tsfile.common.constant.TsFileConstant.PATH_SEPARATOR;
* <p>The codes are divided into the following code regions:
*
* <ol>
- * <li>Interfaces and Implementation for initialization、recover and clear
+ * <li>Interfaces and Implementation for initialization, recover and clear
* <li>Interfaces and Implementation for schema region Info query and
operation
* <li>Interfaces and Implementation for Timeseries operation
* <li>Interfaces for auto create device
@@ -166,7 +166,7 @@ public class SchemaRegionMemoryImpl implements
ISchemaRegion {
private MTreeBelowSGMemoryImpl mtree;
private TagManager tagManager;
- // region Interfaces and Implementation of initialization、snapshot、recover
and clear
+ // region Interfaces and Implementation of initialization, snapshot, recover
and clear
public SchemaRegionMemoryImpl(final ISchemaRegionParams schemaRegionParams)
throws MetadataException {
@@ -766,11 +766,7 @@ public class SchemaRegionMemoryImpl implements
ISchemaRegion {
@Override
public Map<Integer, MetadataException> checkMeasurementExistence(
PartialPath devicePath, List<String> measurementList, List<String>
aliasList) {
- try {
- return mtree.checkMeasurementExistence(devicePath, measurementList,
aliasList);
- } catch (final Exception e) {
- return Collections.emptyMap();
- }
+ return mtree.checkMeasurementExistence(devicePath, measurementList,
aliasList);
}
@Override
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java
index 73bbce272e2..b78f570125a 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java
@@ -126,7 +126,7 @@ import static
org.apache.tsfile.common.constant.TsFileConstant.PATH_SEPARATOR;
* <p>The codes are divided into the following code regions:
*
* <ol>
- * <li>Interfaces and Implementation for initialization、recover and clear
+ * <li>Interfaces and Implementation for initialization, recover and clear
* <li>Interfaces and Implementation for schema region Info query and
operation
* <li>Interfaces and Implementation for Timeseries operation
* <li>Interfaces for auto create device
@@ -169,7 +169,7 @@ public class SchemaRegionPBTreeImpl implements
ISchemaRegion {
private MTreeBelowSGCachedImpl mtree;
private TagManager tagManager;
- // region Interfaces and Implementation of initialization、snapshot、recover
and clear
+ // region Interfaces and Implementation of initialization, snapshot, recover
and clear
public SchemaRegionPBTreeImpl(ISchemaRegionParams schemaRegionParams) throws
MetadataException {
storageGroupFullPath = schemaRegionParams.getDatabase().getFullPath();
@@ -850,11 +850,7 @@ public class SchemaRegionPBTreeImpl implements
ISchemaRegion {
@Override
public Map<Integer, MetadataException> checkMeasurementExistence(
PartialPath devicePath, List<String> measurementList, List<String>
aliasList) {
- try {
- return mtree.checkMeasurementExistence(devicePath, measurementList,
aliasList);
- } catch (final Exception e) {
- return Collections.emptyMap();
- }
+ return mtree.checkMeasurementExistence(devicePath, measurementList,
aliasList);
}
@Override
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java
index 829d242187e..a326a9512d9 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java
@@ -591,8 +591,10 @@ public class MTreeBelowSGCachedImpl {
ICachedMNode device;
try {
device = getNodeByPath(devicePath);
- } catch (MetadataException e) {
+ } catch (PathNotExistException e) {
return Collections.emptyMap();
+ } catch (MetadataException e) {
+ return Collections.singletonMap(0, e);
}
try {
if (!device.isDevice()) {