public boolean invalidateCache(final String databaseName) throws IOException, TException {
    final List<TDataNodeConfiguration> allDataNodes = getNodeManager().getRegisteredDataNodes();
    final TInvalidateCacheReq invalidateCacheReq = new TInvalidateCacheReq();
    invalidateCacheReq.setStorageGroup(true);
    invalidateCacheReq.setFullPath(databaseName);
    for (final TDataNodeConfiguration dataNodeConfiguration : allDataNodes) {
      final int dataNodeId = dataNodeConfiguration.getLocation().getDataNodeId();

      // If the node is not alive, retry for up to 10 times
      NodeStatus nodeStatus = getLoadManager().getNodeStatus(dataNodeId);
      int retryNum = 10;
      if (nodeStatus == NodeStatus.Unknown) {
        for (int i = 0; i < retryNum && nodeStatus == NodeStatus.Unknown; i++) {
          try {
            TimeUnit.MILLISECONDS.sleep(500);
          } catch (final InterruptedException e) {
            LOG.error("Sleep failed in ConfigNodeProcedureEnv: ", e);
            Thread.currentThread().interrupt();
            break;
          }
          nodeStatus = getLoadManager().getNodeStatus(dataNodeId);
        }
      }

      if (nodeStatus == NodeStatus.Unknown) {
        LOG.warn(
            "Invalidate cache failed, because DataNode {} is Unknown",
            dataNodeConfiguration.getLocation().getInternalEndPoint());
        return false;
      }

      // Always invalidate PartitionCache first
      final TSStatus invalidatePartitionStatus =
          (TSStatus)
              SyncDataNodeClientPool.getInstance()
                  .sendSyncRequestToDataNodeWithRetry(
                      dataNodeConfiguration.getLocation().getInternalEndPoint(),
                      invalidateCacheReq,
                      CnToDnSyncRequestType.INVALIDATE_PARTITION_CACHE);

      final TSStatus invalidateSchemaStatus =
          (TSStatus)
              SyncDataNodeClientPool.getInstance()
                  .sendSyncRequestToDataNodeWithRetry(
                      dataNodeConfiguration.getLocation().getInternalEndPoint(),
                      invalidateCacheReq,
                      CnToDnSyncRequestType.INVALIDATE_SCHEMA_CACHE);

      if (!verifySucceed(invalidatePartitionStatus, invalidateSchemaStatus)) {
        LOG.error(
            "Invalidate cache failed, invalidate partition cache status is {}, invalidate schemaengine cache status is {}",
            invalidatePartitionStatus,
            invalidateSchemaStatus);
        return false;
      }
    }
    return true;
  }
@param databaseName database name
@return ALL SUCCESS OR NOT
@throws IOException IOE
@throws TException Thrift IOE
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java