提交 013a9c2b authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 75648425
...@@ -42,7 +42,8 @@ public class ConnectionInfo { ...@@ -42,7 +42,8 @@ public class ConnectionInfo {
// TODO document these settings // TODO document these settings
String[] connectionTime = new String[]{ String[] connectionTime = new String[]{
"PASSWORD", "USER", "STORAGE", "FILE_LOCK", "CIPHER", "DB_CLOSE_ON_EXIT", "PASSWORD", "USER", "STORAGE", "FILE_LOCK", "CIPHER", "DB_CLOSE_ON_EXIT",
"IGNORE_UNKNOWN_SETTINGS", "IFEXISTS", "RECOVER", "CREATE", "CACHE_TYPE" "IGNORE_UNKNOWN_SETTINGS", "IFEXISTS", "RECOVER", "CREATE", "CACHE_TYPE",
"WRITE_MODE_LOG", "WRITE_MODE_DATA"
}; };
for(int i=0; i<connectionTime.length; i++) { for(int i=0; i<connectionTime.length; i++) {
String key = connectionTime[i]; String key = connectionTime[i];
......
...@@ -58,6 +58,7 @@ package org.h2.engine; ...@@ -58,6 +58,7 @@ package org.h2.engine;
* - TestSystemExit * - TestSystemExit
* - Test with hibernate * - Test with hibernate
* - Scan for viruses * - Scan for viruses
* - Newsletter: send to h2database-news@googlegroups.com (http://groups.google.com/group/h2database-news)
* - newsletter: prepare, send (always send to BCC!!) * - newsletter: prepare, send (always send to BCC!!)
* - http://maven.apache.org/guides/mini/guide-ibiblio-upload.html * - http://maven.apache.org/guides/mini/guide-ibiblio-upload.html
* - Add to freshmeat, http://code.google.com/p/h2database/downloads/list * - Add to freshmeat, http://code.google.com/p/h2database/downloads/list
...@@ -200,7 +201,7 @@ public class Constants { ...@@ -200,7 +201,7 @@ public class Constants {
public static final String CONN_URL_INTERNAL = "jdbc:default:connection"; public static final String CONN_URL_INTERNAL = "jdbc:default:connection";
public static final String CONN_URL_COLUMNLIST = "jdbc:columnlist:connection"; public static final String CONN_URL_COLUMNLIST = "jdbc:columnlist:connection";
public static final int VIEW_COST_CACHE_SIZE = 64; public static final int VIEW_INDEX_CACHE_SIZE = 64;
public static final int VIEW_COST_CACHE_MAX_AGE = 10000; // 10 seconds public static final int VIEW_COST_CACHE_MAX_AGE = 10000; // 10 seconds
public static final int MAX_PARAMETER_INDEX = 100000; public static final int MAX_PARAMETER_INDEX = 100000;
......
...@@ -135,6 +135,7 @@ public class Database implements DataHandler { ...@@ -135,6 +135,7 @@ public class Database implements DataHandler {
private String cacheType; private String cacheType;
private boolean indexSummaryValid = true; private boolean indexSummaryValid = true;
private Object lobSyncObject = new Object(); private Object lobSyncObject = new Object();
private String writeModeLog, writeModeData;
public static void setInitialPowerOffCount(int count) { public static void setInitialPowerOffCount(int count) {
initialPowerOffCount = count; initialPowerOffCount = count;
...@@ -291,11 +292,11 @@ public class Database implements DataHandler { ...@@ -291,11 +292,11 @@ public class Database implements DataHandler {
return traceSystem.getTrace(module); return traceSystem.getTrace(module);
} }
public FileStore openFile(String name, boolean mustExist) throws SQLException { public FileStore openFile(String name, String mode, boolean mustExist) throws SQLException {
if(mustExist && !FileUtils.exists(name)) { if(mustExist && !FileUtils.exists(name)) {
throw Message.getSQLException(Message.FILE_NOT_FOUND_1, name); throw Message.getSQLException(Message.FILE_NOT_FOUND_1, name);
} }
FileStore store = FileStore.open(this, name, getMagic(), cipher, filePasswordHash); FileStore store = FileStore.open(this, name, mode, getMagic(), cipher, filePasswordHash);
try { try {
store.init(); store.init();
} catch(SQLException e) { } catch(SQLException e) {
...@@ -312,11 +313,11 @@ public class Database implements DataHandler { ...@@ -312,11 +313,11 @@ public class Database implements DataHandler {
} }
private void openFileData() throws SQLException { private void openFileData() throws SQLException {
fileData = new DiskFile(this, databaseName+Constants.SUFFIX_DATA_FILE, true, true, Constants.DEFAULT_CACHE_SIZE); fileData = new DiskFile(this, databaseName+Constants.SUFFIX_DATA_FILE, writeModeData, true, true, Constants.DEFAULT_CACHE_SIZE);
} }
private void openFileIndex() throws SQLException { private void openFileIndex() throws SQLException {
fileIndex = new DiskFile(this, databaseName+Constants.SUFFIX_INDEX_FILE, false, logIndexChanges, Constants.DEFAULT_CACHE_SIZE_INDEX); fileIndex = new DiskFile(this, databaseName+Constants.SUFFIX_INDEX_FILE, "rw", false, logIndexChanges, Constants.DEFAULT_CACHE_SIZE_INDEX);
} }
public DataPage getDataPage() { public DataPage getDataPage() {
...@@ -348,6 +349,8 @@ public class Database implements DataHandler { ...@@ -348,6 +349,8 @@ public class Database implements DataHandler {
this.databaseShortName = parseDatabaseShortName(); this.databaseShortName = parseDatabaseShortName();
this.cipher = cipher; this.cipher = cipher;
String lockMethodName = ci.removeProperty("FILE_LOCK", null); String lockMethodName = ci.removeProperty("FILE_LOCK", null);
this.writeModeLog = ci.removeProperty("WRITE_MODE_LOG", "rw").toLowerCase();
this.writeModeData = ci.removeProperty("WRITE_MODE_DATA", "rw").toLowerCase();
this.fileLockMethod = FileLock.getFileLockMethod(lockMethodName); this.fileLockMethod = FileLock.getFileLockMethod(lockMethodName);
this.textStorage = ci.getTextStorage(); this.textStorage = ci.getTextStorage();
this.databaseURL = ci.getURL(); this.databaseURL = ci.getURL();
...@@ -522,7 +525,7 @@ public class Database implements DataHandler { ...@@ -522,7 +525,7 @@ public class Database implements DataHandler {
removeUnusedStorages(); removeUnusedStorages();
systemSession.commit(); systemSession.commit();
if(!readOnly) { if(!readOnly) {
emergencyReserve = openFile(createTempFile(), false); emergencyReserve = openFile(createTempFile(), "rw", false);
emergencyReserve.autoDelete(); emergencyReserve.autoDelete();
emergencyReserve.setLength(Constants.EMERGENCY_SPACE_INITIAL); emergencyReserve.setLength(Constants.EMERGENCY_SPACE_INITIAL);
} }
...@@ -1487,4 +1490,8 @@ public class Database implements DataHandler { ...@@ -1487,4 +1490,8 @@ public class Database implements DataHandler {
return lobSyncObject; return lobSyncObject;
} }
public String getWriteModeLog() {
return writeModeLog;
}
} }
...@@ -356,16 +356,16 @@ public class SessionRemote implements SessionInterface, DataHandler { ...@@ -356,16 +356,16 @@ public class SessionRemote implements SessionInterface, DataHandler {
throw Message.getSQLException(Message.FILE_CORRUPTED_1, "wrong checksum"); throw Message.getSQLException(Message.FILE_CORRUPTED_1, "wrong checksum");
} }
public FileStore openFile(String name, boolean mustExist) throws SQLException { public FileStore openFile(String name, String mode, boolean mustExist) throws SQLException {
if(mustExist && !FileUtils.exists(name)) { if(mustExist && !FileUtils.exists(name)) {
throw Message.getSQLException(Message.FILE_CORRUPTED_1, name); throw Message.getSQLException(Message.FILE_CORRUPTED_1, name);
} }
FileStore store; FileStore store;
byte[] magic = Constants.MAGIC_FILE_HEADER.getBytes(); byte[] magic = Constants.MAGIC_FILE_HEADER.getBytes();
if(cipher == null) { if(cipher == null) {
store = FileStore.open(this, name, magic); store = FileStore.open(this, name, mode, magic);
} else { } else {
store = FileStore.open(this, name, magic, cipher, fileEncryptionKey, 0); store = FileStore.open(this, name, mode, magic, cipher, fileEncryptionKey, 0);
} }
store.setCheckedWriting(false); store.setCheckedWriting(false);
try { try {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论