private void removeAncestorsFromCache(ICachedMNode node) {
    ICachedMNode current = node.getParent();
    CacheEntry cacheEntry = getCacheEntry(current);
    boolean isStatusChange;

    while (!current.isDatabase()) {
      isStatusChange = false;
      synchronized (cacheEntry) {
        if (!cacheEntry.hasVolatileDescendant()) {
          cacheEntry.incVolatileDescendant();
          isStatusChange = true;
          nodeCache.removeFromNodeCache(cacheEntry);
        } else {
          cacheEntry.incVolatileDescendant();
        }

        if (!isStatusChange || cacheEntry.isVolatile()) {
          return;
        }
      }

      current = current.getParent();
      cacheEntry = getCacheEntry(current);
    }
  }
This method should be invoked after a node in memory be updated to volatile status, which could
be caused by addChild or updateNode in MTree. The ancestors of volatile node should not stay in
nodeCache in which the node will be evicted. When invoking this method, all the ancestors have
been pinned.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/MemoryManager.java