Skip to content

Commit

Permalink
fix a bug in donor based rebalancing
Browse files Browse the repository at this point in the history
  • Loading branch information
Lei Gao committed Oct 23, 2011
1 parent 82fd240 commit e699144
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class DonorBasedRebalanceAsyncOperation extends RebalanceAsyncOperation {
public final static Pair<ByteArray, Versioned<byte[]>> END = Pair.create(null, null);

// Batch 500 entries for each fetchUpdate call.
private static final int FETCHUPDATE_BATCH_SIZE = 500;
private static final int FETCHUPDATE_BATCH_SIZE = 1000;
// Print scanned entries every 100k
private static final int SCAN_PROGRESS_COUNT = 100000;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ public void setRecoveryMode() {
// only purge if we are NOT in recovery mode
public void purge() {
if(!recoveryModeOn) {
logger.info("DonorBasedRebalancePusherSlave successfully sent "
+ tentativeList.size() + " entries to node " + nodeId + "for store "
+ storeName);
tentativeList.clear();
} else {
logger.error("purge called while recovery mode is on!!!!!");
Expand All @@ -154,11 +151,12 @@ public void purge() {
// return when something is available, blocked otherwise
public boolean hasNext() {
boolean hasNext = false;
if(null == currentElem) {
while(null == currentElem) {
try {
currentElem = getNextElem();
} catch(InterruptedException e) {
logger.info("hasNext is interrupted while waiting for the next elem.");
logger.info("hasNext is interrupted while waiting for the next elem, existing...");
break;
}
}
if(null != currentElem && !currentElem.equals(DonorBasedRebalanceAsyncOperation.END)) {
Expand All @@ -170,11 +168,12 @@ public boolean hasNext() {
// return the element when one or more is available, blocked
// otherwise
public Pair<ByteArray, Versioned<byte[]>> next() {
if(null == currentElem) {
while(null == currentElem) {
try {
currentElem = getNextElem();
} catch(InterruptedException e) {
logger.info("next is interrupted while waiting for the next elem.");
logger.info("next is interrupted while waiting for the next elem, existing...");
break;
}
if(null == currentElem || currentElem.equals(DonorBasedRebalanceAsyncOperation.END)) {
throw new NoSuchElementException();
Expand Down

0 comments on commit e699144

Please sign in to comment.