Skip to content

Commit f2da2c9

Browse files
committed
Replace exceptions with debug logs in schema checks
Changed device alignment and datatype mismatch checks to log debug messages instead of throwing exceptions. This allows the load process to continue while still providing diagnostic information when debug logging is enabled.
1 parent e4c2c76 commit f2da2c9

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/LoadTsFileAnalyzer.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -896,13 +896,12 @@ private void verifySchema(ISchemaTree schemaTree)
896896
// check device schema: is aligned or not
897897
final boolean isAlignedInTsFile = schemaCache.getDeviceIsAligned(device);
898898
final boolean isAlignedInIoTDB = iotdbDeviceSchemaInfo.isAligned();
899-
if (isAlignedInTsFile != isAlignedInIoTDB) {
900-
throw new LoadAnalyzeException(
901-
String.format(
902-
"Device %s in TsFile is %s, but in IoTDB is %s.",
903-
device,
904-
isAlignedInTsFile ? "aligned" : "not aligned",
905-
isAlignedInIoTDB ? "aligned" : "not aligned"));
899+
if (LOGGER.isDebugEnabled() && isAlignedInTsFile != isAlignedInIoTDB) {
900+
LOGGER.debug(
901+
"Device {} in TsFile is {}, but in IoTDB is {}.",
902+
device,
903+
isAlignedInTsFile ? "aligned" : "not aligned",
904+
isAlignedInIoTDB ? "aligned" : "not aligned");
906905
}
907906

908907
// check timeseries schema
@@ -920,15 +919,14 @@ private void verifySchema(ISchemaTree schemaTree)
920919
}
921920

922921
// check datatype
923-
if (!tsFileSchema.getType().equals(iotdbSchema.getType())) {
924-
throw new LoadAnalyzeTypeMismatchException(
925-
String.format(
926-
"Measurement %s%s%s datatype not match, TsFile: %s, IoTDB: %s",
927-
device,
928-
TsFileConstant.PATH_SEPARATOR,
929-
iotdbSchema.getMeasurementId(),
930-
tsFileSchema.getType(),
931-
iotdbSchema.getType()));
922+
if (LOGGER.isDebugEnabled() && !tsFileSchema.getType().equals(iotdbSchema.getType())) {
923+
LOGGER.debug(
924+
"Measurement {}{}{} datatype not match, TsFile: {}, IoTDB: {}",
925+
device,
926+
TsFileConstant.PATH_SEPARATOR,
927+
iotdbSchema.getMeasurementId(),
928+
tsFileSchema.getType(),
929+
iotdbSchema.getType());
932930
}
933931

934932
// check encoding

0 commit comments

Comments
 (0)