dlmarion commented on code in PR #3369:
URL: https://github.com/apache/accumulo/pull/3369#discussion_r1185474211


##########
hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordReader.java:
##########
@@ -348,14 +355,47 @@ public static InputSplit[] getSplits(JobConf job, 
Class<?> callingClass) throws
             // tablets... so clear it
             tl.invalidateCache();
 
-            while (!tl.binRanges(context, ranges, binnedRanges).isEmpty()) {
-              context.requireNotDeleted(tableId);
-              context.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, job)
+                == ConsistencyLevel.IMMEDIATE) {
+              while (!tl.binRanges(context, ranges, binnedRanges).isEmpty()) {
+                context.requireNotDeleted(tableId);
+                context.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(context, 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()) {
+
+                context.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:
   Yep, good catch, will fix.



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