Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
5f5b2e7d
提交
5f5b2e7d
authored
1月 15, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Serialized access mode (server-less multi-connection mode): sequences did not work as expected.
上级
e5c1e4df
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
46 行增加
和
4 行删除
+46
-4
changelog.html
h2/src/docsrc/html/changelog.html
+3
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+8
-1
Sequence.java
h2/src/main/org/h2/schema/Sequence.java
+11
-2
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+3
-0
TestFileLockSerialized.java
h2/src/test/org/h2/test/unit/TestFileLockSerialized.java
+21
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
5f5b2e7d
...
...
@@ -18,7 +18,9 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Page store: new databases can not be opened with older versions.
<ul><li>
Serialized access mode (server-less multi-connection mode): sequences did not work as expected
(there were gaps in generated values when using multiple connections).
</li><li>
Page store: new databases can not be opened with older versions.
</li><li>
Page store: adding data to new database is now faster.
</li><li>
File system: getting the file name from a path is now faster. This should
speed up BLOB and CLOB access.
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
5f5b2e7d
...
...
@@ -2412,6 +2412,7 @@ public class Database implements DataHandler {
synchronized
(
this
)
{
getTrace
().
debug
(
"checkpoint start"
);
flushIndexes
(
0
);
flushSequences
();
checkpoint
();
reconnectModified
(
false
);
getTrace
().
debug
(
"checkpoint end"
);
...
...
@@ -2455,6 +2456,13 @@ public class Database implements DataHandler {
}
}
private
void
flushSequences
()
throws
SQLException
{
for
(
SchemaObject
obj
:
getAllSchemaObjects
(
DbObject
.
SEQUENCE
))
{
Sequence
sequence
=
(
Sequence
)
obj
;
sequence
.
flushWithoutMargin
();
}
}
/**
* Flush all changes and open a new log file.
*/
...
...
@@ -2463,7 +2471,6 @@ public class Database implements DataHandler {
if
(
pageStore
!=
null
)
{
pageStore
.
checkpoint
();
}
LogSystem
log
=
getLog
();
if
(
log
!=
null
)
{
log
.
checkpoint
();
}
...
...
h2/src/main/org/h2/schema/Sequence.java
浏览文件 @
5f5b2e7d
...
...
@@ -99,6 +99,16 @@ public class Sequence extends SchemaObjectBase {
return
v
;
}
/**
* Flush the current value to disk.
*/
public
void
flushWithoutMargin
()
throws
SQLException
{
if
(
valueWithMargin
!=
value
)
{
valueWithMargin
=
value
;
flush
(
null
);
}
}
/**
* Flush the current value, including the margin, to disk.
*
...
...
@@ -133,8 +143,7 @@ public class Sequence extends SchemaObjectBase {
* Flush the current value to disk and close this object.
*/
public
void
close
()
throws
SQLException
{
valueWithMargin
=
value
;
flush
(
null
);
flushWithoutMargin
();
}
public
int
getType
()
{
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
5f5b2e7d
...
...
@@ -299,6 +299,9 @@ java org.h2.test.TestAll timer
/*
power failure test: larger binaries and additional indexes
(with many columns).
increment storage read version
update copyright to 2010
...
...
h2/src/test/org/h2/test/unit/TestFileLockSerialized.java
浏览文件 @
5f5b2e7d
...
...
@@ -36,6 +36,8 @@ public class TestFileLockSerialized extends TestBase {
}
public
void
test
()
throws
Exception
{
println
(
"testSequenceFlush"
);
testSequenceFlush
();
println
(
"testLeftLogFiles"
);
testLeftLogFiles
();
println
(
"testWrongDatabaseInstanceOnReconnect"
);
...
...
@@ -66,6 +68,25 @@ public class TestFileLockSerialized extends TestBase {
testConcurrentReadWrite
();
}
private
void
testSequenceFlush
()
throws
Exception
{
deleteDb
(
"fileLockSerialized"
);
String
url
=
"jdbc:h2:"
+
baseDir
+
"/fileLockSerialized;FILE_LOCK=SERIALIZED;OPEN_NEW=TRUE"
;
ResultSet
rs
;
Connection
conn1
=
DriverManager
.
getConnection
(
url
);
Statement
stat1
=
conn1
.
createStatement
();
stat1
.
execute
(
"create sequence seq"
);
rs
=
stat1
.
executeQuery
(
"call seq.nextval"
);
rs
.
next
();
assertEquals
(
1
,
rs
.
getInt
(
1
));
Connection
conn2
=
DriverManager
.
getConnection
(
url
);
Statement
stat2
=
conn2
.
createStatement
();
rs
=
stat2
.
executeQuery
(
"call seq.nextval"
);
rs
.
next
();
assertEquals
(
2
,
rs
.
getInt
(
1
));
conn1
.
close
();
conn2
.
close
();
}
private
void
testThreeMostlyReaders
(
final
boolean
write
)
throws
Exception
{
boolean
longRun
=
false
;
deleteDb
(
"fileLockSerialized"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论