private void addAncestorsToCache(ICachedMNode node) {
    ICachedMNode current = node.getParent();
    CacheEntry cacheEntry = getCacheEntry(current);

    while (!current.isDatabase()) {
      synchronized (cacheEntry) {
        cacheEntry.decVolatileDescendant();
        if (cacheEntry.hasVolatileDescendant() || cacheEntry.isVolatile()) {
          return;
        }

        nodeCache.addToNodeCache(cacheEntry, current);
      }

      current = current.getParent();
      cacheEntry = getCacheEntry(current);
    }
  }
This method should be invoked after a node in memory be updated to non-volatile status, which
could be caused by flushChildren or deleteChild in MTree.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/MemoryManager.java