Unverified 提交 b954b846 authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #1209 from katzyn/mvstore

Remove useless MVCC / no MVCC conditions from MVStore code
...@@ -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.isMVStore()) { if (!forceLockEvenInMvcc) {
// 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
...@@ -280,8 +280,8 @@ public class MVTable extends TableBase { ...@@ -280,8 +280,8 @@ public class MVTable extends TableBase {
} }
private boolean doLock2(Session session, int lockMode, boolean exclusive) { private boolean doLock2(Session session, int lockMode, boolean exclusive) {
if (exclusive) { if (lockExclusiveSession == null) {
if (lockExclusiveSession == null) { if (exclusive) {
if (lockSharedSessions.isEmpty()) { if (lockSharedSessions.isEmpty()) {
traceLock(session, exclusive, TraceLockEvent.TRACE_LOCK_ADDED_FOR, NO_EXTRA_INFO); traceLock(session, exclusive, TraceLockEvent.TRACE_LOCK_ADDED_FOR, NO_EXTRA_INFO);
session.addLock(this); session.addLock(this);
...@@ -305,21 +305,7 @@ public class MVTable extends TableBase { ...@@ -305,21 +305,7 @@ public class MVTable extends TableBase {
} }
return true; return true;
} }
} } else {
} else {
if (lockExclusiveSession == null) {
if (lockMode == Constants.LOCK_MODE_READ_COMMITTED) {
if (!database.isMultiThreaded() &&
!database.isMVStore()) {
// READ_COMMITTED: a read lock is acquired,
// but released immediately after the operation
// is complete.
// When allowing only one thread, no lock is
// required.
// Row level locks work like read committed.
return true;
}
}
if (lockSharedSessions.putIfAbsent(session, session) == null) { if (lockSharedSessions.putIfAbsent(session, session) == null) {
traceLock(session, exclusive, TraceLockEvent.TRACE_LOCK_OK, NO_EXTRA_INFO); traceLock(session, exclusive, TraceLockEvent.TRACE_LOCK_OK, NO_EXTRA_INFO);
session.addLock(this); session.addLock(this);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论