Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit 3633c9c

Browse files
fix: handling default handling where subsetSize = 0 means the entire pool
Change-Id: Ifb6c293e355d337d457d3b76efe4e21924f80f81
1 parent b6370ce commit 3633c9c

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/LeastInFlightPicker.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ Optional<SessionHandle> pickSession() {
4646
List<AfeHandle> candidates = new ArrayList<>(readyAfes);
4747
int bestCost = Integer.MAX_VALUE;
4848
AfeHandle bestAfe = null;
49-
long iterations = Math.min(options.getRandomSubsetSize(), readyAfes.size());
49+
long iterations = readyAfes.size();
50+
if (options.getRandomSubsetSize() > 0) {
51+
iterations = Math.min(options.getRandomSubsetSize(), iterations);
52+
}
5053

5154
// Partial Fisher-Yates shuffle.
5255
for (int i = 0; i < iterations; i++) {

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/LeastLatencyPicker.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ Optional<SessionHandle> pickSession() {
4646
List<AfeHandle> candidates = new ArrayList<>(readyAfes);
4747
double bestCost = Double.MAX_VALUE;
4848
AfeHandle bestAfe = null;
49-
long iterations = Math.min(options.getRandomSubsetSize(), readyAfes.size());
49+
long iterations = readyAfes.size();
50+
51+
if (options.getRandomSubsetSize() > 0) {
52+
iterations = Math.min(options.getRandomSubsetSize(), iterations);
53+
}
5054

5155
// Partial Fisher-Yates shuffle.
5256
for (int i = 0; i < iterations; i++) {

0 commit comments

Comments
 (0)