Hi,

Thanks a lot! This will be fixed in the next release. I could simplify
your test to:

import java.sql.*;
import org.h2.tools.DeleteDbFiles;
public class TestPageStoreBig {
    public static void main(String[] a) throws Exception {
        DeleteDbFiles.execute("data", "test", true);
        Class.forName("org.h2.Driver");
        Connection conn = DriverManager.getConnection(
            "jdbc:h2:data/test;PAGE_STORE=true");
        conn.createStatement().execute(
            "create table test(id varchar primary key, d varchar)");
        PreparedStatement prep = conn.prepareStatement(
            "insert into test values(?, space(500))");
        for (int i = 0; i < 20000; i++) {
            prep.setString(1, "" + i);
            prep.executeUpdate();
        }
    }
}

Regards,
Thomas


On Fri, Jul 24, 2009 at 1:53 PM, Steve McLeod<[email protected]> wrote:
>
> Hi Thomas,
>
> It wasn't easy, but I've got some code that seems to reliably
> reproduce the problem. This will typically crash either around 35,000
> inserts or 85,000 inserts. There are a couple of different exceptions
> I see, but most recently it was this:
>
> i = 36927
> Exception in thread "main" org.h2.jdbc.JdbcSQLException: General
> error: java.lang.NullPointerException; SQL statement:
> insert into gameplayersummary (gameid, playerid, playername,
> seatnumber, stakelevelid, positionid, tournamentid, gametypeid,
> tableid, tablename, dayid, isplaymoney, istournament, isHero,
> startTime, tableSize, takeInCents, takeInBigBlinds, downcard1,
> downcard2, handType, numPlayersSittingIn, timesseen, flopseen, vpip,
> preflopraised, postflopbet, postflopcalled, postflopfolded,
> postflopraised, postflopBetOrRaised,
> postFlopCallFoldBetOrRaise,blindStealAttempt,
> blindStealAttemptOpportunity, checkRaised, wentToShowdown,
> wonAtShowdown, wonWithoutShowdown, threeBetPreflop,
> threeBetPreflopOpportunity,blindStealDefenseOpportunityOnBigBlind,
> calledPreflopRaise,
> calledPreflopRaiseOpportunity,continuationBetPreflop,
> continuationBetPreflopOpportunity,foldedToBlindStealOnBigBlind,
> foldedToContinuationBet, foldedToContinuationBetOpportunity,
> foldedToPreflopThreeBet, foldedToPreflopThreeBetOpportunity) values
> (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
> [50000-116]
>        at org.h2.message.Message.getSQLException(Message.java:105)
>        at org.h2.message.Message.convert(Message.java:274)
>        at org.h2.table.TableData.addRow(TableData.java:140)
>        at org.h2.command.dml.Insert.update(Insert.java:101)
>        at org.h2.command.CommandContainer.update(CommandContainer.java:72)
>        at org.h2.command.Command.executeUpdate(Command.java:208)
>        at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal
> (JdbcPreparedStatement.java:140)
>        at org.h2.jdbc.JdbcPreparedStatement.executeUpdate
> (JdbcPreparedStatement.java:129)
>        at Test.insert(Test.java:159)
>        at Test.main(Test.java:72)
> Caused by: java.lang.NullPointerException
>        at org.h2.index.PageBtreeIndex.getRowSize(PageBtreeIndex.java:385)
>        at org.h2.index.PageBtreeNode.addChild(PageBtreeNode.java:91)
>        at org.h2.index.PageBtreeNode.split(PageBtreeNode.java:176)
>        at org.h2.index.PageBtreeNode.addRowTry(PageBtreeNode.java:150)
>        at org.h2.index.PageBtreeNode.addRowTry(PageBtreeNode.java:141)
>        at org.h2.index.PageBtreeIndex.add(PageBtreeIndex.java:101)
>        at org.h2.table.TableData.addRow(TableData.java:122)
>        ... 7 more
>
>
> This is with h2-1.1.116.jar.
>
> Rgds
>
> Steve
> ---
>
> import java.sql.*;
> import java.util.Date;
> import java.util.UUID;
>
> public class Test {
>    private static final int MAX = 1000000;
>
>    public static void main(String[] a)
>            throws Exception {
>        Class.forName("org.h2.Driver");
>        Connection conn = DriverManager.
>                getConnection("jdbc:h2:~/test;PAGE_STORE=true", "sa",
> "");
>        conn.createStatement().execute("DROP ALL OBJECTS;");
>        conn.createStatement().execute("CREATE TABLE GamePlayerSummary
> (\n" +
>                "  gameid INTEGER NOT NULL , " +
>                "  playerid INTEGER NOT NULL, " +
>                "  playerName varchar(50) NOT NULL, " +
>                "  seatnumber INTEGER NOT NULL, " +
>                "  stakelevelid INTEGER NOT NULL, " +
>                "  positionid INTEGER NOT NULL, " +
>                "  tournamentid INTEGER, " +
>                "  gametypeid INTEGER NOT NULL, " +
>                "  tableid INTEGER NOT NULL, " +
>                "  tablename varchar(50) NOT NULL, " +
>                "  dayid INTEGER NOT NULL, " +
>                "  istournament BOOLEAN, " +
>                "  isplaymoney BOOLEAN, " +
>                "  isHero BOOLEAN, " +
>                "  startTime DATETIME NOT NULL, " +
>                "  tableSize INTEGER, " +
>                "  takeInCents INTEGER, " +
>                "  takeInBigBlinds DOUBLE, " +
>                "  downCard1 INTEGER, " +
>                "  downCard2 INTEGER, " +
>                "  handtype VARCHAR(3), " +
>                "  numPlayersSittingIn INTEGER, " +
>                "  timesseen INTEGER, " +
>                "  flopseen INTEGER, " +
>                "  vpip INTEGER, " +
>                "  preflopraised INTEGER, " +
>                "  postflopbet INTEGER, " +
>                "  postflopraised INTEGER, " +
>                "  postflopcalled INTEGER, " +
>                "  postflopfolded INTEGER, " +
>                "  postflopbetorraised INTEGER, " +
>                "  postFlopCallFoldBetOrRaise INTEGER, " +
>                "  blindStealAttempt INTEGER, " +
>                "  blindStealAttemptOpportunity INTEGER, " +
>                "  checkRaised INTEGER, " +
>                "  wentToShowdown INTEGER, " +
>                "  wonAtShowdown INTEGER, " +
>                "  wonWithoutShowdown INTEGER, " +
>                "  threeBetPreflop INTEGER, " +
>                "  threeBetPreflopOpportunity INTEGER, " +
>                "  blindStealDefenseOpportunityOnBigBlind INTEGER, " +
>                "  calledPreflopRaise INTEGER, " +
>                "  calledPreflopRaiseOpportunity INTEGER, " +
>                "  continuationBetPreflop INTEGER, " +
>                "  continuationBetPreflopOpportunity INTEGER, " +
>                "  foldedToBlindStealOnBigBlind INTEGER, " +
>                "  foldedToContinuationBet INTEGER, " +
>                "  foldedToContinuationBetOpportunity INTEGER, " +
>                "  foldedToPreflopThreeBet INTEGER, " +
>                "  foldedToPreflopThreeBetOpportunity INTEGER, " +
>                "  PRIMARY KEY(gameid, playerid) " +
>                ");");
>        conn.createStatement().execute(
>                "create index gameplayersummary_full_idx on
> gameplayersummary (playername); ");
>
>        for (int i = 0; i < MAX; i++) {
>            try {
>                insert(conn, i);
>            } catch (SQLException e) {
>                System.err.println("i = " + i);
>                throw e;
>            }
>        }
>        conn.close();
>    }
>
>    private static void insert(Connection conn, int i) throws
> SQLException {
>        if (i % 1000 == 0) {
>            System.out.println("i = " + i);
>        }
>        final PreparedStatement statement = conn.prepareStatement(
>                "insert into gameplayersummary " +
>                        "(gameid, playerid, playername, seatnumber,
> stakelevelid, " +
>                        "positionid, tournamentid, gametypeid,
> tableid, tablename, " +
>                        "dayid, isplaymoney, istournament, isHero,
> startTime, " +
>                        "tableSize, takeInCents, takeInBigBlinds,
> downcard1, downcard2, " +
>                        "handType, numPlayersSittingIn, timesseen,
> flopseen, vpip, " +
>
>                        "preflopraised, postflopbet, postflopcalled,
> postflopfolded, postflopraised, " +
>                        "postflopBetOrRaised,
> postFlopCallFoldBetOrRaise,blindStealAttempt,
> blindStealAttemptOpportunity, checkRaised, " +
>                        "wentToShowdown, wonAtShowdown,
> wonWithoutShowdown, threeBetPreflop, threeBetPreflopOpportunity," +
>                        "blindStealDefenseOpportunityOnBigBlind,
> calledPreflopRaise,
> calledPreflopRaiseOpportunity,continuationBetPreflop,
> continuationBetPreflopOpportunity," +
>                        "foldedToBlindStealOnBigBlind,
> foldedToContinuationBet, foldedToContinuationBetOpportunity,
> foldedToPreflopThreeBet, foldedToPreflopThreeBetOpportunity)" +
>                        " values
> (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
>        statement.setInt(1, i);
>        statement.setInt(2, i);
>        statement.setString(3, UUID.randomUUID().toString());
>        statement.setInt(4, i);
>        statement.setInt(5, i);
>
>        statement.setInt(6, i);
>        statement.setInt(7, i);
>        statement.setInt(8, i);
>        statement.setInt(9, i);
>        statement.setString(10, UUID.randomUUID().toString());
>
>        statement.setInt(11, i);
>        statement.setBoolean(12, true);
>        statement.setBoolean(13, true);
>        statement.setBoolean(14, false);
>        statement.setTimestamp(15, new Timestamp(new Date().getTime
> ()));
>
>        statement.setInt(16, i);
>        statement.setInt(17, i);
>        statement.setInt(18, i);
>        statement.setInt(19, i);
>        statement.setInt(20, i);
>
>        statement.setString(21, "??");
>        statement.setInt(22, i);
>        statement.setInt(23, i);
>        statement.setInt(24, i);
>        statement.setInt(25, i);
>
>        statement.setInt(26, i);
>        statement.setInt(27, i);
>        statement.setInt(28, i);
>        statement.setInt(29, i);
>        statement.setInt(30, i);
>
>        statement.setInt(31, i);
>        statement.setInt(32, i);
>        statement.setInt(33, i);
>        statement.setInt(34, i);
>        statement.setInt(35, i);
>
>        statement.setInt(36, i);
>        statement.setInt(37, i);
>        statement.setInt(38, i);
>        statement.setInt(39, i);
>        statement.setInt(40, i);
>
>        statement.setInt(41, i);
>        statement.setInt(42, i);
>        statement.setInt(43, i);
>        statement.setInt(44, i);
>        statement.setInt(45, i);
>
>        statement.setInt(46, i);
>        statement.setInt(47, i);
>        statement.setInt(48, i);
>        statement.setInt(49, i);
>        statement.setInt(50, i);
>
>        statement.executeUpdate();
>        statement.close();
>    }
> }
>
>
> On Jul 23, 9:39 am, Thomas Mueller <[email protected]>
> wrote:
>> Hi,
>>
>> > I've been trying the new page store option, on an application that
>> > performs around 15 million inserts and updates. Each time I've tried
>> > (5 or 6 times) to run the app I get this exception
>>
>> Could you post a simple, standalone test case that reproduces the
>> problem? It would be great if the test case does not have any
>> dependencies except the H2 jar file (that is, a simple SQL script that
>> can be run in the H2 Console, or a Java class uses the JDBC API and is
>> run using a static main method). Please include any initialization
>> code (CREATE TABLE, INSERT and so on) in the Java class or in a .sql
>> script file.
>>
>> Regards,
>> Thomas
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to