This is an automated email from the ASF dual-hosted git repository. jackietien pushed a commit to branch TyDeleteBug in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit 9220fe75b4f9efc4fd0f2233712d458864ca0930 Author: JackieTien97 <[email protected]> AuthorDate: Mon Jun 8 20:52:09 2020 +0800 add a judgement before remove entry from tag inverted index --- .../org/apache/iotdb/db/metadata/MManager.java | 24 ++++++++++++++-------- 1 file changed, 16 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..1e4de80 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,12 +453,19 @@ 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 { + 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 +979,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 +1580,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 */
