提交 99186183 authored 作者: Thomas Mueller's avatar Thomas Mueller

New experimental page store.

上级 b52e1a19
...@@ -18,7 +18,7 @@ Change Log ...@@ -18,7 +18,7 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>- <ul><li>Bugfixes in the new storage mechanism (page store).
</li></ul> </li></ul>
<h2>Version 1.1.115 (2009-06-21)</h2> <h2>Version 1.1.115 (2009-06-21)</h2>
......
...@@ -320,12 +320,18 @@ public class ConnectionInfo implements Cloneable { ...@@ -320,12 +320,18 @@ public class ConnectionInfo implements Cloneable {
*/ */
String getName() throws SQLException { String getName() throws SQLException {
if (persistent) { if (persistent) {
String n = FileUtils.normalize(name + Constants.SUFFIX_DATA_FILE); String suffix;
if (SysProperties.PAGE_STORE) {
suffix = Constants.SUFFIX_PAGE_FILE;
} else {
suffix = Constants.SUFFIX_DATA_FILE;
}
String n = FileUtils.normalize(name + suffix);
String fileName = FileUtils.getFileName(n); String fileName = FileUtils.getFileName(n);
if (fileName.length() < Constants.SUFFIX_DATA_FILE.length() + 1) { if (fileName.length() < suffix.length() + 1) {
throw Message.getSQLException(ErrorCode.INVALID_DATABASE_NAME_1, name); throw Message.getSQLException(ErrorCode.INVALID_DATABASE_NAME_1, name);
} }
n = n.substring(0, n.length() - Constants.SUFFIX_DATA_FILE.length()); n = n.substring(0, n.length() - suffix.length());
return FileUtils.normalize(n); return FileUtils.normalize(n);
} }
return name; return name;
......
...@@ -531,16 +531,20 @@ public class Database implements DataHandler { ...@@ -531,16 +531,20 @@ public class Database implements DataHandler {
private synchronized void open(int traceLevelFile, int traceLevelSystemOut) throws SQLException { private synchronized void open(int traceLevelFile, int traceLevelSystemOut) throws SQLException {
if (persistent) { if (persistent) {
boolean exists;
if (SysProperties.PAGE_STORE) { if (SysProperties.PAGE_STORE) {
String pageFileName = databaseName + Constants.SUFFIX_PAGE_FILE; String pageFileName = databaseName + Constants.SUFFIX_PAGE_FILE;
if (FileUtils.exists(pageFileName) && FileUtils.isReadOnly(pageFileName)) { exists = FileUtils.exists(pageFileName);
if (exists && FileUtils.isReadOnly(pageFileName)) {
readOnly = true; readOnly = true;
} }
} } else {
String dataFileName = databaseName + Constants.SUFFIX_DATA_FILE; String dataFileName = databaseName + Constants.SUFFIX_DATA_FILE;
if (FileUtils.exists(dataFileName)) { exists = FileUtils.exists(dataFileName);
// if it is already read-only because ACCESS_MODE_DATA=r if (FileUtils.exists(dataFileName)) {
readOnly = readOnly | FileUtils.isReadOnly(dataFileName); // if it is already read-only because ACCESS_MODE_DATA=r
readOnly = readOnly | FileUtils.isReadOnly(dataFileName);
}
} }
if (readOnly) { if (readOnly) {
traceSystem = new TraceSystem(null, false); traceSystem = new TraceSystem(null, false);
...@@ -573,7 +577,7 @@ public class Database implements DataHandler { ...@@ -573,7 +577,7 @@ public class Database implements DataHandler {
getPageStore(); getPageStore();
starting = false; starting = false;
} }
if (FileUtils.exists(dataFileName)) { if (exists) {
lobFilesInDirectories &= !ValueLob.existsLobFile(getDatabasePath()); lobFilesInDirectories &= !ValueLob.existsLobFile(getDatabasePath());
lobFilesInDirectories |= FileUtils.exists(databaseName + Constants.SUFFIX_LOBS_DIRECTORY); lobFilesInDirectories |= FileUtils.exists(databaseName + Constants.SUFFIX_LOBS_DIRECTORY);
} }
......
...@@ -114,7 +114,7 @@ public class Engine { ...@@ -114,7 +114,7 @@ public class Engine {
try { try {
backup = (ConnectionInfo) ci.clone(); backup = (ConnectionInfo) ci.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
// ignore (can not occur) throw Message.getInternalError("clone failed", e);
} }
} }
Session session = openSession(ci); Session session = openSession(ci);
......
...@@ -16,6 +16,7 @@ import java.util.zip.ZipEntry; ...@@ -16,6 +16,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import org.h2.command.dml.BackupCommand; import org.h2.command.dml.BackupCommand;
import org.h2.constant.SysProperties;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.store.FileLister; import org.h2.store.FileLister;
...@@ -107,8 +108,14 @@ public class Backup extends Tool { ...@@ -107,8 +108,14 @@ public class Backup extends Tool {
ZipOutputStream zipOut = new ZipOutputStream(fileOut); ZipOutputStream zipOut = new ZipOutputStream(fileOut);
String base = ""; String base = "";
for (String fileName : list) { for (String fileName : list) {
if (fileName.endsWith(Constants.SUFFIX_DATA_FILE)) { if (SysProperties.PAGE_STORE) {
base = FileUtils.getParent(fileName); if (fileName.endsWith(Constants.SUFFIX_PAGE_FILE)) {
base = FileUtils.getParent(fileName);
}
} else {
if (fileName.endsWith(Constants.SUFFIX_DATA_FILE)) {
base = FileUtils.getParent(fileName);
}
} }
} }
for (String fileName : list) { for (String fileName : list) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论