Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c0616b3c
提交
c0616b3c
authored
6月 16, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove MVCC setting and use MVCC logic if and only if MVStore is used
上级
ac70b6a8
显示空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
60 行增加
和
179 行删除
+60
-179
ErrorCode.java
h2/src/main/org/h2/api/ErrorCode.java
+2
-3
Parser.java
h2/src/main/org/h2/command/Parser.java
+2
-4
Select.java
h2/src/main/org/h2/command/dml/Select.java
+1
-1
Set.java
h2/src/main/org/h2/command/dml/Set.java
+0
-7
SetTypes.java
h2/src/main/org/h2/command/dml/SetTypes.java
+18
-24
ConnectionInfo.java
h2/src/main/org/h2/engine/ConnectionInfo.java
+1
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+6
-22
Session.java
h2/src/main/org/h2/engine/Session.java
+4
-4
UndoLog.java
h2/src/main/org/h2/engine/UndoLog.java
+2
-2
PageDataIndex.java
h2/src/main/org/h2/index/PageDataIndex.java
+1
-1
ScanIndex.java
h2/src/main/org/h2/index/ScanIndex.java
+9
-9
DatabaseInfo.java
h2/src/main/org/h2/jmx/DatabaseInfo.java
+1
-1
MVTable.java
h2/src/main/org/h2/mvstore/db/MVTable.java
+2
-2
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+0
-6
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+1
-1
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+7
-7
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+0
-1
TestGeneralCommonTableQueries.java
...rc/test/org/h2/test/db/TestGeneralCommonTableQueries.java
+1
-1
TestMvcc1.java
h2/src/test/org/h2/test/mvcc/TestMvcc1.java
+0
-18
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+0
-61
TestConcurrentUpdate.java
h2/src/test/org/h2/test/synth/TestConcurrentUpdate.java
+0
-1
TestPageStore.java
h2/src/test/org/h2/test/unit/TestPageStore.java
+2
-2
没有找到文件。
h2/src/main/org/h2/api/ErrorCode.java
浏览文件 @
c0616b3c
...
@@ -1861,7 +1861,7 @@ public class ErrorCode {
...
@@ -1861,7 +1861,7 @@ public class ErrorCode {
* connections at the same time, or trying to insert two rows with the same
* connections at the same time, or trying to insert two rows with the same
* key from two connections. Example:
* key from two connections. Example:
* <pre>
* <pre>
* jdbc:h2:~/test
;MVCC=TRUE
* jdbc:h2:~/test
* Session 1:
* Session 1:
* CREATE TABLE TEST(ID INT);
* CREATE TABLE TEST(ID INT);
* INSERT INTO TEST VALUES(1);
* INSERT INTO TEST VALUES(1);
...
@@ -1887,8 +1887,7 @@ public class ErrorCode {
...
@@ -1887,8 +1887,7 @@ public class ErrorCode {
/**
/**
* The error with code <code>90133</code> is thrown when
* The error with code <code>90133</code> is thrown when
* trying to change a specific database property while the database is
* trying to change a specific database property while the database is
* already open. The MVCC property needs to be set in the first connection
* already open.
* (in the connection opening the database) and can not be changed later on.
*/
*/
public
static
final
int
CANNOT_CHANGE_SETTING_WHEN_OPEN_1
=
90133
;
public
static
final
int
CANNOT_CHANGE_SETTING_WHEN_OPEN_1
=
90133
;
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
c0616b3c
...
@@ -5589,10 +5589,8 @@ public class Parser {
...
@@ -5589,10 +5589,8 @@ public class Parser {
return
new
TransactionCommand
(
session
,
setting
);
return
new
TransactionCommand
(
session
,
setting
);
}
else
if
(
readIf
(
"MVCC"
))
{
}
else
if
(
readIf
(
"MVCC"
))
{
readIfEqualOrTo
();
readIfEqualOrTo
();
boolean
value
=
readBooleanSetting
();
readBooleanSetting
();
Set
command
=
new
Set
(
session
,
SetTypes
.
MVCC
);
return
new
NoOperation
(
session
);
command
.
setInt
(
value
?
1
:
0
);
return
command
;
}
else
if
(
readIf
(
"EXCLUSIVE"
))
{
}
else
if
(
readIf
(
"EXCLUSIVE"
))
{
readIfEqualOrTo
();
readIfEqualOrTo
();
Set
command
=
new
Set
(
session
,
SetTypes
.
EXCLUSIVE
);
Set
command
=
new
Set
(
session
,
SetTypes
.
EXCLUSIVE
);
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
c0616b3c
...
@@ -1308,7 +1308,7 @@ public class Select extends Query {
...
@@ -1308,7 +1308,7 @@ public class Select extends Query {
public
void
setForUpdate
(
boolean
b
)
{
public
void
setForUpdate
(
boolean
b
)
{
this
.
isForUpdate
=
b
;
this
.
isForUpdate
=
b
;
if
(
session
.
getDatabase
().
getSettings
().
selectForUpdateMvcc
&&
if
(
session
.
getDatabase
().
getSettings
().
selectForUpdateMvcc
&&
session
.
getDatabase
().
isM
ultiVersion
())
{
session
.
getDatabase
().
isM
VStore
())
{
isForUpdateMvcc
=
b
;
isForUpdateMvcc
=
b
;
}
}
}
}
...
...
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
c0616b3c
...
@@ -354,13 +354,6 @@ public class Set extends Prepared {
...
@@ -354,13 +354,6 @@ public class Set extends Prepared {
}
}
break
;
break
;
}
}
case
SetTypes
.
MVCC
:
{
if
(
database
.
isMultiVersion
()
!=
(
getIntValue
()
==
1
))
{
throw
DbException
.
get
(
ErrorCode
.
CANNOT_CHANGE_SETTING_WHEN_OPEN_1
,
"MVCC"
);
}
break
;
}
case
SetTypes
.
OPTIMIZE_REUSE_RESULTS
:
{
case
SetTypes
.
OPTIMIZE_REUSE_RESULTS
:
{
session
.
getUser
().
checkAdmin
();
session
.
getUser
().
checkAdmin
();
database
.
setOptimizeReuseResults
(
getIntValue
()
!=
0
);
database
.
setOptimizeReuseResults
(
getIntValue
()
!=
0
);
...
...
h2/src/main/org/h2/command/dml/SetTypes.java
浏览文件 @
c0616b3c
...
@@ -162,100 +162,95 @@ public class SetTypes {
...
@@ -162,100 +162,95 @@ public class SetTypes {
*/
*/
public
static
final
int
REFERENTIAL_INTEGRITY
=
30
;
public
static
final
int
REFERENTIAL_INTEGRITY
=
30
;
/**
* The type of a SET MVCC statement.
*/
public
static
final
int
MVCC
=
31
;
/**
/**
* The type of a SET MAX_OPERATION_MEMORY statement.
* The type of a SET MAX_OPERATION_MEMORY statement.
*/
*/
public
static
final
int
MAX_OPERATION_MEMORY
=
3
2
;
public
static
final
int
MAX_OPERATION_MEMORY
=
3
1
;
/**
/**
* The type of a SET EXCLUSIVE statement.
* The type of a SET EXCLUSIVE statement.
*/
*/
public
static
final
int
EXCLUSIVE
=
3
3
;
public
static
final
int
EXCLUSIVE
=
3
2
;
/**
/**
* The type of a SET CREATE_BUILD statement.
* The type of a SET CREATE_BUILD statement.
*/
*/
public
static
final
int
CREATE_BUILD
=
3
4
;
public
static
final
int
CREATE_BUILD
=
3
3
;
/**
/**
* The type of a SET \@VARIABLE statement.
* The type of a SET \@VARIABLE statement.
*/
*/
public
static
final
int
VARIABLE
=
3
5
;
public
static
final
int
VARIABLE
=
3
4
;
/**
/**
* The type of a SET QUERY_TIMEOUT statement.
* The type of a SET QUERY_TIMEOUT statement.
*/
*/
public
static
final
int
QUERY_TIMEOUT
=
3
6
;
public
static
final
int
QUERY_TIMEOUT
=
3
5
;
/**
/**
* The type of a SET REDO_LOG_BINARY statement.
* The type of a SET REDO_LOG_BINARY statement.
*/
*/
public
static
final
int
REDO_LOG_BINARY
=
3
7
;
public
static
final
int
REDO_LOG_BINARY
=
3
6
;
/**
/**
* The type of a SET BINARY_COLLATION statement.
* The type of a SET BINARY_COLLATION statement.
*/
*/
public
static
final
int
BINARY_COLLATION
=
3
8
;
public
static
final
int
BINARY_COLLATION
=
3
7
;
/**
/**
* The type of a SET JAVA_OBJECT_SERIALIZER statement.
* The type of a SET JAVA_OBJECT_SERIALIZER statement.
*/
*/
public
static
final
int
JAVA_OBJECT_SERIALIZER
=
3
9
;
public
static
final
int
JAVA_OBJECT_SERIALIZER
=
3
8
;
/**
/**
* The type of a SET RETENTION_TIME statement.
* The type of a SET RETENTION_TIME statement.
*/
*/
public
static
final
int
RETENTION_TIME
=
40
;
public
static
final
int
RETENTION_TIME
=
39
;
/**
/**
* The type of a SET QUERY_STATISTICS statement.
* The type of a SET QUERY_STATISTICS statement.
*/
*/
public
static
final
int
QUERY_STATISTICS
=
4
1
;
public
static
final
int
QUERY_STATISTICS
=
4
0
;
/**
/**
* The type of a SET QUERY_STATISTICS_MAX_ENTRIES statement.
* The type of a SET QUERY_STATISTICS_MAX_ENTRIES statement.
*/
*/
public
static
final
int
QUERY_STATISTICS_MAX_ENTRIES
=
4
2
;
public
static
final
int
QUERY_STATISTICS_MAX_ENTRIES
=
4
1
;
/**
/**
* The type of a SET ROW_FACTORY statement.
* The type of a SET ROW_FACTORY statement.
*/
*/
public
static
final
int
ROW_FACTORY
=
4
3
;
public
static
final
int
ROW_FACTORY
=
4
2
;
/**
/**
* The type of SET BATCH_JOINS statement.
* The type of SET BATCH_JOINS statement.
*/
*/
public
static
final
int
BATCH_JOINS
=
4
4
;
public
static
final
int
BATCH_JOINS
=
4
3
;
/**
/**
* The type of SET FORCE_JOIN_ORDER statement.
* The type of SET FORCE_JOIN_ORDER statement.
*/
*/
public
static
final
int
FORCE_JOIN_ORDER
=
4
5
;
public
static
final
int
FORCE_JOIN_ORDER
=
4
4
;
/**
/**
* The type of SET LAZY_QUERY_EXECUTION statement.
* The type of SET LAZY_QUERY_EXECUTION statement.
*/
*/
public
static
final
int
LAZY_QUERY_EXECUTION
=
4
6
;
public
static
final
int
LAZY_QUERY_EXECUTION
=
4
5
;
/**
/**
* The type of SET BUILTIN_ALIAS_OVERRIDE statement.
* The type of SET BUILTIN_ALIAS_OVERRIDE statement.
*/
*/
public
static
final
int
BUILTIN_ALIAS_OVERRIDE
=
4
7
;
public
static
final
int
BUILTIN_ALIAS_OVERRIDE
=
4
6
;
/**
/**
* The type of a SET COLUMN_NAME_RULES statement.
* The type of a SET COLUMN_NAME_RULES statement.
*/
*/
public
static
final
int
COLUMN_NAME_RULES
=
4
8
;
public
static
final
int
COLUMN_NAME_RULES
=
4
7
;
/**
/**
* The type of a SET AUTHENTICATOR statement.
* The type of a SET AUTHENTICATOR statement.
*/
*/
public
static
final
int
AUTHENTICATOR
=
49
;
public
static
final
int
AUTHENTICATOR
=
48
;
private
static
final
int
COUNT
=
AUTHENTICATOR
+
1
;
private
static
final
int
COUNT
=
AUTHENTICATOR
+
1
;
...
@@ -298,7 +293,6 @@ public class SetTypes {
...
@@ -298,7 +293,6 @@ public class SetTypes {
list
.
add
(
SCHEMA_SEARCH_PATH
,
"SCHEMA_SEARCH_PATH"
);
list
.
add
(
SCHEMA_SEARCH_PATH
,
"SCHEMA_SEARCH_PATH"
);
list
.
add
(
UNDO_LOG
,
"UNDO_LOG"
);
list
.
add
(
UNDO_LOG
,
"UNDO_LOG"
);
list
.
add
(
REFERENTIAL_INTEGRITY
,
"REFERENTIAL_INTEGRITY"
);
list
.
add
(
REFERENTIAL_INTEGRITY
,
"REFERENTIAL_INTEGRITY"
);
list
.
add
(
MVCC
,
"MVCC"
);
list
.
add
(
MAX_OPERATION_MEMORY
,
"MAX_OPERATION_MEMORY"
);
list
.
add
(
MAX_OPERATION_MEMORY
,
"MAX_OPERATION_MEMORY"
);
list
.
add
(
EXCLUSIVE
,
"EXCLUSIVE"
);
list
.
add
(
EXCLUSIVE
,
"EXCLUSIVE"
);
list
.
add
(
CREATE_BUILD
,
"CREATE_BUILD"
);
list
.
add
(
CREATE_BUILD
,
"CREATE_BUILD"
);
...
...
h2/src/main/org/h2/engine/ConnectionInfo.java
浏览文件 @
c0616b3c
...
@@ -92,7 +92,7 @@ public class ConnectionInfo implements Cloneable {
...
@@ -92,7 +92,7 @@ public class ConnectionInfo implements Cloneable {
static
{
static
{
String
[]
connectionTime
=
{
"ACCESS_MODE_DATA"
,
"AUTOCOMMIT"
,
"CIPHER"
,
String
[]
connectionTime
=
{
"ACCESS_MODE_DATA"
,
"AUTOCOMMIT"
,
"CIPHER"
,
"CREATE"
,
"CACHE_TYPE"
,
"FILE_LOCK"
,
"IGNORE_UNKNOWN_SETTINGS"
,
"CREATE"
,
"CACHE_TYPE"
,
"FILE_LOCK"
,
"IGNORE_UNKNOWN_SETTINGS"
,
"IFEXISTS"
,
"INIT"
,
"PASSWORD"
,
"RECOVER"
,
"RECOVER_TEST"
,
"IFEXISTS"
,
"INIT"
,
"
MVCC"
,
"
PASSWORD"
,
"RECOVER"
,
"RECOVER_TEST"
,
"USER"
,
"AUTO_SERVER"
,
"AUTO_SERVER_PORT"
,
"NO_UPGRADE"
,
"USER"
,
"AUTO_SERVER"
,
"AUTO_SERVER_PORT"
,
"NO_UPGRADE"
,
"AUTO_RECONNECT"
,
"OPEN_NEW"
,
"PAGE_SIZE"
,
"PASSWORD_HASH"
,
"JMX"
,
"AUTO_RECONNECT"
,
"OPEN_NEW"
,
"PAGE_SIZE"
,
"PASSWORD_HASH"
,
"JMX"
,
"SCOPE_GENERATED_KEYS"
,
"AUTHREALM"
,
"AUTHZPWD"
};
"SCOPE_GENERATED_KEYS"
,
"AUTHREALM"
,
"AUTHZPWD"
};
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
c0616b3c
...
@@ -185,8 +185,6 @@ public class Database implements DataHandler {
...
@@ -185,8 +185,6 @@ public class Database implements DataHandler {
private
final
String
cacheType
;
private
final
String
cacheType
;
private
final
String
accessModeData
;
private
final
String
accessModeData
;
private
boolean
referentialIntegrity
=
true
;
private
boolean
referentialIntegrity
=
true
;
/** ie. the MVCC setting */
private
boolean
multiVersion
;
private
Mode
mode
=
Mode
.
getRegular
();
private
Mode
mode
=
Mode
.
getRegular
();
/** ie. the MULTI_THREADED setting */
/** ie. the MULTI_THREADED setting */
private
boolean
multiThreaded
;
private
boolean
multiThreaded
;
...
@@ -284,8 +282,6 @@ public class Database implements DataHandler {
...
@@ -284,8 +282,6 @@ public class Database implements DataHandler {
if
(
modeName
!=
null
)
{
if
(
modeName
!=
null
)
{
this
.
mode
=
Mode
.
getInstance
(
modeName
);
this
.
mode
=
Mode
.
getInstance
(
modeName
);
}
}
this
.
multiVersion
=
ci
.
getProperty
(
"MVCC"
,
dbSettings
.
mvStore
);
this
.
logMode
=
this
.
logMode
=
ci
.
getProperty
(
"LOG"
,
PageStore
.
LOG_MODE_SYNC
);
ci
.
getProperty
(
"LOG"
,
PageStore
.
LOG_MODE_SYNC
);
this
.
javaObjectSerializerName
=
this
.
javaObjectSerializerName
=
...
@@ -657,7 +653,6 @@ public class Database implements DataHandler {
...
@@ -657,7 +653,6 @@ public class Database implements DataHandler {
dbSettings
.
mvStore
=
false
;
dbSettings
.
mvStore
=
false
;
// Need to re-init this because the first time we do it we don't
// Need to re-init this because the first time we do it we don't
// know if we have an mvstore or a pagestore.
// know if we have an mvstore or a pagestore.
multiVersion
=
ci
.
getProperty
(
"MVCC"
,
false
);
multiThreaded
=
ci
.
getProperty
(
"MULTI_THREADED"
,
false
);
multiThreaded
=
ci
.
getProperty
(
"MULTI_THREADED"
,
false
);
}
}
if
(
readOnly
)
{
if
(
readOnly
)
{
...
@@ -920,7 +915,7 @@ public class Database implements DataHandler {
...
@@ -920,7 +915,7 @@ public class Database implements DataHandler {
verifyMetaLocked
(
session
);
verifyMetaLocked
(
session
);
}
}
meta
.
addRow
(
session
,
r
);
meta
.
addRow
(
session
,
r
);
if
(
isM
ultiVersion
())
{
if
(
isM
VStore
())
{
// TODO this should work without MVCC, but avoid risks at the
// TODO this should work without MVCC, but avoid risks at the
// moment
// moment
session
.
log
(
meta
,
UndoLogRecord
.
INSERT
,
r
);
session
.
log
(
meta
,
UndoLogRecord
.
INSERT
,
r
);
...
@@ -1026,7 +1021,7 @@ public class Database implements DataHandler {
...
@@ -1026,7 +1021,7 @@ public class Database implements DataHandler {
}
}
Row
found
=
cursor
.
get
();
Row
found
=
cursor
.
get
();
meta
.
removeRow
(
session
,
found
);
meta
.
removeRow
(
session
,
found
);
if
(
isM
ultiVersion
())
{
if
(
isM
VStore
())
{
// TODO this should work without MVCC, but avoid risks at
// TODO this should work without MVCC, but avoid risks at
// the moment
// the moment
session
.
log
(
meta
,
UndoLogRecord
.
DELETE
,
found
);
session
.
log
(
meta
,
UndoLogRecord
.
DELETE
,
found
);
...
@@ -2423,12 +2418,12 @@ public class Database implements DataHandler {
...
@@ -2423,12 +2418,12 @@ public class Database implements DataHandler {
}
}
/**
/**
* Check if
multi version concurrency is enabl
ed for this database.
* Check if
MVStore backend is us
ed for this database.
*
*
* @return
true if it is enabled
* @return
{@code true} for MVStore, {@code false} for PageStore
*/
*/
public
boolean
isM
ultiVersion
()
{
public
boolean
isM
VStore
()
{
return
multiVersion
;
return
dbSettings
.
mvStore
;
}
}
/**
/**
...
@@ -2458,13 +2453,6 @@ public class Database implements DataHandler {
...
@@ -2458,13 +2453,6 @@ public class Database implements DataHandler {
public
void
setMultiThreaded
(
boolean
multiThreaded
)
{
public
void
setMultiThreaded
(
boolean
multiThreaded
)
{
if
(
multiThreaded
&&
this
.
multiThreaded
!=
multiThreaded
)
{
if
(
multiThreaded
&&
this
.
multiThreaded
!=
multiThreaded
)
{
if
(
multiVersion
&&
mvStore
==
null
)
{
// currently the combination of MVCC and MULTI_THREADED is not
// supported
throw
DbException
.
get
(
ErrorCode
.
UNSUPPORTED_SETTING_COMBINATION
,
"MVCC & MULTI_THREADED & !MV_STORE"
);
}
if
(
lockMode
==
0
)
{
if
(
lockMode
==
0
)
{
// currently the combination of LOCK_MODE=0 and MULTI_THREADED
// currently the combination of LOCK_MODE=0 and MULTI_THREADED
// is not supported
// is not supported
...
@@ -2872,10 +2860,6 @@ public class Database implements DataHandler {
...
@@ -2872,10 +2860,6 @@ public class Database implements DataHandler {
this
.
defaultTableType
=
defaultTableType
;
this
.
defaultTableType
=
defaultTableType
;
}
}
public
void
setMultiVersion
(
boolean
multiVersion
)
{
this
.
multiVersion
=
multiVersion
;
}
public
DbSettings
getSettings
()
{
public
DbSettings
getSettings
()
{
return
dbSettings
;
return
dbSettings
;
}
}
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
c0616b3c
...
@@ -693,7 +693,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
...
@@ -693,7 +693,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
removeTemporaryLobs
(
true
);
removeTemporaryLobs
(
true
);
if
(
undoLog
.
size
()
>
0
)
{
if
(
undoLog
.
size
()
>
0
)
{
// commit the rows when using MVCC
// commit the rows when using MVCC
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
synchronized
(
database
)
{
synchronized
(
database
)
{
ArrayList
<
Row
>
rows
=
new
ArrayList
<>(
undoLog
.
size
());
ArrayList
<
Row
>
rows
=
new
ArrayList
<>(
undoLog
.
size
());
while
(
undoLog
.
size
()
>
0
)
{
while
(
undoLog
.
size
()
>
0
)
{
...
@@ -916,7 +916,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
...
@@ -916,7 +916,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
if
(
SysProperties
.
CHECK
)
{
if
(
SysProperties
.
CHECK
)
{
int
lockMode
=
database
.
getLockMode
();
int
lockMode
=
database
.
getLockMode
();
if
(
lockMode
!=
Constants
.
LOCK_MODE_OFF
&&
if
(
lockMode
!=
Constants
.
LOCK_MODE_OFF
&&
!
database
.
isM
ultiVersion
())
{
!
database
.
isM
VStore
())
{
TableType
tableType
=
log
.
getTable
().
getTableType
();
TableType
tableType
=
log
.
getTable
().
getTableType
();
if
(!
locks
.
contains
(
log
.
getTable
())
if
(!
locks
.
contains
(
log
.
getTable
())
&&
TableType
.
TABLE_LINK
!=
tableType
&&
TableType
.
TABLE_LINK
!=
tableType
...
@@ -927,7 +927,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
...
@@ -927,7 +927,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
}
}
undoLog
.
add
(
log
);
undoLog
.
add
(
log
);
}
else
{
}
else
{
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
// see also UndoLogRecord.commit
// see also UndoLogRecord.commit
ArrayList
<
Index
>
indexes
=
table
.
getIndexes
();
ArrayList
<
Index
>
indexes
=
table
.
getIndexes
();
for
(
Index
index
:
indexes
)
{
for
(
Index
index
:
indexes
)
{
...
@@ -943,7 +943,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
...
@@ -943,7 +943,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
* READ_COMMITTED.
* READ_COMMITTED.
*/
*/
public
void
unlockReadLocks
()
{
public
void
unlockReadLocks
()
{
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
// MVCC: keep shared locks (insert / update / delete)
// MVCC: keep shared locks (insert / update / delete)
return
;
return
;
}
}
...
...
h2/src/main/org/h2/engine/UndoLog.java
浏览文件 @
c0616b3c
...
@@ -156,7 +156,7 @@ public class UndoLog {
...
@@ -156,7 +156,7 @@ public class UndoLog {
memoryUndo
++;
memoryUndo
++;
if
(
memoryUndo
>
database
.
getMaxMemoryUndo
()
&&
if
(
memoryUndo
>
database
.
getMaxMemoryUndo
()
&&
database
.
isPersistent
()
&&
database
.
isPersistent
()
&&
!
database
.
isM
ultiVersion
())
{
!
database
.
isM
VStore
())
{
if
(
file
==
null
)
{
if
(
file
==
null
)
{
String
fileName
=
database
.
createTempFile
();
String
fileName
=
database
.
createTempFile
();
file
=
database
.
openFile
(
fileName
,
"rw"
,
false
);
file
=
database
.
openFile
(
fileName
,
"rw"
,
false
);
...
@@ -185,7 +185,7 @@ public class UndoLog {
...
@@ -185,7 +185,7 @@ public class UndoLog {
}
}
if
(
memoryUndo
>
database
.
getMaxMemoryUndo
()
&&
if
(
memoryUndo
>
database
.
getMaxMemoryUndo
()
&&
database
.
isPersistent
()
&&
database
.
isPersistent
()
&&
!
database
.
isM
ultiVersion
())
{
!
database
.
isM
VStore
())
{
if
(
file
==
null
)
{
if
(
file
==
null
)
{
String
fileName
=
database
.
createTempFile
();
String
fileName
=
database
.
createTempFile
();
file
=
database
.
openFile
(
fileName
,
"rw"
,
false
);
file
=
database
.
openFile
(
fileName
,
"rw"
,
false
);
...
...
h2/src/main/org/h2/index/PageDataIndex.java
浏览文件 @
c0616b3c
...
@@ -58,7 +58,7 @@ public class PageDataIndex extends PageIndex {
...
@@ -58,7 +58,7 @@ public class PageDataIndex extends PageIndex {
public
PageDataIndex
(
RegularTable
table
,
int
id
,
IndexColumn
[]
columns
,
public
PageDataIndex
(
RegularTable
table
,
int
id
,
IndexColumn
[]
columns
,
IndexType
indexType
,
boolean
create
,
Session
session
)
{
IndexType
indexType
,
boolean
create
,
Session
session
)
{
initBaseIndex
(
table
,
id
,
table
.
getName
()
+
"_DATA"
,
columns
,
indexType
);
initBaseIndex
(
table
,
id
,
table
.
getName
()
+
"_DATA"
,
columns
,
indexType
);
this
.
multiVersion
=
database
.
isM
ultiVersion
();
this
.
multiVersion
=
database
.
isM
VStore
();
// trace = database.getTrace(Trace.PAGE_STORE + "_di");
// trace = database.getTrace(Trace.PAGE_STORE + "_di");
// trace.setLevel(TraceSystem.DEBUG);
// trace.setLevel(TraceSystem.DEBUG);
...
...
h2/src/main/org/h2/index/ScanIndex.java
浏览文件 @
c0616b3c
...
@@ -44,7 +44,7 @@ public class ScanIndex extends BaseIndex {
...
@@ -44,7 +44,7 @@ public class ScanIndex extends BaseIndex {
public
ScanIndex
(
RegularTable
table
,
int
id
,
IndexColumn
[]
columns
,
public
ScanIndex
(
RegularTable
table
,
int
id
,
IndexColumn
[]
columns
,
IndexType
indexType
)
{
IndexType
indexType
)
{
initBaseIndex
(
table
,
id
,
table
.
getName
()
+
"_DATA"
,
columns
,
indexType
);
initBaseIndex
(
table
,
id
,
table
.
getName
()
+
"_DATA"
,
columns
,
indexType
);
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
sessionRowCount
=
new
HashMap
<>();
sessionRowCount
=
new
HashMap
<>();
}
else
{
}
else
{
sessionRowCount
=
null
;
sessionRowCount
=
null
;
...
@@ -67,7 +67,7 @@ public class ScanIndex extends BaseIndex {
...
@@ -67,7 +67,7 @@ public class ScanIndex extends BaseIndex {
tableData
.
setRowCount
(
0
);
tableData
.
setRowCount
(
0
);
rowCount
=
0
;
rowCount
=
0
;
rowCountDiff
=
0
;
rowCountDiff
=
0
;
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
sessionRowCount
.
clear
();
sessionRowCount
.
clear
();
}
}
}
}
...
@@ -102,7 +102,7 @@ public class ScanIndex extends BaseIndex {
...
@@ -102,7 +102,7 @@ public class ScanIndex extends BaseIndex {
rows
.
set
((
int
)
key
,
row
);
rows
.
set
((
int
)
key
,
row
);
}
}
row
.
setDeleted
(
false
);
row
.
setDeleted
(
false
);
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
if
(
delta
==
null
)
{
if
(
delta
==
null
)
{
delta
=
new
HashSet
<>();
delta
=
new
HashSet
<>();
}
}
...
@@ -117,7 +117,7 @@ public class ScanIndex extends BaseIndex {
...
@@ -117,7 +117,7 @@ public class ScanIndex extends BaseIndex {
@Override
@Override
public
void
commit
(
int
operation
,
Row
row
)
{
public
void
commit
(
int
operation
,
Row
row
)
{
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
if
(
delta
!=
null
)
{
if
(
delta
!=
null
)
{
delta
.
remove
(
row
);
delta
.
remove
(
row
);
}
}
...
@@ -127,7 +127,7 @@ public class ScanIndex extends BaseIndex {
...
@@ -127,7 +127,7 @@ public class ScanIndex extends BaseIndex {
}
}
private
void
incrementRowCount
(
int
sessionId
,
int
count
)
{
private
void
incrementRowCount
(
int
sessionId
,
int
count
)
{
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
Integer
id
=
sessionId
;
Integer
id
=
sessionId
;
Integer
c
=
sessionRowCount
.
get
(
id
);
Integer
c
=
sessionRowCount
.
get
(
id
);
int
current
=
c
==
null
?
0
:
c
.
intValue
();
int
current
=
c
==
null
?
0
:
c
.
intValue
();
...
@@ -139,7 +139,7 @@ public class ScanIndex extends BaseIndex {
...
@@ -139,7 +139,7 @@ public class ScanIndex extends BaseIndex {
@Override
@Override
public
void
remove
(
Session
session
,
Row
row
)
{
public
void
remove
(
Session
session
,
Row
row
)
{
// in-memory
// in-memory
if
(!
database
.
isM
ultiVersion
()
&&
rowCount
==
1
)
{
if
(!
database
.
isM
VStore
()
&&
rowCount
==
1
)
{
rows
=
Utils
.
newSmallArrayList
();
rows
=
Utils
.
newSmallArrayList
();
firstFree
=
-
1
;
firstFree
=
-
1
;
}
else
{
}
else
{
...
@@ -153,7 +153,7 @@ public class ScanIndex extends BaseIndex {
...
@@ -153,7 +153,7 @@ public class ScanIndex extends BaseIndex {
rows
.
set
((
int
)
key
,
free
);
rows
.
set
((
int
)
key
,
free
);
firstFree
=
key
;
firstFree
=
key
;
}
}
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
// if storage is null, the delete flag is not yet set
// if storage is null, the delete flag is not yet set
row
.
setDeleted
(
true
);
row
.
setDeleted
(
true
);
if
(
delta
==
null
)
{
if
(
delta
==
null
)
{
...
@@ -170,7 +170,7 @@ public class ScanIndex extends BaseIndex {
...
@@ -170,7 +170,7 @@ public class ScanIndex extends BaseIndex {
@Override
@Override
public
Cursor
find
(
Session
session
,
SearchRow
first
,
SearchRow
last
)
{
public
Cursor
find
(
Session
session
,
SearchRow
first
,
SearchRow
last
)
{
return
new
ScanCursor
(
session
,
this
,
database
.
isM
ultiVersion
());
return
new
ScanCursor
(
session
,
this
,
database
.
isM
VStore
());
}
}
@Override
@Override
...
@@ -182,7 +182,7 @@ public class ScanIndex extends BaseIndex {
...
@@ -182,7 +182,7 @@ public class ScanIndex extends BaseIndex {
@Override
@Override
public
long
getRowCount
(
Session
session
)
{
public
long
getRowCount
(
Session
session
)
{
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
Integer
i
=
sessionRowCount
.
get
(
session
.
getId
());
Integer
i
=
sessionRowCount
.
get
(
session
.
getId
());
long
count
=
i
==
null
?
0
:
i
.
intValue
();
long
count
=
i
==
null
?
0
:
i
.
intValue
();
count
+=
rowCount
;
count
+=
rowCount
;
...
...
h2/src/main/org/h2/jmx/DatabaseInfo.java
浏览文件 @
c0616b3c
...
@@ -116,7 +116,7 @@ public class DatabaseInfo implements DatabaseInfoMBean {
...
@@ -116,7 +116,7 @@ public class DatabaseInfo implements DatabaseInfoMBean {
@Override
@Override
public
boolean
isMvcc
()
{
public
boolean
isMvcc
()
{
return
database
.
isM
ultiVersion
();
return
database
.
isM
VStore
();
}
}
@Override
@Override
...
...
h2/src/main/org/h2/mvstore/db/MVTable.java
浏览文件 @
c0616b3c
...
@@ -167,7 +167,7 @@ public class MVTable extends TableBase {
...
@@ -167,7 +167,7 @@ public class MVTable extends TableBase {
if
(
lockMode
==
Constants
.
LOCK_MODE_OFF
)
{
if
(
lockMode
==
Constants
.
LOCK_MODE_OFF
)
{
return
false
;
return
false
;
}
}
if
(!
forceLockEvenInMvcc
&&
database
.
isM
ultiVersion
())
{
if
(!
forceLockEvenInMvcc
&&
database
.
isM
VStore
())
{
// MVCC: update, delete, and insert use a shared lock.
// MVCC: update, delete, and insert use a shared lock.
// Select doesn't lock except when using FOR UPDATE and
// Select doesn't lock except when using FOR UPDATE and
// the system property h2.selectForUpdateMvcc
// the system property h2.selectForUpdateMvcc
...
@@ -310,7 +310,7 @@ public class MVTable extends TableBase {
...
@@ -310,7 +310,7 @@ public class MVTable extends TableBase {
if
(
lockExclusiveSession
==
null
)
{
if
(
lockExclusiveSession
==
null
)
{
if
(
lockMode
==
Constants
.
LOCK_MODE_READ_COMMITTED
)
{
if
(
lockMode
==
Constants
.
LOCK_MODE_READ_COMMITTED
)
{
if
(!
database
.
isMultiThreaded
()
&&
if
(!
database
.
isMultiThreaded
()
&&
!
database
.
isM
ultiVersion
())
{
!
database
.
isM
VStore
())
{
// READ_COMMITTED: a read lock is acquired,
// READ_COMMITTED: a read lock is acquired,
// but released immediately after the operation
// but released immediately after the operation
// is complete.
// is complete.
...
...
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
c0616b3c
...
@@ -360,13 +360,7 @@ public class PageStore implements CacheWriter {
...
@@ -360,13 +360,7 @@ public class PageStore implements CacheWriter {
readVariableHeader
();
readVariableHeader
();
log
=
new
PageLog
(
this
);
log
=
new
PageLog
(
this
);
log
.
openForReading
(
logKey
,
logFirstTrunkPage
,
logFirstDataPage
);
log
.
openForReading
(
logKey
,
logFirstTrunkPage
,
logFirstDataPage
);
boolean
old
=
database
.
isMultiVersion
();
// temporarily disabling multi-version concurrency, because
// the multi-version index sometimes compares rows
// and the LOB storage is not yet available.
database
.
setMultiVersion
(
false
);
boolean
isEmpty
=
recover
();
boolean
isEmpty
=
recover
();
database
.
setMultiVersion
(
old
);
if
(!
database
.
isReadOnly
())
{
if
(!
database
.
isReadOnly
())
{
readMode
=
true
;
readMode
=
true
;
if
(!
isEmpty
||
!
SysProperties
.
MODIFY_ON_WRITE
||
tempObjects
!=
null
)
{
if
(!
isEmpty
||
!
SysProperties
.
MODIFY_ON_WRITE
||
tempObjects
!=
null
)
{
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
c0616b3c
...
@@ -1043,7 +1043,7 @@ public class MetaTable extends Table {
...
@@ -1043,7 +1043,7 @@ public class MetaTable extends Table {
"FALSE"
:
"TRUE"
);
"FALSE"
:
"TRUE"
);
add
(
rows
,
"MODE"
,
database
.
getMode
().
getName
());
add
(
rows
,
"MODE"
,
database
.
getMode
().
getName
());
add
(
rows
,
"MULTI_THREADED"
,
database
.
isMultiThreaded
()
?
"1"
:
"0"
);
add
(
rows
,
"MULTI_THREADED"
,
database
.
isMultiThreaded
()
?
"1"
:
"0"
);
add
(
rows
,
"MVCC"
,
database
.
isM
ultiVersion
()
?
"TRUE"
:
"FALSE"
);
add
(
rows
,
"MVCC"
,
database
.
isM
VStore
()
?
"TRUE"
:
"FALSE"
);
add
(
rows
,
"QUERY_TIMEOUT"
,
Integer
.
toString
(
session
.
getQueryTimeout
()));
add
(
rows
,
"QUERY_TIMEOUT"
,
Integer
.
toString
(
session
.
getQueryTimeout
()));
add
(
rows
,
"RETENTION_TIME"
,
Integer
.
toString
(
database
.
getRetentionTime
()));
add
(
rows
,
"RETENTION_TIME"
,
Integer
.
toString
(
database
.
getRetentionTime
()));
add
(
rows
,
"LOG"
,
Integer
.
toString
(
database
.
getLogMode
()));
add
(
rows
,
"LOG"
,
Integer
.
toString
(
database
.
getLogMode
()));
...
...
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
c0616b3c
...
@@ -116,7 +116,7 @@ public class RegularTable extends TableBase {
...
@@ -116,7 +116,7 @@ public class RegularTable extends TableBase {
@Override
@Override
public
void
addRow
(
Session
session
,
Row
row
)
{
public
void
addRow
(
Session
session
,
Row
row
)
{
lastModificationId
=
database
.
getNextModificationDataId
();
lastModificationId
=
database
.
getNextModificationDataId
();
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
row
.
setSessionId
(
session
.
getId
());
row
.
setSessionId
(
session
.
getId
());
}
}
int
i
=
0
;
int
i
=
0
;
...
@@ -167,7 +167,7 @@ public class RegularTable extends TableBase {
...
@@ -167,7 +167,7 @@ public class RegularTable extends TableBase {
}
}
private
void
checkRowCount
(
Session
session
,
Index
index
,
int
offset
)
{
private
void
checkRowCount
(
Session
session
,
Index
index
,
int
offset
)
{
if
(
SysProperties
.
CHECK
&&
!
database
.
isM
ultiVersion
())
{
if
(
SysProperties
.
CHECK
&&
!
database
.
isM
VStore
())
{
if
(!(
index
instanceof
PageDelegateIndex
))
{
if
(!(
index
instanceof
PageDelegateIndex
))
{
long
rc
=
index
.
getRowCount
(
session
);
long
rc
=
index
.
getRowCount
(
session
);
if
(
rc
!=
rowCount
+
offset
)
{
if
(
rc
!=
rowCount
+
offset
)
{
...
@@ -259,7 +259,7 @@ public class RegularTable extends TableBase {
...
@@ -259,7 +259,7 @@ public class RegularTable extends TableBase {
index
=
new
TreeIndex
(
this
,
indexId
,
indexName
,
cols
,
indexType
);
index
=
new
TreeIndex
(
this
,
indexId
,
indexName
,
cols
,
indexType
);
}
}
}
}
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
index
=
new
MultiVersionIndex
(
index
,
this
);
index
=
new
MultiVersionIndex
(
index
,
this
);
}
}
if
(
index
.
needRebuild
()
&&
rowCount
>
0
)
{
if
(
index
.
needRebuild
()
&&
rowCount
>
0
)
{
...
@@ -366,7 +366,7 @@ public class RegularTable extends TableBase {
...
@@ -366,7 +366,7 @@ public class RegularTable extends TableBase {
@Override
@Override
public
long
getRowCount
(
Session
session
)
{
public
long
getRowCount
(
Session
session
)
{
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
return
getScanIndex
(
session
).
getRowCount
(
session
);
return
getScanIndex
(
session
).
getRowCount
(
session
);
}
}
return
rowCount
;
return
rowCount
;
...
@@ -374,7 +374,7 @@ public class RegularTable extends TableBase {
...
@@ -374,7 +374,7 @@ public class RegularTable extends TableBase {
@Override
@Override
public
void
removeRow
(
Session
session
,
Row
row
)
{
public
void
removeRow
(
Session
session
,
Row
row
)
{
if
(
database
.
isM
ultiVersion
())
{
if
(
database
.
isM
VStore
())
{
if
(
row
.
isDeleted
())
{
if
(
row
.
isDeleted
())
{
throw
DbException
.
get
(
ErrorCode
.
CONCURRENT_UPDATE_1
,
getName
());
throw
DbException
.
get
(
ErrorCode
.
CONCURRENT_UPDATE_1
,
getName
());
}
}
...
@@ -444,7 +444,7 @@ public class RegularTable extends TableBase {
...
@@ -444,7 +444,7 @@ public class RegularTable extends TableBase {
if
(
lockMode
==
Constants
.
LOCK_MODE_OFF
)
{
if
(
lockMode
==
Constants
.
LOCK_MODE_OFF
)
{
return
lockExclusiveSession
!=
null
;
return
lockExclusiveSession
!=
null
;
}
}
if
(!
forceLockEvenInMvcc
&&
database
.
isM
ultiVersion
())
{
if
(!
forceLockEvenInMvcc
&&
database
.
isM
VStore
())
{
// MVCC: update, delete, and insert use a shared lock.
// MVCC: update, delete, and insert use a shared lock.
// Select doesn't lock except when using FOR UPDATE
// Select doesn't lock except when using FOR UPDATE
if
(
exclusive
)
{
if
(
exclusive
)
{
...
@@ -550,7 +550,7 @@ public class RegularTable extends TableBase {
...
@@ -550,7 +550,7 @@ public class RegularTable extends TableBase {
}
else
{
}
else
{
if
(
lockExclusiveSession
==
null
)
{
if
(
lockExclusiveSession
==
null
)
{
if
(
lockMode
==
Constants
.
LOCK_MODE_READ_COMMITTED
)
{
if
(
lockMode
==
Constants
.
LOCK_MODE_READ_COMMITTED
)
{
if
(!
database
.
isMultiThreaded
()
&&
!
database
.
isM
ultiVersion
())
{
if
(!
database
.
isMultiThreaded
()
&&
!
database
.
isM
VStore
())
{
// READ_COMMITTED: a read lock is acquired,
// READ_COMMITTED: a read lock is acquired,
// but released immediately after the operation
// but released immediately after the operation
// is complete.
// is complete.
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
c0616b3c
...
@@ -251,7 +251,6 @@ public abstract class TestBase {
...
@@ -251,7 +251,6 @@ public abstract class TestBase {
if
(
name
.
startsWith
(
"jdbc:"
))
{
if
(
name
.
startsWith
(
"jdbc:"
))
{
if
(
config
.
mvStore
)
{
if
(
config
.
mvStore
)
{
name
=
addOption
(
name
,
"MV_STORE"
,
"true"
);
name
=
addOption
(
name
,
"MV_STORE"
,
"true"
);
// name = addOption(name, "MVCC", "true");
}
else
{
}
else
{
name
=
addOption
(
name
,
"MV_STORE"
,
"false"
);
name
=
addOption
(
name
,
"MV_STORE"
,
"false"
);
}
}
...
...
h2/src/test/org/h2/test/db/TestGeneralCommonTableQueries.java
浏览文件 @
c0616b3c
...
@@ -527,7 +527,7 @@ public class TestGeneralCommonTableQueries extends AbstractBaseForCommonTableExp
...
@@ -527,7 +527,7 @@ public class TestGeneralCommonTableQueries extends AbstractBaseForCommonTableExp
config
=
new
TestAll
();
config
=
new
TestAll
();
try
{
try
{
// Test with settings: lazy mvStore memory m
vcc m
ultiThreaded
// Test with settings: lazy mvStore memory multiThreaded
// connection url is
// connection url is
// mem:script;MV_STORE=true;LOG=1;LOCK_TIMEOUT=50;
// mem:script;MV_STORE=true;LOG=1;LOCK_TIMEOUT=50;
// MULTI_THREADED=TRUE;LAZY_QUERY_EXECUTION=1
// MULTI_THREADED=TRUE;LAZY_QUERY_EXECUTION=1
...
...
h2/src/test/org/h2/test/mvcc/TestMvcc1.java
浏览文件 @
c0616b3c
...
@@ -36,27 +36,9 @@ public class TestMvcc1 extends TestBase {
...
@@ -36,27 +36,9 @@ public class TestMvcc1 extends TestBase {
@Override
@Override
public
void
test
()
throws
SQLException
{
public
void
test
()
throws
SQLException
{
testCases
();
testCases
();
testSetMode
();
deleteDb
(
"mvcc1"
);
deleteDb
(
"mvcc1"
);
}
}
private
void
testSetMode
()
throws
SQLException
{
deleteDb
(
"mvcc1"
);
c1
=
getConnection
(
"mvcc1;MVCC=FALSE"
);
Statement
stat
=
c1
.
createStatement
();
ResultSet
rs
=
stat
.
executeQuery
(
"select * from information_schema.settings where name='MVCC'"
);
rs
.
next
();
assertEquals
(
"FALSE"
,
rs
.
getString
(
"VALUE"
));
assertThrows
(
ErrorCode
.
CANNOT_CHANGE_SETTING_WHEN_OPEN_1
,
stat
).
execute
(
"SET MVCC TRUE"
);
rs
=
stat
.
executeQuery
(
"select * from information_schema.settings "
+
"where name='MVCC'"
);
rs
.
next
();
assertEquals
(
"FALSE"
,
rs
.
getString
(
"VALUE"
));
c1
.
close
();
}
private
void
testCases
()
throws
SQLException
{
private
void
testCases
()
throws
SQLException
{
if
(!
config
.
mvStore
)
{
if
(!
config
.
mvStore
)
{
return
;
return
;
...
...
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
c0616b3c
...
@@ -82,12 +82,10 @@ public class TestMVTableEngine extends TestBase {
...
@@ -82,12 +82,10 @@ public class TestMVTableEngine extends TestBase {
testAutoCommit
();
testAutoCommit
();
testReopen
();
testReopen
();
testBlob
();
testBlob
();
testExclusiveLock
();
testEncryption
();
testEncryption
();
testReadOnly
();
testReadOnly
();
testReuseDiskSpace
();
testReuseDiskSpace
();
testDataTypes
();
testDataTypes
();
testLocking
();
testSimple
();
testSimple
();
if
(!
config
.
travis
)
{
if
(!
config
.
travis
)
{
testReverseDeletePerformance
();
testReverseDeletePerformance
();
...
@@ -1112,29 +1110,6 @@ public class TestMVTableEngine extends TestBase {
...
@@ -1112,29 +1110,6 @@ public class TestMVTableEngine extends TestBase {
conn
.
close
();
conn
.
close
();
}
}
private
void
testExclusiveLock
()
throws
Exception
{
deleteDb
(
getTestName
());
String
dbName
=
getTestName
()
+
";MV_STORE=TRUE;MVCC=FALSE"
;
Connection
conn
,
conn2
;
Statement
stat
,
stat2
;
conn
=
getConnection
(
dbName
);
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int)"
);
stat
.
execute
(
"insert into test values(1)"
);
conn
.
setAutoCommit
(
false
);
// stat.execute("update test set id = 2");
stat
.
executeQuery
(
"select * from test for update"
);
conn2
=
getConnection
(
dbName
);
stat2
=
conn2
.
createStatement
();
ResultSet
rs2
=
stat2
.
executeQuery
(
"select * from information_schema.locks"
);
assertTrue
(
rs2
.
next
());
assertEquals
(
"TEST"
,
rs2
.
getString
(
"table_name"
));
assertEquals
(
"WRITE"
,
rs2
.
getString
(
"lock_type"
));
conn2
.
close
();
conn
.
close
();
}
private
void
testReadOnly
()
throws
Exception
{
private
void
testReadOnly
()
throws
Exception
{
if
(
config
.
memory
)
{
if
(
config
.
memory
)
{
return
;
return
;
...
@@ -1343,42 +1318,6 @@ public class TestMVTableEngine extends TestBase {
...
@@ -1343,42 +1318,6 @@ public class TestMVTableEngine extends TestBase {
conn
.
close
();
conn
.
close
();
}
}
private
void
testLocking
()
throws
Exception
{
deleteDb
(
getTestName
());
String
dbName
=
getTestName
()
+
";MV_STORE=TRUE;MVCC=FALSE"
;
Connection
conn
=
getConnection
(
dbName
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"set lock_timeout 1000"
);
stat
.
execute
(
"create table a(id int primary key, name varchar)"
);
stat
.
execute
(
"create table b(id int primary key, name varchar)"
);
Connection
conn1
=
getConnection
(
dbName
);
final
Statement
stat1
=
conn1
.
createStatement
();
stat1
.
execute
(
"set lock_timeout 1000"
);
conn
.
setAutoCommit
(
false
);
conn1
.
setAutoCommit
(
false
);
stat
.
execute
(
"insert into a values(1, 'Hello')"
);
stat1
.
execute
(
"insert into b values(1, 'Hello')"
);
Task
t
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
stat1
.
execute
(
"insert into a values(2, 'World')"
);
}
};
t
.
execute
();
try
{
stat
.
execute
(
"insert into b values(2, 'World')"
);
throw
t
.
getException
();
}
catch
(
SQLException
e
)
{
assertEquals
(
e
.
toString
(),
ErrorCode
.
DEADLOCK_1
,
e
.
getErrorCode
());
}
conn1
.
close
();
conn
.
close
();
}
private
void
testSimple
()
throws
Exception
{
private
void
testSimple
()
throws
Exception
{
deleteDb
(
getTestName
());
deleteDb
(
getTestName
());
String
dbName
=
getTestName
()
+
";MV_STORE=TRUE"
;
String
dbName
=
getTestName
()
+
";MV_STORE=TRUE"
;
...
...
h2/src/test/org/h2/test/synth/TestConcurrentUpdate.java
浏览文件 @
c0616b3c
...
@@ -31,7 +31,6 @@ public class TestConcurrentUpdate extends TestBase {
...
@@ -31,7 +31,6 @@ public class TestConcurrentUpdate extends TestBase {
config
.
memory
=
true
;
config
.
memory
=
true
;
config
.
multiThreaded
=
true
;
config
.
multiThreaded
=
true
;
// config.mvStore = false;
// config.mvStore = false;
// config.mvcc = false;
System
.
out
.
println
(
config
);
System
.
out
.
println
(
config
);
TestBase
test
=
createCaller
().
init
(
config
);
TestBase
test
=
createCaller
().
init
(
config
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
...
...
h2/src/test/org/h2/test/unit/TestPageStore.java
浏览文件 @
c0616b3c
...
@@ -167,7 +167,7 @@ public class TestPageStore extends TestBase {
...
@@ -167,7 +167,7 @@ public class TestPageStore extends TestBase {
private
void
testRecoverLobInDatabase
()
throws
SQLException
{
private
void
testRecoverLobInDatabase
()
throws
SQLException
{
deleteDb
(
"pageStoreRecoverLobInDatabase"
);
deleteDb
(
"pageStoreRecoverLobInDatabase"
);
String
url
=
getURL
(
"pageStoreRecoverLobInDatabase;"
+
String
url
=
getURL
(
"pageStoreRecoverLobInDatabase;"
+
"
MVCC=TRUE;
CACHE_SIZE=1"
,
true
);
"CACHE_SIZE=1"
,
true
);
Connection
conn
;
Connection
conn
;
Statement
stat
;
Statement
stat
;
conn
=
getConnection
(
url
,
getUser
(),
getPassword
());
conn
=
getConnection
(
url
,
getUser
(),
getPassword
());
...
@@ -182,7 +182,7 @@ public class TestPageStore extends TestBase {
...
@@ -182,7 +182,7 @@ public class TestPageStore extends TestBase {
Connection
conn2
=
getConnection
(
url
,
getUser
(),
getPassword
());
Connection
conn2
=
getConnection
(
url
,
getUser
(),
getPassword
());
list
.
add
(
conn2
);
list
.
add
(
conn2
);
Statement
stat2
=
conn2
.
createStatement
();
Statement
stat2
=
conn2
.
createStatement
();
conn2
.
setAutoCommit
(
false
);
//
conn2.setAutoCommit(false);
if
(
r
.
nextBoolean
())
{
if
(
r
.
nextBoolean
())
{
stat2
.
execute
(
"update test set id = id where id = "
+
r
.
nextInt
(
100
));
stat2
.
execute
(
"update test set id = id where id = "
+
r
.
nextInt
(
100
));
}
else
{
}
else
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论