PHOENIX-3170 Remove the futuretask from the list if StaleRegionBoundaryCacheException is thrown while initializing the scanners(Rajeshbabu)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c0f72b53 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c0f72b53 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c0f72b53 Branch: refs/heads/calcite Commit: c0f72b536684bdbb6f3e597d5d93e767732bd007 Parents: 47a2b2c Author: Rajeshbabu Chintaguntla <rajeshb...@apache.org> Authored: Tue Sep 13 16:33:46 2016 +0530 Committer: Rajeshbabu Chintaguntla <rajeshb...@apache.org> Committed: Tue Sep 13 16:33:46 2016 +0530 ---------------------------------------------------------------------- .../java/org/apache/phoenix/iterate/BaseResultIterators.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c0f72b53/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java index 8b9adfd..2685b93 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java @@ -31,6 +31,7 @@ import java.io.EOFException; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -751,7 +752,9 @@ public abstract class BaseResultIterators extends ExplainTable implements Result boolean clearedCache = false; for (List<Pair<Scan,Future<PeekingResultIterator>>> future : reverseIfNecessary(futures,isReverse)) { List<PeekingResultIterator> concatIterators = Lists.newArrayListWithExpectedSize(future.size()); - for (Pair<Scan,Future<PeekingResultIterator>> scanPair : reverseIfNecessary(future,isReverse)) { + Iterator<Pair<Scan, Future<PeekingResultIterator>>> scanPairItr = reverseIfNecessary(future,isReverse).iterator(); + while (scanPairItr.hasNext()) { + Pair<Scan,Future<PeekingResultIterator>> scanPair = scanPairItr.next(); try { long timeOutForScan = maxQueryEndTime - System.currentTimeMillis(); if (timeOutForScan < 0) { @@ -773,6 +776,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result try { // Rethrow as SQLException throw ServerUtil.parseServerException(e); } catch (StaleRegionBoundaryCacheException e2) { + scanPairItr.remove(); // Catch only to try to recover from region boundary cache being out of date if (!clearedCache) { // Clear cache once so that we rejigger job based on new boundaries services.clearTableRegionCache(physicalTableName);