Last active
April 30, 2024 09:45
-
-
Save hanohrs/10f25d621f18d00b697cda51e887cf0c to your computer and use it in GitHub Desktop.
h2-2.2.224 AssertionError in shrinkStoreIfPossible repro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ~/Library/Java/JavaVirtualMachines/azul-21.0.3/Contents/Home/bin/java -ea -XX:StartFlightRecording=filename=recording.jfr,settings=profile -cp /Users/hiro/.m2/repository/com/h2database/h2/2.2.224/h2-2.2.224.jar:out/production/h2test Main | |
[0.286s][info][jfr,startup] Started recording 1. No limit specified, using maxsize=250MB as default. | |
[0.286s][info][jfr,startup] | |
[0.286s][info][jfr,startup] Use jcmd 41617 JFR.dump name=1 to copy recording data to file. | |
1 | |
sleeping for 300000 millis... | |
2 | |
Exception in thread "main" org.h2.jdbc.JdbcSQLNonTransientException: 一般エラー: "一般エラー: ""org.h2.mvstore.MVStoreException: java.lang.AssertionError: 446840832 != 442134528 [2.2.224/3]""\000aGeneral error: ""org.h2.mvstore.MVStoreException: java.lang.AssertionError: 446840832 != 442134528 [2.2.224/3]"" [50000-224]" | |
General error: "一般エラー: ""org.h2.mvstore.MVStoreException: java.lang.AssertionError: 446840832 != 442134528 [2.2.224/3]""\000aGeneral error: ""org.h2.mvstore.MVStoreException: java.lang.AssertionError: 446840832 != 442134528 [2.2.224/3]"" [50000-224]" [50000-224] | |
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566) | |
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) | |
at org.h2.message.DbException.get(DbException.java:212) | |
at org.h2.engine.Database.throwLastBackgroundException(Database.java:1817) | |
at org.h2.engine.SessionLocal.beforeCommitOrRollback(SessionLocal.java:764) | |
at org.h2.engine.SessionLocal.commit(SessionLocal.java:679) | |
at org.h2.command.Command.commitIfNonTransactional(Command.java:315) | |
at org.h2.command.Command.executeUpdate(Command.java:247) | |
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:262) | |
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:231) | |
at Main.createAndInsert(Main.java:27) | |
at Main.main(Main.java:19) | |
Caused by: org.h2.message.DbException: 一般エラー: "org.h2.mvstore.MVStoreException: java.lang.AssertionError: 446840832 != 442134528 [2.2.224/3]" | |
General error: "org.h2.mvstore.MVStoreException: java.lang.AssertionError: 446840832 != 442134528 [2.2.224/3]" [50000-224] | |
at org.h2.message.DbException.get(DbException.java:212) | |
at org.h2.message.DbException.convert(DbException.java:407) | |
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:122) | |
at org.h2.mvstore.MVStore.handleException(MVStore.java:1546) | |
at org.h2.mvstore.MVStore.panic(MVStore.java:371) | |
at org.h2.mvstore.FileStore.storeBuffer(FileStore.java:1529) | |
at org.h2.mvstore.FileStore.lambda$serializeAndStore$3(FileStore.java:1432) | |
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) | |
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) | |
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) | |
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) | |
at java.base/java.lang.Thread.run(Thread.java:1583) | |
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: 一般エラー: "org.h2.mvstore.MVStoreException: java.lang.AssertionError: 446840832 != 442134528 [2.2.224/3]" | |
General error: "org.h2.mvstore.MVStoreException: java.lang.AssertionError: 446840832 != 442134528 [2.2.224/3]" [50000-224] | |
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566) | |
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) | |
... 12 more | |
Caused by: org.h2.mvstore.MVStoreException: java.lang.AssertionError: 446840832 != 442134528 [2.2.224/3] | |
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996) | |
... 7 more | |
Caused by: java.lang.AssertionError: 446840832 != 442134528 | |
at org.h2.mvstore.RandomAccessStore.shrinkStoreIfPossible(RandomAccessStore.java:679) | |
at org.h2.mvstore.RandomAccessStore.writeChunk(RandomAccessStore.java:377) | |
at org.h2.mvstore.RandomAccessStore.writeChunk(RandomAccessStore.java:28) | |
at org.h2.mvstore.FileStore.storeBuffer(FileStore.java:1524) | |
... 6 more |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.nio.ByteBuffer; | |
import java.nio.charset.StandardCharsets; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.sql.*; | |
public class Main { | |
private static final String URL = "jdbc:h2:./test;MAX_COMPACT_TIME=-1;AUTO_COMPACT_FILL_RATE=100"; | |
private static final int LIST_LENGTH = 10_000_000; | |
public static void main(String[] args) throws SQLException, InterruptedException, IOException { | |
Files.deleteIfExists(Paths.get("./test.mv.db")); | |
Files.deleteIfExists(Paths.get("./test.trace.db")); | |
try (Connection conn = DriverManager.getConnection(URL)) { | |
createAndInsert(conn, 1); | |
sleep(300_000); | |
createAndInsert(conn, 2); | |
} | |
} | |
private static void createAndInsert(Connection conn, int tableIndex) throws SQLException { | |
System.out.println(tableIndex); | |
try (Statement stmt = conn.createStatement()) { | |
stmt.execute("CREATE TABLE t" + tableIndex + " (" + | |
"c1 VARBINARY," + | |
"c2 VARBINARY," + | |
"c3 VARBINARY," + | |
"c4 VARBINARY," + | |
"c5 VARBINARY," + | |
"c6 VARBINARY," + | |
"c7 VARBINARY," + | |
"c8 VARBINARY," + | |
"c9 VARBINARY," + | |
"PRIMARY KEY (c1, c2)" + | |
")" | |
); | |
} | |
try (PreparedStatement pstmt = conn.prepareStatement( | |
"INSERT INTO t" + tableIndex + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)" | |
)) { | |
byte[] filler = "filler".getBytes(StandardCharsets.UTF_8); | |
ByteBuffer buf = ByteBuffer.allocate(4); | |
for (int i = 0; i < LIST_LENGTH; i++) { | |
buf.putInt(i); | |
pstmt.setBytes(1, buf.array()); | |
buf.clear(); | |
pstmt.setBytes(2, filler); | |
pstmt.setNull(3, Types.NULL); | |
pstmt.setNull(4, Types.NULL); | |
pstmt.setNull(5, Types.NULL); | |
pstmt.setNull(6, Types.NULL); | |
pstmt.setNull(7, Types.NULL); | |
pstmt.setNull(8, Types.NULL); | |
pstmt.setNull(9, Types.NULL); | |
pstmt.execute(); | |
} | |
} | |
} | |
private static void sleep(int millis) throws InterruptedException { | |
System.out.println("sleeping for " + millis + " millis..."); | |
Thread.sleep(millis); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment