Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
59b691be
提交
59b691be
authored
11 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Server mode: if there was an error while reading from a LOB, the session was closed in some cases.
上级
0324fd77
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
43 行增加
和
22 行删除
+43
-22
changelog.html
h2/src/docsrc/html/changelog.html
+2
-1
TcpServerThread.java
h2/src/main/org/h2/server/TcpServerThread.java
+13
-7
LobStorageRemoteInputStream.java
h2/src/main/org/h2/store/LobStorageRemoteInputStream.java
+7
-1
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+21
-13
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
59b691be
...
@@ -18,7 +18,8 @@ Change Log
...
@@ -18,7 +18,8 @@ Change Log
<h1>
Change Log
</h1>
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Issue 463: Driver name and version are now the same in OsgiDataSourceFactory and JdbcDatabaseMetaData.
<ul><li>
Server mode: if there was an error while reading from a LOB, the session was closed in some cases.
</li><li>
Issue 463: Driver name and version are now the same in OsgiDataSourceFactory and JdbcDatabaseMetaData.
</li><li>
JaQu: The data type VARCHAR is now (again) used for Strings
</li><li>
JaQu: The data type VARCHAR is now (again) used for Strings
(no longer TEXT, except when explicitly set).
(no longer TEXT, except when explicitly set).
</li><li>
For in-memory databases, creating an index on a CLOB or BLOB column
</li><li>
For in-memory databases, creating an index on a CLOB or BLOB column
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/TcpServerThread.java
浏览文件 @
59b691be
...
@@ -407,26 +407,33 @@ public class TcpServerThread implements Runnable {
...
@@ -407,26 +407,33 @@ public class TcpServerThread implements Runnable {
long
lobId
=
transfer
.
readLong
();
long
lobId
=
transfer
.
readLong
();
byte
[]
hmac
;
byte
[]
hmac
;
CachedInputStream
in
;
CachedInputStream
in
;
boolean
verifyMac
;
if
(
clientVersion
>=
Constants
.
TCP_PROTOCOL_VERSION_11
)
{
if
(
clientVersion
>=
Constants
.
TCP_PROTOCOL_VERSION_11
)
{
if
(
clientVersion
>=
Constants
.
TCP_PROTOCOL_VERSION_12
)
{
if
(
clientVersion
>=
Constants
.
TCP_PROTOCOL_VERSION_12
)
{
hmac
=
transfer
.
readBytes
();
hmac
=
transfer
.
readBytes
();
transfer
.
verifyLobMac
(
hmac
,
lobId
)
;
verifyMac
=
true
;
}
else
{
}
else
{
hmac
=
null
;
hmac
=
null
;
verifyMac
=
false
;
}
}
in
=
lobs
.
get
(
lobId
);
in
=
lobs
.
get
(
lobId
);
if
(
in
==
null
)
{
if
(
in
==
null
&&
verifyMac
)
{
in
=
new
CachedInputStream
(
null
);
in
=
new
CachedInputStream
(
null
);
lobs
.
put
(
lobId
,
in
);
lobs
.
put
(
lobId
,
in
);
}
}
}
else
{
}
else
{
verifyMac
=
false
;
hmac
=
null
;
hmac
=
null
;
in
=
lobs
.
get
(
lobId
);
in
=
lobs
.
get
(
lobId
);
if
(
in
==
null
)
{
throw
DbException
.
get
(
ErrorCode
.
OBJECT_CLOSED
);
}
}
}
long
offset
=
transfer
.
readLong
();
long
offset
=
transfer
.
readLong
();
int
length
=
transfer
.
readInt
();
if
(
verifyMac
)
{
transfer
.
verifyLobMac
(
hmac
,
lobId
);
}
if
(
in
==
null
)
{
throw
DbException
.
get
(
ErrorCode
.
OBJECT_CLOSED
);
}
if
(
in
.
getPos
()
!=
offset
)
{
if
(
in
.
getPos
()
!=
offset
)
{
LobStorageInterface
lobStorage
=
session
.
getDataHandler
().
getLobStorage
();
LobStorageInterface
lobStorage
=
session
.
getDataHandler
().
getLobStorage
();
InputStream
lobIn
=
lobStorage
.
getInputStream
(
lobId
,
hmac
,
-
1
);
InputStream
lobIn
=
lobStorage
.
getInputStream
(
lobId
,
hmac
,
-
1
);
...
@@ -434,12 +441,11 @@ public class TcpServerThread implements Runnable {
...
@@ -434,12 +441,11 @@ public class TcpServerThread implements Runnable {
lobs
.
put
(
lobId
,
in
);
lobs
.
put
(
lobId
,
in
);
lobIn
.
skip
(
offset
);
lobIn
.
skip
(
offset
);
}
}
int
length
=
transfer
.
readInt
();
// limit the buffer size
// limit the buffer size
length
=
Math
.
min
(
16
*
Constants
.
IO_BUFFER_SIZE
,
length
);
length
=
Math
.
min
(
16
*
Constants
.
IO_BUFFER_SIZE
,
length
);
transfer
.
writeInt
(
SessionRemote
.
STATUS_OK
);
byte
[]
buff
=
new
byte
[
length
];
byte
[]
buff
=
new
byte
[
length
];
length
=
IOUtils
.
readFully
(
in
,
buff
,
0
,
length
);
length
=
IOUtils
.
readFully
(
in
,
buff
,
0
,
length
);
transfer
.
writeInt
(
SessionRemote
.
STATUS_OK
);
transfer
.
writeInt
(
length
);
transfer
.
writeInt
(
length
);
transfer
.
writeBytes
(
buff
,
0
,
length
);
transfer
.
writeBytes
(
buff
,
0
,
length
);
transfer
.
flush
();
transfer
.
flush
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/LobStorageRemoteInputStream.java
浏览文件 @
59b691be
...
@@ -9,6 +9,8 @@ package org.h2.store;
...
@@ -9,6 +9,8 @@ package org.h2.store;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
org.h2.message.DbException
;
/**
/**
* An input stream that reads from a remote LOB.
* An input stream that reads from a remote LOB.
*/
*/
...
@@ -64,7 +66,11 @@ class LobStorageRemoteInputStream extends InputStream {
...
@@ -64,7 +66,11 @@ class LobStorageRemoteInputStream extends InputStream {
if
(
length
==
0
)
{
if
(
length
==
0
)
{
return
-
1
;
return
-
1
;
}
}
length
=
handler
.
readLob
(
lob
,
hmac
,
pos
,
buff
,
off
,
length
);
try
{
length
=
handler
.
readLob
(
lob
,
hmac
,
pos
,
buff
,
off
,
length
);
}
catch
(
DbException
e
)
{
throw
DbException
.
convertToIOException
(
e
);
}
remainingBytes
-=
length
;
remainingBytes
-=
length
;
if
(
length
==
0
)
{
if
(
length
==
0
)
{
return
-
1
;
return
-
1
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
59b691be
...
@@ -29,6 +29,7 @@ import java.util.Random;
...
@@ -29,6 +29,7 @@ import java.util.Random;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.constant.SysProperties
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.message.DbException
;
import
org.h2.store.FileLister
;
import
org.h2.store.FileLister
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
...
@@ -298,7 +299,7 @@ public class TestLob extends TestBase {
...
@@ -298,7 +299,7 @@ public class TestLob extends TestBase {
ResultSet
rs
=
stat
.
executeQuery
(
"select name from test where id = "
+
random
.
nextInt
(
999
));
ResultSet
rs
=
stat
.
executeQuery
(
"select name from test where id = "
+
random
.
nextInt
(
999
));
if
(
rs
.
next
())
{
if
(
rs
.
next
())
{
Reader
r
=
rs
.
getClob
(
"name"
).
getCharacterStream
();
Reader
r
=
rs
.
getClob
(
"name"
).
getCharacterStream
();
while
(
r
.
read
(
tmp
)
>
0
)
{
while
(
r
.
read
(
tmp
)
>
=
0
)
{
// ignore
// ignore
}
}
r
.
close
();
r
.
close
();
...
@@ -307,17 +308,24 @@ public class TestLob extends TestBase {
...
@@ -307,17 +308,24 @@ public class TestLob extends TestBase {
}
catch
(
SQLException
ex
)
{
}
catch
(
SQLException
ex
)
{
// ignore "LOB gone away", this can happen in the presence of concurrent updates
// ignore "LOB gone away", this can happen in the presence of concurrent updates
if
(
ex
.
getErrorCode
()
!=
ErrorCode
.
IO_EXCEPTION_2
)
{
if
(
ex
.
getErrorCode
()
!=
ErrorCode
.
IO_EXCEPTION_2
)
{
ex
.
printStackTrace
()
;
throw
ex
;
}
}
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
// ignore "LOB gone away", this can happen in the presence of concurrent updates
// ignore "LOB gone away", this can happen in the presence of concurrent updates
if
(!(
ex
.
getCause
()
instanceof
SQLException
))
{
Exception
e
=
ex
;
ex
.
printStackTrace
();
if
(
e
.
getCause
()
instanceof
DbException
)
{
e
=
(
Exception
)
e
.
getCause
();
}
}
SQLException
ex2
=
(
SQLException
)
ex
.
getCause
();
if
(!(
e
.
getCause
()
instanceof
SQLException
))
{
if
(
ex2
.
getErrorCode
()
!=
90028
)
{
throw
ex
;
ex
.
printStackTrace
();
}
}
SQLException
e2
=
(
SQLException
)
e
.
getCause
();
if
(
e2
.
getErrorCode
()
!=
ErrorCode
.
IO_EXCEPTION_1
)
{
throw
ex
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
System
.
out
);
throw
e
;
}
}
}
}
}
}
...
@@ -358,12 +366,12 @@ public class TestLob extends TestBase {
...
@@ -358,12 +366,12 @@ public class TestLob extends TestBase {
Deadlock2Task1
task4
=
new
Deadlock2Task1
();
Deadlock2Task1
task4
=
new
Deadlock2Task1
();
Deadlock2Task2
task5
=
new
Deadlock2Task2
();
Deadlock2Task2
task5
=
new
Deadlock2Task2
();
Deadlock2Task2
task6
=
new
Deadlock2Task2
();
Deadlock2Task2
task6
=
new
Deadlock2Task2
();
task1
.
execute
();
task1
.
execute
(
"task1"
);
task2
.
execute
();
task2
.
execute
(
"task2"
);
task3
.
execute
();
task3
.
execute
(
"task3"
);
task4
.
execute
();
task4
.
execute
(
"task4"
);
task5
.
execute
();
task5
.
execute
(
"task5"
);
task6
.
execute
();
task6
.
execute
(
"task6"
);
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
stat
.
execute
(
"insert into test values(null, space(10000 + "
+
i
+
"), 1)"
);
stat
.
execute
(
"insert into test values(null, space(10000 + "
+
i
+
"), 1)"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论