Skip to content

Commit

Permalink
*) added possibility to "recycle" a DHTChunk that failed to transfer.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2898 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
hydrox committed Nov 2, 2006
1 parent 78d65e1 commit 7e8669b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
10 changes: 10 additions & 0 deletions source/de/anomic/plasma/plasmaDHTChunk.java
Expand Up @@ -81,6 +81,8 @@ public class plasmaDHTChunk {
private long selectionStartTime = 0;
private long selectionEndTime = 0;

private int transferFailedCounter = 0;

public indexContainer firstContainer() {
return indexContainers[0];
}
Expand Down Expand Up @@ -313,4 +315,12 @@ public long getSelectionTime() {
if (this.selectionStartTime == 0 || this.selectionEndTime == 0) return -1;
return this.selectionEndTime-this.selectionStartTime;
}

public void incTransferFailedCounter() {
this.transferFailedCounter++;
}

public int getTransferFailedCounter() {
return transferFailedCounter;
}
}
13 changes: 11 additions & 2 deletions source/de/anomic/plasma/plasmaSwitchboard.java
Expand Up @@ -2408,8 +2408,17 @@ public boolean dhtTransferJob() {
// show success
return true;
} else {
dhtTransferChunk.setStatus(plasmaDHTChunk.chunkStatus_FAILED);
log.logFine("DHT distribution: transfer FAILED");
dhtTransferChunk.incTransferFailedCounter();
int maxChunkFails = (int) getConfigLong("indexDistribution.maxChunkFails", 1);
if (dhtTransferChunk.getTransferFailedCounter() >= maxChunkFails) {
System.out.println("DEBUG: " + dhtTransferChunk.getTransferFailedCounter() + " of " + maxChunkFails + " sendings failed for this chunk, aborting!");
dhtTransferChunk.setStatus(plasmaDHTChunk.chunkStatus_FAILED);
log.logFine("DHT distribution: transfer FAILED");
}
else {
System.out.println("DEBUG: " + dhtTransferChunk.getTransferFailedCounter() + " of " + maxChunkFails + " sendings failed for this chunk, retrying!");
log.logFine("DHT distribution: transfer FAILED, sending this chunk again");
}
return false;
}
}
Expand Down
2 changes: 2 additions & 0 deletions yacy.init
Expand Up @@ -702,6 +702,8 @@ indexDistribution.minChunkSize = 5
indexDistribution.maxChunkSize = 1000
indexDistribution.startChunkSize = 50

indexDistribution.maxChunkFails = 1

# defines if the peer should reject incoming index transfer
# request if a given limit is reached
indexDistribution.transferRWIReceiptLimitEnabled = true
Expand Down

0 comments on commit 7e8669b

Please sign in to comment.