Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
96d51cc2
提交
96d51cc2
authored
11月 12, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Trace: slight performance improvement.
上级
c1e5b3cb
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
161 行增加
和
123 行删除
+161
-123
Command.java
h2/src/main/org/h2/command/Command.java
+1
-1
CommandRemote.java
h2/src/main/org/h2/command/CommandRemote.java
+2
-2
Database.java
h2/src/main/org/h2/engine/Database.java
+29
-31
DatabaseCloser.java
h2/src/main/org/h2/engine/DatabaseCloser.java
+1
-1
Engine.java
h2/src/main/org/h2/engine/Engine.java
+0
-2
MetaRecord.java
h2/src/main/org/h2/engine/MetaRecord.java
+1
-1
SessionRemote.java
h2/src/main/org/h2/engine/SessionRemote.java
+3
-3
PageBtreeIndex.java
h2/src/main/org/h2/index/PageBtreeIndex.java
+4
-4
PageDataIndex.java
h2/src/main/org/h2/index/PageDataIndex.java
+7
-7
JdbcDataSourceFactory.java
h2/src/main/org/h2/jdbcx/JdbcDataSourceFactory.java
+1
-1
JdbcXAConnection.java
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
+2
-2
Trace.java
h2/src/main/org/h2/message/Trace.java
+46
-9
TraceObject.java
h2/src/main/org/h2/message/TraceObject.java
+2
-2
TraceSystem.java
h2/src/main/org/h2/message/TraceSystem.java
+10
-4
ResultRemote.java
h2/src/main/org/h2/result/ResultRemote.java
+2
-2
FileLock.java
h2/src/main/org/h2/store/FileLock.java
+11
-11
PageInputStream.java
h2/src/main/org/h2/store/PageInputStream.java
+1
-1
PageLog.java
h2/src/main/org/h2/store/PageLog.java
+20
-21
PageOutputStream.java
h2/src/main/org/h2/store/PageOutputStream.java
+2
-2
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+10
-10
WriterThread.java
h2/src/main/org/h2/store/WriterThread.java
+1
-1
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+4
-4
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+1
-1
没有找到文件。
h2/src/main/org/h2/command/Command.java
浏览文件 @
96d51cc2
...
...
@@ -179,7 +179,7 @@ public abstract class Command implements CommandInterface {
if
(
trace
.
isInfoEnabled
())
{
long
time
=
System
.
currentTimeMillis
()
-
startTime
;
if
(
time
>
Constants
.
SLOW_QUERY_LIMIT_MS
)
{
trace
.
info
(
"slow query:
"
+
time
);
trace
.
info
(
"slow query:
{0} ms"
,
time
);
}
}
}
...
...
h2/src/main/org/h2/command/CommandRemote.java
浏览文件 @
96d51cc2
...
...
@@ -219,7 +219,7 @@ public class CommandRemote implements CommandInterface {
try
{
transfer
.
writeInt
(
SessionRemote
.
COMMAND_CLOSE
).
writeInt
(
id
);
}
catch
(
IOException
e
)
{
trace
.
error
(
"close"
,
e
);
trace
.
error
(
e
,
"close"
);
}
}
}
...
...
@@ -232,7 +232,7 @@ public class CommandRemote implements CommandInterface {
}
}
}
catch
(
DbException
e
)
{
trace
.
error
(
"close"
,
e
);
trace
.
error
(
e
,
"close"
);
}
parameters
.
clear
();
}
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
96d51cc2
差异被折叠。
点击展开。
h2/src/main/org/h2/engine/DatabaseCloser.java
浏览文件 @
96d51cc2
...
...
@@ -83,7 +83,7 @@ public class DatabaseCloser extends Thread {
// if loading classes is no longer allowed
// it would throw an IllegalStateException
try
{
trace
.
error
(
"Could not close the database"
,
e
);
trace
.
error
(
e
,
"could not close the database"
);
// if this was successful, we ignore the exception
// otherwise not
}
catch
(
RuntimeException
e2
)
{
...
...
h2/src/main/org/h2/engine/Engine.java
浏览文件 @
96d51cc2
...
...
@@ -14,7 +14,6 @@ import org.h2.constant.DbSettings;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.message.DbException
;
import
org.h2.message.Trace
;
import
org.h2.store.FileLock
;
import
org.h2.util.MathUtils
;
import
org.h2.util.New
;
...
...
@@ -189,7 +188,6 @@ public class Engine implements SessionFactory {
}
session
.
setAllowLiterals
(
false
);
session
.
commit
(
true
);
session
.
getDatabase
().
getTrace
(
Trace
.
SESSION
).
info
(
"connected #"
+
session
.
getId
());
return
session
;
}
...
...
h2/src/main/org/h2/engine/MetaRecord.java
浏览文件 @
96d51cc2
...
...
@@ -59,7 +59,7 @@ public class MetaRecord implements Comparable<MetaRecord> {
}
catch
(
DbException
e
)
{
e
=
e
.
addSQL
(
sql
);
SQLException
s
=
e
.
getSQLException
();
db
.
getTrace
(
Trace
.
DATABASE
).
error
(
s
ql
,
s
);
db
.
getTrace
(
Trace
.
DATABASE
).
error
(
s
,
sql
);
if
(
listener
!=
null
)
{
listener
.
exceptionThrown
(
s
,
sql
);
// continue startup in this case
...
...
h2/src/main/org/h2/engine/SessionRemote.java
浏览文件 @
96d51cc2
...
...
@@ -145,7 +145,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
trans
.
writeInt
(
id
);
trans
.
close
();
}
catch
(
IOException
e
)
{
trace
.
debug
(
"Could not cancel statement"
,
e
);
trace
.
debug
(
e
,
"could not cancel statement"
);
}
}
}
...
...
@@ -496,7 +496,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
done
(
transfer
);
transfer
.
close
();
}
catch
(
Exception
e
)
{
trace
.
error
(
"close"
,
e
);
trace
.
error
(
e
,
"close"
);
}
}
}
...
...
@@ -580,7 +580,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
*/
public
void
traceOperation
(
String
operation
,
int
id
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
operation
+
" "
+
id
);
trace
.
debug
(
"{0} {1}"
,
operation
,
id
);
}
}
...
...
h2/src/main/org/h2/index/PageBtreeIndex.java
浏览文件 @
96d51cc2
...
...
@@ -67,13 +67,13 @@ public class PageBtreeIndex extends PageIndex {
}
}
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"opened
"
+
getName
()
+
" rows:"
+
rowCount
);
trace
.
debug
(
"opened
{0} rows: {1}"
,
getName
()
,
rowCount
);
}
}
public
void
add
(
Session
session
,
Row
row
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
getName
()
+
" add "
+
row
);
trace
.
debug
(
"{0} add {1}"
,
getName
(),
row
);
}
// safe memory
SearchRow
newRow
=
getSearchRow
(
row
);
...
...
@@ -92,7 +92,7 @@ public class PageBtreeIndex extends PageIndex {
break
;
}
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"split
"
+
splitPoint
);
trace
.
debug
(
"split
{0}"
,
splitPoint
);
}
SearchRow
pivot
=
root
.
getRow
(
splitPoint
-
1
);
store
.
logUndo
(
root
,
root
.
data
);
...
...
@@ -214,7 +214,7 @@ public class PageBtreeIndex extends PageIndex {
public
void
remove
(
Session
session
,
Row
row
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
getName
()
+
" remove "
+
row
);
trace
.
debug
(
"{0} remove {1}"
,
getName
(),
row
);
}
if
(
tableData
.
getContainsLargeObject
())
{
for
(
int
i
=
0
,
len
=
row
.
getColumnCount
();
i
<
len
;
i
++)
{
...
...
h2/src/main/org/h2/index/PageDataIndex.java
浏览文件 @
96d51cc2
...
...
@@ -77,7 +77,7 @@ public class PageDataIndex extends PageIndex {
rowCount
=
root
.
getRowCount
();
}
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
this
+
" opened rows:"
+
rowCount
);
trace
.
debug
(
"{0} opened rows: {1}"
,
this
,
rowCount
);
}
table
.
setRowCount
(
rowCount
);
// estimate the memory usage as follows:
...
...
@@ -118,7 +118,7 @@ public class PageDataIndex extends PageIndex {
// when using auto-generated values, it's possible that multiple
// tries are required (specially if there was originally a primary key)
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
getName
()
+
" add "
+
row
);
trace
.
debug
(
"{0} add {1}"
,
getName
(),
row
);
}
long
add
=
0
;
while
(
true
)
{
...
...
@@ -163,7 +163,7 @@ public class PageDataIndex extends PageIndex {
break
;
}
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
this
+
" split"
);
trace
.
debug
(
"{0} split"
,
this
);
}
long
pivot
=
splitPoint
==
0
?
row
.
getKey
()
:
root
.
getKey
(
splitPoint
-
1
);
PageData
page1
=
root
;
...
...
@@ -312,7 +312,7 @@ public class PageDataIndex extends PageIndex {
}
}
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
getName
()
+
" remove "
+
row
);
trace
.
debug
(
"{0} remove {1}"
,
getName
(),
row
);
}
if
(
rowCount
==
1
)
{
removeAllRows
();
...
...
@@ -344,7 +344,7 @@ public class PageDataIndex extends PageIndex {
public
void
remove
(
Session
session
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
this
+
" remove"
);
trace
.
debug
(
"{0} remove"
,
this
);
}
removeAllRows
();
store
.
free
(
rootPageId
);
...
...
@@ -353,7 +353,7 @@ public class PageDataIndex extends PageIndex {
public
void
truncate
(
Session
session
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
this
+
" truncate"
);
trace
.
debug
(
"{0} truncate"
,
this
);
}
store
.
logTruncate
(
session
,
tableData
.
getId
());
removeAllRows
();
...
...
@@ -448,7 +448,7 @@ public class PageDataIndex extends PageIndex {
public
void
close
(
Session
session
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
this
+
" close"
);
trace
.
debug
(
"{0} close"
,
this
);
}
if
(
delta
!=
null
)
{
delta
.
clear
();
...
...
h2/src/main/org/h2/jdbcx/JdbcDataSourceFactory.java
浏览文件 @
96d51cc2
...
...
@@ -59,7 +59,7 @@ implements ObjectFactory
//## Java 1.4 begin ##
public
synchronized
Object
getObjectInstance
(
Object
obj
,
Name
name
,
Context
nameCtx
,
Hashtable
<
?
,
?
>
environment
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"getObjectInstance obj=
"
+
obj
+
" name="
+
name
+
" nameCtx="
+
nameCtx
+
" environment="
+
environment
);
trace
.
debug
(
"getObjectInstance obj=
{0} name={1} nameCtx={2} environment={3}"
,
obj
,
name
,
nameCtx
,
environment
);
}
if
(
obj
instanceof
Reference
)
{
Reference
ref
=
(
Reference
)
obj
;
...
...
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
浏览文件 @
96d51cc2
...
...
@@ -529,11 +529,11 @@ implements XAConnection, XAResource
Trace
trace
=
getTrace
();
try
{
if
(!
isClosed
())
{
trace
.
error
(
"Pooled connection not closed"
,
openStackTrace
);
trace
.
error
(
openStackTrace
,
"pooled connection not closed"
);
JdbcXAConnection
.
this
.
close
();
}
}
catch
(
SQLException
e
)
{
trace
.
debug
(
"finalize"
,
e
);
trace
.
debug
(
e
,
"finalize"
);
}
}
...
...
h2/src/main/org/h2/message/Trace.java
浏览文件 @
96d51cc2
...
...
@@ -6,6 +6,7 @@
*/
package
org
.
h2
.
message
;
import
java.text.MessageFormat
;
import
org.h2.constant.SysProperties
;
import
org.h2.util.StringUtils
;
...
...
@@ -54,11 +55,6 @@ public class Trace {
*/
public
static
final
String
LOCK
=
"lock"
;
/**
* The trace module name for the transaction log.
*/
public
static
final
String
LOG
=
"log"
;
/**
* The trace module name for schemas.
*/
...
...
@@ -148,11 +144,25 @@ public class Trace {
/**
* Write a message with trace level ERROR to the trace system.
*
* @param t the exception
* @param s the message
*/
public
void
error
(
Throwable
t
,
String
s
)
{
if
(
isEnabled
(
TraceSystem
.
ERROR
))
{
traceWriter
.
write
(
TraceSystem
.
ERROR
,
module
,
s
,
t
);
}
}
/**
* Write a message with trace level ERROR to the trace system.
*
* @param t the exception
* @param s the message
* @param params the parameters
*/
public
void
error
(
String
s
,
Throwable
t
)
{
public
void
error
(
Throwable
t
,
String
s
,
Object
...
params
)
{
if
(
isEnabled
(
TraceSystem
.
ERROR
))
{
s
=
MessageFormat
.
format
(
s
,
(
Object
[])
params
);
traceWriter
.
write
(
TraceSystem
.
ERROR
,
module
,
s
,
t
);
}
}
...
...
@@ -172,9 +182,22 @@ public class Trace {
* Write a message with trace level INFO to the trace system.
*
* @param s the message
* @param params the parameters
*/
public
void
info
(
String
s
,
Object
...
params
)
{
if
(
isEnabled
(
TraceSystem
.
INFO
))
{
s
=
MessageFormat
.
format
(
s
,
(
Object
[])
params
);
traceWriter
.
write
(
TraceSystem
.
INFO
,
module
,
s
,
null
);
}
}
/**
* Write a message with trace level INFO to the trace system.
*
* @param t the exception
* @param s the message
*/
void
info
(
String
s
,
Throwable
t
)
{
void
info
(
Throwable
t
,
String
s
)
{
if
(
isEnabled
(
TraceSystem
.
INFO
))
{
traceWriter
.
write
(
TraceSystem
.
INFO
,
module
,
s
,
t
);
}
...
...
@@ -228,9 +251,11 @@ public class Trace {
* Write a message with trace level DEBUG to the trace system.
*
* @param s the message
* @param params the parameters
*/
public
void
debug
(
String
s
)
{
public
void
debug
(
String
s
,
Object
...
params
)
{
if
(
isEnabled
(
TraceSystem
.
DEBUG
))
{
s
=
MessageFormat
.
format
(
s
,
(
Object
[])
params
);
traceWriter
.
write
(
TraceSystem
.
DEBUG
,
module
,
s
,
null
);
}
}
...
...
@@ -239,14 +264,26 @@ public class Trace {
* Write a message with trace level DEBUG to the trace system.
*
* @param s the message
* @param params the parameters
*/
public
void
debug
(
String
s
)
{
if
(
isEnabled
(
TraceSystem
.
DEBUG
))
{
traceWriter
.
write
(
TraceSystem
.
DEBUG
,
module
,
s
,
null
);
}
}
/**
* Write a message with trace level DEBUG to the trace system.
* @param t the exception
* @param s the message
*/
public
void
debug
(
String
s
,
Throwable
t
)
{
public
void
debug
(
Throwable
t
,
String
s
)
{
if
(
isEnabled
(
TraceSystem
.
DEBUG
))
{
traceWriter
.
write
(
TraceSystem
.
DEBUG
,
module
,
s
,
t
);
}
}
/**
* Write Java source code with trace level INFO to the trace system.
*
...
...
h2/src/main/org/h2/message/TraceObject.java
浏览文件 @
96d51cc2
...
...
@@ -403,9 +403,9 @@ public class TraceObject {
}
else
{
int
errorCode
=
e
.
getErrorCode
();
if
(
errorCode
>=
23000
&&
errorCode
<
24000
)
{
trace
.
info
(
"SQLException"
,
e
);
trace
.
info
(
e
,
"exception"
);
}
else
{
trace
.
error
(
"SQLException"
,
e
);
trace
.
error
(
e
,
"exception"
);
}
}
return
e
;
...
...
h2/src/main/org/h2/message/TraceSystem.java
浏览文件 @
96d51cc2
...
...
@@ -12,12 +12,13 @@ import java.io.Writer;
import
java.sql.DriverManager
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Constants
;
import
org.h2.jdbc.JdbcSQLException
;
import
org.h2.util.IOUtils
;
import
org.h2.util.
SmallLRUCache
;
import
org.h2.util.
New
;
/**
* The trace mechanism is the logging facility of this database. There is
...
...
@@ -83,7 +84,7 @@ public class TraceSystem implements TraceWriter {
private
int
levelMax
;
private
int
maxFileSize
=
DEFAULT_MAX_FILE_SIZE
;
private
String
fileName
;
private
SmallLRUCache
<
String
,
Trace
>
traces
;
private
HashMap
<
String
,
Trace
>
traces
;
private
SimpleDateFormat
dateFormat
;
private
Writer
fileWriter
;
private
PrintWriter
printWriter
;
...
...
@@ -119,14 +120,19 @@ public class TraceSystem implements TraceWriter {
}
/**
* Get or create a trace object for this module.
* Get or create a trace object for this module. Trace modules with names
* such as "JDBC[1]" are not cached (modules where the name ends with "]").
* All others are cached.
*
* @param module the module name
* @return the trace object
*/
public
synchronized
Trace
getTrace
(
String
module
)
{
if
(
module
.
endsWith
(
"]"
))
{
new
Trace
(
writer
,
module
);
}
if
(
traces
==
null
)
{
traces
=
SmallLRUCache
.
newInstance
(
16
);
traces
=
New
.
hashMap
(
16
);
}
Trace
t
=
traces
.
get
(
module
);
if
(
t
==
null
)
{
...
...
h2/src/main/org/h2/result/ResultRemote.java
浏览文件 @
96d51cc2
...
...
@@ -151,7 +151,7 @@ public class ResultRemote implements ResultInterface {
transfer
.
writeInt
(
SessionRemote
.
RESULT_CLOSE
).
writeInt
(
id
);
}
}
catch
(
IOException
e
)
{
trace
.
error
(
"close"
,
e
);
trace
.
error
(
e
,
"close"
);
}
finally
{
transfer
=
null
;
session
=
null
;
...
...
@@ -164,7 +164,7 @@ public class ResultRemote implements ResultInterface {
try
{
v
.
close
();
}
catch
(
DbException
e
)
{
trace
.
error
(
"delete lob "
+
v
.
getTraceSQL
(),
e
);
trace
.
error
(
e
,
"delete lob {0}"
,
v
.
getTraceSQL
()
);
}
}
lobValues
=
null
;
...
...
h2/src/main/org/h2/store/FileLock.java
浏览文件 @
96d51cc2
...
...
@@ -163,7 +163,7 @@ public class FileLock implements Runnable {
serverSocket
.
close
();
}
}
catch
(
Exception
e
)
{
trace
.
debug
(
"unlock"
,
e
);
trace
.
debug
(
e
,
"unlock"
);
}
finally
{
fileName
=
null
;
serverSocket
=
null
;
...
...
@@ -174,7 +174,7 @@ public class FileLock implements Runnable {
watchdog
.
interrupt
();
}
}
catch
(
Exception
e
)
{
trace
.
debug
(
"unlock"
,
e
);
trace
.
debug
(
e
,
"unlock"
);
}
}
...
...
@@ -208,7 +208,7 @@ public class FileLock implements Runnable {
}
lastWrite
=
fs
.
getLastModified
(
fileName
);
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"save
"
+
properties
);
trace
.
debug
(
"save
{0}"
,
properties
);
}
return
properties
;
}
catch
(
IOException
e
)
{
...
...
@@ -260,7 +260,7 @@ public class FileLock implements Runnable {
try
{
Properties
p2
=
SortedProperties
.
loadProperties
(
fileName
);
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"load
"
+
p2
);
trace
.
debug
(
"load
{0}"
,
p2
);
}
return
p2
;
}
catch
(
IOException
e
)
{
...
...
@@ -278,7 +278,7 @@ public class FileLock implements Runnable {
try
{
Thread
.
sleep
(
2
*
sleep
);
}
catch
(
Exception
e
)
{
trace
.
debug
(
"sleep"
,
e
);
trace
.
debug
(
e
,
"sleep"
);
}
return
;
}
else
if
(
dist
>
TIME_GRANULARITY
)
{
...
...
@@ -287,7 +287,7 @@ public class FileLock implements Runnable {
try
{
Thread
.
sleep
(
SLEEP_GAP
);
}
catch
(
Exception
e
)
{
trace
.
debug
(
"sleep"
,
e
);
trace
.
debug
(
e
,
"sleep"
);
}
}
throw
getExceptionFatal
(
"Lock file recently modified"
,
null
);
...
...
@@ -395,7 +395,7 @@ public class FileLock implements Runnable {
}
catch
(
BindException
e
)
{
throw
getExceptionFatal
(
"Bind Exception"
,
null
);
}
catch
(
ConnectException
e
)
{
trace
.
debug
(
"Socket not connected to port "
+
port
,
e
);
trace
.
debug
(
e
,
"socket not connected to port "
+
port
);
}
catch
(
IOException
e
)
{
throw
getExceptionFatal
(
"IOException"
,
null
);
}
...
...
@@ -415,7 +415,7 @@ public class FileLock implements Runnable {
properties
.
setProperty
(
"ipAddress"
,
ipAddress
);
properties
.
setProperty
(
"port"
,
String
.
valueOf
(
port
));
}
catch
(
Exception
e
)
{
trace
.
debug
(
"lock"
,
e
);
trace
.
debug
(
e
,
"lock"
);
serverSocket
=
null
;
lockFile
();
return
;
...
...
@@ -496,7 +496,7 @@ public class FileLock implements Runnable {
}
catch
(
NullPointerException
e
)
{
// ignore
}
catch
(
Exception
e
)
{
trace
.
debug
(
"watchdog"
,
e
);
trace
.
debug
(
e
,
"watchdog"
);
}
}
while
(
serverSocket
!=
null
)
{
...
...
@@ -505,11 +505,11 @@ public class FileLock implements Runnable {
Socket
s
=
serverSocket
.
accept
();
s
.
close
();
}
catch
(
Exception
e
)
{
trace
.
debug
(
"watchdog"
,
e
);
trace
.
debug
(
e
,
"watchdog"
);
}
}
}
catch
(
Exception
e
)
{
trace
.
debug
(
"watchdog"
,
e
);
trace
.
debug
(
e
,
"watchdog"
);
}
trace
.
debug
(
"watchdog end"
);
}
...
...
h2/src/main/org/h2/store/PageInputStream.java
浏览文件 @
96d51cc2
...
...
@@ -109,7 +109,7 @@ public class PageInputStream extends InputStream {
}
}
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"pageIn.readPage
"
+
next
);
trace
.
debug
(
"pageIn.readPage
{0}"
,
next
);
}
dataPage
=
-
1
;
data
=
null
;
...
...
h2/src/main/org/h2/store/PageLog.java
浏览文件 @
96d51cc2
...
...
@@ -179,7 +179,7 @@ public class PageLog {
* @param atEnd whether only pages at the end of the file should be used
*/
void
openForWriting
(
int
newFirstTrunkPage
,
boolean
atEnd
)
{
trace
.
debug
(
"log openForWriting firstPage:
"
+
newFirstTrunkPage
);
trace
.
debug
(
"log openForWriting firstPage:
{0}"
,
newFirstTrunkPage
);
this
.
firstTrunkPage
=
newFirstTrunkPage
;
logKey
++;
pageOut
=
new
PageOutputStream
(
store
,
newFirstTrunkPage
,
undoAll
,
logKey
,
atEnd
);
...
...
@@ -252,7 +252,7 @@ public class PageLog {
*/
void
recover
(
int
stage
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log recover stage:
"
+
stage
);
trace
.
debug
(
"log recover stage:
{0}"
,
stage
);
}
if
(
stage
==
RECOVERY_STAGE_ALLOCATE
)
{
PageInputStream
in
=
new
PageInputStream
(
store
,
logKey
,
firstTrunkPage
,
firstDataPage
);
...
...
@@ -291,14 +291,14 @@ public class PageLog {
if
(
stage
==
RECOVERY_STAGE_UNDO
)
{
if
(!
undo
.
get
(
pageId
))
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log undo
"
+
pageId
);
trace
.
debug
(
"log undo
{0}"
,
pageId
);
}
store
.
writePage
(
pageId
,
data
);
undo
.
set
(
pageId
);
undoAll
.
set
(
pageId
);
}
else
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log undo skip
"
+
pageId
);
trace
.
debug
(
"log undo skip
{0}"
,
pageId
);
}
}
}
...
...
@@ -311,12 +311,12 @@ public class PageLog {
}
else
if
(
stage
==
RECOVERY_STAGE_REDO
)
{
if
(
isSessionCommitted
(
sessionId
,
logId
,
pos
))
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log redo + table:
"
+
tableId
+
" s:"
+
sessionId
+
" "
+
row
);
trace
.
debug
(
"log redo + table:
{0} s:{1} {2}"
,
tableId
,
sessionId
,
row
);
}
store
.
redo
(
pos
,
tableId
,
row
,
true
);
}
else
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log ignore s:
"
+
sessionId
+
" + table:"
+
tableId
+
" "
+
row
);
trace
.
debug
(
"log ignore s:
{0} + table:{1} {2}"
,
sessionId
,
tableId
,
row
);
}
}
}
...
...
@@ -327,12 +327,12 @@ public class PageLog {
if
(
stage
==
RECOVERY_STAGE_REDO
)
{
if
(
isSessionCommitted
(
sessionId
,
logId
,
pos
))
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log redo - table:
"
+
tableId
+
" key:"
+
key
);
trace
.
debug
(
"log redo - table:
{0} key:{1}"
,
tableId
,
key
);
}
store
.
redoDelete
(
pos
,
tableId
,
key
);
}
else
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log ignore s:
"
+
sessionId
+
" - table:"
+
tableId
+
" key:"
+
key
);
trace
.
debug
(
"log ignore s:
{0} - table:{1} key:{2}"
,
sessionId
,
tableId
,
key
);
}
}
}
...
...
@@ -342,12 +342,12 @@ public class PageLog {
if
(
stage
==
RECOVERY_STAGE_REDO
)
{
if
(
isSessionCommitted
(
sessionId
,
logId
,
pos
))
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log redo truncate table:
"
+
tableId
);
trace
.
debug
(
"log redo truncate table:
{0}"
,
tableId
);
}
store
.
redoTruncate
(
tableId
);
}
else
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log ignore s:
"
+
sessionId
+
" truncate table:"
+
tableId
);
trace
.
debug
(
"log ignore s:
{0} truncate table:{1}"
,
sessionId
,
tableId
);
}
}
}
...
...
@@ -355,7 +355,7 @@ public class PageLog {
int
sessionId
=
in
.
readVarInt
();
String
transaction
=
in
.
readString
();
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log prepare commit
"
+
sessionId
+
" "
+
transaction
+
" pos:"
+
pos
);
trace
.
debug
(
"log prepare commit
{0} {1} pos:{2}"
,
sessionId
,
transaction
,
pos
);
}
if
(
stage
==
RECOVERY_STAGE_UNDO
)
{
int
page
=
pageIn
.
getDataPage
();
...
...
@@ -364,13 +364,13 @@ public class PageLog {
}
else
if
(
x
==
ROLLBACK
)
{
int
sessionId
=
in
.
readVarInt
();
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log rollback
"
+
sessionId
+
" pos:"
+
pos
);
trace
.
debug
(
"log rollback
{0} pos:{1}"
,
sessionId
,
pos
);
}
// ignore - this entry is just informational
}
else
if
(
x
==
COMMIT
)
{
int
sessionId
=
in
.
readVarInt
();
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log commit
"
+
sessionId
+
" pos:"
+
pos
);
trace
.
debug
(
"log commit
{0} pos:{1}"
,
sessionId
,
pos
);
}
if
(
stage
==
RECOVERY_STAGE_UNDO
)
{
setLastCommitForSession
(
sessionId
,
logId
,
pos
);
...
...
@@ -475,7 +475,7 @@ public class PageLog {
return
;
}
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log undo
"
+
pageId
);
trace
.
debug
(
"log undo
{0}"
,
pageId
);
}
if
(
SysProperties
.
CHECK
)
{
if
(
page
==
null
)
{
...
...
@@ -513,7 +513,7 @@ public class PageLog {
private
void
freeLogPages
(
IntArray
pages
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log frees
"
+
pages
.
get
(
0
)
+
".."
+
pages
.
get
(
pages
.
size
()
-
1
));
trace
.
debug
(
"log frees
{0}..{1}"
,
pages
.
get
(
0
),
pages
.
get
(
pages
.
size
()
-
1
));
}
Data
buffer
=
getBuffer
();
buffer
.
writeByte
((
byte
)
FREE_LOG
);
...
...
@@ -537,7 +537,7 @@ public class PageLog {
*/
void
commit
(
int
sessionId
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log commit s:
"
+
sessionId
);
trace
.
debug
(
"log commit s:
{0}"
,
sessionId
);
}
if
(
store
.
getDatabase
().
getPageStore
()
==
null
)
{
// database already closed
...
...
@@ -560,7 +560,7 @@ public class PageLog {
*/
void
prepareCommit
(
Session
session
,
String
transaction
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log prepare commit s:
"
+
session
.
getId
()
+
" "
+
transaction
);
trace
.
debug
(
"log prepare commit s:
{0}, {1}"
,
session
.
getId
(),
transaction
);
}
if
(
store
.
getDatabase
().
getPageStore
()
==
null
)
{
// database already closed
...
...
@@ -596,8 +596,7 @@ public class PageLog {
*/
void
logAddOrRemoveRow
(
Session
session
,
int
tableId
,
Row
row
,
boolean
add
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log "
+
(
add
?
"+"
:
"-"
)
+
" s:"
+
session
.
getId
()
+
" table:"
+
tableId
+
" row:"
+
row
);
trace
.
debug
(
"log {0} s:{1} table:{2} row:{3}"
,
add
?
"+"
:
"-"
,
session
.
getId
(),
tableId
,
row
);
}
session
.
addLogPos
(
logSectionId
,
logPos
);
logPos
++;
...
...
@@ -641,7 +640,7 @@ public class PageLog {
*/
void
logTruncate
(
Session
session
,
int
tableId
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log truncate s:
"
+
session
.
getId
()
+
" table:"
+
tableId
);
trace
.
debug
(
"log truncate s:
{0} table:{1}"
,
session
.
getId
(),
tableId
);
}
session
.
addLogPos
(
logSectionId
,
logPos
);
logPos
++;
...
...
@@ -714,7 +713,7 @@ public class PageLog {
* @return the trunk page of the data page to keep
*/
private
int
removeUntil
(
int
trunkPage
,
int
firstDataPageToKeep
)
{
trace
.
debug
(
"log.removeUntil
"
+
trunkPage
+
" "
+
firstDataPageToKeep
);
trace
.
debug
(
"log.removeUntil
{0} {1}"
,
trunkPage
,
firstDataPageToKeep
);
while
(
true
)
{
Page
p
=
store
.
getPage
(
trunkPage
);
PageStreamTrunk
t
=
(
PageStreamTrunk
)
p
;
...
...
h2/src/main/org/h2/store/PageOutputStream.java
浏览文件 @
96d51cc2
...
...
@@ -143,7 +143,7 @@ public class PageOutputStream {
private
void
storePage
()
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"pageOut.storePage
"
+
data
);
trace
.
debug
(
"pageOut.storePage
{0}"
,
data
);
}
data
.
write
();
}
...
...
@@ -175,7 +175,7 @@ public class PageOutputStream {
*/
void
fillPage
()
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"pageOut.storePage fill
"
+
data
.
getPos
());
trace
.
debug
(
"pageOut.storePage fill
{0}"
,
data
.
getPos
());
}
reserve
(
data
.
getRemaining
()
+
1
);
reserved
-=
data
.
getRemaining
();
...
...
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
96d51cc2
...
...
@@ -423,7 +423,7 @@ public class PageStore implements CacheWriter {
freed
.
clear
(
i
);
}
else
if
(!
freed
.
get
(
i
))
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"free
"
+
i
);
trace
.
debug
(
"free
{0}"
,
i
);
}
file
.
seek
((
long
)
i
<<
pageSizeShift
);
file
.
readFully
(
test
,
0
,
16
);
...
...
@@ -601,7 +601,7 @@ public class PageStore implements CacheWriter {
pageCount
=
newPageCount
;
// the easiest way to remove superfluous entries
freeLists
.
clear
();
trace
.
debug
(
"pageCount:
"
+
pageCount
);
trace
.
debug
(
"pageCount:
{0}"
,
pageCount
);
long
newLength
=
(
long
)
pageCount
<<
pageSizeShift
;
if
(
file
.
length
()
!=
newLength
)
{
file
.
setLength
(
newLength
);
...
...
@@ -629,7 +629,7 @@ public class PageStore implements CacheWriter {
if
(
f
!=
null
)
{
DbException
.
throwInternalError
(
"not free: "
+
f
);
}
trace
.
debug
(
"swap
"
+
a
+
" and "
+
b
+
" via "
+
free
);
trace
.
debug
(
"swap
{0} and {1} via {2}"
,
a
,
b
,
free
);
Page
pageA
=
null
;
if
(
isUsed
(
a
))
{
pageA
=
getPage
(
a
);
...
...
@@ -674,7 +674,7 @@ public class PageStore implements CacheWriter {
freePage
(
full
);
}
}
else
{
trace
.
debug
(
"move
"
+
p
.
getPos
()
+
" to "
+
free
);
trace
.
debug
(
"move
{0} to {1}"
,
p
.
getPos
(),
free
);
try
{
p
.
moveTo
(
systemSession
,
free
);
}
finally
{
...
...
@@ -900,7 +900,7 @@ public class PageStore implements CacheWriter {
*/
void
setLogFirstPage
(
int
logKey
,
int
trunkPageId
,
int
dataPageId
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"setLogFirstPage key:
"
+
logKey
+
" trunk: "
+
trunkPageId
+
" data: "
+
dataPageId
);
trace
.
debug
(
"setLogFirstPage key:
{0} trunk: {1} data: {2}"
,
logKey
,
trunkPageId
,
dataPageId
);
}
this
.
logKey
=
logKey
;
this
.
logFirstTrunkPage
=
trunkPageId
;
...
...
@@ -977,7 +977,7 @@ public class PageStore implements CacheWriter {
public
void
writeBack
(
CacheObject
obj
)
{
Page
record
=
(
Page
)
obj
;
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"writeBack
"
+
record
);
trace
.
debug
(
"writeBack
{0}"
,
record
);
}
synchronized
(
database
)
{
record
.
write
();
...
...
@@ -1019,7 +1019,7 @@ public class PageStore implements CacheWriter {
synchronized
(
database
)
{
if
(
trace
.
isDebugEnabled
())
{
if
(!
page
.
isChanged
())
{
trace
.
debug
(
"updateRecord
"
+
page
.
toString
());
trace
.
debug
(
"updateRecord
{0}"
,
page
.
toString
());
}
}
checkOpen
();
...
...
@@ -1214,7 +1214,7 @@ public class PageStore implements CacheWriter {
*/
void
freeUnused
(
int
pageId
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"freeUnused
"
+
pageId
);
trace
.
debug
(
"freeUnused
{0}"
,
pageId
);
}
synchronized
(
database
)
{
cache
.
remove
(
pageId
);
...
...
@@ -1336,7 +1336,7 @@ public class PageStore implements CacheWriter {
if
(
reservedPages
!=
null
)
{
for
(
int
r
:
reservedPages
.
keySet
())
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"reserve
"
+
r
);
trace
.
debug
(
"reserve
{0}"
,
r
);
}
allocatePage
(
r
);
}
...
...
@@ -1586,7 +1586,7 @@ public class PageStore implements CacheWriter {
String
[]
ops
=
StringUtils
.
arraySplit
(
options
,
','
,
false
);
Index
meta
;
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"addMeta id=
"
+
id
+
" type="
+
type
+
" root="
+
rootPageId
+
" parent="
+
parent
+
" columns="
+
columnList
);
trace
.
debug
(
"addMeta id=
{0} type={1} root={2} parent={3} columns={4}"
,
id
,
type
,
rootPageId
,
parent
,
columnList
);
}
if
(
redo
&&
rootPageId
!=
0
)
{
// ensure the page is empty, but not used by regular data
...
...
h2/src/main/org/h2/store/WriterThread.java
浏览文件 @
96d51cc2
...
...
@@ -87,7 +87,7 @@ public class WriterThread implements Runnable {
}
catch
(
Exception
e
)
{
TraceSystem
traceSystem
=
database
.
getTraceSystem
();
if
(
traceSystem
!=
null
)
{
traceSystem
.
getTrace
(
Trace
.
LOG
).
error
(
"flush"
,
e
);
traceSystem
.
getTrace
(
Trace
.
DATABASE
).
error
(
e
,
"flush"
);
}
}
// TODO log writer: could also flush the dirty cache
...
...
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
96d51cc2
...
...
@@ -137,7 +137,7 @@ public class RegularTable extends TableBase {
// this could happen, for example on failure in the storage
// but if that is not the case it means there is something wrong
// with the database
trace
.
error
(
"Could not undo operation"
,
e
);
trace
.
error
(
e2
,
"could not undo operation"
);
throw
e2
;
}
DbException
de
=
DbException
.
convert
(
e
);
...
...
@@ -259,7 +259,7 @@ public class RegularTable extends TableBase {
// this could happen, for example on failure in the storage
// but if that is not the case it means
// there is something wrong with the database
trace
.
error
(
"Could not remove index"
,
e
);
trace
.
error
(
e2
,
"could not remove index"
);
throw
e2
;
}
throw
e
;
...
...
@@ -364,7 +364,7 @@ public class RegularTable extends TableBase {
// this could happen, for example on failure in the storage
// but if that is not the case it means there is something wrong
// with the database
trace
.
error
(
"Could not undo operation"
,
e
);
trace
.
error
(
e2
,
"could not undo operation"
);
throw
e2
;
}
throw
DbException
.
convert
(
e
);
...
...
@@ -590,7 +590,7 @@ public class RegularTable extends TableBase {
private
void
traceLock
(
Session
session
,
boolean
exclusive
,
String
s
)
{
if
(
traceLock
.
isDebugEnabled
())
{
traceLock
.
debug
(
session
.
getId
()
+
" "
+
(
exclusive
?
"exclusive write lock"
:
"shared read lock"
)
+
" "
+
s
+
" "
+
getName
());
traceLock
.
debug
(
"{0} {1} {2} {3}"
,
session
.
getId
(),
exclusive
?
"exclusive write lock"
:
"shared read lock"
,
s
,
getName
());
}
}
...
...
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
96d51cc2
...
...
@@ -415,7 +415,7 @@ public class TableLink extends Table {
*/
public
PreparedStatement
getPreparedStatement
(
String
sql
,
boolean
exclusive
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
getName
()
+
":\n"
+
sql
);
trace
.
debug
(
"{0} :\n{1}"
,
getName
(),
sql
);
}
try
{
if
(
conn
==
null
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论