|
@@ -110,7 +110,8 @@ public class XceiverClientGrpc extends XceiverClientSpi {
|
|
|
public void connect() throws Exception {
|
|
|
// connect to the closest node, if closest node doesn't exist, delegate to
|
|
|
// first node, which is usually the leader in the pipeline.
|
|
|
- DatanodeDetails dn = this.pipeline.getClosestNode();
|
|
|
+ DatanodeDetails dn = topologyAwareRead ? this.pipeline.getClosestNode() :
|
|
|
+ this.pipeline.getFirstNode();
|
|
|
// just make a connection to the picked datanode at the beginning
|
|
|
connectToDatanode(dn, null);
|
|
|
}
|
|
@@ -122,8 +123,8 @@ public class XceiverClientGrpc extends XceiverClientSpi {
|
|
|
public void connect(String encodedToken) throws Exception {
|
|
|
// connect to the closest node, if closest node doesn't exist, delegate to
|
|
|
// first node, which is usually the leader in the pipeline.
|
|
|
- DatanodeDetails dn;
|
|
|
- dn = this.pipeline.getClosestNode();
|
|
|
+ DatanodeDetails dn = topologyAwareRead ? this.pipeline.getClosestNode() :
|
|
|
+ this.pipeline.getFirstNode();
|
|
|
// just make a connection to the picked datanode at the beginning
|
|
|
connectToDatanode(dn, encodedToken);
|
|
|
}
|