@Override
  public TSStatus write(ConsensusGroupId groupId, IConsensusRequest request)
      throws ConsensusException {
    SimpleConsensusServerImpl impl =
        Optional.ofNullable(stateMachineMap.get(groupId))
            .orElseThrow(() -> new ConsensusGroupNotExistException(groupId));
    // Schema Write when readOnly is handled at RegionWriteExecutor
    if (impl.isReadOnly() && groupId instanceof DataRegionId) {
      return StatusUtils.getStatus(TSStatusCode.SYSTEM_READ_ONLY);
    } else {
      TSStatus status;
      if (groupId instanceof DataRegionId) {
        long startWriteTime = System.nanoTime();
        status = impl.write(request);
        // only record time cost for data region in Performance Overview Dashboard
        PERFORMANCE_OVERVIEW_METRICS.recordEngineCost(System.nanoTime() - startWriteTime);
      } else {
        status = impl.write(request);
      }
      return status;
    }
  }
A simple consensus implementation, which can be used when replicaNum is 1.

<p>Notice: The stateMachine needs to implement WAL itself to ensure recovery after a restart
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/simple/SimpleConsensus.java