public long calculateSyncLag() {
    lock.lock();
    try {
      // if there isn't a consensus pipe task, the syncLag is 0
      if (consensusPipe2ConnectorMap.isEmpty()) {
        return 0;
      }
      // else we find the biggest gap between leader and replicas in all consensus pipe task.
      syncLag = Long.MIN_VALUE;
      consensusPipe2ConnectorMap
          .keySet()
          .forEach(
              consensusPipeName ->
                  syncLag =
                      Math.max(syncLag, getSyncLagForSpecificConsensusPipe(consensusPipeName)));
      return syncLag;
    } finally {
      lock.unlock();
    }
  }
SyncLag represents the biggest difference between the current replica users' write progress and
the synchronization progress of all other replicas. The semantics is how much data the leader
has left to synchronize.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java