提交 b02190d5 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Remove MVCC logic from RegularTable

上级 384e5195
...@@ -115,9 +115,6 @@ public class RegularTable extends TableBase { ...@@ -115,9 +115,6 @@ 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.isMVStore()) {
row.setSessionId(session.getId());
}
int i = 0; int i = 0;
try { try {
for (int size = indexes.size(); i < size; i++) { for (int size = indexes.size(); i < size; i++) {
...@@ -154,7 +151,7 @@ public class RegularTable extends TableBase { ...@@ -154,7 +151,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.isMVStore()) { if (SysProperties.CHECK) {
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) {
...@@ -350,26 +347,11 @@ public class RegularTable extends TableBase { ...@@ -350,26 +347,11 @@ public class RegularTable extends TableBase {
@Override @Override
public long getRowCount(Session session) { public long getRowCount(Session session) {
if (database.isMVStore()) {
return getScanIndex(session).getRowCount(session);
}
return rowCount; return rowCount;
} }
@Override @Override
public void removeRow(Session session, Row row) { public void removeRow(Session session, Row row) {
if (database.isMVStore()) {
if (row.isDeleted()) {
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, getName());
}
int old = row.getSessionId();
int newId = session.getId();
if (old == 0) {
row.setSessionId(newId);
} else if (old != newId) {
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, getName());
}
}
lastModificationId = database.getNextModificationDataId(); lastModificationId = database.getNextModificationDataId();
int i = indexes.size() - 1; int i = indexes.size() - 1;
try { try {
...@@ -428,17 +410,6 @@ public class RegularTable extends TableBase { ...@@ -428,17 +410,6 @@ 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.isMVStore()) {
// MVCC: update, delete, and insert use a shared lock.
// Select doesn't lock except when using FOR UPDATE
if (exclusive) {
exclusive = false;
} else {
if (lockExclusiveSession == null) {
return false;
}
}
}
if (lockExclusiveSession == session) { if (lockExclusiveSession == session) {
return true; return true;
} }
...@@ -534,15 +505,13 @@ public class RegularTable extends TableBase { ...@@ -534,15 +505,13 @@ 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.isMVStore()) { // 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. // When allowing only one thread, no lock is
// When allowing only one thread, no lock is // required.
// required. // Row level locks work like read committed.
// Row level locks work like read committed. return true;
return true;
}
} }
if (!lockSharedSessions.containsKey(session)) { if (!lockSharedSessions.containsKey(session)) {
traceLock(session, exclusive, "ok"); traceLock(session, exclusive, "ok");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论