Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f8c24c4f
提交
f8c24c4f
authored
12月 20, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The .trace.db file is now only created if required.
上级
9ae1fcab
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
22 行增加
和
27 行删除
+22
-27
changelog.html
h2/src/docsrc/html/changelog.html
+2
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+3
-3
Session.java
h2/src/main/org/h2/engine/Session.java
+1
-1
SessionRemote.java
h2/src/main/org/h2/engine/SessionRemote.java
+1
-1
JdbcDataSourceFactory.java
h2/src/main/org/h2/jdbcx/JdbcDataSourceFactory.java
+1
-1
TraceSystem.java
h2/src/main/org/h2/message/TraceSystem.java
+1
-12
FileLister.java
h2/src/main/org/h2/store/FileLister.java
+1
-1
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+1
-1
TestStatement.java
h2/src/test/org/h2/test/jdbc/TestStatement.java
+6
-1
TestFileLock.java
h2/src/test/org/h2/test/unit/TestFileLock.java
+5
-5
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
f8c24c4f
...
@@ -18,7 +18,8 @@ Change Log
...
@@ -18,7 +18,8 @@ Change Log
<h1>
Change Log
</h1>
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Shell tool: improved PostgreSQL compatibility.
<ul><li>
The .trace.db file is now only created if required.
</li><li>
Shell tool: improved PostgreSQL compatibility.
</li><li>
Trying to open a database in read-only mode when a .lock.db file exists will now fail
</li><li>
Trying to open a database in read-only mode when a .lock.db file exists will now fail
with a nice error message.
with a nice error message.
</li><li>
H2 Console: data that is too long is now abbreviated as follows: text... (100000 characters).
</li><li>
H2 Console: data that is too long is now abbreviated as follows: text... (100000 characters).
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
f8c24c4f
...
@@ -587,9 +587,9 @@ public class Database implements DataHandler {
...
@@ -587,9 +587,9 @@ public class Database implements DataHandler {
}
}
boolean
exists
=
existsData
||
existsPage
;
boolean
exists
=
existsData
||
existsPage
;
if
(
readOnly
)
{
if
(
readOnly
)
{
traceSystem
=
new
TraceSystem
(
null
,
false
);
traceSystem
=
new
TraceSystem
(
null
);
}
else
{
}
else
{
traceSystem
=
new
TraceSystem
(
databaseName
+
Constants
.
SUFFIX_TRACE_FILE
,
true
);
traceSystem
=
new
TraceSystem
(
databaseName
+
Constants
.
SUFFIX_TRACE_FILE
);
}
}
traceSystem
.
setLevelFile
(
traceLevelFile
);
traceSystem
.
setLevelFile
(
traceLevelFile
);
traceSystem
.
setLevelSystemOut
(
traceLevelSystemOut
);
traceSystem
.
setLevelSystemOut
(
traceLevelSystemOut
);
...
@@ -656,7 +656,7 @@ public class Database implements DataHandler {
...
@@ -656,7 +656,7 @@ public class Database implements DataHandler {
reserveLobFileObjectIds
();
reserveLobFileObjectIds
();
writer
=
WriterThread
.
create
(
this
,
writeDelay
);
writer
=
WriterThread
.
create
(
this
,
writeDelay
);
}
else
{
}
else
{
traceSystem
=
new
TraceSystem
(
null
,
false
);
traceSystem
=
new
TraceSystem
(
null
);
log
=
new
LogSystem
(
null
,
null
,
false
,
null
,
null
);
log
=
new
LogSystem
(
null
,
null
,
false
,
null
,
null
);
}
}
systemUser
=
new
User
(
this
,
0
,
Constants
.
DBA_NAME
,
true
);
systemUser
=
new
User
(
this
,
0
,
Constants
.
DBA_NAME
,
true
);
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
f8c24c4f
...
@@ -681,7 +681,7 @@ public class Session extends SessionWithState {
...
@@ -681,7 +681,7 @@ public class Session extends SessionWithState {
traceModuleName
=
Trace
.
JDBC
+
"["
+
id
+
"]"
;
traceModuleName
=
Trace
.
JDBC
+
"["
+
id
+
"]"
;
}
}
if
(
closed
)
{
if
(
closed
)
{
return
new
TraceSystem
(
null
,
false
).
getTrace
(
traceModuleName
);
return
new
TraceSystem
(
null
).
getTrace
(
traceModuleName
);
}
}
return
database
.
getTrace
(
traceModuleName
);
return
database
.
getTrace
(
traceModuleName
);
}
}
...
...
h2/src/main/org/h2/engine/SessionRemote.java
浏览文件 @
f8c24c4f
...
@@ -276,7 +276,7 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D
...
@@ -276,7 +276,7 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D
}
}
databaseName
=
name
.
substring
(
idx
+
1
);
databaseName
=
name
.
substring
(
idx
+
1
);
String
server
=
name
.
substring
(
0
,
idx
);
String
server
=
name
.
substring
(
0
,
idx
);
traceSystem
=
new
TraceSystem
(
null
,
false
);
traceSystem
=
new
TraceSystem
(
null
);
try
{
try
{
String
traceLevelFile
=
ci
.
getProperty
(
SetTypes
.
TRACE_LEVEL_FILE
,
null
);
String
traceLevelFile
=
ci
.
getProperty
(
SetTypes
.
TRACE_LEVEL_FILE
,
null
);
if
(
traceLevelFile
!=
null
)
{
if
(
traceLevelFile
!=
null
)
{
...
...
h2/src/main/org/h2/jdbcx/JdbcDataSourceFactory.java
浏览文件 @
f8c24c4f
...
@@ -78,7 +78,7 @@ implements ObjectFactory
...
@@ -78,7 +78,7 @@ implements ObjectFactory
private
TraceSystem
getTraceSystem
()
{
private
TraceSystem
getTraceSystem
()
{
synchronized
(
JdbcDataSourceFactory
.
class
)
{
synchronized
(
JdbcDataSourceFactory
.
class
)
{
if
(
cachedTraceSystem
==
null
)
{
if
(
cachedTraceSystem
==
null
)
{
cachedTraceSystem
=
new
TraceSystem
(
SysProperties
.
CLIENT_TRACE_DIRECTORY
+
"h2datasource"
+
Constants
.
SUFFIX_TRACE_FILE
,
false
);
cachedTraceSystem
=
new
TraceSystem
(
SysProperties
.
CLIENT_TRACE_DIRECTORY
+
"h2datasource"
+
Constants
.
SUFFIX_TRACE_FILE
);
cachedTraceSystem
.
setLevelFile
(
SysProperties
.
DATASOURCE_TRACE_LEVEL
);
cachedTraceSystem
.
setLevelFile
(
SysProperties
.
DATASOURCE_TRACE_LEVEL
);
}
}
return
cachedTraceSystem
;
return
cachedTraceSystem
;
...
...
h2/src/main/org/h2/message/TraceSystem.java
浏览文件 @
f8c24c4f
...
@@ -100,20 +100,12 @@ public class TraceSystem implements TraceWriter {
...
@@ -100,20 +100,12 @@ public class TraceSystem implements TraceWriter {
* Create a new trace system object.
* Create a new trace system object.
*
*
* @param fileName the file name
* @param fileName the file name
* @param init if the trace system should be initialized
*/
*/
public
TraceSystem
(
String
fileName
,
boolean
init
)
{
public
TraceSystem
(
String
fileName
)
{
this
.
fileName
=
fileName
;
this
.
fileName
=
fileName
;
updateLevel
();
updateLevel
();
traces
=
SmallLRUCache
.
newInstance
(
100
);
traces
=
SmallLRUCache
.
newInstance
(
100
);
dateFormat
=
new
SimpleDateFormat
(
"MM-dd HH:mm:ss "
);
dateFormat
=
new
SimpleDateFormat
(
"MM-dd HH:mm:ss "
);
if
(
fileName
!=
null
&&
init
)
{
try
{
openWriter
();
}
catch
(
Exception
e
)
{
logWritingError
(
e
);
}
}
}
}
private
void
updateLevel
()
{
private
void
updateLevel
()
{
...
@@ -324,9 +316,6 @@ public class TraceSystem implements TraceWriter {
...
@@ -324,9 +316,6 @@ public class TraceSystem implements TraceWriter {
}
}
fileWriter
=
null
;
fileWriter
=
null
;
}
}
if
(
fileName
!=
null
&&
FileUtils
.
length
(
fileName
)
==
0
)
{
FileUtils
.
tryDelete
(
fileName
);
}
}
}
/**
/**
...
...
h2/src/main/org/h2/store/FileLister.java
浏览文件 @
f8c24c4f
...
@@ -51,7 +51,7 @@ public class FileLister {
...
@@ -51,7 +51,7 @@ public class FileLister {
public
static
void
tryUnlockDatabase
(
ArrayList
<
String
>
files
,
String
message
)
throws
SQLException
{
public
static
void
tryUnlockDatabase
(
ArrayList
<
String
>
files
,
String
message
)
throws
SQLException
{
for
(
String
fileName
:
files
)
{
for
(
String
fileName
:
files
)
{
if
(
fileName
.
endsWith
(
Constants
.
SUFFIX_LOCK_FILE
))
{
if
(
fileName
.
endsWith
(
Constants
.
SUFFIX_LOCK_FILE
))
{
FileLock
lock
=
new
FileLock
(
new
TraceSystem
(
null
,
false
),
fileName
,
Constants
.
LOCK_SLEEP
);
FileLock
lock
=
new
FileLock
(
new
TraceSystem
(
null
),
fileName
,
Constants
.
LOCK_SLEEP
);
try
{
try
{
lock
.
lock
(
FileLock
.
LOCK_FILE
);
lock
.
lock
(
FileLock
.
LOCK_FILE
);
lock
.
unlock
();
lock
.
unlock
();
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
f8c24c4f
...
@@ -400,7 +400,7 @@ public abstract class TestBase {
...
@@ -400,7 +400,7 @@ public abstract class TestBase {
System
.
err
.
println
(
"ERROR: "
+
s
+
" "
+
e
.
toString
()
+
" ------------------------------"
);
System
.
err
.
println
(
"ERROR: "
+
s
+
" "
+
e
.
toString
()
+
" ------------------------------"
);
e
.
printStackTrace
();
e
.
printStackTrace
();
try
{
try
{
TraceSystem
ts
=
new
TraceSystem
(
null
,
false
);
TraceSystem
ts
=
new
TraceSystem
(
null
);
FileLock
lock
=
new
FileLock
(
ts
,
"error.lock"
,
1000
);
FileLock
lock
=
new
FileLock
(
ts
,
"error.lock"
,
1000
);
lock
.
lock
(
FileLock
.
LOCK_FILE
);
lock
.
lock
(
FileLock
.
LOCK_FILE
);
FileWriter
fw
=
new
FileWriter
(
"error.txt"
,
true
);
FileWriter
fw
=
new
FileWriter
(
"error.txt"
,
true
);
...
...
h2/src/test/org/h2/test/jdbc/TestStatement.java
浏览文件 @
f8c24c4f
...
@@ -57,10 +57,15 @@ public class TestStatement extends TestBase {
...
@@ -57,10 +57,15 @@ public class TestStatement extends TestBase {
}
}
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
String
fileName
=
baseDir
+
"/statement.trace.db"
;
String
fileName
=
baseDir
+
"/statement.trace.db"
;
FileObject
trace
=
FileSystem
.
getInstance
(
fileName
).
openFileObject
(
fileName
,
"r"
);
stat
.
execute
(
"DROP TABLE TEST IF EXISTS"
);
stat
.
execute
(
"DROP TABLE TEST IF EXISTS"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY)"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY)"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(1)"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(1)"
);
try
{
stat
.
execute
(
"ERROR"
);
}
catch
(
SQLException
e
)
{
// ignore
}
FileObject
trace
=
FileSystem
.
getInstance
(
fileName
).
openFileObject
(
fileName
,
"r"
);
long
start
=
trace
.
length
();
long
start
=
trace
.
length
();
try
{
try
{
stat
.
execute
(
"ERROR"
);
stat
.
execute
(
"ERROR"
);
...
...
h2/src/test/org/h2/test/unit/TestFileLock.java
浏览文件 @
f8c24c4f
...
@@ -57,14 +57,14 @@ public class TestFileLock extends TestBase implements Runnable {
...
@@ -57,14 +57,14 @@ public class TestFileLock extends TestBase implements Runnable {
f
.
delete
();
f
.
delete
();
f
.
createNewFile
();
f
.
createNewFile
();
f
.
setLastModified
(
System
.
currentTimeMillis
()
+
10000
);
f
.
setLastModified
(
System
.
currentTimeMillis
()
+
10000
);
FileLock
lock
=
new
FileLock
(
new
TraceSystem
(
null
,
false
),
FILE
,
Constants
.
LOCK_SLEEP
);
FileLock
lock
=
new
FileLock
(
new
TraceSystem
(
null
),
FILE
,
Constants
.
LOCK_SLEEP
);
lock
.
lock
(
FileLock
.
LOCK_FILE
);
lock
.
lock
(
FileLock
.
LOCK_FILE
);
lock
.
unlock
();
lock
.
unlock
();
}
}
private
void
testSimple
()
throws
SQLException
{
private
void
testSimple
()
throws
SQLException
{
FileLock
lock1
=
new
FileLock
(
new
TraceSystem
(
null
,
false
),
FILE
,
Constants
.
LOCK_SLEEP
);
FileLock
lock1
=
new
FileLock
(
new
TraceSystem
(
null
),
FILE
,
Constants
.
LOCK_SLEEP
);
FileLock
lock2
=
new
FileLock
(
new
TraceSystem
(
null
,
false
),
FILE
,
Constants
.
LOCK_SLEEP
);
FileLock
lock2
=
new
FileLock
(
new
TraceSystem
(
null
),
FILE
,
Constants
.
LOCK_SLEEP
);
lock1
.
lock
(
FileLock
.
LOCK_FILE
);
lock1
.
lock
(
FileLock
.
LOCK_FILE
);
try
{
try
{
lock2
.
lock
(
FileLock
.
LOCK_FILE
);
lock2
.
lock
(
FileLock
.
LOCK_FILE
);
...
@@ -73,7 +73,7 @@ public class TestFileLock extends TestBase implements Runnable {
...
@@ -73,7 +73,7 @@ public class TestFileLock extends TestBase implements Runnable {
// expected
// expected
}
}
lock1
.
unlock
();
lock1
.
unlock
();
lock2
=
new
FileLock
(
new
TraceSystem
(
null
,
false
),
FILE
,
Constants
.
LOCK_SLEEP
);
lock2
=
new
FileLock
(
new
TraceSystem
(
null
),
FILE
,
Constants
.
LOCK_SLEEP
);
lock2
.
lock
(
FileLock
.
LOCK_FILE
);
lock2
.
lock
(
FileLock
.
LOCK_FILE
);
lock2
.
unlock
();
lock2
.
unlock
();
}
}
...
@@ -101,7 +101,7 @@ public class TestFileLock extends TestBase implements Runnable {
...
@@ -101,7 +101,7 @@ public class TestFileLock extends TestBase implements Runnable {
public
void
run
()
{
public
void
run
()
{
FileLock
lock
=
null
;
FileLock
lock
=
null
;
while
(!
stop
)
{
while
(!
stop
)
{
lock
=
new
FileLock
(
new
TraceSystem
(
null
,
false
),
FILE
,
100
);
lock
=
new
FileLock
(
new
TraceSystem
(
null
),
FILE
,
100
);
try
{
try
{
lock
.
lock
(
allowSockets
?
FileLock
.
LOCK_SOCKET
:
FileLock
.
LOCK_FILE
);
lock
.
lock
(
allowSockets
?
FileLock
.
LOCK_SOCKET
:
FileLock
.
LOCK_FILE
);
base
.
trace
(
lock
+
" locked"
);
base
.
trace
(
lock
+
" locked"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论