Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
135c9b5b
提交
135c9b5b
authored
15 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Smaller changes
上级
c731412a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
1517 行增加
和
1474 行删除
+1517
-1474
changelog.html
h2/src/docsrc/html/changelog.html
+1
-1
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+487
-466
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+487
-466
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+475
-468
Command.java
h2/src/main/org/h2/command/Command.java
+1
-0
CommandContainer.java
h2/src/main/org/h2/command/CommandContainer.java
+0
-1
CommandList.java
h2/src/main/org/h2/command/CommandList.java
+0
-1
SysProperties.java
h2/src/main/org/h2/constant/SysProperties.java
+6
-0
Database.java
h2/src/main/org/h2/engine/Database.java
+26
-24
Session.java
h2/src/main/org/h2/engine/Session.java
+4
-1
SessionInterface.java
h2/src/main/org/h2/engine/SessionInterface.java
+1
-0
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+5
-9
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+1
-1
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+12
-17
TestFileLockSerialized.java
h2/src/test/org/h2/test/unit/TestFileLockSerialized.java
+11
-19
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
135c9b5b
...
@@ -24,7 +24,7 @@ Change Log
...
@@ -24,7 +24,7 @@ Change Log
translation was too much out of sync. Please use the Google translation instead.
translation was too much out of sync. Please use the Google translation instead.
</li><li>
Certain queries were not sorted if subselect queries were involved
</li><li>
Certain queries were not sorted if subselect queries were involved
</li><li>
More bugs in the server-less multi-connection mode have been fixed:
</li><li>
More bugs in the server-less multi-connection mode have been fixed:
90097 The database is read only, caches must be cleared on reconnect, etc.
.
90097 The database is read only, caches must be cleared on reconnect, etc.
</li></ul>
</li></ul>
<h2>
Version 1.2.121 (2009-10-11)
</h2>
<h2>
Version 1.2.121 (2009-10-11)
</h2>
...
...
This diff is collapsed.
Click to expand it.
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
135c9b5b
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
135c9b5b
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
135c9b5b
This source diff could not be displayed because it is too large. You can
view the blob
instead.
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/Command.java
浏览文件 @
135c9b5b
...
@@ -190,6 +190,7 @@ public abstract class Command implements CommandInterface {
...
@@ -190,6 +190,7 @@ public abstract class Command implements CommandInterface {
trace
.
info
(
"slow query: "
+
time
);
trace
.
info
(
"slow query: "
+
time
);
}
}
}
}
session
.
getDatabase
().
afterWriting
();
}
}
public
int
executeUpdate
()
throws
SQLException
{
public
int
executeUpdate
()
throws
SQLException
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/CommandContainer.java
浏览文件 @
135c9b5b
...
@@ -71,7 +71,6 @@ public class CommandContainer extends Command {
...
@@ -71,7 +71,6 @@ public class CommandContainer extends Command {
prepared
.
checkParameters
();
prepared
.
checkParameters
();
int
updateCount
=
prepared
.
update
();
int
updateCount
=
prepared
.
update
();
prepared
.
trace
(
startTime
,
updateCount
);
prepared
.
trace
(
startTime
,
updateCount
);
session
.
getDatabase
().
afterWriting
();
return
updateCount
;
return
updateCount
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/CommandList.java
浏览文件 @
135c9b5b
...
@@ -42,7 +42,6 @@ public class CommandList extends Command {
...
@@ -42,7 +42,6 @@ public class CommandList extends Command {
public
int
update
()
throws
SQLException
{
public
int
update
()
throws
SQLException
{
int
updateCount
=
command
.
executeUpdate
();
int
updateCount
=
command
.
executeUpdate
();
executeRemaining
();
executeRemaining
();
session
.
getDatabase
().
afterWriting
();
return
updateCount
;
return
updateCount
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/constant/SysProperties.java
浏览文件 @
135c9b5b
...
@@ -566,6 +566,12 @@ public class SysProperties {
...
@@ -566,6 +566,12 @@ public class SysProperties {
*/
*/
public
static
final
int
RECONNECT_CHECK_DELAY
=
getIntSetting
(
"h2.reconnectCheckDelay"
,
200
);
public
static
final
int
RECONNECT_CHECK_DELAY
=
getIntSetting
(
"h2.reconnectCheckDelay"
,
200
);
/**
* System property <code>h2.reconnectClearCache</code> (default: false).<br />
* Clear the database cache after re-connecting.
*/
public
static
final
boolean
RECONNECT_CLEAR_CACHE
=
getBooleanSetting
(
"h2.reconnectClearCache"
,
false
);
/**
/**
* System property <code>h2.redoBufferSize</code> (default: 262144).<br />
* System property <code>h2.redoBufferSize</code> (default: 262144).<br />
* Size of the redo buffer (used at startup when recovering).
* Size of the redo buffer (used at startup when recovering).
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Database.java
浏览文件 @
135c9b5b
...
@@ -169,8 +169,8 @@ public class Database implements DataHandler {
...
@@ -169,8 +169,8 @@ public class Database implements DataHandler {
private
Properties
reconnectLastLock
;
private
Properties
reconnectLastLock
;
private
volatile
long
reconnectCheckNext
;
private
volatile
long
reconnectCheckNext
;
private
volatile
boolean
reconnectChangePending
;
private
volatile
boolean
reconnectChangePending
;
private
volatile
boolean
allowedToRunCheckpoint
;
private
volatile
boolean
checkpointAllowed
;
private
volatile
boolean
isC
heckpointRunning
;
private
volatile
boolean
c
heckpointRunning
;
private
int
cacheSize
;
private
int
cacheSize
;
...
@@ -1810,12 +1810,14 @@ public class Database implements DataHandler {
...
@@ -1810,12 +1810,14 @@ public class Database implements DataHandler {
* @throws SQLException
* @throws SQLException
*/
*/
public
synchronized
void
clearCaches
()
throws
SQLException
{
public
synchronized
void
clearCaches
()
throws
SQLException
{
if
(
fileData
!=
null
)
{
if
(
SysProperties
.
RECONNECT_CLEAR_CACHE
)
{
fileData
.
getCache
().
clear
();
if
(
fileData
!=
null
)
{
fileIndex
.
getCache
().
clear
();
fileData
.
getCache
().
clear
();
}
fileIndex
.
getCache
().
clear
();
if
(
pageStore
!=
null
)
{
}
pageStore
.
getCache
().
clear
();
if
(
pageStore
!=
null
)
{
pageStore
.
getCache
().
clear
();
}
}
}
}
}
...
@@ -2383,11 +2385,11 @@ public class Database implements DataHandler {
...
@@ -2383,11 +2385,11 @@ public class Database implements DataHandler {
if
(
fileLockMethod
!=
FileLock
.
LOCK_SERIALIZED
||
readOnly
||
!
reconnectChangePending
||
closing
)
{
if
(
fileLockMethod
!=
FileLock
.
LOCK_SERIALIZED
||
readOnly
||
!
reconnectChangePending
||
closing
)
{
return
;
return
;
}
}
//
T
o avoid race conditions, we already set it here
//
t
o avoid race conditions, we already set it here
// (overlap with
allowedToRunCheckpoint
)
// (overlap with
checkpointAllowed
)
isC
heckpointRunning
=
true
;
c
heckpointRunning
=
true
;
if
(!
allowedToRunCheckpoint
)
{
if
(!
checkpointAllowed
)
{
isC
heckpointRunning
=
false
;
c
heckpointRunning
=
false
;
return
;
return
;
}
}
...
@@ -2398,7 +2400,7 @@ public class Database implements DataHandler {
...
@@ -2398,7 +2400,7 @@ public class Database implements DataHandler {
flushIndexes
(
0
);
flushIndexes
(
0
);
checkpoint
();
checkpoint
();
reconnectModified
(
false
);
reconnectModified
(
false
);
isC
heckpointRunning
=
false
;
c
heckpointRunning
=
false
;
getTrace
().
debug
(
"checkpoint end"
);
getTrace
().
debug
(
"checkpoint end"
);
}
}
}
}
...
@@ -2453,28 +2455,28 @@ public class Database implements DataHandler {
...
@@ -2453,28 +2455,28 @@ public class Database implements DataHandler {
/**
/**
* This method is called before writing to the log file.
* This method is called before writing to the log file.
*
*
* @return true if the call was successful,
* @return true if the call was successful
and writing is allowed
,
* false if another connection was faster
* false if another connection was faster
*/
*/
public
boolean
beforeWriting
()
{
public
boolean
beforeWriting
()
{
if
(
fileLockMethod
==
FileLock
.
LOCK_SERIALIZED
)
{
if
(
fileLockMethod
==
FileLock
.
LOCK_SERIALIZED
)
{
//
To avoid race conditions, we already set it here (overlap with
//
to avoid race conditions, we already set it here
//
isC
heckpointRunning)
//
(overlap with c
heckpointRunning)
allowedToRunCheckpoint
=
false
;
checkpointAllowed
=
false
;
while
(
isC
heckpointRunning
)
{
while
(
c
heckpointRunning
)
{
try
{
try
{
Thread
.
sleep
(
10
+(
int
)
Math
.
random
()
*
10
);
Thread
.
sleep
(
10
+
(
int
)
(
Math
.
random
()
*
10
)
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// ignore
// ignore
}
}
}
}
boolean
allowedToWrite
=
reconnectModified
(
true
);
boolean
writingAllowed
=
reconnectModified
(
true
);
if
(!
allowedToWrite
)
{
if
(!
writingAllowed
)
{
// make sure the next call to isReconnectNeeded() returns yes
// make sure the next call to isReconnectNeeded() returns yes
reconnectCheckNext
=
System
.
currentTimeMillis
()
-
1
;
reconnectCheckNext
=
System
.
currentTimeMillis
()
-
1
;
reconnectLastLock
=
null
;
reconnectLastLock
=
null
;
}
}
return
allowedToWrite
;
return
writingAllowed
;
}
}
return
true
;
return
true
;
}
}
...
@@ -2483,7 +2485,7 @@ public class Database implements DataHandler {
...
@@ -2483,7 +2485,7 @@ public class Database implements DataHandler {
* This method is called after updates are finished.
* This method is called after updates are finished.
*/
*/
public
void
afterWriting
()
{
public
void
afterWriting
()
{
allowedToRunCheckpoint
=
true
;
checkpointAllowed
=
true
;
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Session.java
浏览文件 @
135c9b5b
...
@@ -1134,7 +1134,10 @@ public class Session extends SessionWithState {
...
@@ -1134,7 +1134,10 @@ public class Session extends SessionWithState {
newSession
.
sessionState
=
sessionState
;
newSession
.
sessionState
=
sessionState
;
newSession
.
recreateSessionState
();
newSession
.
recreateSessionState
();
database
.
clearCaches
();
database
.
clearCaches
();
while
(
write
&&
!
database
.
beforeWriting
())
{
if
(
write
)
{
while
(!
database
.
beforeWriting
())
{
// wait until we are allowed to write
}
}
}
return
newSession
;
return
newSession
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/SessionInterface.java
浏览文件 @
135c9b5b
...
@@ -88,4 +88,5 @@ public interface SessionInterface {
...
@@ -88,4 +88,5 @@ public interface SessionInterface {
* @return the new connection
* @return the new connection
*/
*/
SessionInterface
reconnect
(
boolean
write
)
throws
SQLException
;
SessionInterface
reconnect
(
boolean
write
)
throws
SQLException
;
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
135c9b5b
...
@@ -695,18 +695,14 @@ public class TableFilter implements ColumnResolver {
...
@@ -695,18 +695,14 @@ public class TableFilter implements ColumnResolver {
}
}
/**
/**
*
Returns if there are in(...) comparisons involved
*
Are there any index conditions that involve IN(...).
*
*
* @see Comparison#IN_LIST
* @return whether there are IN(...) comparisons
* @see Comparison#IN_QUERY
*
* @return if there are in(...) comparisons involved
*/
*/
public
boolean
hasInComparisons
()
{
public
boolean
hasInComparisons
()
{
for
(
int
i
=
0
;
i
<
indexConditions
.
size
();
i
++)
{
for
(
IndexCondition
cond
:
indexConditions
)
{
if
((
indexConditions
.
get
(
i
).
getCompareType
()
==
Comparison
.
IN_QUERY
)
int
compareType
=
cond
.
getCompareType
();
||
if
(
compareType
==
Comparison
.
IN_QUERY
||
compareType
==
Comparison
.
IN_LIST
)
{
(
indexConditions
.
get
(
i
).
getCompareType
()
==
Comparison
.
IN_LIST
))
{
return
true
;
return
true
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
135c9b5b
...
@@ -717,7 +717,7 @@ public abstract class TestBase {
...
@@ -717,7 +717,7 @@ public abstract class TestBase {
* @param condition the condition
* @param condition the condition
* @throws AssertionError if the condition is false
* @throws AssertionError if the condition is false
*/
*/
p
rotected
void
assertTrue
(
boolean
condition
)
{
p
ublic
void
assertTrue
(
boolean
condition
)
{
assertTrue
(
"Expected: true got: false"
,
condition
);
assertTrue
(
"Expected: true got: false"
,
condition
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
135c9b5b
...
@@ -10,7 +10,6 @@ import java.io.File;
...
@@ -10,7 +10,6 @@ import java.io.File;
import
java.io.StringReader
;
import
java.io.StringReader
;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.Date
;
import
java.sql.Date
;
import
java.sql.DriverManager
;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
...
@@ -883,21 +882,17 @@ public class TestCases extends TestBase {
...
@@ -883,21 +882,17 @@ public class TestCases extends TestBase {
}
}
private
void
testOrderByWithSubselect
()
throws
SQLException
{
private
void
testOrderByWithSubselect
()
throws
SQLException
{
Connection
c
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:testdb"
);
deleteDb
(
"cases"
);
Statement
s
=
c
.
createStatement
();
s
.
execute
(
"create table master(id number primary key, name varchar2(30));"
);
Connection
conn
=
getConnection
(
"cases"
);
s
.
execute
(
"create table detail(id number references master(id), location varchar2(30));"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table master(id number primary key, name varchar2(30));"
);
s
.
execute
(
"Insert into master values(1,'a');"
);
stat
.
execute
(
"create table detail(id number references master(id), location varchar2(30));"
);
s
.
execute
(
"Insert into master values(2,'b');"
);
s
.
execute
(
"Insert into master values(3,'c');"
);
stat
.
execute
(
"Insert into master values(1,'a'), (2,'b'), (3,'c');"
);
s
.
execute
(
"commit;"
);
stat
.
execute
(
"Insert into detail values(1,'a'), (2,'b'), (3,'c');"
);
s
.
execute
(
"Insert into detail values(1,'a');"
);
s
.
execute
(
"Insert into detail values(2,'b');"
);
ResultSet
rs
=
stat
.
executeQuery
(
s
.
execute
(
"Insert into detail values(3,'c');"
);
s
.
execute
(
"commit;"
);
ResultSet
rs
=
s
.
executeQuery
(
"select master.id, master.name "
+
"select master.id, master.name "
+
"from master "
+
"from master "
+
"where master.id in (select detail.id from detail) "
+
"where master.id in (select detail.id from detail) "
+
...
@@ -909,7 +904,7 @@ public class TestCases extends TestBase {
...
@@ -909,7 +904,7 @@ public class TestCases extends TestBase {
assertTrue
(
rs
.
next
());
assertTrue
(
rs
.
next
());
assertEquals
(
3
,
rs
.
getInt
(
1
));
assertEquals
(
3
,
rs
.
getInt
(
1
));
c
.
close
();
c
onn
.
close
();
}
}
}
}
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestFileLockSerialized.java
浏览文件 @
135c9b5b
...
@@ -403,11 +403,8 @@ public class TestFileLockSerialized extends TestBase {
...
@@ -403,11 +403,8 @@ public class TestFileLockSerialized extends TestBase {
final
String
url
=
"jdbc:h2:"
+
baseDir
+
"/fileLockSerialized;FILE_LOCK=SERIALIZED;OPEN_NEW=TRUE;CACHE_SIZE="
+
cacheSizeKb
;
final
String
url
=
"jdbc:h2:"
+
baseDir
+
"/fileLockSerialized;FILE_LOCK=SERIALIZED;OPEN_NEW=TRUE;CACHE_SIZE="
+
cacheSizeKb
;
final
boolean
[]
importFinished
=
{
false
};
final
boolean
[]
importFinished
=
{
false
};
final
boolean
[]
updateFinished
=
{
false
};
final
boolean
[]
testFinished
=
{
false
};
final
Exception
[]
ex
=
new
Exception
[
1
];
final
Exception
[]
ex
=
new
Exception
[
1
];
final
Thread
importUpdate
=
new
Thread
()
{
new
Thread
()
{
public
void
run
()
{
public
void
run
()
{
try
{
try
{
Connection
conn
=
DriverManager
.
getConnection
(
url
);
Connection
conn
=
DriverManager
.
getConnection
(
url
);
...
@@ -419,17 +416,17 @@ public class TestFileLockSerialized extends TestBase {
...
@@ -419,17 +416,17 @@ public class TestFileLockSerialized extends TestBase {
importFinished
[
0
]
=
true
;
importFinished
[
0
]
=
true
;
Thread
.
sleep
(
5000
);
Thread
.
sleep
(
5000
);
stat
.
execute
(
"update test set id2=999 where id=500"
);
stat
.
execute
(
"update test set id2=999 where id=500"
);
updateFinished
[
0
]
=
true
;
conn
.
close
();
conn
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
ex
[
0
]
=
e
;
ex
[
0
]
=
e
;
}
finally
{
importFinished
[
0
]
=
true
;
}
}
}
}
};
importUpdate
.
start
();
}.
start
();
Thread
select
=
new
Thread
()
{
new
Thread
()
{
public
void
run
()
{
public
void
run
()
{
try
{
try
{
Connection
conn
=
DriverManager
.
getConnection
(
url
);
Connection
conn
=
DriverManager
.
getConnection
(
url
);
...
@@ -442,26 +439,21 @@ public class TestFileLockSerialized extends TestBase {
...
@@ -442,26 +439,21 @@ public class TestFileLockSerialized extends TestBase {
assertTrue
(
rs
.
next
());
assertTrue
(
rs
.
next
());
assertEquals
(
500
,
rs
.
getInt
(
1
));
assertEquals
(
500
,
rs
.
getInt
(
1
));
rs
.
close
();
rs
.
close
();
while
(!
updateFinished
[
0
])
{
importUpdate
.
join
();
Thread
.
sleep
(
100
);
}
Thread
.
sleep
(
1000
);
Thread
.
sleep
(
1000
);
rs
=
stat
.
executeQuery
(
"select id2 from test where id=500"
);
rs
=
stat
.
executeQuery
(
"select id2 from test where id=500"
);
assertTrue
(
rs
.
next
());
assertTrue
(
rs
.
next
());
assertEquals
(
999
,
rs
.
getInt
(
1
));
assertEquals
(
999
,
rs
.
getInt
(
1
));
rs
.
close
();
rs
.
close
();
conn
.
close
();
conn
.
close
();
testFinished
[
0
]
=
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
ex
[
0
]
=
e
;
ex
[
0
]
=
e
;
}
}
}
}
};
}.
start
();
select
.
start
();
while
((
ex
[
0
]
==
null
)
&&
(!
testFinished
[
0
]))
{
importUpdate
.
join
();
Thread
.
sleep
(
10
);
select
.
join
();
}
if
(
ex
[
0
]
!=
null
)
{
if
(
ex
[
0
]
!=
null
)
{
throw
ex
[
0
];
throw
ex
[
0
];
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论