This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch caLastOpt
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit c90289c449cf976af89b2ae026701fc0e0888540
Author: JackieTien97 <[email protected]>
AuthorDate: Tue May 16 19:45:26 2023 +0800

    wrong  Update
---
 .../cache/lastCache/container/LastCacheContainer.java         | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/LastCacheContainer.java
 
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/LastCacheContainer.java
index 65a2444f37..94057f3ca3 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/LastCacheContainer.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/LastCacheContainer.java
@@ -41,8 +41,15 @@ public class LastCacheContainer implements 
ILastCacheContainer {
   @Override
   public synchronized void updateCachedLast(
       TimeValuePair timeValuePair, boolean highPriorityUpdate, Long 
latestFlushedTime) {
-    if (timeValuePair == null || timeValuePair.getValue() == null) {
-      return;
+    if (highPriorityUpdate) { // for write, we won't cache null value
+      if (timeValuePair == null || timeValuePair.getValue() == null) {
+        return;
+      }
+    } else { // for read, we need to cache null value, because it means that 
there is no data for
+      // this time series
+      if (timeValuePair == null) {
+        return;
+      }
     }
 
     if (lastCacheValue == null) {

Reply via email to