ensure termination of shrink()

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7927 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 13 years ago
parent 52230a6864
commit 44d6416e2d

@ -177,23 +177,27 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
boolean donesomething = false;
// first try to merge small files that match
while (this.merger.queueLength() < 3 || this.array.entries() >= 50) {
donesomething = this.array.shrinkBestSmallFiles(this.merger, targetFileSize);
int term = 10;
while (term-- > 0 && (this.merger.queueLength() < 3 || this.array.entries() >= 50)) {
if (!this.array.shrinkBestSmallFiles(this.merger, targetFileSize)) break; else donesomething = true;
}
// then try to merge simply any small file
while (this.merger.queueLength() < 2) {
donesomething = this.array.shrinkAnySmallFiles(this.merger, targetFileSize);
term = 10;
while (term-- > 0 && (this.merger.queueLength() < 2)) {
if (!this.array.shrinkAnySmallFiles(this.merger, targetFileSize)) break; else donesomething = true;
}
// if there is no small file, then merge matching files up to limit
while (this.merger.queueLength() < 1) {
donesomething = this.array.shrinkUpToMaxSizeFiles(this.merger, maxFileSize);
term = 10;
while (term-- > 0 && (this.merger.queueLength() < 1)) {
if (!this.array.shrinkUpToMaxSizeFiles(this.merger, maxFileSize)) break; else donesomething = true;
}
// rewrite old files (hack from sixcooler, see http://forum.yacy-websuche.de/viewtopic.php?p=15004#p15004)
while (this.merger.queueLength() < 1) {
donesomething = this.array.shrinkOldFiles(this.merger, targetFileSize);
term = 10;
while (term-- > 0 && (this.merger.queueLength() < 1)) {
if (!this.array.shrinkOldFiles(this.merger, targetFileSize)) break; else donesomething = true;
}
return donesomething;

Loading…
Cancel
Save