System.arraycopy(valBytes, 0, outputValue, offsetTillNow, valBytes.length);
// Generate MR key - upper 8 bytes of 16 byte md5
byte[] oldMd5 = ByteUtils.copy(md5er.digest(keyBytes), 0, 2 * ByteUtils.SIZE_OF_INT);
ByteArray oldMd5ByteArray = new ByteArray(oldMd5);
BytesWritable outputKey = new BytesWritable(oldMd5ToNewMd5.get(oldMd5ByteArray));
int replicaType = 0;
for(Integer partition: partitionList) {
ByteUtils.writeInt(outputValue, partitionToNode[partition].getId(), 0);
ByteUtils.writeInt(outputValue, partition, ByteUtils.SIZE_OF_INT);
if(getSaveKeys()) {
ByteUtils.writeBytes(outputValue,
replicaType,
2 * ByteUtils.SIZE_OF_INT,
ByteUtils.SIZE_OF_BYTE);
}
BytesWritable outputVal = new BytesWritable(outputValue);
output.collect(outputKey, outputVal);
replicaType++;
}