Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
81904b30
提交
81904b30
authored
7月 18, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support LOG=0 and LOG=1. Use LOG=1 by default in test cases.
上级
70b9adab
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
133 行增加
和
50 行删除
+133
-50
help.csv
h2/src/docsrc/help/help.csv
+29
-2
changelog.html
h2/src/docsrc/html/changelog.html
+5
-1
faq.html
h2/src/docsrc/html/faq.html
+2
-1
Set.java
h2/src/main/org/h2/command/dml/Set.java
+1
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+13
-0
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+28
-38
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+1
-0
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-1
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+9
-6
TestTransaction.java
h2/src/test/org/h2/test/db/TestTransaction.java
+42
-0
supportTemplates.txt
h2/src/test/org/h2/test/todo/supportTemplates.txt
+1
-0
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
81904b30
...
@@ -1118,6 +1118,33 @@ This setting is persistent.
...
@@ -1118,6 +1118,33 @@ This setting is persistent.
SET IGNORECASE TRUE
SET IGNORECASE TRUE
"
"
"Commands (Other)","SET LOG","
SET LOCK_MODE int
","
Sets the transaction log mode. The values 0, 1, and 2 are supported, the default is 2.
This setting affects all connections.
LOG=0 means the transaction log is disabled completely. It is the fastest mode,
but also the most dangerous: if the process is killed while the database is open in this mode,
the data might be lost. It must only be used if this is not a problem, for example when
initially loading a database, or when running tests.
LOG=1 means the transaction log is enabled, but FileDescriptor.sync is disabled.
This setting is about half as fast as with LOG=0. This setting is useful if no protection
against power failure is required, but the data must be protected against killing the process.
LOG=2 (the default) means the transaction log is enabled, and FileDescriptor.sync is called
for each checkpoint. This setting is about half as fast as LOG=1. Depending on the
file system, this will also protect against power failure in the majority if cases.
Admin rights are required to execute this command.
This command commits an open transaction.
This setting is not persistent.
This setting can be appended to the database URL: jdbc:h2:test;LOG=0
","
SET LOG 1
"
"Commands (Other)","SET LOCK_MODE","
"Commands (Other)","SET LOCK_MODE","
SET LOCK_MODE int
SET LOCK_MODE int
","
","
...
@@ -1498,8 +1525,8 @@ CASE WHEN CNT<10 THEN 'Low' ELSE 'High' END
...
@@ -1498,8 +1525,8 @@ CASE WHEN CNT<10 THEN 'Low' ELSE 'High' END
"Other Grammar","Cipher","
"Other Grammar","Cipher","
{ AES | XTEA }
{ AES | XTEA }
","
","
Two algorithms are supported
, AES (AES-128) and XTEA (using 32 rounds). The AES
Two algorithms are supported
: AES (AES-128) and XTEA (using 32 rounds).
algorithm is about half as fast as XTEA
.
XTEA is a bit faster than AES in some environments, but AES is more secure
.
","
","
AES
AES
"
"
...
...
h2/src/docsrc/html/changelog.html
浏览文件 @
81904b30
...
@@ -18,7 +18,11 @@ Change Log
...
@@ -18,7 +18,11 @@ Change Log
<h1>
Change Log
</h1>
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
After deleting a lot of data (for example by dropping or altering tables, or indexes,
<ul><li>
For improved performance, LOG=0 and LOG=1 are again supported.
LOG=0 means the transaction log is disabled completely (fastest; for loading a database).
LOG=1 means the transaction log is enabled, but FileDescriptor.sync is disabled (if no protection against power failure is required).
LOG=2 is the default (transaction log is enabled, FileDescriptor.sync for each checkpoint).
</li><li>
After deleting a lot of data (for example by dropping or altering tables, or indexes,
or after a large transaction), opening a large database was very slow. Fixed.
or after a large transaction), opening a large database was very slow. Fixed.
</li><li>
When killing the process after creating and dropping many tables (specially temporary tables),
</li><li>
When killing the process after creating and dropping many tables (specially temporary tables),
the database could not be opened sometimes.
the database could not be opened sometimes.
...
...
h2/src/docsrc/html/faq.html
浏览文件 @
81904b30
...
@@ -148,7 +148,8 @@ bugs that have not yet been found (as with most software). Some features are kno
...
@@ -148,7 +148,8 @@ bugs that have not yet been found (as with most software). Some features are kno
to be dangerous, they are only supported for situations where performance is more important
to be dangerous, they are only supported for situations where performance is more important
than reliability. Those dangerous features are:
than reliability. Those dangerous features are:
</p>
</p>
<ul><li>
Using the transaction isolation level
<code>
READ_UNCOMMITTED
</code>
<ul><li>
Disabling the transaction log or FileDescriptor.sync() using LOG=0 or LOG=1.
</li><li>
Using the transaction isolation level
<code>
READ_UNCOMMITTED
</code>
(
<code>
LOCK_MODE 0
</code>
) while at the same time using multiple
(
<code>
LOCK_MODE 0
</code>
) while at the same time using multiple
connections.
connections.
</li><li>
Disabling database file protection using (setting
<code>
FILE_LOCK
</code>
to
</li><li>
Disabling database file protection using (setting
<code>
FILE_LOCK
</code>
to
...
...
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
81904b30
...
@@ -204,7 +204,7 @@ public class Set extends Prepared {
...
@@ -204,7 +204,7 @@ public class Set extends Prepared {
if
(
value
==
0
)
{
if
(
value
==
0
)
{
session
.
getUser
().
checkAdmin
();
session
.
getUser
().
checkAdmin
();
}
}
// currently no effect
database
.
setLogMode
(
value
);
break
;
break
;
}
}
case
SetTypes
.
MAX_LENGTH_INPLACE_LOB
:
{
case
SetTypes
.
MAX_LENGTH_INPLACE_LOB
:
{
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
81904b30
...
@@ -2273,4 +2273,17 @@ public class Database implements DataHandler {
...
@@ -2273,4 +2273,17 @@ public class Database implements DataHandler {
return
conn
;
return
conn
;
}
}
public
void
setLogMode
(
int
log
)
{
if
(
pageStore
!=
null
)
{
pageStore
.
setLogMode
(
log
);
}
}
public
int
getLogMode
()
{
if
(
pageStore
!=
null
)
{
return
pageStore
.
getLogMode
();
}
return
PageStore
.
LOG_MODE_OFF
;
}
}
}
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
81904b30
...
@@ -81,12 +81,8 @@ import org.h2.value.ValueString;
...
@@ -81,12 +81,8 @@ import org.h2.value.ValueString;
public
class
PageStore
implements
CacheWriter
{
public
class
PageStore
implements
CacheWriter
{
// TODO test running out of disk space (using a special file system)
// TODO test running out of disk space (using a special file system)
// TODO test with recovery being the default method
// TODO unused pages should be freed once in a while
// TODO test reservedPages does not grow unbound
// TODO node row counts are incorrect (it's not splitting row counts)
// TODO utf-x: test if it's faster
// TODO corrupt pages should be freed once in a while
// TODO node row counts are incorrect (not splitting row counts)
// TODO after opening the database, delay writing until required
// TODO after opening the database, delay writing until required
// TODO optimization: try to avoid allocating a byte array per page
// TODO optimization: try to avoid allocating a byte array per page
// TODO optimization: check if calling Data.getValueLen slows things down
// TODO optimization: check if calling Data.getValueLen slows things down
...
@@ -96,28 +92,12 @@ public class PageStore implements CacheWriter {
...
@@ -96,28 +92,12 @@ public class PageStore implements CacheWriter {
// TODO detect circles in linked lists
// TODO detect circles in linked lists
// (input stream, free list, extend pages...)
// (input stream, free list, extend pages...)
// at runtime and recovery
// at runtime and recovery
// synchronized correctly (on the index?)
// TODO remove trace or use isDebugEnabled
// TODO remove trace or use isDebugEnabled
// TODO recover tool: support syntax to delete a row with a key
// TODO recover tool: support syntax to delete a row with a key
// TODO don't store default values (store a special value)
// TODO don't store default values (store a special value)
// TODO split files (1 GB max size)
// TODO add a setting (that can be changed at runtime) to call fsync
// and delay on each commit
// TODO check for file size (exception if not exact size expected)
// TODO check for file size (exception if not exact size expected)
// TODO online backup using bsdiff
// TODO online backup using bsdiff
// TODO when removing DiskFile:
// remove CacheObject.blockCount
// remove Record.getMemorySize
// simplify InDoubtTransaction
// remove parameter in Record.write(DataPage buff)
// remove Record.getByteCount
// remove Database.objectIds
// remove TableData.checkRowCount
// remove Row.setPos
// remove database URL option RECOVER=1 option
// remove old database URL options and documentation
/**
/**
* The smallest possible page size.
* The smallest possible page size.
*/
*/
...
@@ -128,22 +108,26 @@ public class PageStore implements CacheWriter {
...
@@ -128,22 +108,26 @@ public class PageStore implements CacheWriter {
*/
*/
public
static
final
int
PAGE_SIZE_MAX
=
32768
;
public
static
final
int
PAGE_SIZE_MAX
=
32768
;
/**
* This log mode means the transaction log is not used.
*/
public
static
final
int
LOG_MODE_OFF
=
0
;
/**
* This log mode means the transaction log is used and FileDescriptor.sync()
* is called for each checkpoint. This is the default level.
*/
private
static
final
int
LOG_MODE_SYNC
=
2
;
private
static
final
int
PAGE_ID_FREE_LIST_ROOT
=
3
;
private
static
final
int
PAGE_ID_FREE_LIST_ROOT
=
3
;
private
static
final
int
PAGE_ID_META_ROOT
=
4
;
private
static
final
int
PAGE_ID_META_ROOT
=
4
;
private
static
final
int
MIN_PAGE_COUNT
=
6
;
private
static
final
int
MIN_PAGE_COUNT
=
6
;
private
static
final
int
INCREMENT_PAGES
=
128
;
private
static
final
int
INCREMENT_PAGES
=
128
;
private
static
final
int
READ_VERSION
=
3
;
private
static
final
int
READ_VERSION
=
3
;
private
static
final
int
WRITE_VERSION
=
3
;
private
static
final
int
WRITE_VERSION
=
3
;
private
static
final
int
META_TYPE_DATA_INDEX
=
0
;
private
static
final
int
META_TYPE_DATA_INDEX
=
0
;
private
static
final
int
META_TYPE_BTREE_INDEX
=
1
;
private
static
final
int
META_TYPE_BTREE_INDEX
=
1
;
private
static
final
int
META_TABLE_ID
=
-
1
;
private
static
final
int
META_TABLE_ID
=
-
1
;
private
static
final
SearchRow
[]
EMPTY_SEARCH_ROW
=
{
};
private
static
final
SearchRow
[]
EMPTY_SEARCH_ROW
=
{
};
private
Database
database
;
private
Database
database
;
private
final
Trace
trace
;
private
final
Trace
trace
;
private
String
fileName
;
private
String
fileName
;
...
@@ -153,11 +137,8 @@ public class PageStore implements CacheWriter {
...
@@ -153,11 +137,8 @@ public class PageStore implements CacheWriter {
private
int
pageSizeShift
;
private
int
pageSizeShift
;
private
long
writeCountBase
,
writeCount
,
readCount
;
private
long
writeCountBase
,
writeCount
,
readCount
;
private
int
logKey
,
logFirstTrunkPage
,
logFirstDataPage
;
private
int
logKey
,
logFirstTrunkPage
,
logFirstDataPage
;
private
Cache
cache
;
private
Cache
cache
;
private
int
freeListPagesPerList
;
private
int
freeListPagesPerList
;
private
boolean
recoveryRunning
;
private
boolean
recoveryRunning
;
/**
/**
...
@@ -171,7 +152,6 @@ public class PageStore implements CacheWriter {
...
@@ -171,7 +152,6 @@ public class PageStore implements CacheWriter {
private
int
pageCount
;
private
int
pageCount
;
private
PageLog
log
;
private
PageLog
log
;
private
Schema
metaSchema
;
private
Schema
metaSchema
;
private
RegularTable
metaTable
;
private
RegularTable
metaTable
;
private
PageDataIndex
metaIndex
;
private
PageDataIndex
metaIndex
;
...
@@ -189,7 +169,6 @@ public class PageStore implements CacheWriter {
...
@@ -189,7 +169,6 @@ public class PageStore implements CacheWriter {
private
long
maxLogSize
=
Constants
.
DEFAULT_MAX_LOG_SIZE
;
private
long
maxLogSize
=
Constants
.
DEFAULT_MAX_LOG_SIZE
;
private
Session
systemSession
;
private
Session
systemSession
;
private
BitSet
freed
=
new
BitSet
();
private
BitSet
freed
=
new
BitSet
();
private
ArrayList
<
PageFreeList
>
freeLists
=
New
.
arrayList
();
private
ArrayList
<
PageFreeList
>
freeLists
=
New
.
arrayList
();
/**
/**
...
@@ -202,10 +181,9 @@ public class PageStore implements CacheWriter {
...
@@ -202,10 +181,9 @@ public class PageStore implements CacheWriter {
private
int
changeCount
=
1
;
private
int
changeCount
=
1
;
private
Data
emptyPage
;
private
Data
emptyPage
;
private
long
logSizeBase
;
private
long
logSizeBase
;
private
HashMap
<
String
,
Integer
>
statistics
;
private
HashMap
<
String
,
Integer
>
statistics
;
private
int
logMode
=
LOG_MODE_SYNC
;
/**
/**
* Create a new page store object.
* Create a new page store object.
...
@@ -755,7 +733,9 @@ public class PageStore implements CacheWriter {
...
@@ -755,7 +733,9 @@ public class PageStore implements CacheWriter {
private
void
writeVariableHeader
()
{
private
void
writeVariableHeader
()
{
trace
.
debug
(
"writeVariableHeader"
);
trace
.
debug
(
"writeVariableHeader"
);
if
(
logMode
==
LOG_MODE_SYNC
)
{
file
.
sync
();
file
.
sync
();
}
Data
page
=
createData
();
Data
page
=
createData
();
page
.
writeInt
(
0
);
page
.
writeInt
(
0
);
page
.
writeLong
(
getWriteCountTotal
());
page
.
writeLong
(
getWriteCountTotal
());
...
@@ -1202,12 +1182,14 @@ public class PageStore implements CacheWriter {
...
@@ -1202,12 +1182,14 @@ public class PageStore implements CacheWriter {
* @param add true if the row is added, false if it is removed
* @param add true if the row is added, false if it is removed
*/
*/
public
void
logAddOrRemoveRow
(
Session
session
,
int
tableId
,
Row
row
,
boolean
add
)
{
public
void
logAddOrRemoveRow
(
Session
session
,
int
tableId
,
Row
row
,
boolean
add
)
{
synchronized
(
database
)
{
if
(
logMode
!=
LOG_MODE_OFF
)
{
if
(!
recoveryRunning
)
{
if
(!
recoveryRunning
)
{
synchronized
(
database
)
{
log
.
logAddOrRemoveRow
(
session
,
tableId
,
row
,
add
);
log
.
logAddOrRemoveRow
(
session
,
tableId
,
row
,
add
);
}
}
}
}
}
}
}
/**
/**
* Mark a committed transaction.
* Mark a committed transaction.
...
@@ -1703,4 +1685,12 @@ public class PageStore implements CacheWriter {
...
@@ -1703,4 +1685,12 @@ public class PageStore implements CacheWriter {
return
changeCount
;
return
changeCount
;
}
}
public
void
setLogMode
(
int
logMode
)
{
this
.
logMode
=
logMode
;
}
public
int
getLogMode
()
{
return
logMode
;
}
}
}
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
81904b30
...
@@ -859,6 +859,7 @@ public class MetaTable extends Table {
...
@@ -859,6 +859,7 @@ public class MetaTable extends Table {
add
(
rows
,
"MULTI_THREADED"
,
database
.
isMultiThreaded
()
?
"1"
:
"0"
);
add
(
rows
,
"MULTI_THREADED"
,
database
.
isMultiThreaded
()
?
"1"
:
"0"
);
add
(
rows
,
"MVCC"
,
database
.
isMultiVersion
()
?
"TRUE"
:
"FALSE"
);
add
(
rows
,
"MVCC"
,
database
.
isMultiVersion
()
?
"TRUE"
:
"FALSE"
);
add
(
rows
,
"QUERY_TIMEOUT"
,
""
+
session
.
getQueryTimeout
());
add
(
rows
,
"QUERY_TIMEOUT"
,
""
+
session
.
getQueryTimeout
());
add
(
rows
,
"LOG"
,
""
+
database
.
getLogMode
());
// the setting for the current database
// the setting for the current database
add
(
rows
,
"h2.allowBigDecimalExtensions"
,
""
+
SysProperties
.
ALLOW_BIG_DECIMAL_EXTENSIONS
);
add
(
rows
,
"h2.allowBigDecimalExtensions"
,
""
+
SysProperties
.
ALLOW_BIG_DECIMAL_EXTENSIONS
);
add
(
rows
,
"h2.baseDir"
,
""
+
SysProperties
.
getBaseDir
());
add
(
rows
,
"h2.baseDir"
,
""
+
SysProperties
.
getBaseDir
());
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
81904b30
...
@@ -352,7 +352,8 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
...
@@ -352,7 +352,8 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
System
.
setProperty
(
"h2.check2"
,
"false"
);
System
.
setProperty
(
"h2.check2"
,
"false"
);
System
.
setProperty
(
"h2.lobInDatabase"
,
"true"
);
System
.
setProperty
(
"h2.lobInDatabase"
,
"true"
);
System
.
setProperty
(
"h2.analyzeAuto"
,
"100"
);
System
.
setProperty
(
"h2.analyzeAuto"
,
"100"
);
// System.setProperty("h2.pageSize", "64");
System
.
setProperty
(
"h2.pageSize"
,
"64"
);
// System.setProperty("reopenShift", "9");
RecordingFileSystem
.
register
();
RecordingFileSystem
.
register
();
test
.
record
=
true
;
test
.
record
=
true
;
TestReopen
reopen
=
new
TestReopen
();
TestReopen
reopen
=
new
TestReopen
();
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
81904b30
...
@@ -252,17 +252,20 @@ public abstract class TestBase {
...
@@ -252,17 +252,20 @@ public abstract class TestBase {
url
+=
";TRACE_LEVEL_SYSTEM_OUT=2"
;
url
+=
";TRACE_LEVEL_SYSTEM_OUT=2"
;
}
}
if
(
config
.
traceLevelFile
>
0
&&
admin
)
{
if
(
config
.
traceLevelFile
>
0
&&
admin
)
{
if
(
url
.
indexOf
(
"TRACE_LEVEL_FILE="
)
<
0
)
{
if
(
url
.
indexOf
(
"
;
TRACE_LEVEL_FILE="
)
<
0
)
{
url
+=
";TRACE_LEVEL_FILE="
+
config
.
traceLevelFile
;
url
+=
";TRACE_LEVEL_FILE="
+
config
.
traceLevelFile
;
}
}
if
(
url
.
indexOf
(
"
TRACE_MAX_FILE_SIZE
"
)
<
0
)
{
if
(
url
.
indexOf
(
"
;TRACE_MAX_FILE_SIZE=
"
)
<
0
)
{
url
+=
";TRACE_MAX_FILE_SIZE=8"
;
url
+=
";TRACE_MAX_FILE_SIZE=8"
;
}
}
}
}
if
(
url
.
indexOf
(
";LOG="
)
<
0
)
{
url
+=
";LOG=1"
;
}
if
(
config
.
throttle
>
0
)
{
if
(
config
.
throttle
>
0
)
{
url
+=
";THROTTLE="
+
config
.
throttle
;
url
+=
";THROTTLE="
+
config
.
throttle
;
}
}
if
(
url
.
indexOf
(
"LOCK_TIMEOUT="
)
<
0
)
{
if
(
url
.
indexOf
(
"
;
LOCK_TIMEOUT="
)
<
0
)
{
url
+=
";LOCK_TIMEOUT=50"
;
url
+=
";LOCK_TIMEOUT=50"
;
}
}
if
(
config
.
diskUndo
&&
admin
)
{
if
(
config
.
diskUndo
&&
admin
)
{
...
@@ -272,15 +275,15 @@ public abstract class TestBase {
...
@@ -272,15 +275,15 @@ public abstract class TestBase {
// force operations to disk
// force operations to disk
url
+=
";MAX_OPERATION_MEMORY=1"
;
url
+=
";MAX_OPERATION_MEMORY=1"
;
}
}
if
(
config
.
mvcc
&&
url
.
indexOf
(
"MVCC="
)
<
0
)
{
if
(
config
.
mvcc
&&
url
.
indexOf
(
"
;
MVCC="
)
<
0
)
{
url
+=
";MVCC=TRUE"
;
url
+=
";MVCC=TRUE"
;
}
}
if
(
config
.
cacheType
!=
null
&&
admin
&&
url
.
indexOf
(
"CACHE_TYPE="
)
<
0
)
{
if
(
config
.
cacheType
!=
null
&&
admin
&&
url
.
indexOf
(
"
;
CACHE_TYPE="
)
<
0
)
{
url
+=
";CACHE_TYPE="
+
config
.
cacheType
;
url
+=
";CACHE_TYPE="
+
config
.
cacheType
;
}
}
if
(
config
.
diskResult
&&
admin
)
{
if
(
config
.
diskResult
&&
admin
)
{
url
+=
";MAX_MEMORY_ROWS=100"
;
url
+=
";MAX_MEMORY_ROWS=100"
;
if
(
url
.
indexOf
(
"CACHE_SIZE="
)
<
0
)
{
if
(
url
.
indexOf
(
"
;
CACHE_SIZE="
)
<
0
)
{
url
+=
";CACHE_SIZE=0"
;
url
+=
";CACHE_SIZE=0"
;
}
}
}
}
...
...
h2/src/test/org/h2/test/db/TestTransaction.java
浏览文件 @
81904b30
...
@@ -34,6 +34,7 @@ public class TestTransaction extends TestBase {
...
@@ -34,6 +34,7 @@ public class TestTransaction extends TestBase {
}
}
public
void
test
()
throws
SQLException
{
public
void
test
()
throws
SQLException
{
testLogMode
();
testRollback
();
testRollback
();
testRollback2
();
testRollback2
();
testForUpdate
();
testForUpdate
();
...
@@ -44,6 +45,47 @@ public class TestTransaction extends TestBase {
...
@@ -44,6 +45,47 @@ public class TestTransaction extends TestBase {
deleteDb
(
"transaction"
);
deleteDb
(
"transaction"
);
}
}
private
void
testLogMode
()
throws
SQLException
{
if
(
config
.
memory
)
{
return
;
}
deleteDb
(
"transaction"
);
testLogMode
(
0
);
testLogMode
(
1
);
testLogMode
(
2
);
}
private
void
testLogMode
(
int
logMode
)
throws
SQLException
{
Connection
conn
;
Statement
stat
;
ResultSet
rs
;
conn
=
getConnection
(
"transaction"
);
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int primary key) as select 1"
);
stat
.
execute
(
"set write_delay 0"
);
stat
.
execute
(
"set log "
+
logMode
);
rs
=
stat
.
executeQuery
(
"select value from information_schema.settings where name = 'LOG'"
);
rs
.
next
();
assertEquals
(
logMode
,
rs
.
getInt
(
1
));
stat
.
execute
(
"insert into test values(2)"
);
stat
.
execute
(
"shutdown immediately"
);
try
{
conn
.
close
();
}
catch
(
SQLException
e
)
{
// expected
}
conn
=
getConnection
(
"transaction"
);
stat
=
conn
.
createStatement
();
rs
=
stat
.
executeQuery
(
"select * from test order by id"
);
assertTrue
(
rs
.
next
());
if
(
logMode
!=
0
)
{
assertTrue
(
rs
.
next
());
}
assertFalse
(
rs
.
next
());
stat
.
execute
(
"drop table test"
);
conn
.
close
();
}
private
void
testForUpdate
()
throws
SQLException
{
private
void
testForUpdate
()
throws
SQLException
{
deleteDb
(
"transaction"
);
deleteDb
(
"transaction"
);
Connection
conn
=
getConnection
(
"transaction"
);
Connection
conn
=
getConnection
(
"transaction"
);
...
...
h2/src/test/org/h2/test/todo/supportTemplates.txt
浏览文件 @
81904b30
...
@@ -58,6 +58,7 @@ I am very interested in analyzing and solving this problem. Corruption problems
...
@@ -58,6 +58,7 @@ I am very interested in analyzing and solving this problem. Corruption problems
- What is your database URL?
- What is your database URL?
- How many connections does your application use concurrently?
- How many connections does your application use concurrently?
- Do you use temporary tables?
- Do you use temporary tables?
- Did you use LOG=0 or LOG=1?
- With which version of H2 was this database created?
- With which version of H2 was this database created?
You can find it out using:
You can find it out using:
select * from information_schema.settings where name='CREATE_BUILD'
select * from information_schema.settings where name='CREATE_BUILD'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论