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 2022/08/25 07:01:32 UTC
[iotdb] 01/01: do not add mods to cache when mods file does not exist
This is an automated email from the ASF dual-hosted git repository.
marklau99 pushed a commit to branch IOTDB-4225
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit c8a46920063b93917828f9818c1e62e16805b3c3
Author: Liu Xuxin <li...@outlook.com>
AuthorDate: Thu Aug 25 15:01:16 2022 +0800
do not add mods to cache when mods file does not exist
---
.../main/java/org/apache/iotdb/db/query/context/QueryContext.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/server/src/main/java/org/apache/iotdb/db/query/context/QueryContext.java b/server/src/main/java/org/apache/iotdb/db/query/context/QueryContext.java
index 5ce05c1816..1551a73274 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/context/QueryContext.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/context/QueryContext.java
@@ -27,6 +27,7 @@ import org.apache.iotdb.db.query.control.QueryTimeManager;
import org.apache.iotdb.tsfile.file.metadata.IChunkMetadata;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -90,6 +91,10 @@ public class QueryContext {
* them from 'modFile' and put then into the cache.
*/
public List<Modification> getPathModifications(ModificationFile modFile, PartialPath path) {
+ // if the mods file does not exist, do not add it to the cache
+ if (!modFile.exists()) {
+ return Collections.emptyList();
+ }
Map<String, List<Modification>> fileModifications =
filePathModCache.computeIfAbsent(modFile.getFilePath(), k -> new ConcurrentHashMap<>());
return fileModifications.computeIfAbsent(