keith-turner commented on code in PR #3369:
URL: https://github.com/apache/accumulo/pull/3369#discussion_r1185464951


##########
hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordReader.java:
##########
@@ -381,14 +388,48 @@ public static List<InputSplit> getSplits(JobContext 
context, Class<?> callingCla
             // tables tablets... so clear it
             tl.invalidateCache();
 
-            while (!tl.binRanges(clientContext, ranges, 
binnedRanges).isEmpty()) {
-              clientContext.requireNotDeleted(tableId);
-              clientContext.requireNotOffline(tableId, tableName);
-              binnedRanges.clear();
-              log.warn("Unable to locate bins for specified ranges. 
Retrying.");
-              // sleep randomly between 100 and 200 ms
-              sleepUninterruptibly(100 + random.nextInt(100), 
TimeUnit.MILLISECONDS);
-              tl.invalidateCache();
+            if (InputConfigurator.getConsistencyLevel(callingClass, 
context.getConfiguration())
+                == ConsistencyLevel.IMMEDIATE) {
+              while (!tl.binRanges(clientContext, ranges, 
binnedRanges).isEmpty()) {
+                clientContext.requireNotDeleted(tableId);
+                clientContext.requireNotOffline(tableId, tableName);
+                binnedRanges.clear();
+                log.warn("Unable to locate bins for specified ranges. 
Retrying.");
+                // sleep randomly between 100 and 200 ms
+                sleepUninterruptibly(100 + random.nextInt(100), 
TimeUnit.MILLISECONDS);
+                tl.invalidateCache();
+              }
+            } else {
+              Map<String,Map<KeyExtent,List<Range>>> unhostedRanges = new 
HashMap<>();
+              unhostedRanges.put("", new HashMap<>());
+              BiConsumer<CachedTablet,Range> consumer = (ct, r) -> {
+                unhostedRanges.get("").computeIfAbsent(ct.getExtent(), k -> 
new ArrayList<>())
+                    .add(r);
+              };
+              List<Range> failures =
+                  tl.findTablets(clientContext, ranges, consumer, 
LocationNeed.NOT_REQUIRED);
+
+              Retry retry = Retry.builder().infiniteRetries().retryAfter(100, 
MILLISECONDS)
+                  .incrementBy(100, MILLISECONDS).maxWait(2, 
SECONDS).backOffFactor(1.5)
+                  .logInterval(3, MINUTES).createRetry();
+
+              while (!failures.isEmpty()) {
+
+                clientContext.requireNotDeleted(tableId);
+
+                try {
+                  retry.waitForNextAttempt(log,
+                      String.format("locating tablets in table %s(%s) for %d 
ranges", tableName,
+                          tableId, ranges.size()));
+                } catch (InterruptedException e) {
+                  throw new RuntimeException(e);
+                }
+

Review Comment:
   Partial findings may have been put in the map, need to clear it.
   
   ```suggestion
   unhostedRanges.get("").clear();
   ```



-- 
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]

Reply via email to