tudoutiao / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

Large transaction: "Cannot remove records" in .trace.db file #157

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This problem occurs when the transaction is larger than the cache size.
Test case:

package db;
import java.io.*;
import java.sql.*;
import org.h2.tools.DeleteDbFiles;
import org.h2.util.IOUtils;
public class TestH2CachePerformance {
    public static void main(String... args) throws Exception {
        DeleteDbFiles.execute("data", null, true);
        org.h2.Driver.load();
        Connection conn = DriverManager.getConnection(
                "jdbc:h2:data/test;CACHE_SIZE=100;TRACE_LEVEL_FILE=2");
        conn.setAutoCommit(false);
        Statement stat = conn.createStatement();
        stat.execute("create table test(id identity, name varchar)");
        stat.execute("insert into test select x, space(1024) " +
                "from system_range(1, 1000)");
        conn.commit();
        conn.close();
        String s = IOUtils.readStringAndClose(
                new FileReader("data/test.trace.db"), -1);
        if (s.indexOf("Cannot remove records") >= 0) {
            throw new Exception();
        }
    }
}

Original issue reported on code.google.com by thomas.t...@gmail.com on 30 Dec 2009 at 10:59

GoogleCodeExporter commented 8 years ago
While the problem is not completely solved, transactions can now be much larger
in version 1.2.130

Original comment by thomas.t...@gmail.com on 26 Feb 2010 at 4:31