Skip to content

Commit

Permalink
configurable free disk space via disk.free
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5163 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
lotus committed Sep 15, 2008
1 parent 7c5867a commit fd92332
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions defaults/yacy.init
Expand Up @@ -885,3 +885,5 @@ autoReCrawl_memprereq = -1
compare_yacy.left = YaCy
compare_yacy.right = YaCy

# minimum free disk space for crawling (MiB)
disk.free = 3000
11 changes: 4 additions & 7 deletions source/de/anomic/crawler/ResourceObserver.java
Expand Up @@ -32,9 +32,6 @@
import de.anomic.tools.diskUsage;

public final class ResourceObserver {
// The minimal free space on every used volume, for now set to 1000 MB.
// TODO make it configurable
private final static long MIN_FREE_DISK_SPACE = 1000L /* MiB */ * 1024L * 1024L;
// Unknown for now
//private final static long MIN_FREE_MEMORY = 0;
// We are called with the cleanup job every five minutes;
Expand Down Expand Up @@ -126,10 +123,10 @@ public boolean getMemoryOK () {
}

/**
* @return amount of space that should be kept free
* @return amount of space (MiB) that should be kept free
*/
public long getMinFreeDiskSpace () {
return MIN_FREE_DISK_SPACE;
return sb.getConfigLong("disk.free", 3000) /* MiB */ * 1024L * 1024L;
}

/**
Expand All @@ -146,8 +143,8 @@ private boolean checkDisks() {
for (final Map.Entry<String, long[]> entry: usage.entrySet()) {
val = entry.getValue();
this.log.logInfo("df of Volume " + entry.getKey() + ": " + (val[1] / 1024 / 1024) + " MB");
if (val[1] < MIN_FREE_DISK_SPACE) {
this.log.logWarning("Volume " + entry.getKey() + ": free space (" + (val[1] / 1024 / 1024) + " MB) is too low (< " + (MIN_FREE_DISK_SPACE / 1024 / 1024) + " MB)");
if (val[1] < getMinFreeDiskSpace()) {
this.log.logWarning("Volume " + entry.getKey() + ": free space (" + (val[1] / 1024 / 1024) + " MB) is too low (< " + (getMinFreeDiskSpace() / 1024 / 1024) + " MB)");
below = true;
}
}
Expand Down

0 comments on commit fd92332

Please sign in to comment.