dlmarion commented on code in PR #5937:
URL: https://github.com/apache/accumulo/pull/5937#discussion_r2557554428
##########
core/src/main/java/org/apache/accumulo/core/spi/scan/ConfigurableScanServerHostSelector.java:
##########
@@ -18,138 +18,171 @@
*/
package org.apache.accumulo.core.spi.scan;
+import static org.apache.accumulo.core.spi.scan.RendezvousHasher.Mode.HOST;
+
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
import org.apache.accumulo.core.data.TabletId;
-
-import com.google.common.hash.HashCode;
-import com.google.common.net.HostAndPort;
+import org.apache.accumulo.core.util.HostAndPort;
/**
- * Extension of the {@code ConfigurableScanServerSelector} that can be used
when there are multiple
+ * Extension of the {@link ConfigurableScanServerSelector} that can be used
when there are multiple
* ScanServers running on the same host and for some reason, like using a
shared off-heap cache,
* sending scans for the same tablet to the same host may provide a better
experience.
*
- * This implementation will initially hash a Tablet to a ScanServer. If the
ScanServer is unable to
- * execute the scan, this implementation will try to send the scan to a
ScanServer on the same host.
- * If there are no more ScanServers to try on that host, then it will fall
back to trying a
- * different host and the process repeats.
+ * <p>
+ * This implementation will use rendezvous hashing to map a tablet to one or
more host. Then it will
+ * randomly pick one of those host and then randomly pick a scan server on
that host. Scan servers
Review Comment:
```suggestion
* randomly pick one of those hosts and then randomly pick a scan server on
that host. Scan servers
```
##########
core/src/main/java/org/apache/accumulo/core/spi/scan/ConfigurableScanServerHostSelector.java:
##########
@@ -18,138 +18,171 @@
*/
package org.apache.accumulo.core.spi.scan;
+import static org.apache.accumulo.core.spi.scan.RendezvousHasher.Mode.HOST;
+
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
import org.apache.accumulo.core.data.TabletId;
-
-import com.google.common.hash.HashCode;
-import com.google.common.net.HostAndPort;
+import org.apache.accumulo.core.util.HostAndPort;
/**
- * Extension of the {@code ConfigurableScanServerSelector} that can be used
when there are multiple
+ * Extension of the {@link ConfigurableScanServerSelector} that can be used
when there are multiple
* ScanServers running on the same host and for some reason, like using a
shared off-heap cache,
* sending scans for the same tablet to the same host may provide a better
experience.
*
- * This implementation will initially hash a Tablet to a ScanServer. If the
ScanServer is unable to
- * execute the scan, this implementation will try to send the scan to a
ScanServer on the same host.
- * If there are no more ScanServers to try on that host, then it will fall
back to trying a
- * different host and the process repeats.
+ * <p>
+ * This implementation will use rendezvous hashing to map a tablet to one or
more host. Then it will
Review Comment:
```suggestion
* This implementation will use rendezvous hashing to map a tablet to one or
more hosts. Then it will
```
##########
core/src/main/java/org/apache/accumulo/core/spi/scan/ConfigurableScanServerHostSelector.java:
##########
@@ -18,138 +18,171 @@
*/
package org.apache.accumulo.core.spi.scan;
+import static org.apache.accumulo.core.spi.scan.RendezvousHasher.Mode.HOST;
+
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
import org.apache.accumulo.core.data.TabletId;
-
-import com.google.common.hash.HashCode;
-import com.google.common.net.HostAndPort;
+import org.apache.accumulo.core.util.HostAndPort;
/**
- * Extension of the {@code ConfigurableScanServerSelector} that can be used
when there are multiple
+ * Extension of the {@link ConfigurableScanServerSelector} that can be used
when there are multiple
* ScanServers running on the same host and for some reason, like using a
shared off-heap cache,
* sending scans for the same tablet to the same host may provide a better
experience.
*
- * This implementation will initially hash a Tablet to a ScanServer. If the
ScanServer is unable to
- * execute the scan, this implementation will try to send the scan to a
ScanServer on the same host.
- * If there are no more ScanServers to try on that host, then it will fall
back to trying a
- * different host and the process repeats.
+ * <p>
+ * This implementation will use rendezvous hashing to map a tablet to one or
more host. Then it will
+ * randomly pick one of those host and then randomly pick a scan server on
that host. Scan servers
+ * that have not had previous failures are chosen first.
+ *
+ * <p>
+ * This implementation uses the same configuration as {@link
ConfigurableScanServerSelector} but
+ * interprets {@code attemptPlans} differently in two ways. First for the
server count it will use
+ * that to determine how many host to choose from. Second it will only
consider an attempt plan as
Review Comment:
```suggestion
* that to determine how many hosts to choose from. Second it will only
consider an attempt plan as
```
##########
core/src/main/java/org/apache/accumulo/core/spi/scan/ConfigurableScanServerHostSelector.java:
##########
@@ -18,138 +18,171 @@
*/
package org.apache.accumulo.core.spi.scan;
+import static org.apache.accumulo.core.spi.scan.RendezvousHasher.Mode.HOST;
+
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
import org.apache.accumulo.core.data.TabletId;
-
-import com.google.common.hash.HashCode;
-import com.google.common.net.HostAndPort;
+import org.apache.accumulo.core.util.HostAndPort;
/**
- * Extension of the {@code ConfigurableScanServerSelector} that can be used
when there are multiple
+ * Extension of the {@link ConfigurableScanServerSelector} that can be used
when there are multiple
* ScanServers running on the same host and for some reason, like using a
shared off-heap cache,
* sending scans for the same tablet to the same host may provide a better
experience.
*
- * This implementation will initially hash a Tablet to a ScanServer. If the
ScanServer is unable to
- * execute the scan, this implementation will try to send the scan to a
ScanServer on the same host.
- * If there are no more ScanServers to try on that host, then it will fall
back to trying a
- * different host and the process repeats.
+ * <p>
+ * This implementation will use rendezvous hashing to map a tablet to one or
more host. Then it will
+ * randomly pick one of those host and then randomly pick a scan server on
that host. Scan servers
+ * that have not had previous failures are chosen first.
+ *
+ * <p>
+ * This implementation uses the same configuration as {@link
ConfigurableScanServerSelector} but
+ * interprets {@code attemptPlans} differently in two ways. First for the
server count it will use
+ * that to determine how many host to choose from. Second it will only
consider an attempt plan as
+ * failed when servers on all host have failed.
+ *
+ * <pre>
+ * "attemptPlans":[
+ * {"servers":"1", "busyTimeout":"10s"},
+ * {"servers":"3", "busyTimeout":"30s"},
+ * ]
+ * </pre>
+ *
+ * <p>
+ * For example given the above attempt plan configuration, the following
sequence of events could
+ * happen a tablet.
Review Comment:
```suggestion
* happen for a tablet.
```
##########
core/src/main/java/org/apache/accumulo/core/spi/scan/ConfigurableScanServerHostSelector.java:
##########
@@ -18,138 +18,171 @@
*/
package org.apache.accumulo.core.spi.scan;
+import static org.apache.accumulo.core.spi.scan.RendezvousHasher.Mode.HOST;
+
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
import org.apache.accumulo.core.data.TabletId;
-
-import com.google.common.hash.HashCode;
-import com.google.common.net.HostAndPort;
+import org.apache.accumulo.core.util.HostAndPort;
/**
- * Extension of the {@code ConfigurableScanServerSelector} that can be used
when there are multiple
+ * Extension of the {@link ConfigurableScanServerSelector} that can be used
when there are multiple
* ScanServers running on the same host and for some reason, like using a
shared off-heap cache,
* sending scans for the same tablet to the same host may provide a better
experience.
*
- * This implementation will initially hash a Tablet to a ScanServer. If the
ScanServer is unable to
- * execute the scan, this implementation will try to send the scan to a
ScanServer on the same host.
- * If there are no more ScanServers to try on that host, then it will fall
back to trying a
- * different host and the process repeats.
+ * <p>
+ * This implementation will use rendezvous hashing to map a tablet to one or
more host. Then it will
+ * randomly pick one of those host and then randomly pick a scan server on
that host. Scan servers
+ * that have not had previous failures are chosen first.
+ *
+ * <p>
+ * This implementation uses the same configuration as {@link
ConfigurableScanServerSelector} but
+ * interprets {@code attemptPlans} differently in two ways. First for the
server count it will use
+ * that to determine how many host to choose from. Second it will only
consider an attempt plan as
+ * failed when servers on all host have failed.
+ *
+ * <pre>
+ * "attemptPlans":[
+ * {"servers":"1", "busyTimeout":"10s"},
+ * {"servers":"3", "busyTimeout":"30s"},
+ * ]
+ * </pre>
+ *
+ * <p>
+ * For example given the above attempt plan configuration, the following
sequence of events could
+ * happen a tablet.
+ *
+ * <ol>
+ * <li>host32 is chosen and it has 2 severs [host32:1000,host32:1001].
host32:1001 is randomly
+ * chosen.</li>
+ * <li>Scan on host32:1001 has a busy timeout.</li>
+ * <li>host32 is chosen again because not all servers have failed. For the
server, host32:1000 is
+ * chosen because host32:1001 failed.
+ * <li>Scan on host32:1000 has a busy timeout.</li>
+ * <li>Because all servers on host32 have failed, move to the next attemptPlan
and choose from three
+ * host. host32,host40, and host09 are candidates and host09 is randomly
picked, then a server from
Review Comment:
```suggestion
* hosts. host32, host40, and host09 are candidates and host09 is randomly
picked, then a server from
```
--
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]