提交 678c598e authored 作者: Thomas Mueller's avatar Thomas Mueller

Issue 558: with the MVStore, a NullPointerException could occur when using LOBs…

Issue 558: with the MVStore, a NullPointerException could occur when using LOBs at session commit (LobStorageMap.removeLob).
上级 ad07f963
...@@ -273,6 +273,10 @@ public class LobStorageMap implements LobStorageInterface { ...@@ -273,6 +273,10 @@ public class LobStorageMap implements LobStorageInterface {
trace("remove " + tableId + "/" + lobId); trace("remove " + tableId + "/" + lobId);
} }
Object[] value = lobMap.remove(lobId); Object[] value = lobMap.remove(lobId);
if (value == null) {
// already removed
return;
}
byte[] streamStoreId = (byte[]) value[0]; byte[] streamStoreId = (byte[]) value[0];
Object[] key = new Object[] {streamStoreId, lobId }; Object[] key = new Object[] {streamStoreId, lobId };
refMap.remove(key); refMap.remove(key);
......
...@@ -61,6 +61,7 @@ public class TestLob extends TestBase { ...@@ -61,6 +61,7 @@ public class TestLob extends TestBase {
@Override @Override
public void test() throws Exception { public void test() throws Exception {
testCloseLobTwice();
testCleaningUpLobsOnRollback(); testCleaningUpLobsOnRollback();
testClobWithRandomUnicodeChars(); testClobWithRandomUnicodeChars();
testCommitOnExclusiveConnection(); testCommitOnExclusiveConnection();
...@@ -112,6 +113,20 @@ public class TestLob extends TestBase { ...@@ -112,6 +113,20 @@ public class TestLob extends TestBase {
FileUtils.deleteRecursive(TEMP_DIR, true); FileUtils.deleteRecursive(TEMP_DIR, true);
} }
private void testCloseLobTwice() throws SQLException {
deleteDb("lob");
Connection conn = getConnection("lob");
PreparedStatement prep = conn.prepareStatement("set @c = ?");
prep.setCharacterStream(1, new StringReader(
new String(new char[10000])), 10000);
prep.execute();
prep.setCharacterStream(1, new StringReader(
new String(new char[10001])), 10001);
prep.execute();
conn.setAutoCommit(true);
conn.close();
}
private void testCleaningUpLobsOnRollback() throws Exception { private void testCleaningUpLobsOnRollback() throws Exception {
if (config.mvStore) { if (config.mvStore) {
return; return;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论