HDDS-1749 : Ozone Client should randomize the list of nodes in pipeline for reads. (#1124)

This commit is contained in:
avijayanhwx 2019-07-25 07:54:46 -07:00 committed by bshashikant
parent 62deab17a3
commit ba43233451
1 changed files with 4 additions and 0 deletions

View File

@ -54,6 +54,7 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -269,6 +270,9 @@ public class XceiverClientGrpc extends XceiverClientSpi {
datanodeList = pipeline.getNodesInOrder();
} else {
datanodeList = pipeline.getNodes();
// Shuffle datanode list so that clients do not read in the same order
// every time.
Collections.shuffle(datanodeList);
}
for (DatanodeDetails dn : datanodeList) {
try {