Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
d8a70f6d
提交
d8a70f6d
authored
11月 13, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The database now tries to detect if the classloader or virtual machine has almost shut down.
上级
ad16b7de
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
43 行增加
和
35 行删除
+43
-35
ScriptCommand.java
h2/src/main/org/h2/command/dml/ScriptCommand.java
+9
-7
MetaRecord.java
h2/src/main/org/h2/engine/MetaRecord.java
+14
-12
LogSystem.java
h2/src/main/org/h2/log/LogSystem.java
+7
-5
DiskFile.java
h2/src/main/org/h2/store/DiskFile.java
+13
-11
没有找到文件。
h2/src/main/org/h2/command/dml/ScriptCommand.java
浏览文件 @
d8a70f6d
...
@@ -61,6 +61,14 @@ import org.h2.value.ValueString;
...
@@ -61,6 +61,14 @@ import org.h2.value.ValueString;
*/
*/
public
class
ScriptCommand
extends
ScriptBase
{
public
class
ScriptCommand
extends
ScriptBase
{
private
static
final
Comparator
TABLE_COMPARATOR
=
new
Comparator
()
{
public
int
compare
(
Object
o1
,
Object
o2
)
{
Table
t1
=
(
Table
)
o1
;
Table
t2
=
(
Table
)
o2
;
return
t1
.
getId
()
-
t2
.
getId
();
}
};
private
boolean
passwords
;
private
boolean
passwords
;
private
boolean
data
;
private
boolean
data
;
private
boolean
settings
;
private
boolean
settings
;
...
@@ -188,13 +196,7 @@ public class ScriptCommand extends ScriptBase {
...
@@ -188,13 +196,7 @@ public class ScriptCommand extends ScriptBase {
ObjectArray
tables
=
db
.
getAllSchemaObjects
(
DbObject
.
TABLE_OR_VIEW
);
ObjectArray
tables
=
db
.
getAllSchemaObjects
(
DbObject
.
TABLE_OR_VIEW
);
// sort by id, so that views are after tables and views on views
// sort by id, so that views are after tables and views on views
// after the base views
// after the base views
tables
.
sort
(
new
Comparator
()
{
tables
.
sort
(
TABLE_COMPARATOR
);
public
int
compare
(
Object
o1
,
Object
o2
)
{
Table
t1
=
(
Table
)
o1
;
Table
t2
=
(
Table
)
o2
;
return
t1
.
getId
()
-
t2
.
getId
();
}
});
for
(
int
i
=
0
;
i
<
tables
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
tables
.
size
();
i
++)
{
Table
table
=
(
Table
)
tables
.
get
(
i
);
Table
table
=
(
Table
)
tables
.
get
(
i
);
table
.
lock
(
session
,
false
,
false
);
table
.
lock
(
session
,
false
,
false
);
...
...
h2/src/main/org/h2/engine/MetaRecord.java
浏览文件 @
d8a70f6d
...
@@ -24,6 +24,19 @@ import org.h2.value.ValueString;
...
@@ -24,6 +24,19 @@ import org.h2.value.ValueString;
*/
*/
public
class
MetaRecord
{
public
class
MetaRecord
{
private
static
final
Comparator
META_RECORD_COMPARATOR
=
new
Comparator
()
{
public
int
compare
(
Object
o1
,
Object
o2
)
{
MetaRecord
m1
=
(
MetaRecord
)
o1
;
MetaRecord
m2
=
(
MetaRecord
)
o2
;
int
c1
=
DbObjectBase
.
getCreateOrder
(
m1
.
getObjectType
());
int
c2
=
DbObjectBase
.
getCreateOrder
(
m2
.
getObjectType
());
if
(
c1
!=
c2
)
{
return
c1
-
c2
;
}
return
m1
.
getId
()
-
m2
.
getId
();
}
};
private
int
id
;
private
int
id
;
private
int
objectType
;
private
int
objectType
;
private
int
headPos
;
private
int
headPos
;
...
@@ -49,18 +62,7 @@ public class MetaRecord {
...
@@ -49,18 +62,7 @@ public class MetaRecord {
* @param records the list of meta records
* @param records the list of meta records
*/
*/
public
static
void
sort
(
ObjectArray
records
)
{
public
static
void
sort
(
ObjectArray
records
)
{
records
.
sort
(
new
Comparator
()
{
records
.
sort
(
META_RECORD_COMPARATOR
);
public
int
compare
(
Object
o1
,
Object
o2
)
{
MetaRecord
m1
=
(
MetaRecord
)
o1
;
MetaRecord
m2
=
(
MetaRecord
)
o2
;
int
c1
=
DbObjectBase
.
getCreateOrder
(
m1
.
getObjectType
());
int
c2
=
DbObjectBase
.
getCreateOrder
(
m2
.
getObjectType
());
if
(
c1
!=
c2
)
{
return
c1
-
c2
;
}
return
m1
.
getId
()
-
m2
.
getId
();
}
});
}
}
void
setRecord
(
SearchRow
r
)
{
void
setRecord
(
SearchRow
r
)
{
...
...
h2/src/main/org/h2/log/LogSystem.java
浏览文件 @
d8a70f6d
...
@@ -36,6 +36,12 @@ public class LogSystem {
...
@@ -36,6 +36,12 @@ public class LogSystem {
*/
*/
public
static
final
int
LOG_WRITTEN
=
-
1
;
public
static
final
int
LOG_WRITTEN
=
-
1
;
private
static
final
Comparator
LOG_FILE_COMPARATOR
=
new
Comparator
()
{
public
int
compare
(
Object
a
,
Object
b
)
{
return
((
LogFile
)
a
).
getId
()
-
((
LogFile
)
b
).
getId
();
}
};
private
Database
database
;
private
Database
database
;
private
ObjectArray
activeLogs
;
private
ObjectArray
activeLogs
;
private
LogFile
currentLog
;
private
LogFile
currentLog
;
...
@@ -309,11 +315,7 @@ public class LogSystem {
...
@@ -309,11 +315,7 @@ public class LogSystem {
}
}
}
}
}
}
activeLogs
.
sort
(
new
Comparator
()
{
activeLogs
.
sort
(
LOG_FILE_COMPARATOR
);
public
int
compare
(
Object
a
,
Object
b
)
{
return
((
LogFile
)
a
).
getId
()
-
((
LogFile
)
b
).
getId
();
}
});
if
(
activeLogs
.
size
()
==
0
)
{
if
(
activeLogs
.
size
()
==
0
)
{
LogFile
l
=
new
LogFile
(
this
,
0
,
fileNamePrefix
);
LogFile
l
=
new
LogFile
(
this
,
0
,
fileNamePrefix
);
activeLogs
.
add
(
l
);
activeLogs
.
add
(
l
);
...
...
h2/src/main/org/h2/store/DiskFile.java
浏览文件 @
d8a70f6d
...
@@ -81,6 +81,18 @@ public class DiskFile implements CacheWriter {
...
@@ -81,6 +81,18 @@ public class DiskFile implements CacheWriter {
private
static
final
int
OFFSET
=
FileStore
.
HEADER_LENGTH
;
private
static
final
int
OFFSET
=
FileStore
.
HEADER_LENGTH
;
private
static
final
int
FREE_PAGE
=
-
1
;
private
static
final
int
FREE_PAGE
=
-
1
;
private
static
final
Comparator
REDO_LOG_COMPARATOR
=
new
Comparator
()
{
public
int
compare
(
Object
o1
,
Object
o2
)
{
RedoLogRecord
e1
=
(
RedoLogRecord
)
o1
;
RedoLogRecord
e2
=
(
RedoLogRecord
)
o2
;
int
comp
=
e1
.
recordId
-
e2
.
recordId
;
if
(
comp
==
0
)
{
comp
=
e1
.
sequenceId
-
e2
.
sequenceId
;
}
return
comp
;
}
};
private
Database
database
;
private
Database
database
;
private
String
fileName
;
private
String
fileName
;
private
FileStore
file
;
private
FileStore
file
;
...
@@ -1187,17 +1199,7 @@ public class DiskFile implements CacheWriter {
...
@@ -1187,17 +1199,7 @@ public class DiskFile implements CacheWriter {
if
(
redoBuffer
.
size
()
==
0
)
{
if
(
redoBuffer
.
size
()
==
0
)
{
return
;
return
;
}
}
redoBuffer
.
sort
(
new
Comparator
()
{
redoBuffer
.
sort
(
REDO_LOG_COMPARATOR
);
public
int
compare
(
Object
o1
,
Object
o2
)
{
RedoLogRecord
e1
=
(
RedoLogRecord
)
o1
;
RedoLogRecord
e2
=
(
RedoLogRecord
)
o2
;
int
comp
=
e1
.
recordId
-
e2
.
recordId
;
if
(
comp
==
0
)
{
comp
=
e1
.
sequenceId
-
e2
.
sequenceId
;
}
return
comp
;
}
});
// first write all deleted entries
// first write all deleted entries
// because delete entries are always 1 block,
// because delete entries are always 1 block,
// while not-deleted entries can be many blocks
// while not-deleted entries can be many blocks
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论