You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "dlmarion (via GitHub)" <gi...@apache.org> on 2023/05/02 20:56:30 UTC

[GitHub] [accumulo] dlmarion opened a new pull request, #3369: Use empty location in getSplits call for eventual consistency scans

dlmarion opened a new pull request, #3369:
URL: https://github.com/apache/accumulo/pull/3369

   Closes #3341


-- 
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: notifications-unsubscribe@accumulo.apache.org

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


[GitHub] [accumulo] keith-turner commented on a diff in pull request #3369: Use empty location in getSplits call for eventual consistency scans

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #3369:
URL: https://github.com/apache/accumulo/pull/3369#discussion_r1185464144


##########
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:
   ```suggestion
   unhostedRanges.get("").clear();
   ```



##########
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 finding may have been put in the map, need 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: notifications-unsubscribe@accumulo.apache.org

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


[GitHub] [accumulo] keith-turner commented on a diff in pull request #3369: Use empty location in getSplits call for eventual consistency scans

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@accumulo.apache.org

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


[GitHub] [accumulo] keith-turner commented on a diff in pull request #3369: Use empty location in getSplits call for eventual consistency scans

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #3369:
URL: https://github.com/apache/accumulo/pull/3369#discussion_r1185226923


##########
hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordReader.java:
##########
@@ -348,14 +355,45 @@ 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()) {
+

Review Comment:
   Need to check if the table still exists when failures is non empty.  Things end up in failures because it could not find a tablet that overlapped the range.  This could be caused by split, merge, or table deletion.



##########
hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordReader.java:
##########
@@ -381,14 +388,46 @@ 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()) {
+

Review Comment:
   also need table deletion check



-- 
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: notifications-unsubscribe@accumulo.apache.org

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


[GitHub] [accumulo] dlmarion merged pull request #3369: Use empty location in getSplits call for eventual consistency scans

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion merged PR #3369:
URL: https://github.com/apache/accumulo/pull/3369


-- 
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: notifications-unsubscribe@accumulo.apache.org

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


[GitHub] [accumulo] dlmarion commented on a diff in pull request #3369: Use empty location in getSplits call for eventual consistency scans

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #3369:
URL: https://github.com/apache/accumulo/pull/3369#discussion_r1185327750


##########
hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordReader.java:
##########
@@ -348,14 +355,45 @@ 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()) {
+

Review Comment:
   Added check in 3a8be6f



##########
hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordReader.java:
##########
@@ -381,14 +388,46 @@ 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()) {
+

Review Comment:
   Added check in 3a8be6f



-- 
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: notifications-unsubscribe@accumulo.apache.org

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


[GitHub] [accumulo] dlmarion commented on a diff in pull request #3369: Use empty location in getSplits call for eventual consistency scans

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@accumulo.apache.org

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