rickyma commented on code in PR #1663:
URL: 
https://github.com/apache/incubator-uniffle/pull/1663#discussion_r1571873277


##########
client/src/main/java/org/apache/uniffle/client/impl/ShuffleReadClientImpl.java:
##########
@@ -102,12 +102,13 @@ public 
ShuffleReadClientImpl(ShuffleClientFactory.ReadClientBuilder builder) {
         readBufferSize = Integer.MAX_VALUE;
       }
       boolean offHeapEnabled = 
builder.getRssConf().get(RssClientConf.OFF_HEAP_MEMORY_ENABLE);
-
       builder.indexReadLimit(indexReadLimit);
       builder.storageType(storageType);
       builder.readBufferSize(readBufferSize);
       builder.offHeapEnable(offHeapEnabled);
-      
builder.clientType(builder.getRssConf().get(RssClientConf.RSS_CLIENT_TYPE));
+      if (builder.getClientType() == null) {
+        
builder.clientType(builder.getRssConf().get(RssClientConf.RSS_CLIENT_TYPE));

Review Comment:
   This is an issue of historical oversight in the code; it's not written in a 
standard way. Normally speaking, if there are fields in the builder, which are 
not null, we should take from the builder first. If the builder doesn't have 
them, then we should take from RssConf. In the current production code, even if 
the builder has the field(which is not null), we still basically take it from 
RssConf. 
   
   And that is the reason why 
https://github.com/apache/incubator-uniffle/pull/1663/files#diff-2c63c456bb33c64e05cbb946b316f6b26ac9153fc8ef112024e47bf8c3fc3c5aR46
 does not fail when we set `rss.client.type` to `GRPC_NETTY`. Because when 
calling the builder's build() method, the client type will be reset to the 
default value `GRPC` through RssConf, so there has actually been a hidden bug 
here all along.
   
   Of course, it's not impossible to remove those fields from the builder and 
set them all through RssConf, it's just harder to maintain. I think, since we 
already have those fields in the builder, we should support setting them 
through the builder, otherwise it's better to remove them altogether.



##########
client/src/main/java/org/apache/uniffle/client/impl/ShuffleReadClientImpl.java:
##########
@@ -102,12 +102,13 @@ public 
ShuffleReadClientImpl(ShuffleClientFactory.ReadClientBuilder builder) {
         readBufferSize = Integer.MAX_VALUE;
       }
       boolean offHeapEnabled = 
builder.getRssConf().get(RssClientConf.OFF_HEAP_MEMORY_ENABLE);
-
       builder.indexReadLimit(indexReadLimit);
       builder.storageType(storageType);
       builder.readBufferSize(readBufferSize);
       builder.offHeapEnable(offHeapEnabled);
-      
builder.clientType(builder.getRssConf().get(RssClientConf.RSS_CLIENT_TYPE));
+      if (builder.getClientType() == null) {
+        
builder.clientType(builder.getRssConf().get(RssClientConf.RSS_CLIENT_TYPE));

Review Comment:
   And that is the reason why 
https://github.com/apache/incubator-uniffle/pull/1663/files#diff-2c63c456bb33c64e05cbb946b316f6b26ac9153fc8ef112024e47bf8c3fc3c5aR46
 does not fail when we set `rss.client.type` to `GRPC_NETTY`. Because when 
calling the builder's build() method, the client type will be reset to the 
default value `GRPC` through RssConf, so there has actually been a hidden bug 
here all along.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to