Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e51f5f4c
提交
e51f5f4c
authored
9月 21, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Page store bugfixes
上级
76011ce9
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
80 行增加
和
4 行删除
+80
-4
roadmap.html
h2/src/docsrc/html/roadmap.html
+1
-0
PageFreeList.java
h2/src/main/org/h2/store/PageFreeList.java
+4
-0
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+1
-0
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+8
-1
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+1
-1
TestCache.java
h2/src/test/org/h2/test/unit/TestCache.java
+65
-2
没有找到文件。
h2/src/docsrc/html/roadmap.html
浏览文件 @
e51f5f4c
...
...
@@ -453,6 +453,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
See PostgreSQL.
</li><li>
Add option to enable TCP_NODELAY using Socket.setTcpNoDelay(true).
</li><li>
Maybe disallow = within database names (jdbc:h2:mem:MODE=DB2 means database name MODE=DB2).
</li><li>
Fast alter table add column.
</li></ul>
<h2>
Not Planned
</h2>
...
...
h2/src/main/org/h2/store/PageFreeList.java
浏览文件 @
e51f5f4c
...
...
@@ -197,4 +197,8 @@ public class PageFreeList extends Page {
store
.
freePage
(
getPos
(),
true
,
data
);
}
public
String
toString
()
{
return
"page ["
+
getPos
()
+
"] freeList"
+
(
full
?
"full"
:
""
);
}
}
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
e51f5f4c
...
...
@@ -1004,6 +1004,7 @@ public class PageStore implements CacheWriter {
writeBack
();
// clear the cache because it contains pages with closed indexes
cache
.
clear
();
freeLists
.
clear
();
if
(
setReadOnly
)
{
database
.
setReadOnly
(
true
);
}
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
e51f5f4c
...
...
@@ -299,7 +299,9 @@ java org.h2.test.TestAll timer
/*
test cacheTQ
test linked table cache.patch
mvcc merge problem
javadoc: constructor parameters are not verified (PageOutputStream)
...
...
@@ -426,6 +428,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
diskResult
=
true
;
deleteIndex
=
true
;
traceLevelFile
=
3
;
cache2Q
=
true
;
throttle
=
1
;
cipher
=
"XTEA"
;
test
();
...
...
@@ -434,6 +437,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
diskResult
=
false
;
deleteIndex
=
false
;
traceLevelFile
=
1
;
cache2Q
=
false
;
throttle
=
0
;
cipher
=
null
;
test
();
...
...
@@ -471,6 +475,9 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
* Run all tests with the current settings.
*/
private
void
test
()
throws
SQLException
{
//if(logMode != 2) return;
System
.
out
.
println
();
System
.
out
.
println
(
"Test "
+
toString
()
+
" ("
+
MemoryUtils
.
getMemoryUsed
()
+
" KB used)"
);
beforeTest
();
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
e51f5f4c
...
...
@@ -254,7 +254,7 @@ public abstract class TestBase {
if
(
config
.
mvcc
&&
url
.
indexOf
(
"MVCC="
)
<
0
)
{
url
+=
";MVCC=TRUE"
;
}
if
(
config
.
cache2Q
)
{
if
(
config
.
cache2Q
&&
url
.
indexOf
(
"CACHE_TYPE="
)
<
0
)
{
url
+=
";CACHE_TYPE=TQ"
;
}
if
(
config
.
diskResult
&&
admin
)
{
...
...
h2/src/test/org/h2/test/unit/TestCache.java
浏览文件 @
e51f5f4c
...
...
@@ -12,12 +12,19 @@ import java.sql.SQLException;
import
java.sql.Statement
;
import
java.util.Random
;
import
org.h2.message.Trace
;
import
org.h2.test.TestBase
;
import
org.h2.util.Cache
;
import
org.h2.util.CacheLRU
;
import
org.h2.util.CacheObject
;
import
org.h2.util.CacheWriter
;
/**
* Tests the cache.
*/
public
class
TestCache
extends
TestBase
{
public
class
TestCache
extends
TestBase
implements
CacheWriter
{
private
String
out
;
/**
* Run just this test.
...
...
@@ -29,11 +36,67 @@ public class TestCache extends TestBase {
}
public
void
test
()
throws
SQLException
{
testCache
(
false
);
testCache
(
true
);
testCacheDb
(
false
);
testCacheDb
(
true
);
}
private
void
testCache
(
boolean
lru
)
throws
SQLException
{
out
=
""
;
Cache
c
=
CacheLRU
.
getCache
(
this
,
lru
?
"LRU"
:
"TQ"
,
16
);
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
c
.
put
(
new
Obj
(
i
));
}
assertEquals
(
lru
?
"0 1 2 3 "
:
"4 5 6 "
,
out
);
}
/**
* A simple cache object
*/
class
Obj
extends
CacheObject
{
Obj
(
int
pos
)
{
setPos
(
pos
);
}
public
int
getMemorySize
()
{
return
1024
;
}
public
boolean
canRemove
()
{
return
true
;
}
public
boolean
isChanged
()
{
return
true
;
}
public
String
toString
()
{
return
"["
+
getPos
()
+
"]"
;
}
}
public
void
flushLog
()
{
out
+=
"flush "
;
}
public
Trace
getTrace
()
{
return
null
;
}
public
void
writeBack
(
CacheObject
entry
)
{
out
+=
entry
.
getPos
()
+
" "
;
}
private
void
testCacheDb
(
boolean
lru
)
throws
SQLException
{
if
(
config
.
memory
)
{
return
;
}
deleteDb
(
"cache"
);
Connection
conn
=
getConnection
(
"cache
"
);
Connection
conn
=
getConnection
(
"cache
;CACHE_TYPE="
+
(
lru
?
"LRU"
:
"TQ"
)
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SET CACHE_SIZE 1024"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论