Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2460e391
提交
2460e391
authored
10月 18, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Page store: new write and read counters in the meta data table.
上级
2a1545d7
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
51 行增加
和
12 行删除
+51
-12
changelog.html
h2/src/docsrc/html/changelog.html
+5
-1
roadmap.html
h2/src/docsrc/html/roadmap.html
+4
-4
LogSystem.java
h2/src/main/org/h2/log/LogSystem.java
+1
-1
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+32
-6
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+9
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
2460e391
...
...
@@ -18,7 +18,11 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
The SQL syntax is documented using (railroad) diagrams.
<ul><li>
Page store: new write and read counters in the meta data table. Use
SELECT * FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME IN(
'info.FILE_WRITE_TOTAL', 'info.FILE_WRITE', 'info.FILE_READ',
'info.CACHE_MAX_SIZE', 'info.CACHE_SIZE')
</li><li>
The SQL syntax is documented using (railroad) diagrams.
The diagrams are HTML.
</li><li>
The documentation is no longer available in Japanese because the
translation was too much out of sync. Please use the Google translation instead.
...
...
h2/src/docsrc/html/roadmap.html
浏览文件 @
2460e391
...
...
@@ -205,6 +205,10 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>
Updatable result set on table without primary key or unique index
</li><li>
Use LinkedList instead of ArrayList where applicable
</li><li>
Support % operator (modulo)
</li><li>
Support JMX: create an MBean for each database and server (support JConsole).
See http://thedevcloud.blogspot.com/2008/10/displaying-hsql-database-manager-in.html
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ManagementFactory.html#getPlatformMBeanServer()
http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html
</li><li>
Support 1+'2'=3, '1'+'2'='12' (MS SQL Server compatibility)
</li><li>
Support nested transactions
</li><li>
Add a benchmark for big databases, and one for many users
...
...
@@ -241,10 +245,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>
Ability to resize the cache array when resizing the cache
</li><li>
Time based cache writing (one second after writing the log)
</li><li>
Check state of H2 driver for DDLUtils: https://issues.apache.org/jira/browse/DDLUTILS-185
</li><li>
Support JMX: create an MBean for each database and server (support JConsole).
See http://thedevcloud.blogspot.com/2008/10/displaying-hsql-database-manager-in.html
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ManagementFactory.html#getPlatformMBeanServer()
http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html
</li><li>
Index usage for REGEXP LIKE.
</li><li>
Compatibility: add a role DBA (like ADMIN).
</li><li>
Better support multiple processors for in-memory databases.
...
...
h2/src/main/org/h2/log/LogSystem.java
浏览文件 @
2460e391
...
...
@@ -716,7 +716,7 @@ public class LogSystem {
*/
public
String
getWritePos
()
{
if
(
pageStore
!=
null
)
{
return
""
+
pageStore
.
getWriteCount
();
return
""
+
pageStore
.
getWriteCount
Total
();
}
return
currentLog
.
getId
()
+
"/"
+
currentLog
.
getPos
();
}
...
...
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
2460e391
...
...
@@ -72,7 +72,7 @@ import org.h2.value.ValueString;
* The format of page 1 and 2 is:
* <ul>
* <li>CRC32 of the remaining data: int (0-3)</li>
* <li>write counter (incremented each time
the header changes
): long (4-11)</li>
* <li>write counter (incremented each time
something is written
): long (4-11)</li>
* <li>log trunk key: int (12-15)</li>
* <li>log trunk page (0 for none): int (16-19)</li>
* <li>log data page (0 for none): int (20-23)</li>
...
...
@@ -163,7 +163,7 @@ public class PageStore implements CacheWriter {
private
String
accessMode
;
private
int
pageSize
;
private
int
pageSizeShift
;
private
long
writeCount
;
private
long
writeCount
Base
,
writeCount
,
readCount
;
private
int
logKey
,
logFirstTrunkPage
,
logFirstDataPage
;
private
Cache
cache
;
...
...
@@ -240,6 +240,7 @@ public class PageStore implements CacheWriter {
}
file
.
seek
((
long
)
pageId
<<
pageSizeShift
);
file
.
readFullyDirect
(
buffer
,
0
,
pageSize
);
readCount
++;
out
.
write
(
buffer
,
0
,
pageSize
);
return
pageId
+
1
;
}
catch
(
IOException
e
)
{
...
...
@@ -411,7 +412,11 @@ public class PageStore implements CacheWriter {
// the easiest way to remove superfluous entries
freeLists
.
clear
();
trace
.
debug
(
"pageCount:"
+
pageCount
);
file
.
setLength
((
long
)
pageCount
<<
pageSizeShift
);
long
newLength
=
(
long
)
pageCount
<<
pageSizeShift
;
if
(
file
.
length
()
!=
newLength
)
{
file
.
setLength
(
newLength
);
writeCount
++;
}
}
private
void
compact
(
int
full
)
throws
SQLException
{
...
...
@@ -546,6 +551,7 @@ public class PageStore implements CacheWriter {
file
.
seek
(
FileStore
.
HEADER_LENGTH
);
Data
page
=
Data
.
create
(
database
,
new
byte
[
PAGE_SIZE_MIN
-
FileStore
.
HEADER_LENGTH
]);
file
.
readFully
(
page
.
getBytes
(),
0
,
PAGE_SIZE_MIN
-
FileStore
.
HEADER_LENGTH
);
readCount
++;
setPageSize
(
page
.
readInt
());
int
writeVersion
=
page
.
readByte
();
int
readVersion
=
page
.
readByte
();
...
...
@@ -573,7 +579,7 @@ public class PageStore implements CacheWriter {
int
expected
=
(
int
)
crc
.
getValue
();
int
got
=
page
.
readInt
();
if
(
expected
==
got
)
{
writeCount
=
page
.
readLong
();
writeCount
Base
=
page
.
readLong
();
logKey
=
page
.
readInt
();
logFirstTrunkPage
=
page
.
readInt
();
logFirstDataPage
=
page
.
readInt
();
...
...
@@ -616,6 +622,7 @@ public class PageStore implements CacheWriter {
page
.
writeByte
((
byte
)
READ_VERSION
);
file
.
seek
(
FileStore
.
HEADER_LENGTH
);
file
.
write
(
page
.
getBytes
(),
0
,
pageSize
-
FileStore
.
HEADER_LENGTH
);
writeCount
++;
}
/**
...
...
@@ -649,7 +656,7 @@ public class PageStore implements CacheWriter {
file
.
write
(
page
.
getBytes
(),
0
,
pageSize
);
file
.
seek
(
pageSize
+
pageSize
);
file
.
write
(
page
.
getBytes
(),
0
,
pageSize
);
writeCount
++;
// don't increment the write counter, because it was just written
}
/**
...
...
@@ -927,6 +934,7 @@ public class PageStore implements CacheWriter {
}
file
.
seek
((
long
)
pos
<<
pageSizeShift
);
file
.
readFully
(
page
.
getBytes
(),
0
,
pageSize
);
readCount
++;
}
}
...
...
@@ -1430,7 +1438,16 @@ public class PageStore implements CacheWriter {
}
/**
* Get the write count.
* Get the file write count since the database was created.
*
* @return the write count
*/
public
long
getWriteCountTotal
()
{
return
writeCount
+
writeCountBase
;
}
/**
* Get the file write count since the database was opened.
*
* @return the write count
*/
...
...
@@ -1438,6 +1455,15 @@ public class PageStore implements CacheWriter {
return
writeCount
;
}
/**
* Get the file read count since the database was opened.
*
* @return the read count
*/
public
long
getReadCount
()
{
return
readCount
;
}
/**
* A table is truncated.
*
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
2460e391
...
...
@@ -49,6 +49,7 @@ import org.h2.schema.SchemaObject;
import
org.h2.schema.Sequence
;
import
org.h2.schema.TriggerObject
;
import
org.h2.store.DiskFile
;
import
org.h2.store.PageStore
;
import
org.h2.tools.Csv
;
import
org.h2.util.MathUtils
;
import
org.h2.util.ObjectArray
;
...
...
@@ -868,6 +869,14 @@ public class MetaTable extends Table {
add
(
rows
,
"h2.serverCachedObjects"
,
""
+
SysProperties
.
SERVER_CACHED_OBJECTS
);
add
(
rows
,
"h2.serverResultSetFetchSize"
,
""
+
SysProperties
.
SERVER_RESULT_SET_FETCH_SIZE
);
add
(
rows
,
"h2.sortNullsHigh"
,
""
+
SysProperties
.
SORT_NULLS_HIGH
);
if
(
database
.
isPageStoreEnabled
()
&&
database
.
isPersistent
())
{
PageStore
store
=
database
.
getPageStore
();
add
(
rows
,
"info.FILE_WRITE_TOTAL"
,
""
+
store
.
getWriteCountTotal
());
add
(
rows
,
"info.FILE_WRITE"
,
""
+
store
.
getWriteCount
());
add
(
rows
,
"info.FILE_READ"
,
""
+
store
.
getReadCount
());
add
(
rows
,
"info.CACHE_MAX_SIZE"
,
""
+
store
.
getCache
().
getMaxSize
());
add
(
rows
,
"info.CACHE_SIZE"
,
""
+
store
.
getCache
().
getSize
());
}
DiskFile
dataFile
=
database
.
getDataFile
();
if
(
dataFile
!=
null
)
{
add
(
rows
,
"CACHE_TYPE"
,
dataFile
.
getCache
().
getTypeName
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论