提交 48f24252 authored 作者: Thomas Mueller's avatar Thomas Mueller

The emergency reserve file has been removed.

上级 0cc8c7bf
...@@ -18,7 +18,12 @@ Change Log ...@@ -18,7 +18,12 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>Build: JAVA_HOME is now automatically detected on Mac OS X. <ul><li>The emergency reserve file has been removed. It didn't provide an appropriate
solution for the problem. It is still possible for an application to detect and deal with
the low disk space problem (deleting temporary files for example)
using DatabaseEventListener.diskSpaceIsLow, but this method is now always called
with stillAvailable=0.
</li><li>Build: JAVA_HOME is now automatically detected on Mac OS X.
</li><li>Testing for local connections was very slow on some systems. </li><li>Testing for local connections was very slow on some systems.
</li><li>The cache memory usage calculation is more conservative. </li><li>The cache memory usage calculation is more conservative.
</li><li>Allocating space got slower and slower the larger the database. </li><li>Allocating space got slower and slower the larger the database.
......
...@@ -68,6 +68,7 @@ public interface DatabaseEventListener extends EventListener { ...@@ -68,6 +68,7 @@ public interface DatabaseEventListener extends EventListener {
* within this method (even to close it). * within this method (even to close it).
* *
* @param stillAvailable the estimated space that is still available, in bytes * @param stillAvailable the estimated space that is still available, in bytes
* (if known)
* @throws SQLException if the operation should be canceled * @throws SQLException if the operation should be canceled
*/ */
void diskSpaceIsLow(long stillAvailable) throws SQLException; void diskSpaceIsLow(long stillAvailable) throws SQLException;
......
...@@ -206,7 +206,7 @@ public abstract class ScriptBase extends Prepared implements DataHandler { ...@@ -206,7 +206,7 @@ public abstract class ScriptBase extends Prepared implements DataHandler {
} }
public void freeUpDiskSpace() throws SQLException { public void freeUpDiskSpace() throws SQLException {
session.getDatabase().checkWritingAllowed(); session.getDatabase().freeUpDiskSpace();
} }
public void handleInvalidChecksum() throws SQLException { public void handleInvalidChecksum() throws SQLException {
......
...@@ -215,18 +215,6 @@ public class SysProperties { ...@@ -215,18 +215,6 @@ public class SysProperties {
*/ */
public static final boolean DOLLAR_QUOTING = getBooleanSetting("h2.dollarQuoting", true); public static final boolean DOLLAR_QUOTING = getBooleanSetting("h2.dollarQuoting", true);
/**
* System property <code>h2.emergencySpaceInitial</code> (default: 262144).<br />
* Size of 'reserve' file to detect disk full problems early.
*/
public static final int EMERGENCY_SPACE_INITIAL = getIntSetting("h2.emergencySpaceInitial", 256 * 1024);
/**
* System property <code>h2.emergencySpaceMin</code> (default: 65536).<br />
* Minimum size of 'reserve' file.
*/
public static final int EMERGENCY_SPACE_MIN = getIntSetting("h2.emergencySpaceMin", 64 * 1024);
/** /**
* System property <code>h2.largeResultBufferSize</code> (default: 4096).<br /> * System property <code>h2.largeResultBufferSize</code> (default: 4096).<br />
* Buffer size for large result sets. Set this value to 0 to disable the buffer. * Buffer size for large result sets. Set this value to 0 to disable the buffer.
......
...@@ -130,7 +130,6 @@ public class Database implements DataHandler { ...@@ -130,7 +130,6 @@ public class Database implements DataHandler {
private boolean noDiskSpace; private boolean noDiskSpace;
private int writeDelay = Constants.DEFAULT_WRITE_DELAY; private int writeDelay = Constants.DEFAULT_WRITE_DELAY;
private DatabaseEventListener eventListener; private DatabaseEventListener eventListener;
private FileStore emergencyReserve;
private int maxMemoryRows = Constants.DEFAULT_MAX_MEMORY_ROWS; private int maxMemoryRows = Constants.DEFAULT_MAX_MEMORY_ROWS;
private int maxMemoryUndo = SysProperties.DEFAULT_MAX_MEMORY_UNDO; private int maxMemoryUndo = SysProperties.DEFAULT_MAX_MEMORY_UNDO;
private int lockMode = SysProperties.DEFAULT_LOCK_MODE; private int lockMode = SysProperties.DEFAULT_LOCK_MODE;
...@@ -406,10 +405,6 @@ public class Database implements DataHandler { ...@@ -406,10 +405,6 @@ public class Database implements DataHandler {
lock.unlock(); lock.unlock();
lock = null; lock = null;
} }
if (emergencyReserve != null) {
emergencyReserve.closeAndDeleteSilently();
emergencyReserve = null;
}
} catch (Exception e) { } catch (Exception e) {
TraceSystem.traceThrowable(e); TraceSystem.traceThrowable(e);
} }
...@@ -618,11 +613,6 @@ public class Database implements DataHandler { ...@@ -618,11 +613,6 @@ public class Database implements DataHandler {
removeUnusedStorages(systemSession); removeUnusedStorages(systemSession);
} }
systemSession.commit(true); systemSession.commit(true);
if (!readOnly && persistent) {
emergencyReserve = openFile(createTempFile(), "rw", false);
emergencyReserve.setLength(SysProperties.EMERGENCY_SPACE_INITIAL);
emergencyReserve.autoDelete();
}
traceSystem.getTrace(Trace.DATABASE).info("opened " + databaseName); traceSystem.getTrace(Trace.DATABASE).info("opened " + databaseName);
} }
...@@ -1453,10 +1443,6 @@ public class Database implements DataHandler { ...@@ -1453,10 +1443,6 @@ public class Database implements DataHandler {
} }
private void deleteOldTempFiles() throws SQLException { private void deleteOldTempFiles() throws SQLException {
if (emergencyReserve != null) {
emergencyReserve.closeAndDeleteSilently();
emergencyReserve = null;
}
String path = FileUtils.getParent(databaseName); String path = FileUtils.getParent(databaseName);
String prefix = FileUtils.normalize(databaseName); String prefix = FileUtils.normalize(databaseName);
String[] list = FileUtils.listFiles(path); String[] list = FileUtils.listFiles(path);
...@@ -1742,18 +1728,8 @@ public class Database implements DataHandler { ...@@ -1742,18 +1728,8 @@ public class Database implements DataHandler {
} }
public synchronized void freeUpDiskSpace() throws SQLException { public synchronized void freeUpDiskSpace() throws SQLException {
long sizeAvailable = 0;
if (emergencyReserve != null) {
sizeAvailable = emergencyReserve.length();
long newLength = sizeAvailable / 4;
if (newLength < SysProperties.EMERGENCY_SPACE_MIN) {
newLength = 0;
noDiskSpace = true;
}
emergencyReserve.setLength(newLength);
}
if (eventListener != null) { if (eventListener != null) {
eventListener.diskSpaceIsLow(sizeAvailable); eventListener.diskSpaceIsLow(0);
} }
} }
......
...@@ -53,6 +53,7 @@ implements Trigger, CloseListener ...@@ -53,6 +53,7 @@ implements Trigger, CloseListener
{ {
//## Java 1.4 begin ## //## Java 1.4 begin ##
private static final boolean STORE_DOCUMENT_TEXT_IN_INDEX = Boolean.getBoolean("h2.storeDocumentTextInIndex");
private static HashMap indexers = new HashMap(); private static HashMap indexers = new HashMap();
private static final String FIELD_DATA = "DATA"; private static final String FIELD_DATA = "DATA";
private static final String FIELD_QUERY = "QUERY"; private static final String FIELD_QUERY = "QUERY";
...@@ -471,7 +472,8 @@ implements Trigger, CloseListener ...@@ -471,7 +472,8 @@ implements Trigger, CloseListener
} }
allData.append(data); allData.append(data);
} }
doc.add(new Field(FIELD_DATA, allData.toString(), Field.Store.NO, Field.Index.TOKENIZED)); Field.Store storeText = STORE_DOCUMENT_TEXT_IN_INDEX ? Field.Store.YES : Field.Store.NO;
doc.add(new Field(FIELD_DATA, allData.toString(), storeText, Field.Index.TOKENIZED));
try { try {
indexer.addDocument(doc); indexer.addDocument(doc);
} catch (IOException e) { } catch (IOException e) {
......
...@@ -1114,7 +1114,7 @@ class WebThread extends Thread implements DatabaseEventListener { ...@@ -1114,7 +1114,7 @@ class WebThread extends Thread implements DatabaseEventListener {
} }
public void diskSpaceIsLow(long stillAvailable) { public void diskSpaceIsLow(long stillAvailable) {
log("Disk space is low; still available: " + stillAvailable); log("No more disk space is available");
} }
public void exceptionThrown(SQLException e, String sql) { public void exceptionThrown(SQLException e, String sql) {
...@@ -2147,7 +2147,7 @@ class WebThread extends Thread implements DatabaseEventListener { ...@@ -2147,7 +2147,7 @@ class WebThread extends Thread implements DatabaseEventListener {
} }
public void diskSpaceIsLow(long stillAvailable) { public void diskSpaceIsLow(long stillAvailable) {
trace("Disk space is low; still available: " + stillAvailable); trace("No more disk space is available");
} }
public void exceptionThrown(SQLException e, String sql) { public void exceptionThrown(SQLException e, String sql) {
......
...@@ -827,8 +827,6 @@ public class MetaTable extends Table { ...@@ -827,8 +827,6 @@ public class MetaTable extends Table {
add(rows, new String[]{"h2.clientTraceDirectory", SysProperties.CLIENT_TRACE_DIRECTORY}); add(rows, new String[]{"h2.clientTraceDirectory", SysProperties.CLIENT_TRACE_DIRECTORY});
add(rows, new String[]{SysProperties.H2_COLLATOR_CACHE_SIZE, "" + SysProperties.getCollatorCacheSize()}); add(rows, new String[]{SysProperties.H2_COLLATOR_CACHE_SIZE, "" + SysProperties.getCollatorCacheSize()});
add(rows, new String[]{"h2.defaultMaxMemoryUndo", "" + SysProperties.DEFAULT_MAX_MEMORY_UNDO}); add(rows, new String[]{"h2.defaultMaxMemoryUndo", "" + SysProperties.DEFAULT_MAX_MEMORY_UNDO});
add(rows, new String[]{"h2.emergencySpaceInitial", "" + SysProperties.EMERGENCY_SPACE_INITIAL});
add(rows, new String[]{"h2.emergencySpaceMin", "" + SysProperties.EMERGENCY_SPACE_MIN});
add(rows, new String[]{"h2.lobFilesInDirectories", "" + SysProperties.LOB_FILES_IN_DIRECTORIES}); add(rows, new String[]{"h2.lobFilesInDirectories", "" + SysProperties.LOB_FILES_IN_DIRECTORIES});
add(rows, new String[]{"h2.lobFilesPerDirectory", "" + SysProperties.LOB_FILES_PER_DIRECTORY}); add(rows, new String[]{"h2.lobFilesPerDirectory", "" + SysProperties.LOB_FILES_PER_DIRECTORY});
add(rows, new String[]{"h2.logAllErrors", "" + SysProperties.LOG_ALL_ERRORS}); add(rows, new String[]{"h2.logAllErrors", "" + SysProperties.LOG_ALL_ERRORS});
......
...@@ -90,7 +90,7 @@ public class ShowProgress implements DatabaseEventListener { ...@@ -90,7 +90,7 @@ public class ShowProgress implements DatabaseEventListener {
* @param stillAvailable the number of bytes still available * @param stillAvailable the number of bytes still available
*/ */
public void diskSpaceIsLow(long stillAvailable) { public void diskSpaceIsLow(long stillAvailable) {
System.out.println("diskSpaceIsLow stillAvailable="+stillAvailable); System.out.println("diskSpaceIsLow");
} }
/** /**
......
...@@ -282,8 +282,8 @@ java org.h2.test.TestAll timer ...@@ -282,8 +282,8 @@ java org.h2.test.TestAll timer
System.setProperty("h2.check2", "true"); System.setProperty("h2.check2", "true");
/* /*
remove emergencyReserve?
remove emergencyReserver? build.sh from mac (test in Ubuntu)
test.sql test.sql
good: good:
......
...@@ -52,7 +52,7 @@ public class TestListener extends TestBase implements DatabaseEventListener { ...@@ -52,7 +52,7 @@ public class TestListener extends TestBase implements DatabaseEventListener {
} }
public void diskSpaceIsLow(long stillAvailable) { public void diskSpaceIsLow(long stillAvailable) {
printTime("diskSpaceIsLow stillAvailable=" + stillAvailable); printTime("diskSpaceIsLow");
} }
public void exceptionThrown(SQLException e, String sql) { public void exceptionThrown(SQLException e, String sql) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论