This is an automated email from the ASF dual-hosted git repository. lancelly pushed a commit to branch checkStartAndEndTime in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 99c93f62a61f705103044716a33fdf3d25574762 Author: lancelly <[email protected]> AuthorDate: Tue Oct 24 20:23:43 2023 +0800 check --- .../dataregion/tsfile/TsFileResource.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java index ce49b700768..2de81049172 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java @@ -730,6 +730,16 @@ public class TsFileResource { private boolean isSatisfied(Filter timeFilter, boolean isSeq, long ttl, boolean debug) { long startTime = getFileStartTime(); long endTime = isClosed() || !isSeq ? getFileEndTime() : Long.MAX_VALUE; + if (startTime > endTime) { + // startTime > endTime indicates that there is something wrong with this TsFile. Return false + // directly, or it may lead to infinite loop in GroupByMonthFilter#getTimePointPosition. + LOGGER.warn( + "startTime[{}] of TsFileResource[{}] is greater than its endTime[{}]", + startTime, + this, + endTime); + return false; + } if (!isAlive(endTime, ttl)) { if (debug) { @@ -760,6 +770,16 @@ public class TsFileResource { long startTime = getStartTime(deviceId); long endTime = isClosed() || !isSeq ? getEndTime(deviceId) : Long.MAX_VALUE; + if (startTime > endTime) { + // startTime > endTime indicates that there is something wrong with this TsFile. Return false + // directly, or it may lead to infinite loop in GroupByMonthFilter#getTimePointPosition. + LOGGER.warn( + "startTime[{}] of TsFileResource[{}] is greater than its endTime[{}]", + startTime, + this, + endTime); + return false; + } if (timeFilter != null) { boolean res = timeFilter.satisfyStartEndTime(startTime, endTime);
