提交 6de905e8 authored 作者: Thomas Mueller's avatar Thomas Mueller

The feature LOG_SIZE_LIMIT that was introduced in version 1.3.165 did not always…

The feature LOG_SIZE_LIMIT that was introduced in version 1.3.165 did not always work correctly (specially with regards to multithreading) and has been removed. The message "Transaction log could not be truncated" is still written to the .trace.db file if required.
上级 c89ab9ef
......@@ -311,14 +311,6 @@ public class DbSettings extends SettingsBase {
*/
public final boolean shareLinkedConnections = get("SHARE_LINKED_CONNECTIONS", true);
/**
* Database setting <code>LOG_SIZE_LIMIT</code> (default: 0).<br />
* The maximum size of the transaction log (in MB). If the transaction log
* is bigger than this value the oldest session is rolled back. The value 0
* means the sessions are never rolled back.
*/
public long logSizeLimit = get("LOG_SIZE_LIMIT", 0);
private DbSettings(HashMap<String, String> s) {
super(s);
}
......
......@@ -1441,26 +1441,6 @@ public class PageStore implements CacheWriter {
}
ignoreBigLog = true;
trace.error(null, "Transaction log could not be truncated; size: " + (newSize / 1024 / 1024) + " MB");
long logSizeLimit = database.getSettings().logSizeLimit;
if (logSizeLimit == 0 || newSize < logSizeLimit) {
return;
}
int firstUncommittedSection = log.getLogSectionId();
Session[] sessions = database.getSessions(true);
Session oldestSession = null;
for (Session s : sessions) {
int firstUncommitted = s.getFirstUncommittedLog();
if (firstUncommitted != Session.LOG_WRITTEN) {
if (firstUncommitted < firstUncommittedSection) {
firstUncommittedSection = firstUncommitted;
oldestSession = s;
}
}
}
trace.info("Rolling back session #" +oldestSession.getId() + " (the oldest uncommitted)");
synchronized (oldestSession) {
oldestSession.rollback();
}
logSizeBase = log.getSize();
}
}
......
......@@ -78,18 +78,10 @@ public class TestPageStore extends TestBase implements DatabaseEventListener {
}
private void testLogLimit() throws Exception {
testLogLimit(false);
testLogLimit(true);
}
private void testLogLimit(boolean autoRollback) throws Exception {
deleteDb("pageStore");
Connection conn, conn2;
Statement stat, stat2;
String url = "pageStore;TRACE_LEVEL_FILE=2";
if (autoRollback) {
url += ";LOG_SIZE_LIMIT=1";
}
conn = getConnection(url);
stat = conn.createStatement();
stat.execute("create table test(id int primary key)");
......@@ -106,19 +98,9 @@ public class TestPageStore extends TestBase implements DatabaseEventListener {
InputStream in = FileUtils.newInputStream(getBaseDir() + "/pageStore.trace.db");
String s = IOUtils.readStringAndClose(new InputStreamReader(in), -1);
assertTrue(s.indexOf("Transaction log could not be truncated") > 0);
if (autoRollback) {
assertTrue(s, s.indexOf("Rolling back session") > 0);
} else {
assertTrue(s, s.indexOf("Rolling back session") < 0);
}
conn.commit();
ResultSet rs = stat2.executeQuery("select * from test");
if (autoRollback) {
assertFalse(rs.next());
} else {
assertTrue(rs.next());
}
assertTrue(rs.next());
conn2.close();
conn.close();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论