Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c1844be3
提交
c1844be3
authored
8月 19, 2013
作者:
noelgrandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add an UNDO_LOG_SIZE column to the SESSIONS metadata table, to allow detecting when rogue
sessions are creating large transactions.
上级
4b0906e9
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
32 行增加
和
2 行删除
+32
-2
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
Session.java
h2/src/main/org/h2/engine/Session.java
+4
-0
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+5
-2
TestMetaData.java
h2/src/test/org/h2/test/jdbc/TestMetaData.java
+21
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
c1844be3
...
@@ -32,6 +32,8 @@ Change Log
...
@@ -32,6 +32,8 @@ Change Log
engines on a per-DB basis.
engines on a per-DB basis.
</li><li>
When running the Recover tool on very large (>6G) databases, some statistics were reported with
</li><li>
When running the Recover tool on very large (>6G) databases, some statistics were reported with
negative numbers.
negative numbers.
</li><li>
Add an UNDO_LOG_SIZE column to the SESSIONS metadata table, to allow detecting when rogue
sessions are creating large transactions.
</li></ul>
</li></ul>
<h2>
Version 1.3.173 (2013-07-28)
</h2>
<h2>
Version 1.3.173 (2013-07-28)
</h2>
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
c1844be3
...
@@ -1382,6 +1382,10 @@ public class Session extends SessionWithState {
...
@@ -1382,6 +1382,10 @@ public class Session extends SessionWithState {
closeTemporaryResults
();
closeTemporaryResults
();
}
}
public
int
getUndoLogSize
()
{
return
undoLog
.
size
();
}
/**
/**
* Represents a savepoint (a position in a transaction to where one can roll
* Represents a savepoint (a position in a transaction to where one can roll
* back to).
* back to).
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
c1844be3
...
@@ -488,7 +488,8 @@ public class MetaTable extends Table {
...
@@ -488,7 +488,8 @@ public class MetaTable extends Table {
"USER_NAME"
,
"USER_NAME"
,
"SESSION_START"
,
"SESSION_START"
,
"STATEMENT"
,
"STATEMENT"
,
"STATEMENT_START"
"STATEMENT_START"
,
"UNDO_LOG_SIZE"
);
);
break
;
break
;
}
}
...
@@ -1547,7 +1548,9 @@ public class MetaTable extends Table {
...
@@ -1547,7 +1548,9 @@ public class MetaTable extends Table {
// STATEMENT
// STATEMENT
command
==
null
?
null
:
command
.
toString
(),
command
==
null
?
null
:
command
.
toString
(),
// STATEMENT_START
// STATEMENT_START
new
Timestamp
(
start
).
toString
()
new
Timestamp
(
start
).
toString
(),
// UNDO_LOG_SIZE
""
+
s
.
getUndoLogSize
()
);
);
}
}
}
}
...
...
h2/src/test/org/h2/test/jdbc/TestMetaData.java
浏览文件 @
c1844be3
...
@@ -50,6 +50,7 @@ public class TestMetaData extends TestBase {
...
@@ -50,6 +50,7 @@ public class TestMetaData extends TestBase {
testStatic
();
testStatic
();
testGeneral
();
testGeneral
();
testAllowLiteralsNone
();
testAllowLiteralsNone
();
testSessions
();
}
}
private
void
testColumnResultSetMeta
()
throws
SQLException
{
private
void
testColumnResultSetMeta
()
throws
SQLException
{
...
@@ -971,4 +972,24 @@ public class TestMetaData extends TestBase {
...
@@ -971,4 +972,24 @@ public class TestMetaData extends TestBase {
deleteDb
(
"metaData"
);
deleteDb
(
"metaData"
);
}
}
private
void
testSessions
()
throws
SQLException
{
Connection
conn
=
getConnection
(
"metaData"
);
conn
.
setAutoCommit
(
false
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int)"
);
stat
.
execute
(
"begin transaction"
);
for
(
int
i
=
0
;
i
<
6
;
i
++)
{
stat
.
execute
(
"insert into test values (1)"
);
}
ResultSet
rs
=
stat
.
executeQuery
(
"select undo_log_size from INFORMATION_SCHEMA.SESSIONS"
);
rs
.
next
();
assertEquals
(
6
,
rs
.
getInt
(
1
));
rs
.
close
();
stat
.
execute
(
"commit"
);
rs
=
stat
.
executeQuery
(
"select undo_log_size from INFORMATION_SCHEMA.SESSIONS"
);
rs
.
next
();
assertEquals
(
0
,
rs
.
getInt
(
1
));
conn
.
close
();
deleteDb
(
"metaData"
);
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论