Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b6a3142e
提交
b6a3142e
authored
18 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
550fd0a1
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
64 行增加
和
37 行删除
+64
-37
features.html
h2/src/docsrc/html/features.html
+3
-0
Database.java
h2/src/main/org/h2/engine/Database.java
+1
-1
DiskFile.java
h2/src/main/org/h2/store/DiskFile.java
+19
-4
Recover.java
h2/src/main/org/h2/tools/Recover.java
+16
-16
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+15
-10
TestCrashAPI.java
h2/src/test/org/h2/test/synth/TestCrashAPI.java
+10
-6
没有找到文件。
h2/src/docsrc/html/features.html
浏览文件 @
b6a3142e
...
...
@@ -268,6 +268,9 @@ Features
</tr><tr>
<td><a
href=
"http://sql-workbench.net"
>
SQL Workbench/J
</a></td>
<td>
Free DBMS-independent SQL Tool.
</td>
</tr><tr>
<td><a
href=
"http://www.streamcruncher.com"
>
StreamCruncher
</a></td>
<td>
Event (Stream) Processing Kernel.
</td>
</tr>
</table>
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Database.java
浏览文件 @
b6a3142e
...
...
@@ -596,7 +596,7 @@ public class Database implements DataHandler {
if
(
storages
.
size
()
>
id
)
{
storage
=
(
Storage
)
storages
.
get
(
id
);
if
(
storage
!=
null
)
{
if
(
Constants
.
CHECK
&&
storage
!=
null
&&
storage
.
getDiskFile
()
!=
file
)
{
if
(
Constants
.
CHECK
&&
storage
.
getDiskFile
()
!=
file
)
{
throw
Message
.
getInternalError
();
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/DiskFile.java
浏览文件 @
b6a3142e
...
...
@@ -43,10 +43,10 @@ public class DiskFile implements CacheWriter {
private
Database
database
;
private
String
fileName
;
private
FileStore
file
;
private
BitField
used
=
new
BitField
()
;
private
BitField
deleted
=
new
BitField
()
;
private
BitField
used
;
private
BitField
deleted
;
private
int
fileBlockCount
;
private
IntArray
pageOwners
=
new
IntArray
()
;
private
IntArray
pageOwners
;
private
Cache
cache
;
private
LogSystem
log
;
private
DataPage
rowBuff
;
...
...
@@ -55,11 +55,12 @@ public class DiskFile implements CacheWriter {
private
boolean
logChanges
;
private
int
recordOverhead
;
private
boolean
init
,
initAlreadyTried
;
private
ObjectArray
redoBuffer
=
new
ObjectArray
()
;
private
ObjectArray
redoBuffer
;
private
int
redoBufferSize
;
private
int
readCount
,
writeCount
;
public
DiskFile
(
Database
database
,
String
fileName
,
boolean
dataFile
,
boolean
logChanges
,
int
cacheSize
)
throws
SQLException
{
reset
();
this
.
database
=
database
;
this
.
log
=
database
.
getLog
();
this
.
fileName
=
fileName
;
...
...
@@ -92,6 +93,13 @@ public class DiskFile implements CacheWriter {
throw
e
;
}
}
private
void
reset
()
{
used
=
new
BitField
();
deleted
=
new
BitField
();
pageOwners
=
new
IntArray
();
redoBuffer
=
new
ObjectArray
();
}
private
void
setBlockCount
(
int
count
)
{
fileBlockCount
=
count
;
...
...
@@ -183,6 +191,13 @@ public class DiskFile implements CacheWriter {
public
synchronized
void
initFromSummary
(
byte
[]
summary
)
{
if
(
summary
==
null
||
summary
.
length
==
0
)
{
ObjectArray
list
=
database
.
getAllStorages
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
Storage
s
=
(
Storage
)
list
.
get
(
i
);
database
.
removeStorage
(
s
.
getId
(),
this
);
}
reset
();
initAlreadyTried
=
false
;
init
=
false
;
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
b6a3142e
...
...
@@ -375,20 +375,17 @@ public class Recover implements DataHandler {
s
.
reset
();
}
blocks
=
s
.
readInt
();
if
(
blocks
<
0
)
{
writer
.
println
(
"// ["
+
pos
+
"] blocks: "
+
blocks
);
}
else
if
(
blocks
==
0
)
{
writer
.
println
(
"// ["
+
pos
+
"] blocks: 0 (end)"
);
if
(
blocks
<=
0
)
{
writer
.
println
(
"// ["
+
pos
+
"] blocks: "
+
blocks
+
" (end)"
);
break
;
}
else
{
char
type
=
(
char
)
s
.
readByte
();
int
sessionId
=
s
.
readInt
();
writer
.
println
(
"// type: "
+
type
+
" session: "
+
sessionId
);
if
(
type
==
'P'
)
{
String
transaction
=
s
.
readString
();
writer
.
println
(
"//
transaction
: "
+
transaction
);
writer
.
println
(
"//
prepared session:"
+
sessionId
+
" tx
: "
+
transaction
);
}
else
if
(
type
==
'C'
)
{
writer
.
println
(
"// commit"
);
break
;
writer
.
println
(
"// commit session:"
+
sessionId
);
}
else
{
int
storageId
=
s
.
readInt
();
int
recordId
=
s
.
readInt
();
...
...
@@ -404,21 +401,21 @@ public class Recover implements DataHandler {
if
(
sumLength
>
0
)
{
s
.
read
(
summary
,
0
,
sumLength
);
}
writer
.
println
(
"// fileType: "
+
fileType
+
" sumLength: "
+
sumLength
);
writer
.
println
(
"//
summary session:"
+
sessionId
+
"
fileType: "
+
fileType
+
" sumLength: "
+
sumLength
);
dumpSummary
(
writer
,
summary
);
break
;
}
case
'T'
:
writer
.
println
(
"// storage: "
+
storageId
+
" recordId: "
+
recordId
+
" blockCount: "
+
blockCount
);
writer
.
println
(
"//
truncate session:"
+
sessionId
+
"
storage: "
+
storageId
+
" recordId: "
+
recordId
+
" blockCount: "
+
blockCount
);
break
;
case
'I'
:
writer
.
println
(
"// storage: "
+
storageId
+
" recordId: "
+
recordId
+
" blockCount: "
+
blockCount
);
writer
.
println
(
"//
insert session:"
+
sessionId
+
"
storage: "
+
storageId
+
" recordId: "
+
recordId
+
" blockCount: "
+
blockCount
);
break
;
case
'D'
:
writer
.
println
(
"// storage: "
+
storageId
+
" recordId: "
+
recordId
+
" blockCount: "
+
blockCount
);
writer
.
println
(
"//
delete session:"
+
sessionId
+
"
storage: "
+
storageId
+
" recordId: "
+
recordId
+
" blockCount: "
+
blockCount
);
break
;
default
:
writer
.
println
(
"// storage: "
+
storageId
+
" recordId: "
+
recordId
+
" blockCount: "
+
blockCount
);
writer
.
println
(
"//
type?:"
+
type
+
" session:"
+
sessionId
+
"
storage: "
+
storageId
+
" recordId: "
+
recordId
+
" blockCount: "
+
blockCount
);
break
;
}
}
...
...
@@ -434,7 +431,7 @@ public class Recover implements DataHandler {
private
void
dumpSummary
(
PrintWriter
writer
,
byte
[]
summary
)
throws
SQLException
{
if
(
summary
==
null
||
summary
.
length
==
0
)
{
writer
.
println
(
"// summary is empty"
);
writer
.
println
(
"//
summary is empty"
);
return
;
}
try
{
...
...
@@ -445,7 +442,10 @@ public class Recover implements DataHandler {
}
int
len
=
in
.
readInt
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
in
.
readInt
();
int
storageId
=
in
.
readInt
();
if
(
storageId
!=
-
1
)
{
writer
.
println
(
"// pos:"
+(
i
*
DiskFile
.
BLOCKS_PER_PAGE
)+
" storage:"
+
storageId
);
}
}
while
(
true
)
{
int
s
=
in
.
readInt
();
...
...
@@ -525,7 +525,7 @@ public class Recover implements DataHandler {
}
else
{
pageOwners
[
page
]
=
storageId
;
}
writer
.
println
(
"// ["
+
block
+
"] p
:"
+
page
+
" c:"
+
blockCount
+
" s
:"
+
storageId
);
writer
.
println
(
"// ["
+
block
+
"] p
age:"
+
page
+
" blocks:"
+
blockCount
+
" storage
:"
+
storageId
);
}
}
catch
(
Throwable
e
)
{
writeError
(
writer
,
e
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
b6a3142e
...
...
@@ -90,19 +90,26 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
TestAll
test
=
new
TestAll
();
test
.
printSystem
();
// code coverage
//max / hibernate
// Sorry, a typo by me. I don't specify any database name and then when
// I call getTables I get a catalog name that I pass on to getColumns and
// here getColumns does not return anything unless I null out the return
// catalog name.
// java.lang.Error: query was too quick; result: 0
// at org.h2.test.db.TestCases$1.run(TestCases.java:156)
// at java.lang.Thread.run(Thread.java:595)
//java.lang.Error: query was too quick; result: 0
// at org.h2.test.db.TestCases$1.run(TestCases.java:156)
// at java.lang.Thread.run(Thread.java:595)
//java.lang.Exception: closing took 1266
// at org.h2.test.TestBase.error(TestBase.java:206)
// at org.h2.test.db.TestCases.testDisconnect(TestCases.java:173)
// at org.h2.test.db.TestCases.test(TestCases.java:25)
// at org.h2.test.TestBase.runTest(TestBase.java:55)
// at org.h2.test.TestAll.testDatabase(TestAll.java:414)
// at org.h2.test.TestAll.testAll(TestAll.java:377)
// at org.h2.test.TestAll.testEverything(TestAll.java:273)
// at org.h2.test.TestAll.main(TestAll.java:196)
// Check if new Hibernate dialect for H2 is ok
// http://opensource.atlassian.com/projects/hibernate/browse/HHH-2300
// open JPA test - submit patch
// ant mavenUploadLocal
// d:\data\h2test\openjpa\openjpa-persistence-jdbc\src\test\resources\META-INF\persistence.xml
// <!-- <property name="openjpa.ConnectionProperties"
// value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
...
...
@@ -117,11 +124,9 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
// Test and document JDK 1.6 QueryObjectFactory
// submit hibernate dialect
// clean build path (remove hibernate librarires)
// test with PostgreSQL Version 8.2
// create table testoe(id int primary key, name varchar(255))
// create user oe identified by merlin
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestCrashAPI.java
浏览文件 @
b6a3142e
...
...
@@ -48,7 +48,7 @@ public class TestCrashAPI extends TestBase {
private
long
callCount
;
private
String
DIR
=
"synth"
;
private
void
deleteDb
(
int
seed
)
{
private
void
deleteDb
()
{
try
{
deleteDb
(
BASE_DIR
+
"/"
+
DIR
,
null
);
}
catch
(
Exception
e
)
{
...
...
@@ -59,13 +59,16 @@ public class TestCrashAPI extends TestBase {
private
Connection
getConnection
(
int
seed
,
boolean
delete
)
throws
Exception
{
openCount
++;
if
(
delete
)
{
deleteDb
(
seed
);
deleteDb
();
}
// can not use FILE_LOCK=NO, otherwise something could be written into the database in the finalizer
String
add
=
""
;
// ";STORAGE=TEXT";
// int testing;
// if(openCount>=10) {
// add = ";STORAGE=TEXT";
// if(openCount>=24) {
// System.exit(1);
// }
// add = ";LOG=2";
// System.out.println("now open " + openCount);
// add += ";TRACE_LEVEL_FILE=3";
...
...
@@ -73,6 +76,7 @@ public class TestCrashAPI extends TestBase {
// }
String
url
=
getURL
(
DIR
+
"/crashapi"
+
seed
,
true
)
+
add
;
Connection
conn
=
null
;
// System.gc();
conn
=
DriverManager
.
getConnection
(
url
,
"sa"
,
""
);
...
...
@@ -114,7 +118,7 @@ public class TestCrashAPI extends TestBase {
private
void
testOne
(
int
seed
)
throws
Exception
{
printTime
(
"TestCrashAPI "
+
seed
);
callCount
=
0
;
openCount
=
0
;
random
=
new
RandomGen
(
null
);
random
.
setSeed
(
seed
);
...
...
@@ -371,10 +375,10 @@ public class TestCrashAPI extends TestBase {
}
public
void
test
()
throws
Exception
{
for
(
int
i
=
0
;
i
<
Integer
.
MAX_VALUE
;
i
++
)
{
while
(
true
)
{
int
seed
=
RandomUtils
.
nextInt
(
Integer
.
MAX_VALUE
);
testCase
(
seed
);
deleteDb
(
seed
);
deleteDb
();
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论