private void fillActiveGroups() {
      dataNodeTrackers.forEach(dataNodeTracker -> {
        logger.trace("Thread name: {} Trying to create active group for data node {} ", threadName,
            dataNodeTracker.getDataNodeId());
        List<ActiveGroupTracker> finishedActiveGroupTrackers = dataNodeTracker.getFinishedActiveGroupTrackers();

        finishedActiveGroupTrackers.forEach(activeGroupTracker -> {
          logger.trace("Thread name: {} Trying to create active group for active group tracker {} ", threadName,
              activeGroupTracker);

          List<ReplicaTracker> activeReplicaTrackers = fillReplicaStatusForFinishedGroup(activeGroupTracker).stream()
              .filter(replicaTracker -> replicaTracker.getReplicaStatus().equals(ReplicaStatus.ACTIVE))
              .collect(Collectors.toList());

          logger.trace("Thread name: {} trying to create group from active replicas {} for group id {} ",
              threadName, activeReplicaTrackers, activeGroupTracker.getGroupId());

          if (activeReplicaTrackers.isEmpty()) {
            return;
          }

          RemoteReplicaGroup remoteReplicaGroup = new RemoteReplicaGroup(
              activeReplicaTrackers.stream().map(ReplicaTracker::getRemoteReplicaInfo).collect(Collectors.toList()),
              dataNodeTracker.getDataNodeId(), false, activeGroupTracker.getGroupId());

          activeGroupTracker.startIteration(remoteReplicaGroup, activeReplicaTrackers);
          logger.trace("Thread name: {} Created active remote replica group for group tracker {} ", threadName,
              activeGroupTracker);
        });
      });
    }
For all active group trackers which are not tracking any remote replica group, does below things

1. updates status of preassigned available replicas with UNKNOWN, OFFLINE and STANDBY status.
2. Creates active remote replica group from updated replicas with status as ACTIVE.
3. Updates group tracker for newly created active groups.
ambry-replication/src/main/java/com/github/ambry/replication/ReplicaThread.java