提交 66c2dc5b authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 2cdc5f9a
......@@ -898,6 +898,7 @@ public class Database implements DataHandler {
sequence.close();
}
meta.close(systemSession);
systemSession.commit(true);
indexSummaryValid = true;
}
} catch (SQLException e) {
......
......@@ -212,7 +212,7 @@ public class LogFile {
int blocks = in.readInt();
if (blocks < 0) {
return true;
} else if (blocks == 0) {
} else if (blocks == 0 && !database.getReadOnly()) {
truncate(pos);
return false;
}
......
......@@ -82,6 +82,10 @@ public class LogSystem {
return;
}
file.flush();
if (database.getLogIndexChanges()) {
file = database.getIndexFile();
file.flush();
}
if (containsInDoubtTransactions()) {
// if there are any in-doubt transactions
// (even if they are resolved), can't update or delete the log files
......
......@@ -170,7 +170,7 @@ public class FileSystemDatabase extends FileSystem {
if (log) {
e.printStackTrace();
}
return new RuntimeException(e.toString());
return new RuntimeException(e.toString(), e);
}
public boolean canWrite(String fileName) {
......
......@@ -13,6 +13,7 @@ import java.util.HashMap;
import org.h2.message.Message;
import org.h2.util.IOUtils;
import org.h2.util.RandomUtils;
/**
* This file system keeps files fully in memory.
......@@ -64,7 +65,7 @@ public class FileSystemMemory extends FileSystem {
}
}
public boolean tryDelete(String fileName) {
public boolean tryDelete(String fileName) {
synchronized (MEMORY_FILES) {
MEMORY_FILES.remove(fileName);
}
......@@ -74,7 +75,12 @@ public class FileSystemMemory extends FileSystem {
public String createTempFile(String name, String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException {
name += ".";
for (int i = 0;; i++) {
String n = name + i + suffix;
int test;
String n = name + RandomUtils.getSecureLong() + suffix;
// String n = name + i + suffix;
if (!exists(n)) {
// creates the file (not thread safe)
getMemoryFile(n);
......
......@@ -72,6 +72,8 @@ public class TableLink extends Table {
conn = JdbcUtils.getConnection(driver, url, user, password);
DatabaseMetaData meta = conn.getMetaData();
boolean storesLowerCase = meta.storesLowerCaseIdentifiers();
boolean storesMixedCase = meta.storesMixedCaseIdentifiers();
boolean supportsMixedCaseIdentifiers = meta.supportsMixedCaseIdentifiers();
ResultSet rs = meta.getColumns(null, null, originalTable, null);
int i = 0;
ObjectArray columnList = new ObjectArray();
......@@ -96,6 +98,9 @@ public class TableLink extends Table {
String n = rs.getString("COLUMN_NAME");
if (storesLowerCase && n.equals(StringUtils.toLowerEnglish(n))) {
n = StringUtils.toUpperEnglish(n);
} else if (storesMixedCase && !supportsMixedCaseIdentifiers) {
// TeraData
n = StringUtils.toUpperEnglish(n);
}
int sqlType = rs.getInt("DATA_TYPE");
long precision = rs.getInt("COLUMN_SIZE");
......
......@@ -537,11 +537,15 @@ public class Recover implements DataHandler {
break;
case 'I':
writer.println("// insert session:"+sessionId+" storage:" + storageId + " pos:" + recId + " blockCount:"+blockCount);
writeLogRecord(writer, s);
if (storageId >= 0) {
writeLogRecord(writer, s);
}
break;
case 'D':
writer.println("// delete session:"+sessionId+" storage:" + storageId + " pos:" + recId + " blockCount:"+blockCount);
writeLogRecord(writer, s);
if (storageId >= 0) {
writeLogRecord(writer, s);
}
break;
default:
writer.println("// type?:"+type+" session:"+sessionId+" storage:" + storageId + " pos:" + recId + " blockCount:"+blockCount);
......
......@@ -36,6 +36,7 @@ public class JdbcDriverUtils {
"jdbc:postgresql:", "org.postgresql.Driver",
"jdbc:sybase:", "com.sybase.jdbc3.jdbc.SybDriver",
"jdbc:sqlserver:", "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"jdbc:teradata:", "com.ncr.teradata.TeraDriver",
};
public static String getDriver(String url) {
......
......@@ -163,6 +163,8 @@ java org.h2.test.TestAll timer
should write (log) to system table before adding to internal data structures
//new TestCrashAPI().init(test).testCase(2046453618);
temp file delete should be per-database and should stop deleting once the database is closed
--------------
scheduler: what if invoke takes more than...
......@@ -449,7 +451,6 @@ Use a default delay of 1 second before closing a database.
beforeTest();
// db
new TestScriptSimple().runTest(this);
new TestScript().runTest(this);
new TestAutoRecompile().runTest(this);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论