Source:
private ReplicaMetadataResponse getReplicaMetadataResponse(List<RemoteReplicaInfo> replicasToReplicatePerNode, ConnectedChannel connectedChannel, DataNodeId remoteNode, boolean remoteColo) throws ReplicationException, IOException { List<ReplicaMetadataRequestInfo> replicaMetadataRequestInfoList = new ArrayList<ReplicaMetadataRequestInfo>(); for (RemoteReplicaInfo remoteReplicaInfo : replicasToReplicatePerNode) { ReplicaMetadataRequestInfo replicaMetadataRequestInfo = new ReplicaMetadataRequestInfo(remoteReplicaInfo.getReplicaId().getPartitionId(), remoteReplicaInfo.getToken(), dataNodeId.getHostname(), remoteReplicaInfo.getLocalReplicaId().getReplicaPath()); replicaMetadataRequestInfoList.add(replicaMetadataRequestInfo); logger .trace("Remote node: Thread name: Remote replica: Token sent to remote: ", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), remoteReplicaInfo.getToken()); } ReplicaMetadataRequest request = new ReplicaMetadataRequest(correlationIdGenerator.incrementAndGet(), "replication-metadata-" + dataNodeId.getHostname(), replicaMetadataRequestInfoList, replicationConfig.replicationFetchSizeInBytes); long replicaMetadataRequestStartTime = SystemTime.getInstance().milliseconds(); connectedChannel.send(request); InputStream stream = connectedChannel.receive(); ReplicaMetadataResponse response = ReplicaMetadataResponse.readFrom(new DataInputStream(stream), findTokenFactory, clusterMap); if (remoteColo) { replicationMetrics.interColoReplicationMetadataRequestTime .update(SystemTime.getInstance().milliseconds() - replicaMetadataRequestStartTime); } else { replicationMetrics.intraColoReplicationMetadataRequestTime .update(SystemTime.getInstance().milliseconds() - replicaMetadataRequestStartTime); } if (response.getError() != ServerErrorCode.No_Error || response.getReplicaMetadataResponseInfoList().size() != replicasToReplicatePerNode.size()) { logger.error("Remote node: " + remoteNode + " Thread name: " + threadName + " Remote replicas: " + replicasToReplicatePerNode + " Replica metadata response error: " + response.getError()); throw new ReplicationException("Replica Metadata Response Error " + response.getError()); } return response; }

Target:
private ReplicaMetadataResponse getReplicaMetadataResponse(List<RemoteReplicaInfo> replicasToReplicatePerNode, ConnectedChannel connectedChannel, DataNodeId remoteNode, boolean remoteColo) throws ReplicationException, IOException { List<ReplicaMetadataRequestInfo> replicaMetadataRequestInfoList = new ArrayList<ReplicaMetadataRequestInfo>(); for (RemoteReplicaInfo remoteReplicaInfo : replicasToReplicatePerNode) { ReplicaMetadataRequestInfo replicaMetadataRequestInfo = new ReplicaMetadataRequestInfo(remoteReplicaInfo.getReplicaId().getPartitionId(), remoteReplicaInfo.getToken(), dataNodeId.getHostname(), remoteReplicaInfo.getLocalReplicaId().getReplicaPath()); replicaMetadataRequestInfoList.add(replicaMetadataRequestInfo); logger .trace("Remote node: Thread name: Remote replica: Token sent to remote: ", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), remoteReplicaInfo.getToken()); } ReplicaMetadataRequest request = new ReplicaMetadataRequest(correlationIdGenerator.incrementAndGet(), "replication-metadata-" + dataNodeId.getHostname(), replicaMetadataRequestInfoList, replicationConfig.replicationFetchSizeInBytes); long replicaMetadataRequestStartTime = SystemTime.getInstance().milliseconds(); connectedChannel.send(request); InputStream stream = connectedChannel.receive(); ReplicaMetadataResponse response = ReplicaMetadataResponse.readFrom(new DataInputStream(stream), findTokenFactory, clusterMap); if (remoteColo) { replicationMetrics.interColoReplicationMetadataRequestTime .update(SystemTime.getInstance().milliseconds() - replicaMetadataRequestStartTime); } else { replicationMetrics.intraColoReplicationMetadataRequestTime .update(SystemTime.getInstance().milliseconds() - replicaMetadataRequestStartTime); } if (response.getError() != ServerErrorCode.No_Error || response.getReplicaMetadataResponseInfoList().size() != replicasToReplicatePerNode.size()) { logger.error("Remote node: " + remoteNode + " Thread name: " + threadName + " Remote replicas: " + replicasToReplicatePerNode + " Replica metadata response error: " + response.getError() + " ReplicaMetadataResponseInfoListSize: " + response.getReplicaMetadataResponseInfoList().size() + " ReplicasToReplicatePerNodeSize: " + replicasToReplicatePerNode.size()); throw new ReplicationException("Replica Metadata Response Error " + response.getError()); } return response; }