public void deleteUniqueIdAndMayDeleteWALNode(String applicantUniqueId) {
    nodesLock.lock();
    try {
      WALNode walNode = uniqueId2Nodes.remove(applicantUniqueId);
      if (!uniqueId2Nodes.containsValue(walNode)) {
        if (walNode != null) {
          walNode.close();
          if (walNode.getLogDirectory().exists()) {
            FileUtils.deleteFileOrDirectory(walNode.getLogDirectory());
          }
          WALManager.getInstance().subtractTotalDiskUsage(walNode.getDiskUsage());
          WALManager.getInstance().subtractTotalFileNum(walNode.getFileNum());
        }
        walNodes.remove(walNode);
        if (walNodes.isEmpty()) {
          nodeIdCounter = -1;
        }
      }
    } finally {
      nodesLock.unlock();
    }
  }
This strategy creates wal nodes according to the number of memTables. Each wal node manages fixed
number of memTables.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/allocation/ElasticStrategy.java