Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
10615986
提交
10615986
authored
14 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Various system properties have been replaced with database level settings.
上级
c5a3778e
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
29 行增加
和
53 行删除
+29
-53
DbSettings.java
h2/src/main/org/h2/constant/DbSettings.java
+8
-0
SysProperties.java
h2/src/main/org/h2/constant/SysProperties.java
+0
-16
ConnectionInfo.java
h2/src/main/org/h2/engine/ConnectionInfo.java
+2
-6
Database.java
h2/src/main/org/h2/engine/Database.java
+1
-1
Engine.java
h2/src/main/org/h2/engine/Engine.java
+6
-0
Session.java
h2/src/main/org/h2/engine/Session.java
+3
-2
TestCancel.java
h2/src/test/org/h2/test/jdbc/TestCancel.java
+7
-15
TestCrashAPI.java
h2/src/test/org/h2/test/synth/TestCrashAPI.java
+2
-13
没有找到文件。
h2/src/main/org/h2/constant/DbSettings.java
浏览文件 @
10615986
...
...
@@ -125,6 +125,14 @@ public class DbSettings extends SettingsBase {
*/
public
final
int
queryCacheSize
=
get
(
"QUERY_CACHE_SIZE"
,
0
);
/**
* Database setting <code>MAX_QUERY_TIMEOUT</code> (default: 0).<br />
* The maximum timeout of a query in milliseconds. The default is 0, meaning
* no limit. Please note the actual query timeout may be set to a lower
* value.
*/
public
int
maxQueryTimeout
=
get
(
"MAX_QUERY_TIMEOUT"
,
0
);
private
DbSettings
(
HashMap
<
String
,
String
>
s
)
{
super
(
s
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/constant/SysProperties.java
浏览文件 @
10615986
...
...
@@ -37,12 +37,6 @@ public class SysProperties {
*/
public
static
final
String
H2_SCRIPT_DIRECTORY
=
"h2.scriptDirectory"
;
/**
* INTERNAL
*/
public
static
final
String
H2_MAX_QUERY_TIMEOUT
=
"h2.maxQueryTimeout"
;
// TODO DbSettings
/**
* INTERNAL
*/
...
...
@@ -638,16 +632,6 @@ public class SysProperties {
return
getStringSetting
(
H2_SCRIPT_DIRECTORY
,
""
);
}
/**
* System property <code>h2.maxQueryTimeout</code> (default: 0).<br />
* The maximum timeout of a query. The default is 0, meaning no limit.
*
* @return the current value
*/
public
static
int
getMaxQueryTimeout
()
{
return
getIntSetting
(
H2_MAX_QUERY_TIMEOUT
,
0
);
}
/**
* System property <code>h2.collatorCacheSize</code> (default: 32000).<br />
* The cache size for collation keys (in elements). Used when a collator has
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/ConnectionInfo.java
浏览文件 @
10615986
...
...
@@ -28,6 +28,7 @@ import org.h2.util.Utils;
*/
public
class
ConnectionInfo
implements
Cloneable
{
private
static
final
HashSet
<
String
>
KNOWN_SETTINGS
=
New
.
hashSet
();
private
Properties
prop
=
new
Properties
();
private
String
originalURL
;
private
String
url
;
...
...
@@ -562,10 +563,9 @@ public class ConnectionInfo implements Cloneable {
this
.
name
=
serverKey
;
}
public
DbSettings
getDbSettings
()
{
DbSettings
getDbSettings
()
{
DbSettings
defaultSettings
=
DbSettings
.
getInstance
(
null
);
HashMap
<
String
,
String
>
s
=
null
;
ArrayList
<
String
>
remove
=
New
.
arrayList
();
for
(
Object
k
:
prop
.
keySet
())
{
String
key
=
k
.
toString
();
if
(!
isKnownSetting
(
key
)
&&
defaultSettings
.
containsKey
(
key
))
{
...
...
@@ -573,11 +573,7 @@ public class ConnectionInfo implements Cloneable {
s
=
New
.
hashMap
();
}
s
.
put
(
key
,
prop
.
getProperty
(
key
));
remove
.
add
(
key
);
}
}
for
(
String
r
:
remove
)
{
prop
.
remove
(
r
);
}
return
DbSettings
.
getInstance
(
s
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Database.java
浏览文件 @
10615986
...
...
@@ -484,7 +484,7 @@ public class Database implements DataHandler {
if
(
n
==
null
||
n
.
length
()
==
0
)
{
n
=
"unnamed"
;
}
return
getSettings
()
.
databaseToUpper
?
StringUtils
.
toUpperEnglish
(
n
)
:
n
;
return
dbSettings
.
databaseToUpper
?
StringUtils
.
toUpperEnglish
(
n
)
:
n
;
}
private
synchronized
void
open
(
int
traceLevelFile
,
int
traceLevelSystemOut
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Engine.java
浏览文件 @
10615986
...
...
@@ -10,6 +10,7 @@ import java.util.HashMap;
import
org.h2.command.CommandInterface
;
import
org.h2.command.Parser
;
import
org.h2.command.dml.SetTypes
;
import
org.h2.constant.DbSettings
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.message.DbException
;
...
...
@@ -157,7 +158,12 @@ public class Engine implements SessionFactory {
}
}
session
.
setAllowLiterals
(
true
);
DbSettings
defaultSettings
=
DbSettings
.
getInstance
(
null
);
for
(
String
setting
:
ci
.
getKeys
())
{
if
(
defaultSettings
.
containsKey
(
setting
))
{
// database setting are only used when opening the database
continue
;
}
String
value
=
ci
.
getProperty
(
setting
);
try
{
CommandInterface
command
=
session
.
prepareCommand
(
"SET "
+
Parser
.
quoteIdentifier
(
setting
)
+
" "
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Session.java
浏览文件 @
10615986
...
...
@@ -95,7 +95,7 @@ public class Session extends SessionWithState {
private
long
currentCommandStart
;
private
HashMap
<
String
,
Value
>
variables
;
private
HashSet
<
ResultInterface
>
temporaryResults
;
private
int
queryTimeout
=
SysProperties
.
getMaxQueryTimeout
()
;
private
int
queryTimeout
;
private
boolean
commitOrRollbackDisabled
;
private
Table
waitForLock
;
private
int
modificationId
;
...
...
@@ -106,6 +106,7 @@ public class Session extends SessionWithState {
public
Session
(
Database
database
,
User
user
,
int
id
)
{
this
.
database
=
database
;
this
.
queryTimeout
=
database
.
getSettings
().
maxQueryTimeout
;
this
.
queryCacheSize
=
database
.
getSettings
().
queryCacheSize
;
this
.
undoLog
=
new
UndoLog
(
this
);
this
.
user
=
user
;
...
...
@@ -1125,7 +1126,7 @@ public class Session extends SessionWithState {
}
public
void
setQueryTimeout
(
int
queryTimeout
)
{
int
max
=
SysProperties
.
getMaxQueryTimeout
()
;
int
max
=
database
.
getSettings
().
maxQueryTimeout
;
if
(
max
!=
0
&&
(
max
<
queryTimeout
||
queryTimeout
==
0
))
{
// the value must be at most max
queryTimeout
=
max
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestCancel.java
浏览文件 @
10615986
...
...
@@ -12,9 +12,7 @@ import java.sql.ResultSet;
import
java.sql.SQLException
;
import
java.sql.Savepoint
;
import
java.sql.Statement
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.test.TestBase
;
/**
...
...
@@ -149,10 +147,7 @@ public class TestCancel extends TestBase {
private
void
testMaxQueryTimeout
()
throws
SQLException
{
deleteDb
(
"cancel"
);
int
oldMax
=
SysProperties
.
getMaxQueryTimeout
();
try
{
System
.
setProperty
(
SysProperties
.
H2_MAX_QUERY_TIMEOUT
,
""
+
10
);
Connection
conn
=
getConnection
(
"cancel"
);
Connection
conn
=
getConnection
(
"cancel;MAX_QUERY_TIMEOUT=10"
);
Statement
stat
=
conn
.
createStatement
();
try
{
stat
.
executeQuery
(
"SELECT MAX(RAND()) FROM SYSTEM_RANGE(1, 100000000)"
);
...
...
@@ -161,9 +156,6 @@ public class TestCancel extends TestBase {
assertEquals
(
ErrorCode
.
STATEMENT_WAS_CANCELED
,
e
.
getErrorCode
());
}
conn
.
close
();
}
finally
{
System
.
setProperty
(
"h2.maxQueryTimeout"
,
""
+
oldMax
);
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestCrashAPI.java
浏览文件 @
10615986
...
...
@@ -32,7 +32,6 @@ import java.util.Comparator;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.store.FileLister
;
import
org.h2.test.TestAll
;
...
...
@@ -177,7 +176,7 @@ public class TestCrashAPI extends TestBase implements Runnable {
// can not use FILE_LOCK=NO, otherwise something could be written into
// the database in the finalize method
String
add
=
""
;
String
add
=
"
;MAX_QUERY_TIMEOUT=10000
"
;
// int testing;
// if(openCount >= 32) {
...
...
@@ -263,7 +262,7 @@ public class TestCrashAPI extends TestBase implements Runnable {
return
conn
;
}
p
rivate
void
testOn
e
(
int
seed
)
throws
SQLException
{
p
ublic
void
testCas
e
(
int
seed
)
throws
SQLException
{
printTime
(
"seed: "
+
seed
);
callCount
=
0
;
openCount
=
0
;
...
...
@@ -513,14 +512,4 @@ public class TestCrashAPI extends TestBase implements Runnable {
return
this
;
}
public
void
testCase
(
int
i
)
throws
SQLException
{
int
old
=
SysProperties
.
getMaxQueryTimeout
();
try
{
System
.
setProperty
(
SysProperties
.
H2_MAX_QUERY_TIMEOUT
,
""
+
10000
);
testOne
(
i
);
}
finally
{
System
.
setProperty
(
SysProperties
.
H2_MAX_QUERY_TIMEOUT
,
""
+
old
);
}
}
}
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论