Hi,

when using MULTI_THREADED=1 sometimes I get an exception when running a 
query:

org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: 
page[50387075] data leaf table:124233 TEMP_RESULT_SET_124233 entries:0 
parent:0 keys:null offsets:null parent 0 expected 50392430"; SQL statement:
SELECT 1376648402056  "time", ifnull(v1.value, v.c1), ifnull(v2.value, 
v.c1), ifnull(v3.value, v.c1) , ifnull(v4.value, v.c1) 
FROM values('null') v
LEFT OUTER JOIN (
    SELECT vi1.value
        FROM rvalues_110501 vi1
        WHERE vi1.time = (SELECT min(time) FROM rvalues_110501 WHERE 
timeend > 1376648402056) AND vi1.time < 1376648402056
) v1 ON 1=1
LEFT OUTER JOIN (
    SELECT vi2.value
        FROM rvalues_110398 vi2
        WHERE vi2.time = (SELECT min(time) FROM rvalues_110398 WHERE 
timeend > 1376648402056) AND vi2.time < 1376648402056
) v2 ON 1=1
LEFT OUTER JOIN (
    SELECT vi3.value
        FROM rvalues_110689 vi3
        WHERE vi3.time = (SELECT min(time) FROM rvalues_110689 WHERE 
timeend > 1376648402056) AND vi3.time < 1376648402056
) v3 ON 1=1
LEFT OUTER JOIN (
    SELECT vi4.value
        FROM rvalues_110475 vi4
        WHERE vi4.time = (SELECT min(time) FROM rvalues_110475 WHERE 
timeend > 1376648402056) AND vi4.time < 1376648402056
) v4 ON 1=1
UNION
SELECT times.time, v1.value, v2.value, v3.value, v4.value
FROM
  (
   SELECT DISTINCT v.time
   FROM rvalues_110501 v
   WHERE v.time BETWEEN 1376648402056 and 1376907602056
   UNION
   SELECT DISTINCT v.time
   FROM rvalues_110398 v
   WHERE v.time BETWEEN 1376648402056 and 1376907602056
   UNION
   SELECT DISTINCT v.time
   FROM rvalues_110689 v
   WHERE v.time BETWEEN 1376648402056 and 1376907602056
   UNION
   SELECT DISTINCT v.time
   FROM rvalues_110475 v
   WHERE v.time BETWEEN 1376648402056 and 1376907602056
  ) AS times
LEFT OUTER JOIN
    rvalues_110501 v1
    ON times.time=v1.time AND v1.time BETWEEN 1376648402056 AND 
1376907602056
LEFT OUTER JOIN
    rvalues_110398 v2
    ON times.time=v2.time AND v2.time BETWEEN 1376648402056 AND 
1376907602056
LEFT OUTER JOIN
    rvalues_110689 v3
    ON times.time=v3.time AND v3.time BETWEEN 1376648402056 AND 
1376907602056
LEFT OUTER JOIN
    rvalues_110475 v4
    ON times.time=v4.time AND v4.time BETWEEN 1376648402056 AND 
1376907602056
ORDER BY "time"
LIMIT 500001
Caused by: java.lang.RuntimeException: page[50387075] data leaf 
table:124233 TEMP_RESULT_SET_124233 entries:0 parent:0 keys:null 
offsets:null parent 0 expected 50392430
        at 
org.h2.message.DbException.throwInternalError(DbException.java:228)
        at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:244)
        at org.h2.index.PageDataNode.addRowTry(PageDataNode.java:129)
        at org.h2.index.PageDataIndex.addTry(PageDataIndex.java:172)
        at org.h2.index.PageDataIndex.add(PageDataIndex.java:135)
        at org.h2.table.RegularTable.addRow(RegularTable.java:124)
        ... 32 more

I am using H2 1.3.172.
The database URL is: 
jdbc:h2:data/properties;LOCK_TIMEOUT=86400000;MULTI_THREADED=1
My database is quite large (around 15000 tables with 104GB size).

Unfortunately I cannot provide a small simple test case. I can only give 
some information about the circumstances.

A small explanation for the query:
The query selects the time based data from four different properties (one 
table for one propery) and merges them as one table.

So having the following tables (with two columns time and value):
A:
2000 A_1
2500 A_2

B: 
2100 B_1
2500 B_2

C: 
2300 C_1
2400 C_2

D: 
2300 D_1

would result in:
      A     B     C      D
2000  A_1  null  null  null
2100 null   B_1  null  null
2300 null  null   C_1   D_1
2400 null  null   C_2  null
2500  A_2   B_2  null  null


I guess the exception is thrown due to the fact that new data is added to 
the tables while the query is running?
The database seems to be ok after the exception is thrown (so no 
corruption).

Maybe the exception gives you a hint about a problematic source code 
section?

Uli 

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to