Make sure we skip over deleted shards if there are multiple together.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/1e6fb1e1 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/1e6fb1e1 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/1e6fb1e1 Branch: refs/heads/master Commit: 1e6fb1e10d66c24d2c4b0d0f61a3312077545c97 Parents: 4440424 Author: Michael Russo <[email protected]> Authored: Mon Aug 29 10:11:19 2016 -0700 Committer: Michael Russo <[email protected]> Committed: Mon Aug 29 10:11:19 2016 -0700 ---------------------------------------------------------------------- .../core/astyanax/MultiRowShardColumnIterator.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/1e6fb1e1/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowShardColumnIterator.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowShardColumnIterator.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowShardColumnIterator.java index 04266e1..2446968 100644 --- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowShardColumnIterator.java +++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowShardColumnIterator.java @@ -128,17 +128,20 @@ public class MultiRowShardColumnIterator<R, C, T> implements Iterator<T> { currentShard = currentShardIterator.next(); // handle marked deleted shards - if( currentShard.isDeleted() && currentShardIterator.hasNext()){ + while ( currentShard.isDeleted() && currentShardIterator.hasNext()){ if(logger.isTraceEnabled()) { logger.trace("Shard is marked deleted, advancing to next - {}", currentShard); } currentShard = currentShardIterator.next(); - }else if ( currentShard.isDeleted() && !currentShardIterator.hasNext()){ + } + + // if the last shard is deleted, return false, there is no next to seek + if ( currentShard.isDeleted() && !currentShardIterator.hasNext()){ if(logger.isTraceEnabled()) { - logger.trace("Shard is marked deleted, and there is no more - {}", currentShard); + logger.trace("Shard is marked deleted, and there are no more shards - {}", currentShard); } return false;
