Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

configurable disk space hardlimit for dht

lotus79251e6f60de
diff --git a/defaults/yacy.init b/defaults/yacy.init
index a437a3707..2ee5561fa 100644
--- a/defaults/yacy.init
+++ b/defaults/yacy.init
@@ -896,6 +896,8 @@ compare_yacy.right = YaCy
# minimum free disk space for crawling (MiB)
disk.free = 3000
+# minimum for DHT or 1/5th of former, whatever is max
+disk.free.hardlimit = 1000
# setting if execution of CGI files is allowed or not
cgi.allow = false
diff --git a/source/de/anomic/crawler/ResourceObserver.java b/source/de/anomic/crawler/ResourceObserver.java
index 26fb7c356..2a88a2ad0 100644
--- a/source/de/anomic/crawler/ResourceObserver.java
+++ b/source/de/anomic/crawler/ResourceObserver.java
@@ -161,7 +161,14 @@ public final class ResourceObserver {
* @return amount of space (MiB) that should be kept free
*/
public long getMinFreeDiskSpace () {
- return sb.getConfigLong("disk.free", 3000) /* MiB */ * 1024L * 1024L;
+ return sb.getConfigLong(SwitchboardConstants.DISK_FREE, 3000) /* MiB */ * 1024L * 1024L;
+ }
+
+ /**
+ * @return amount of space (MiB) that should at least be kept free
+ */
+ public long getMinFreeDiskSpace_hardlimit () {
+ return sb.getConfigLong(SwitchboardConstants.DISK_FREE_HARDLIMIT, 100) /* MiB */ * 1024L * 1024L;
}
/**
@@ -187,7 +194,7 @@ public final class ResourceObserver {
log.logWarning("Volume " + entry.getKey() + ": free space (" + (val[1] / 1024 / 1024) + " MB) is too low (< " + (getMinFreeDiskSpace() / 1024 / 1024) + " MB)");
ret = MEDIUM;
}
- if (val[1] < Math.min(getMinFreeDiskSpace() / 5L, 100L)) {
+ if (val[1] < Math.max(getMinFreeDiskSpace() / 5L, getMinFreeDiskSpace_hardlimit())) {
ret = LOW;
}
}
diff --git a/source/de/anomic/search/SwitchboardConstants.java b/source/de/anomic/search/SwitchboardConstants.java
index 0b1d1045d..44473c938 100644
--- a/source/de/anomic/search/SwitchboardConstants.java
+++ b/source/de/anomic/search/SwitchboardConstants.java
@@ -385,6 +385,14 @@ public final class SwitchboardConstants {
public static final String WORK_PATH = "workPath";
public static final String WORK_PATH_DEFAULT = "DATA/WORK";
+
+ /**
+ * ResourceObserver
+ */
+ public static final String DISK_FREE = "disk.free";
+ public static final String DISK_FREE_HARDLIMIT = "disk.free.hardlimit";
+
+
/*
* Some constants
*/