RemoteTablet(String tableId, Master.TabletLocationsPB tabletLocations, List<ServerInfo> serverInfos) { this.tabletId = tabletLocations.getTabletId().toStringUtf8(); this.tableId = tableId; this.partition = ProtobufHelper.pbToPartition(tabletLocations.getPartition()); this.tabletServers = new HashMap<>(serverInfos.size()); for (ServerInfo serverInfo : serverInfos) { this.tabletServers.put(serverInfo.getUuid(), serverInfo); } ImmutableList.Builder<LocatedTablet.Replica> replicasBuilder = new ImmutableList.Builder<>(); for (Master.TabletLocationsPB.ReplicaPB replica : tabletLocations.getReplicasList()) { String uuid = replica.getTsInfo().getPermanentUuid().toStringUtf8(); replicasBuilder.add(new LocatedTablet.Replica(replica)); if (replica.getRole().equals(Metadata.RaftPeerPB.Role.LEADER)) { leaderUuid = uuid; } } if (leaderUuid == null) { LOG.warn("No leader provided for tablet {}", getTabletId()); } replicas.set(replicasBuilder.build()); }