private void snapshotDaemon() {
    if (isStopped.get()) {
      return;
    }
    try {
      for (RaftGroupId groupId : serverRef.get().getServer().getGroupIds()) {
        if (getSnapshotFlag(groupId).get()) {
          try {
            serverRef
                .get()
                .triggerSnapshot(Utils.fromRaftGroupIdToConsensusGroupId(groupId), false);
            final boolean flagCleared = snapshotFlag.get(groupId).compareAndSet(true, false);
            if (!flagCleared) {
              logger.info(
                  "{}: clear snapshot flag failed for group {}, please check the related implementation",
                  this,
                  groupId);
            }
          } catch (ConsensusException e) {
            logger.info(
                "{} take snapshot failed for group {} due to {}. Disk file status {}",
                this,
                groupId,
                e,
                getLatestSummary(groupId).orElse(null));
          }
        }
      }
    } catch (IOException ignore) {
    }
  }
Periodically woken up. Will take a snapshot if a flag is set.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/DiskGuardian.java