Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
16bdacb2
提交
16bdacb2
authored
8月 02, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Issue 101: Rollback of a large transaction could fail.
上级
0e440644
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
47 行增加
和
11 行删除
+47
-11
changelog.html
h2/src/docsrc/html/changelog.html
+2
-1
UndoLog.java
h2/src/main/org/h2/log/UndoLog.java
+4
-0
UndoLogRecord.java
h2/src/main/org/h2/log/UndoLogRecord.java
+28
-9
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+13
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
16bdacb2
...
...
@@ -18,7 +18,8 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Various improvements in the page store mechanism (still experimental).
<ul><li>
Issue 101: Rollback of a large transaction could fail.
</li><li>
Various improvements in the page store mechanism (still experimental).
</li><li>
The functions LENGTH, OCTET_LENGTH, and BIT_LENGTH now return BIGINT.
</li><li>
Data types CLOB and BLOB: the maximum precision was Integer.MAX_VALUE, it is now Long.MAX_VALUE.
</li><li>
Multi-threaded kernel: creating and dropping temporary database objects
...
...
h2/src/main/org/h2/log/UndoLog.java
浏览文件 @
16bdacb2
...
...
@@ -85,6 +85,10 @@ public class UndoLog {
}
}
}
for
(
int
k
=
0
;
k
<
i
;
k
++)
{
UndoLogRecord
e
=
records
.
get
(
k
);
e
.
invalidatePos
();
}
first
.
seek
(
file
);
}
return
entry
;
...
...
h2/src/main/org/h2/log/UndoLogRecord.java
浏览文件 @
16bdacb2
...
...
@@ -100,6 +100,7 @@ public class UndoLogRecord {
}
}
try
{
row
.
setDeleted
(
false
);
table
.
removeRow
(
session
,
row
);
}
catch
(
SQLException
e
)
{
if
(
session
.
getDatabase
().
getLockMode
()
==
Constants
.
LOCK_MODE_OFF
...
...
@@ -117,6 +118,7 @@ public class UndoLogRecord {
table
.
addRow
(
session
,
row
);
// reset session id, otherwise other session think
// that this row was inserted by this session
commit
();
row
.
commit
();
}
catch
(
SQLException
e
)
{
if
(
session
.
getDatabase
().
getLockMode
()
==
Constants
.
LOCK_MODE_OFF
...
...
@@ -133,6 +135,15 @@ public class UndoLogRecord {
}
}
/**
* Go to the right position in the file.
*
* @param file the file
*/
void
seek
(
FileStore
file
)
throws
SQLException
{
file
.
seek
(
filePos
*
Constants
.
FILE_BLOCK_SIZE
);
}
/**
* Save the row in the file using the data page as a buffer.
*
...
...
@@ -143,6 +154,8 @@ public class UndoLogRecord {
buff
.
reset
();
buff
.
writeInt
(
0
);
buff
.
writeInt
(
operation
);
buff
.
writeByte
(
row
.
isDeleted
()
?
(
byte
)
1
:
(
byte
)
0
);
buff
.
writeInt
(
row
.
getSessionId
());
buff
.
writeInt
(
row
.
getColumnCount
());
for
(
int
i
=
0
;
i
<
row
.
getColumnCount
();
i
++)
{
buff
.
writeValue
(
row
.
getValue
(
i
));
...
...
@@ -156,15 +169,6 @@ public class UndoLogRecord {
state
=
STORED
;
}
/**
* Go to the right position in the file.
*
* @param file the file
*/
void
seek
(
FileStore
file
)
throws
SQLException
{
file
.
seek
(
filePos
*
Constants
.
FILE_BLOCK_SIZE
);
}
/**
* Load an undo log record row using the data page as a buffer.
*
...
...
@@ -188,12 +192,16 @@ public class UndoLogRecord {
Message
.
throwInternalError
(
"operation="
+
operation
+
" op="
+
op
);
}
}
boolean
deleted
=
buff
.
readByte
()
==
1
;
int
sessionId
=
buff
.
readInt
();
int
columnCount
=
buff
.
readInt
();
Value
[]
values
=
new
Value
[
columnCount
];
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
values
[
i
]
=
buff
.
readValue
();
}
row
=
new
Row
(
values
,
0
);
row
.
setDeleted
(
deleted
);
row
.
setSessionId
(
sessionId
);
state
=
IN_MEMORY_READ_POS
;
}
...
...
@@ -224,4 +232,15 @@ public class UndoLogRecord {
public
Row
getRow
()
{
return
row
;
}
/**
* Change the state from IN_MEMORY to IN_MEMORY_READ_POS. This method is
* called if a later record was read from the temporary file, and therefore
* the position could have changed.
*/
void
invalidatePos
()
{
if
(
this
.
state
==
IN_MEMORY
)
{
state
=
IN_MEMORY_READ_POS
;
}
}
}
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
16bdacb2
...
...
@@ -17,7 +17,6 @@ import java.sql.Statement;
import
java.sql.Time
;
import
java.sql.Timestamp
;
import
java.util.Random
;
import
org.h2.constant.ErrorCode
;
import
org.h2.test.TestBase
;
...
...
@@ -36,6 +35,7 @@ public class TestCases extends TestBase {
}
public
void
test
()
throws
Exception
{
testLargeRollback
();
testConstraintAlterTable
();
testJoinWithView
();
testLobDecrypt
();
...
...
@@ -72,6 +72,18 @@ public class TestCases extends TestBase {
deleteDb
(
"cases"
);
}
private
void
testLargeRollback
()
throws
SQLException
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
conn
.
createStatement
().
execute
(
"set MAX_MEMORY_UNDO 8"
);
conn
.
createStatement
().
execute
(
"create table test(id number primary key)"
);
conn
.
setAutoCommit
(
false
);
conn
.
createStatement
().
execute
(
"insert into test select x from system_range(1, 10)"
);
conn
.
createStatement
().
execute
(
"delete from test"
);
conn
.
rollback
();
conn
.
close
();
}
private
void
testConstraintAlterTable
()
throws
SQLException
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论