code: private AbstractTopology recoverPartitions(AbstractTopology topology, String haGroup, Set<Integer> recoverPartitions) {
  
          long version = topology.version;
          if (!recoverPartitions.isEmpty()) {
              // In rejoin case, partition list from the rejoining node could be out of range if the rejoining
              // host is a previously elastic removed node or some other used nodes, if out of range, do not restore
              if (Collections.max(recoverPartitions) > Collections.max(m_cartographer.getPartitions())) {
                  recoverPartitions.clear();
              }
          }
          AbstractTopology recoveredTopo = AbstractTopology.mutateRecoverTopology(topology,
                  m_messenger.getLiveHostIds(),
                  m_messenger.getHostId(),
                  haGroup,
                  recoverPartitions);
          if (recoveredTopo == null) {
              return null;
          }
          List<Integer> partitions = Lists.newArrayList(recoveredTopo.getPartitionIdList(m_messenger.getHostId()));
          if (partitions != null && partitions.size() == m_catalogContext.getNodeSettings().getLocalSitesCount()) {
              TopologyZKUtils.updateTopologyToZK(m_messenger.getZK(), recoveredTopo);
          }
          if (version < recoveredTopo.version && !recoverPartitions.isEmpty()) {
              consoleLog.info("Partition placement layout has been restored for rejoining.");
          }
          return recoveredTopo;
      }
docs: recover the partition assignment from one of lost hosts in the same placement group for rejoin
  Use the placement group of the recovering host to find a matched host from the lost nodes in the topology
  If the partition count from the lost node is the same as the site count of the recovering host,
  The partitions on the lost node will be placed on the recovering host. Partition group layout will be maintained.
  Topology will be updated on ZK if successful
  @param topology The topology from ZK, which contains the partition assignments for live or lost hosts
  @param haGroup The placement group of the recovering host
  @param recoverPartitions the partition placement to be recovered on this host
  @return A list of partitions if recover effort is a success.