wary commented on code in PR #329:
URL: 
https://github.com/apache/doris-spark-connector/pull/329#discussion_r2195061931


##########
spark-doris-connector/spark-doris-connector-base/src/main/java/org/apache/doris/spark/util/LoadBalanceList.java:
##########
@@ -0,0 +1,38 @@
+package org.apache.doris.spark.util;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+
+
+public class LoadBalanceList<T> implements Iterable<T> {
+
+       private final List<T> list;
+
+       public LoadBalanceList(List<T> servers) {
+               this.list = Collections.unmodifiableList(servers);
+       }
+
+       @Override
+       public Iterator<T> iterator() {
+               return new Iterator<T>() {
+                       final int offset = Math.abs(new Random().nextInt());

Review Comment:
   > But the offset is random every time, is this similar to the effect of 
direct randomness? For example, when getting here, is a random value also 
returned every time? Instead of polling?
   > 
   > 
https://github.com/apache/doris-spark-connector/blob/b8335012caf6e359a4bdc5f15d1b7ee51eac0902/spark-doris-connector/spark-doris-connector-base/src/main/java/org/apache/doris/spark/client/DorisFrontendClient.java#L160-L163
   
   I probably know what you are  thinking about. I modified the assignment 
logic of offset, please check it again.



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to