You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ma...@apache.org on 2023/01/01 10:56:10 UTC
[iotdb] branch rel/1.0 updated: [To rel/1.0][IOTDB-5311]Fix RunTimeException and NoSuchFile Exception when selecting files causing compaction scheduled thread to get stuck
This is an automated email from the ASF dual-hosted git repository.
marklau99 pushed a commit to branch rel/1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/1.0 by this push:
new 6016451fb5 [To rel/1.0][IOTDB-5311]Fix RunTimeException and NoSuchFile Exception when selecting files causing compaction scheduled thread to get stuck
6016451fb5 is described below
commit 6016451fb5bd6bdc4e2d4ee7859452a6bd61c239
Author: 周沛辰 <45...@users.noreply.github.com>
AuthorDate: Sun Jan 1 18:56:04 2023 +0800
[To rel/1.0][IOTDB-5311]Fix RunTimeException and NoSuchFile Exception when selecting files causing compaction scheduled thread to get stuck
---
.../apache/iotdb/db/engine/storagegroup/DataRegion.java | 14 +++++++++-----
.../fileSystem/fileInputFactory/FileInputFactory.java | 4 +++-
.../fileSystem/fileInputFactory/HDFSInputFactory.java | 11 ++++++-----
.../fileSystem/fileInputFactory/LocalFSInputFactory.java | 14 ++------------
4 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
index 0be9f26df5..51f95ee996 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
@@ -2129,11 +2129,15 @@ public class DataRegion implements IDataRegionForQuery {
}
private void executeCompaction() {
- List<Long> timePartitions = new ArrayList<>(tsFileManager.getTimePartitions());
- // sort the time partition from largest to smallest
- timePartitions.sort((o1, o2) -> (int) (o2 - o1));
- for (long timePartition : timePartitions) {
- CompactionScheduler.scheduleCompaction(tsFileManager, timePartition);
+ try {
+ List<Long> timePartitions = new ArrayList<>(tsFileManager.getTimePartitions());
+ // sort the time partition from largest to smallest
+ timePartitions.sort((o1, o2) -> (int) (o2 - o1));
+ for (long timePartition : timePartitions) {
+ CompactionScheduler.scheduleCompaction(tsFileManager, timePartition);
+ }
+ } catch (Throwable e) {
+ logger.error("Meet error in compaction schedule.", e);
}
}
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/FileInputFactory.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/FileInputFactory.java
index 7f63a0b390..d4ae9744e1 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/FileInputFactory.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/FileInputFactory.java
@@ -21,7 +21,9 @@ package org.apache.iotdb.tsfile.fileSystem.fileInputFactory;
import org.apache.iotdb.tsfile.read.reader.TsFileInput;
+import java.io.IOException;
+
public interface FileInputFactory {
- TsFileInput getTsFileInput(String filePath);
+ TsFileInput getTsFileInput(String filePath) throws IOException;
}
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/HDFSInputFactory.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/HDFSInputFactory.java
index 900ecf350b..6cd1c54050 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/HDFSInputFactory.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/HDFSInputFactory.java
@@ -24,6 +24,7 @@ import org.apache.iotdb.tsfile.read.reader.TsFileInput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -44,15 +45,15 @@ public class HDFSInputFactory implements FileInputFactory {
}
@Override
- public TsFileInput getTsFileInput(String filePath) {
+ public TsFileInput getTsFileInput(String filePath) throws IOException {
try {
return (TsFileInput) constructor.newInstance(filePath);
} catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
- logger.error(
- "Failed to get TsFile input of file: {}. Please check your dependency of Hadoop module.",
- filePath,
+ throw new IOException(
+ String.format(
+ "Failed to get TsFile input of file: %s. Please check your dependency of Hadoop module.",
+ filePath),
e);
- return null;
}
}
}
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/LocalFSInputFactory.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/LocalFSInputFactory.java
index 354cd24cc6..55483d1e25 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/LocalFSInputFactory.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileInputFactory/LocalFSInputFactory.java
@@ -22,23 +22,13 @@ package org.apache.iotdb.tsfile.fileSystem.fileInputFactory;
import org.apache.iotdb.tsfile.read.reader.LocalTsFileInput;
import org.apache.iotdb.tsfile.read.reader.TsFileInput;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.io.IOException;
import java.nio.file.Paths;
public class LocalFSInputFactory implements FileInputFactory {
- private static final Logger logger = LoggerFactory.getLogger(LocalFSInputFactory.class);
-
@Override
- public TsFileInput getTsFileInput(String filePath) {
- try {
- return new LocalTsFileInput(Paths.get(filePath));
- } catch (IOException e) {
- logger.error("Failed to get TsFile input of file: {}, ", filePath, e);
- return null;
- }
+ public TsFileInput getTsFileInput(String filePath) throws IOException {
+ return new LocalTsFileInput(Paths.get(filePath));
}
}