Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[bugfix] Check for free disk space in BrokerPool should respect confi…

…guration parameter, so one can disable it if necessary.
  • Loading branch information...
commit 4764a4686fed1fdeef8f5735e3ad7ed58a72b7f4 1 parent 5cc31c2
@wolfgangmm wolfgangmm authored
Showing with 12 additions and 6 deletions.
  1. +12 −6 src/org/exist/storage/BrokerPool.java
View
18 src/org/exist/storage/BrokerPool.java
@@ -516,7 +516,9 @@ public static void registerStatusObserver(Observer observer) {
@ConfigurationFieldAsAttribute("sync-period")
private long majorSyncPeriod = DEFAULT_SYNCH_PERIOD; //the period after which a major sync should occur
private long lastMajorSync = System.currentTimeMillis(); //time the last major sync occurred
-
+
+ private long diskSpaceMin = 64 * 1024L * 1024L;
+
/**
* The listener that is notified when the database instance shuts down.
*/
@@ -668,6 +670,11 @@ private BrokerPool(String instanceName, int minBrokers, int maxBrokers, Configur
}
LOG.info("database instance '" + instanceName + "' is enabled for transactions : " + this.transactionsEnabled);
+ final Integer min = (Integer) conf.getProperty(BrokerPool.DISK_SPACE_MIN_PROPERTY);
+ if (min != null) {
+ diskSpaceMin = min * 1024L * 1024L;
+ }
+
pageSize = conf.getInteger(PROPERTY_PAGE_SIZE);
if (pageSize < 0)
{pageSize = DEFAULT_PAGE_SIZE;}
@@ -1333,13 +1340,12 @@ public boolean isTransactional() {
//TODO : confusion between dataDir and a so-called "journalDir" !
return !isReadOnly && transactionsEnabled;
}
-
- private static final long minFreeSpace = 50l * 1024l * 1024l;
public boolean isReadOnly() {
- final long freeSpace = dataLock.getFreeSpace();
- if (freeSpace < minFreeSpace) {
- LOG.info("Partition have " + (freeSpace / (1024l * 1024l)) + " Mb.");
+ final long freeSpace = dataLock.getFile().getUsableSpace();
+ if (freeSpace < diskSpaceMin) {
+ LOG.fatal("Partition containing DATA_DIR: " + dataLock.getFile().getAbsolutePath() + " is running out of disk space. " +
+ "Switching eXist-db to read only to prevent data loss!");
setReadOnly();
}
Please sign in to comment.
Something went wrong with that request. Please try again.