Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
75a32ce8
提交
75a32ce8
authored
6 年前
作者:
Andrei Tokar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drop TransactionMap.readLogId
上级
52dec4ac
全部展开
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
45 行增加
和
246 行删除
+45
-246
MVPrimaryIndex.java
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
+1
-1
MVSecondaryIndex.java
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
+1
-1
MVSpatialIndex.java
h2/src/main/org/h2/mvstore/db/MVSpatialIndex.java
+1
-1
TransactionMap.java
h2/src/main/org/h2/mvstore/tx/TransactionMap.java
+42
-152
TestTransactionStore.java
h2/src/test/org/h2/test/store/TestTransactionStore.java
+0
-91
没有找到文件。
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
浏览文件 @
75a32ce8
...
@@ -380,7 +380,7 @@ public class MVPrimaryIndex extends BaseIndex {
...
@@ -380,7 +380,7 @@ public class MVPrimaryIndex extends BaseIndex {
return
dataMap
;
return
dataMap
;
}
}
Transaction
t
=
session
.
getTransaction
();
Transaction
t
=
session
.
getTransaction
();
return
dataMap
.
getInstance
(
t
,
Long
.
MAX_VALUE
);
return
dataMap
.
getInstance
(
t
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
浏览文件 @
75a32ce8
...
@@ -463,7 +463,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
...
@@ -463,7 +463,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
return
dataMap
;
return
dataMap
;
}
}
Transaction
t
=
session
.
getTransaction
();
Transaction
t
=
session
.
getTransaction
();
return
dataMap
.
getInstance
(
t
,
Long
.
MAX_VALUE
);
return
dataMap
.
getInstance
(
t
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVSpatialIndex.java
浏览文件 @
75a32ce8
...
@@ -328,7 +328,7 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
...
@@ -328,7 +328,7 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
return
dataMap
;
return
dataMap
;
}
}
Transaction
t
=
session
.
getTransaction
();
Transaction
t
=
session
.
getTransaction
();
return
dataMap
.
getInstance
(
t
,
Long
.
MAX_VALUE
);
return
dataMap
.
getInstance
(
t
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/tx/TransactionMap.java
浏览文件 @
75a32ce8
差异被折叠。
点击展开。
h2/src/test/org/h2/test/store/TestTransactionStore.java
浏览文件 @
75a32ce8
...
@@ -55,7 +55,6 @@ public class TestTransactionStore extends TestBase {
...
@@ -55,7 +55,6 @@ public class TestTransactionStore extends TestBase {
testStopWhileCommitting
();
testStopWhileCommitting
();
testGetModifiedMaps
();
testGetModifiedMaps
();
testKeyIterator
();
testKeyIterator
();
testMultiStatement
();
testTwoPhaseCommit
();
testTwoPhaseCommit
();
testSavepoint
();
testSavepoint
();
testConcurrentTransactionsReadCommitted
();
testConcurrentTransactionsReadCommitted
();
...
@@ -537,96 +536,6 @@ public class TestTransactionStore extends TestBase {
...
@@ -537,96 +536,6 @@ public class TestTransactionStore extends TestBase {
s
.
close
();
s
.
close
();
}
}
/**
* Tests behavior when used for a sequence of SQL statements. Each statement
* uses a savepoint. Within a statement, changes by the statement itself are
* not seen; the change is only seen when the statement finished.
* <p>
* Update statements that change the key of multiple rows may use delete/add
* pairs to do so (they don't need to first delete all entries and then
* re-add them). Trying to add multiple values for the same key is not
* allowed (an update statement that would result in a duplicate key).
*/
private
void
testMultiStatement
()
{
MVStore
s
=
MVStore
.
open
(
null
);
TransactionStore
ts
=
new
TransactionStore
(
s
);
ts
.
init
();
Transaction
tx
;
TransactionMap
<
String
,
String
>
m
;
long
startUpdate
;
tx
=
ts
.
begin
();
// start of statement
// create table test
startUpdate
=
tx
.
setSavepoint
();
m
=
tx
.
openMap
(
"test"
);
m
.
setSavepoint
(
startUpdate
);
// start of statement
// insert into test(id, name) values(1, 'Hello'), (2, 'World')
startUpdate
=
tx
.
setSavepoint
();
m
.
setSavepoint
(
startUpdate
);
assertTrue
(
m
.
trySet
(
"1"
,
"Hello"
,
true
));
assertTrue
(
m
.
trySet
(
"2"
,
"World"
,
true
));
// not seen yet (within the same statement)
assertNull
(
m
.
get
(
"1"
));
assertNull
(
m
.
get
(
"2"
));
// start of statement
startUpdate
=
tx
.
setSavepoint
();
// now we see the newest version
m
.
setSavepoint
(
startUpdate
);
assertEquals
(
"Hello"
,
m
.
get
(
"1"
));
assertEquals
(
"World"
,
m
.
get
(
"2"
));
// update test set primaryKey = primaryKey + 1
// (this is usually a tricky case)
assertEquals
(
"Hello"
,
m
.
get
(
"1"
));
assertTrue
(
m
.
trySet
(
"1"
,
null
,
true
));
assertTrue
(
m
.
trySet
(
"2"
,
"Hello"
,
true
));
assertEquals
(
"World"
,
m
.
get
(
"2"
));
// already updated by this statement, so it has no effect
// but still returns true because it was changed by this transaction
assertTrue
(
m
.
trySet
(
"2"
,
null
,
true
));
assertTrue
(
m
.
trySet
(
"3"
,
"World"
,
true
));
// not seen within this statement
assertEquals
(
"Hello"
,
m
.
get
(
"1"
));
assertEquals
(
"World"
,
m
.
get
(
"2"
));
assertNull
(
m
.
get
(
"3"
));
// start of statement
startUpdate
=
tx
.
setSavepoint
();
m
.
setSavepoint
(
startUpdate
);
// select * from test
assertNull
(
m
.
get
(
"1"
));
assertEquals
(
"Hello"
,
m
.
get
(
"2"
));
assertEquals
(
"World"
,
m
.
get
(
"3"
));
// start of statement
startUpdate
=
tx
.
setSavepoint
();
m
.
setSavepoint
(
startUpdate
);
// update test set id = 1
// should fail: duplicate key
assertTrue
(
m
.
trySet
(
"2"
,
null
,
true
));
assertTrue
(
m
.
trySet
(
"1"
,
"Hello"
,
true
));
assertTrue
(
m
.
trySet
(
"3"
,
null
,
true
));
assertFalse
(
m
.
trySet
(
"1"
,
"World"
,
true
));
tx
.
rollbackToSavepoint
(
startUpdate
);
startUpdate
=
tx
.
setSavepoint
();
m
.
setSavepoint
(
startUpdate
);
assertNull
(
m
.
get
(
"1"
));
assertEquals
(
"Hello"
,
m
.
get
(
"2"
));
assertEquals
(
"World"
,
m
.
get
(
"3"
));
tx
.
commit
();
ts
.
close
();
s
.
close
();
}
private
void
testTwoPhaseCommit
()
{
private
void
testTwoPhaseCommit
()
{
String
fileName
=
getBaseDir
()
+
"/testTwoPhaseCommit.h3"
;
String
fileName
=
getBaseDir
()
+
"/testTwoPhaseCommit.h3"
;
FileUtils
.
delete
(
fileName
);
FileUtils
.
delete
(
fileName
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论