This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch rel/0.13
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.13 by this push:
new 85dd7ed19a [To rel/0.13][IOTDB-3602] Skip empty TsFile when loading
directory (#6450)
85dd7ed19a is described below
commit 85dd7ed19a2fca6f43de5af782949de752f0635d
Author: Chen YZ <[email protected]>
AuthorDate: Mon Jun 27 10:56:05 2022 +0800
[To rel/0.13][IOTDB-3602] Skip empty TsFile when loading directory (#6450)
---
.../iotdb/db/integration/IoTDBLoadExternalTsfileIT.java | 10 ++--------
.../aligned/IoTDBLoadExternalAlignedTsFileIT.java | 9 ++-------
.../java/org/apache/iotdb/db/qp/executor/PlanExecutor.java | 12 +++++++++++-
3 files changed, 15 insertions(+), 16 deletions(-)
diff --git
a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java
b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java
index d0abb5a843..853301f611 100644
---
a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java
+++
b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java
@@ -929,10 +929,7 @@ public class IoTDBLoadExternalTsfileIT {
statement.execute(String.format("load '%s'", vehicleTmpDir));
} catch (Exception e) {
hasError = true;
- assertTrue(
- e.getMessage()
- .contains(
- "because root.vehicle.d0.s0 is INT32 in the loading TsFile
but is INT64 in IoTDB."));
+ assertTrue(e.getMessage().contains("Fail to load TsFile"));
}
assertTrue(hasError);
@@ -950,10 +947,7 @@ public class IoTDBLoadExternalTsfileIT {
statement.execute(String.format("load '%s'", testTmpDir));
} catch (Exception e) {
hasError = true;
- assertTrue(
- e.getMessage()
- .contains(
- "because root.test.d0.s0 is INT32 in the loading TsFile
but is FLOAT in IoTDB."));
+ assertTrue(e.getMessage().contains("Fail to load TsFile"));
}
assertTrue(hasError);
diff --git
a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBLoadExternalAlignedTsFileIT.java
b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBLoadExternalAlignedTsFileIT.java
index 9da1221dc2..b76d007cee 100644
---
a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBLoadExternalAlignedTsFileIT.java
+++
b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBLoadExternalAlignedTsFileIT.java
@@ -930,9 +930,7 @@ public class IoTDBLoadExternalAlignedTsFileIT {
statement.execute(String.format("load '%s'", vehicleTmpDir));
} catch (Exception e) {
hasError = true;
- assertTrue(
- e.getMessage()
- .contains("is aligned in the loading TsFile but is not aligned
in IoTDB."));
+ assertTrue(e.getMessage().contains("Fail to load TsFile"));
}
assertTrue(hasError);
@@ -950,10 +948,7 @@ public class IoTDBLoadExternalAlignedTsFileIT {
statement.execute(String.format("load '%s'", testTmpDir));
} catch (Exception e) {
hasError = true;
- assertTrue(
- e.getMessage()
- .contains(
- "because root.test.d0.s0 is INT32 in the loading TsFile
but is FLOAT in IoTDB."));
+ assertTrue(e.getMessage().contains("Fail to load TsFile"));
}
assertTrue(hasError);
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
index f57a473b1e..b6c12ac352 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
@@ -1238,6 +1238,7 @@ public class PlanExecutor implements IPlanExecutor {
File[] files = curFile.listFiles();
long[] establishTime = new long[files.length];
List<Integer> tsfiles = new ArrayList<>();
+ List<String> failedFiles = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
File file = files[i];
@@ -1258,7 +1259,12 @@ public class PlanExecutor implements IPlanExecutor {
return establishTime[o1] < establishTime[o2] ? -1 : 1;
});
for (Integer i : tsfiles) {
- loadFile(files[i], plan);
+ try {
+ loadFile(files[i], plan);
+ } catch (QueryProcessException e) {
+ logger.error("{}, skip load {}.", e.getMessage(),
files[i].getAbsolutePath());
+ failedFiles.add(files[i].getAbsolutePath());
+ }
}
for (File file : files) {
@@ -1266,6 +1272,10 @@ public class PlanExecutor implements IPlanExecutor {
loadDir(file, plan);
}
}
+ if (failedFiles.size() > 0) {
+ throw new QueryProcessException(
+ String.format("Fail to load TsFile %s", String.join(",",
failedFiles)));
+ }
}
private void loadFile(File file, OperateFilePlan plan) throws
QueryProcessException {