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

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 92f014f  [IOTDB-753] Add a judgement before removing entry from tag 
inverted index (#1328)
92f014f is described below

commit 92f014f4bb74cb98effb35eb843475bac7c8e2f7
Author: Jackie Tien <[email protected]>
AuthorDate: Tue Jun 9 09:20:33 2020 +0800

    [IOTDB-753] Add a judgement before removing entry from tag inverted index 
(#1328)
    
    * add a judgement before remove entry from tag inverted index
---
 .../org/apache/iotdb/db/metadata/MManager.java     | 27 +++++++++++++++-------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java 
b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
index 19e3a0a..7a857a6 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
@@ -453,11 +453,21 @@ public class MManager {
         tagLogFile.readTag(config.getTagAttributeTotalSize(), 
node.getOffset());
     if (tagMap != null) {
       for (Entry<String, String> entry : tagMap.entrySet()) {
-        tagIndex.get(entry.getKey()).get(entry.getValue()).remove(node);
-        if (tagIndex.get(entry.getKey()).get(entry.getValue()).isEmpty()) {
-          tagIndex.get(entry.getKey()).remove(entry.getValue());
-          if (tagIndex.get(entry.getKey()).isEmpty()) {
-            tagIndex.remove(entry.getKey());
+        if (tagIndex.containsKey(entry.getKey()) && 
tagIndex.get(entry.getKey())
+            .containsKey(entry.getValue())) {
+          tagIndex.get(entry.getKey()).get(entry.getValue()).remove(node);
+          if (tagIndex.get(entry.getKey()).get(entry.getValue()).isEmpty()) {
+            tagIndex.get(entry.getKey()).remove(entry.getValue());
+            if (tagIndex.get(entry.getKey()).isEmpty()) {
+              tagIndex.remove(entry.getKey());
+            }
+          }
+        } else {
+          if (logger.isWarnEnabled()) {
+            logger.warn(String.format(
+                "TimeSeries %s's tag info has been removed from tag inverted 
index before "
+                    + "deleting it, tag key is %s, tag value is %s",
+                node.getFullPath(), entry.getKey(), entry.getValue()));
           }
         }
       }
@@ -972,7 +982,7 @@ public class MManager {
 
   /**
    * get device node, if the storage group is not set, create it when 
autoCreateSchema is true
-   *
+   * <p>
    * (we develop this method as we need to get the node's lock after we get 
the lock.writeLock())
    *
    * <p>!!!!!!Attention!!!!! must call the return node's readUnlock() if you 
call this method.
@@ -1573,8 +1583,9 @@ public class MManager {
   }
 
   /**
-   * if the path is in local mtree, nothing needed to do (because mtree is in 
the memory);
-   * Otherwise cache the path to mRemoteSchemaCache
+   * if the path is in local mtree, nothing needed to do (because mtree is in 
the memory); Otherwise
+   * cache the path to mRemoteSchemaCache
+   *
    * @param path
    * @param schema
    */

Reply via email to