public synchronized void cacheHeartbeatSample(
      RegionHeartbeatSample newHeartbeatSample, boolean overwrite) {
    if (overwrite || getLastSample() == null) {
      super.cacheHeartbeatSample(newHeartbeatSample);
      return;
    }
    RegionStatus lastStatus = ((RegionHeartbeatSample) getLastSample()).getStatus();
    if (lastStatus.equals(RegionStatus.Adding) || lastStatus.equals(RegionStatus.Removing)) {
      RegionHeartbeatSample fakeHeartbeatSample =
          new RegionHeartbeatSample(newHeartbeatSample.getSampleLogicalTimestamp(), lastStatus);
      super.cacheHeartbeatSample(fakeHeartbeatSample);
    } else {
      super.cacheHeartbeatSample(newHeartbeatSample);
    }
  }
RegionCache caches the RegionHeartbeatSamples of a Region. Update and cache the current
statistics of the Region based on the latest RegionHeartbeatSample.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/region/RegionCache.java