Hi, Thanks for the test case! I can reproduce this now. The warning should not be logged, but it seems it doesn't prevent empty space in the transaction log to be re-used. Anyway, it doesn't work as expected, I will investigate.
Regards, Thomas On Wednesday, May 9, 2012, wburzyns wrote: > The problem is that the database is growing much more than it should > (as if there was an uncommitted, long-running transaction - but there > isn't any). This is accompanied by "pageStore: Transaction log could > not be truncated" warning in *.trace.db. The problem disappears if I > manually force CHECKPOINT after every commit. As far as I know (I read > it some time ago in one of your posts: > > https://groups.google.com/group/h2-database/browse_thread/thread/b26bbac61cc2a185 > ) > manual checkpointing should not be neccessary. > > I simplified the testcase. Please find it attached below: > > > package H2_Growing_txn_log_issue; > > > import java.sql.Connection; > import java.sql.PreparedStatement; > import java.sql.Statement; > import java.util.Random; > import org.h2.jdbcx.JdbcDataSource; > > > public class H2_Growing_txn_log_issue > { > private static final String DATA_TABLE_NAME = "MATDB_DATA"; > > > public static void main(String[] args) throws Exception > { > // create/open the DB > System.setProperty("h2.lobInDatabase", "true"); > String dbUrl = "jdbc:h2:split:" + > System.getProperty("java.io.tmpdir") + "txn_log_issue"; > > JdbcDataSource ds = new JdbcDataSource(); > ds.setURL(dbUrl); > Connection dbConn = ds.getConnection(); > > // create data table and a relevant precompiled insertion > statement > Statement st = null; > st = dbConn.createStatement(); > st.executeUpdate("CREATE TABLE IF NOT EXISTS " + > DATA_TABLE_NAME + "(DATA BLOB)"); > st.close(); > > PreparedStatement tableDataInsertSt = > dbConn.prepareStatement("INSERT INTO " + DATA_TABLE_NAME + " > VALUES(?)"); > > // do the test > Random random = new Random(0xBAD); // ensure full > repeatability > for (int i = 0; i < 1024; ++i) { > // start a transaction > dbConn.setAutoCommit(false); > > // generate some data > byte[] data = new byte[(int)(random.nextDouble() * > 102400)]; > random.nextBytes(data); > > // save the data in the DB > tableDataInsertSt.setBytes(1, data); > tableDataInsertSt.executeUpdate(); > tableDataInsertSt.clearParameters(); > > // commit the transaction > dbConn.commit(); > //st.executeUpdate("CHECKPOINT"); // if uncommented this > prevents the transaction log from growing > } > tableDataInsertSt.close(); > > // done > dbConn.close(); > } > } > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To post to this group, send email to > [email protected]<javascript:;> > . > To unsubscribe from this group, send email to > [email protected] <javascript:;>. > For more options, visit this group at > http://groups.google.com/group/h2-database?hl=en. > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
