Open GoogleCodeExporter opened 9 years ago
This issue also occurs in our application, but not very frequently. Even the
rare occurences are big issue for us, because it requires re-filling the
database with all data from our primary data storage. This procedure takes
about 30 hours in our production environment.
We are using multi-threaded mode as well for performance reasons (same as
mentioned by the author of this issue).
Last occurences happened with version 1.3.172 on CentOS 6.3.
We were not able to reproduce the issue in developer's workspace on Windows 7
using the attached code.
Original comment by radek.kr...@gmail.com
on 3 Feb 2014 at 12:36
H2MultiThreadTest1: I tested before, but was not able to reproduce then. Now I
tested again and got the exception("Undo entry not written"). I will
investigate.
I also tried with the MVStore (append ";MV_STORE=TRUE" to the database URL), in
the current trunk, and so far could not see a problem. But the MVStore is not
ready for production yet.
Original comment by thomas.t...@gmail.com
on 21 Feb 2014 at 5:10
The problem seens to be: between writing the undo entry and writing the change,
a checkpoint is written. This is unexpected, and therefore an exception is
thrown. I'm not sure yet how to best solve this (I would like to avoid
additional synchronization or locking), but I'm working on it.
Original comment by thomas.t...@gmail.com
on 22 Feb 2014 at 6:52
Please note this is only an issue for H2 version 1.3.x. With version 1.4.x,
this code path is not used.
Original comment by thomas.t...@gmail.com
on 16 Apr 2014 at 5:14
The issue with "undo entry not written" still rarely occurs with version
1.4.180. Last occurrence produced the following stacktrace. Other information
from my comment #1 are still valid.
2014-07-23 11:33:51,457 [TP-Processor7 | u:xxx | sql: SELECT * FROM WORKITEM
WHERE C_TYPE='defect' AND NOT C_SEVERITY='critical'] ERROR
com.polarion.platform.sql.internal.runtime.Database - General error:
"java.lang.RuntimeException: Undo entry not written" [50000-180]
org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: Undo
entry not written" [50000-180]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:168)
at org.h2.message.DbException.convert(DbException.java:295)
at org.h2.message.DbException.toSQLException(DbException.java:268)
at org.h2.message.TraceObject.logAndConvert(TraceObject.java:352)
at org.h2.jdbc.JdbcResultSet.next(JdbcResultSet.java:125)
...
Caused by: java.lang.RuntimeException: Undo entry not written
at org.h2.message.DbException.throwInternalError(DbException.java:242)
at org.h2.store.PageLog.addUndo(PageLog.java:501)
at org.h2.store.PageStore.free(PageStore.java:1254)
at org.h2.store.PageStore.free(PageStore.java:1237)
at org.h2.index.PageDataIndex.remove(PageDataIndex.java:372)
at org.h2.table.RegularTable.removeChildrenAndResources(RegularTable.java:723)
at org.h2.result.ResultTempTable.dropTable(ResultTempTable.java:222)
at org.h2.result.ResultTempTable.close(ResultTempTable.java:191)
at org.h2.result.LocalResult.close(LocalResult.java:390)
at org.h2.jdbc.JdbcResultSet.nextRow(JdbcResultSet.java:3234)
at org.h2.jdbc.JdbcResultSet.next(JdbcResultSet.java:123)
... 78 more
Original comment by radek.kr...@gmail.com
on 23 Jul 2014 at 1:17
I observed the "undo entry not written" problem with 1.4.187.
The database file was initially created with 1.3.176.
The database URL is
jdbc:h2:test/data;LOCK_TIMEOUT=86400000;WRITE_DELAY=10000;MAX_MEMORY_ROWS=100000
0;MAX_OPERATION_MEMORY=50000000;MV_STORE=FALSE;MVCC=FALSE;MULTI_THREADED=TRUE
12.05.2015 07:22:06,452: ERROR [Quartz_uw_an-1] (Updater.executeUpdate:260) -
unable to execute 'executeUpdate(
insert into TABLE1(id)
select id from TABLE2
minus
select id from TABLE1;
)'
org.h2.jdbc.JdbcSQLException: Allgemeiner Fehler: "java.lang.RuntimeException:
Undo entry not written"
General error: "java.lang.RuntimeException: Undo entry not written" [50000-187]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:168)
at org.h2.message.DbException.convert(DbException.java:295)
at org.h2.table.RegularTable.removeRow(RegularTable.java:407)
at org.h2.engine.UndoLogRecord.undo(UndoLogRecord.java:96)
at org.h2.engine.Session.rollbackTo(Session.java:634)
at org.h2.command.Command.executeUpdate(Command.java:278)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:184)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:158)
at org.myapp.Updater.execute(Updater.java:88)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Undo entry not written
at org.h2.message.DbException.throwInternalError(DbException.java:242)
at org.h2.store.PageLog.addUndo(PageLog.java:501)
at org.h2.store.PageStore.update(PageStore.java:1092)
at org.h2.index.PageDataLeaf.remove(PageDataLeaf.java:430)
at org.h2.index.PageDataNode.remove(PageDataNode.java:248)
at org.h2.index.PageDataIndex.remove(PageDataIndex.java:344)
at org.h2.table.RegularTable.removeRow(RegularTable.java:389)
... 13 more
12.05.2015 07:22:06,576: ERROR [Quartz_uw_an-1] (Updater.rollback:133) -
org.h2.jdbc.JdbcSQLException: Allgemeiner Fehler:
"java.lang.ArrayIndexOutOfBoundsException"
General error: "java.lang.ArrayIndexOutOfBoundsException"; SQL statement:
ROLLBACK [50000-187]
org.h2.jdbc.JdbcSQLException: Allgemeiner Fehler:
"java.lang.ArrayIndexOutOfBoundsException"
General error: "java.lang.ArrayIndexOutOfBoundsException"; SQL statement:
ROLLBACK [50000-187]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:168)
at org.h2.message.DbException.convert(DbException.java:295)
at org.h2.table.RegularTable.removeRow(RegularTable.java:407)
at org.h2.engine.UndoLogRecord.undo(UndoLogRecord.java:96)
at org.h2.engine.Session.rollbackTo(Session.java:634)
at org.h2.engine.Session.rollback(Session.java:602)
at org.h2.command.dml.TransactionCommand.update(TransactionCommand.java:49)
at org.h2.command.CommandContainer.update(CommandContainer.java:78)
at org.h2.command.Command.executeUpdate(Command.java:254)
at org.h2.jdbc.JdbcConnection.rollbackInternal(JdbcConnection.java:1501)
at org.h2.jdbc.JdbcConnection.rollback(JdbcConnection.java:489)
at org.myapp.Updater.rollback(Updater.java:128)
at org.myapp.Updater.execute(Updater.java:88)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ArrayIndexOutOfBoundsException
at org.h2.index.PageDataLeaf.removeRow(PageDataLeaf.java:304)
at org.h2.index.PageDataLeaf.remove(PageDataLeaf.java:429)
at org.h2.index.PageDataNode.remove(PageDataNode.java:248)
at org.h2.index.PageDataIndex.remove(PageDataIndex.java:344)
at org.h2.table.RegularTable.removeRow(RegularTable.java:389)
... 17 more
Original comment by u.wiel...@gematronik.com
on 12 May 2015 at 7:44
The problem also still appears with the testcase and 1.4.187.
org.h2.jdbc.JdbcSQLException: Allgemeiner Fehler: "java.lang.RuntimeException:
Undo entry not written"
General error: "java.lang.RuntimeException: Undo entry not written"; SQL
statement:
SELECT 28253713151973 "time", ifnull(v1.value, v.c1) "label1",
ifnull(v2.value, v.c1) "label2" FROM values('-nc-') v LEFT OUTER JOIN (
SELECT vi1.value FROM values_1 vi1 WHERE vi1.time = (SELECT min(time)
FROM values_1 WHERE timeend > 28253713151973) AND vi1.time < 28253713151973 )
v1 ON 1=1 LEFT OUTER JOIN ( SELECT vi2.value FROM values_1 vi2
WHERE vi2.time = (SELECT min(time) FROM values_1 WHERE timeend >
28253713151973) AND vi2.time < 28253713151973 ) v2 ON 1=1 UNION SELECT
times.time, v1.value "label1", v2.value "label2" FROM ( SELECT DISTINCT
v.time FROM values_1 v WHERE v.time BETWEEN 28253713151973 and
28423713151973 UNION SELECT DISTINCT v.time FROM values_1 v WHERE
v.time BETWEEN 28253713151973 and 28423713151973 ) AS times LEFT OUTER JOIN
values_1 v1 ON times.time=v1.time AND v1.time BETWEEN 28253713151973 AND
28423713151973 LEFT OUTER JOIN values_1 v2 ON times.time=v2.time AND
v2.time BETWEEN 28253713151973 AND 28423713151973 ORDER BY "time" LIMIT 500000
[50000-187]
org.h2.jdbc.JdbcSQLException: Allgemeiner Fehler: "java.lang.RuntimeException:
Undo entry not written"
General error: "java.lang.RuntimeException: Undo entry not written"; SQL
statement:
SELECT 28253713151973 "time", ifnull(v1.value, v.c1) "label1",
ifnull(v2.value, v.c1) "label2" FROM values('-nc-') v LEFT OUTER JOIN (
SELECT vi1.value FROM values_1 vi1 WHERE vi1.time = (SELECT min(time)
FROM values_1 WHERE timeend > 28253713151973) AND vi1.time < 28253713151973 )
v1 ON 1=1 LEFT OUTER JOIN ( SELECT vi2.value FROM values_1 vi2
WHERE vi2.time = (SELECT min(time) FROM values_1 WHERE timeend >
28253713151973) AND vi2.time < 28253713151973 ) v2 ON 1=1 UNION SELECT
times.time, v1.value "label1", v2.value "label2" FROM ( SELECT DISTINCT
v.time FROM values_1 v WHERE v.time BETWEEN 28253713151973 and
28423713151973 UNION SELECT DISTINCT v.time FROM values_1 v WHERE
v.time BETWEEN 28253713151973 and 28423713151973 ) AS times LEFT OUTER JOIN
values_1 v1 ON times.time=v1.time AND v1.time BETWEEN 28253713151973 AND
28423713151973 LEFT OUTER JOIN values_1 v2 ON times.time=v2.time AND
v2.time BETWEEN 28253713151973 AND 28423713151973 ORDER BY "time" LIMIT 500000
[50000-187]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:168)
at org.h2.message.DbException.convert(DbException.java:295)
at org.h2.table.RegularTable.addRow(RegularTable.java:137)
at org.h2.result.ResultTempTable.addRow(ResultTempTable.java:153)
at org.h2.result.ResultTempTable.addRows(ResultTempTable.java:170)
at org.h2.result.LocalResult.addRow(LocalResult.java:289)
at org.h2.command.dml.Select.queryFlat(Select.java:585)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:685)
at org.h2.command.dml.Query.query(Query.java:322)
at org.h2.command.dml.Query.query(Query.java:290)
at org.h2.command.dml.SelectUnion.queryWithoutCache(SelectUnion.java:193)
at org.h2.command.dml.SelectUnion.query(SelectUnion.java:425)
at org.h2.command.dml.Query.query(Query.java:290)
at org.h2.index.ViewIndex.find(ViewIndex.java:272)
at org.h2.index.ViewIndex.find(ViewIndex.java:177)
at org.h2.index.BaseIndex.find(BaseIndex.java:127)
at org.h2.index.IndexCursor.find(IndexCursor.java:159)
at org.h2.table.TableFilter.next(TableFilter.java:329)
at org.h2.command.dml.Select.queryFlat(Select.java:573)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:685)
at org.h2.command.dml.Query.query(Query.java:322)
at org.h2.command.dml.Query.query(Query.java:290)
at org.h2.command.dml.SelectUnion.queryWithoutCache(SelectUnion.java:194)
at org.h2.command.dml.SelectUnion.query(SelectUnion.java:425)
at org.h2.command.dml.Query.query(Query.java:290)
at org.h2.command.dml.Query.query(Query.java:36)
at org.h2.command.CommandContainer.query(CommandContainer.java:90)
at org.h2.command.Command.executeQuery(Command.java:197)
at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:79)
at H2MultiThreadTest1$Selector2.run(H2MultiThreadTest1.java:204)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Undo entry not written
at org.h2.message.DbException.throwInternalError(DbException.java:242)
at org.h2.store.PageLog.addUndo(PageLog.java:501)
at org.h2.store.PageStore.update(PageStore.java:1092)
at org.h2.index.PageDataLeaf.addRowTry(PageDataLeaf.java:208)
at org.h2.index.PageDataNode.addRowTry(PageDataNode.java:130)
at org.h2.index.PageDataIndex.addTry(PageDataIndex.java:173)
at org.h2.index.PageDataIndex.add(PageDataIndex.java:136)
at org.h2.table.RegularTable.addRow(RegularTable.java:119)
... 28 more
Original comment by u.wiel...@gematronik.com
on 12 May 2015 at 2:27
Note that the database URL in the testcase need to be modified so that MVStore
is not used.
Attached file corrects the test case.
Original comment by u.wiel...@gematronik.com
on 12 May 2015 at 2:29
Attachments:
Original issue reported on code.google.com by
u.wiel...@gematronik.com
on 9 Jan 2014 at 9:16Attachments: