void mergeAll(ReplicaMap other) {
    Set<String> bplist = other.map.keySet();
    for (String bp : bplist) {
      checkBlockPool(bp);
      try (AutoCloseDataSetLock l = lockManager.writeLock(LockLevel.BLOCK_POOl, bp)) {
        LightWeightResizableGSet<Block, ReplicaInfo> replicaInfos = other.map.get(bp);
        LightWeightResizableGSet<Block, ReplicaInfo> curSet = map.get(bp);
        HashSet<ReplicaInfo> replicaSet = new HashSet<>();
        //Can't add to GSet while in another GSet iterator may cause endlessLoop
        for (ReplicaInfo replicaInfo : replicaInfos) {
          replicaSet.add(replicaInfo);
        }
        if (curSet == null && !replicaSet.isEmpty()) {
          // Add an entry for block pool if it does not exist already
          curSet = new LightWeightResizableGSet<>();
          map.put(bp, curSet);
        }
        for (ReplicaInfo replicaInfo : replicaSet) {
          checkBlock(replicaInfo);
          curSet.put(replicaInfo);
        }
      }
    }
  }
@Test
  public void testMergeAll() {
    ReplicaMap temReplicaMap = new ReplicaMap();
    Block tmpBlock = new Block(5678, 5678, 5678);
    temReplicaMap.add(bpid, new FinalizedReplica(tmpBlock, null, null));

    map.mergeAll(temReplicaMap);
    assertNotNull(map.get(bpid, 1234));
    assertNotNull(map.get(bpid, 5678));
  }