Unverified 提交 9f4ea2c5 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1228 from katzyn/mvcc

Remove some PageStore+MVCC leftovers
...@@ -692,21 +692,6 @@ public class Session extends SessionWithState implements TransactionStore.Rollba ...@@ -692,21 +692,6 @@ 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
if (database.isMVStore()) {
synchronized (database) {
ArrayList<Row> rows = new ArrayList<>(undoLog.size());
while (undoLog.size() > 0) {
UndoLogRecord entry = undoLog.getLast();
entry.commit();
rows.add(entry.getRow());
undoLog.removeLast(false);
}
for (Row r : rows) {
r.commit();
}
}
}
undoLog.clear(); undoLog.clear();
} }
if (!ddl) { if (!ddl) {
...@@ -926,15 +911,6 @@ public class Session extends SessionWithState implements TransactionStore.Rollba ...@@ -926,15 +911,6 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
} }
} }
undoLog.add(log); undoLog.add(log);
} else {
if (database.isMVStore()) {
// see also UndoLogRecord.commit
ArrayList<Index> indexes = table.getIndexes();
for (Index index : indexes) {
index.commit(operation, row);
}
row.commit();
}
} }
} }
......
...@@ -106,9 +106,6 @@ public class UndoLogRecord { ...@@ -106,9 +106,6 @@ public class UndoLogRecord {
try { try {
table.addRow(session, row); table.addRow(session, row);
table.fireAfterRow(session, null, row, true); table.fireAfterRow(session, null, row, true);
// reset session id, otherwise other sessions think
// that this row was inserted by this session
row.commit();
} catch (DbException e) { } catch (DbException e) {
if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF
&& e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { && e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) {
...@@ -137,7 +134,6 @@ public class UndoLogRecord { ...@@ -137,7 +134,6 @@ public class UndoLogRecord {
buff.writeByte(row.isDeleted() ? (byte) 1 : (byte) 0); buff.writeByte(row.isDeleted() ? (byte) 1 : (byte) 0);
buff.writeInt(log.getTableId(table)); buff.writeInt(log.getTableId(table));
buff.writeLong(row.getKey()); buff.writeLong(row.getKey());
buff.writeInt(row.getSessionId());
int count = row.getColumnCount(); int count = row.getColumnCount();
buff.writeInt(count); buff.writeInt(count);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
...@@ -212,7 +208,6 @@ public class UndoLogRecord { ...@@ -212,7 +208,6 @@ public class UndoLogRecord {
boolean deleted = buff.readByte() == 1; boolean deleted = buff.readByte() == 1;
table = log.getTable(buff.readInt()); table = log.getTable(buff.readInt());
long key = buff.readLong(); long key = buff.readLong();
int sessionId = buff.readInt();
int columnCount = buff.readInt(); int columnCount = buff.readInt();
Value[] values = new Value[columnCount]; Value[] values = new Value[columnCount];
for (int i = 0; i < columnCount; i++) { for (int i = 0; i < columnCount; i++) {
...@@ -221,7 +216,6 @@ public class UndoLogRecord { ...@@ -221,7 +216,6 @@ public class UndoLogRecord {
row = getTable().getDatabase().createRow(values, Row.MEMORY_CALCULATE); row = getTable().getDatabase().createRow(values, Row.MEMORY_CALCULATE);
row.setKey(key); row.setKey(key);
row.setDeleted(deleted); row.setDeleted(deleted);
row.setSessionId(sessionId);
state = IN_MEMORY_INVALID; state = IN_MEMORY_INVALID;
} }
...@@ -243,14 +237,6 @@ public class UndoLogRecord { ...@@ -243,14 +237,6 @@ public class UndoLogRecord {
return filePos; return filePos;
} }
/**
* This method is called after the operation was committed.
* It commits the change to the indexes.
*/
void commit() {
table.commit(operation, row);
}
/** /**
* Get the row that was deleted or inserted. * Get the row that was deleted or inserted.
* *
......
...@@ -446,11 +446,6 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index { ...@@ -446,11 +446,6 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
return table; return table;
} }
@Override
public void commit(int operation, Row row) {
// nothing to do
}
@Override @Override
public Row getRow(Session session, long key) { public Row getRow(Session session, long key) {
throw DbException.getUnsupportedException(toString()); throw DbException.getUnsupportedException(toString());
......
...@@ -244,15 +244,6 @@ public interface Index extends SchemaObject { ...@@ -244,15 +244,6 @@ public interface Index extends SchemaObject {
*/ */
Table getTable(); Table getTable();
/**
* Commit the operation for a row. This is only important for multi-version
* indexes. The method is only called if multi-version is enabled.
*
* @param operation the operation type
* @param row the row
*/
void commit(int operation, Row row);
/** /**
* Get the row with the given key. * Get the row with the given key.
* *
......
...@@ -53,25 +53,6 @@ public interface Row extends SearchRow { ...@@ -53,25 +53,6 @@ public interface Row extends SearchRow {
*/ */
void setDeleted(boolean deleted); void setDeleted(boolean deleted);
/**
* Set session id.
*
* @param sessionId the session id
*/
void setSessionId(int sessionId);
/**
* Get session id.
*
* @return the session id
*/
int getSessionId();
/**
* This record has been committed. The session id is reset.
*/
void commit();
/** /**
* Check if the row is deleted. * Check if the row is deleted.
* *
......
...@@ -22,7 +22,6 @@ public class RowImpl implements Row { ...@@ -22,7 +22,6 @@ public class RowImpl implements Row {
private int memory; private int memory;
private int version; private int version;
private boolean deleted; private boolean deleted;
private int sessionId;
public RowImpl(Value[] data, int memory) { public RowImpl(Value[] data, int memory) {
this.data = data; this.data = data;
...@@ -41,7 +40,6 @@ public class RowImpl implements Row { ...@@ -41,7 +40,6 @@ public class RowImpl implements Row {
RowImpl r2 = new RowImpl(d2, memory); RowImpl r2 = new RowImpl(d2, memory);
r2.key = key; r2.key = key;
r2.version = version + 1; r2.version = version + 1;
r2.sessionId = sessionId;
return r2; return r2;
} }
...@@ -154,24 +152,6 @@ public class RowImpl implements Row { ...@@ -154,24 +152,6 @@ public class RowImpl implements Row {
this.deleted = deleted; this.deleted = deleted;
} }
@Override
public void setSessionId(int sessionId) {
this.sessionId = sessionId;
}
@Override
public int getSessionId() {
return sessionId;
}
/**
* This record has been committed. The session id is reset.
*/
@Override
public void commit() {
this.sessionId = 0;
}
@Override @Override
public boolean isDeleted() { public boolean isDeleted() {
return deleted; return deleted;
......
...@@ -56,7 +56,6 @@ public class RowList { ...@@ -56,7 +56,6 @@ public class RowList {
buff.writeLong(r.getKey()); buff.writeLong(r.getKey());
buff.writeInt(r.getVersion()); buff.writeInt(r.getVersion());
buff.writeInt(r.isDeleted() ? 1 : 0); buff.writeInt(r.isDeleted() ? 1 : 0);
buff.writeInt(r.getSessionId());
for (int i = 0; i < columnCount; i++) { for (int i = 0; i < columnCount; i++) {
Value v = r.getValue(i); Value v = r.getValue(i);
buff.checkCapacity(1); buff.checkCapacity(1);
...@@ -174,7 +173,6 @@ public class RowList { ...@@ -174,7 +173,6 @@ public class RowList {
key = 0; key = 0;
} }
boolean deleted = buff.readInt() == 1; boolean deleted = buff.readInt() == 1;
int sessionId = buff.readInt();
Value[] values = new Value[columnCount]; Value[] values = new Value[columnCount];
for (int i = 0; i < columnCount; i++) { for (int i = 0; i < columnCount; i++) {
Value v; Value v;
...@@ -196,7 +194,6 @@ public class RowList { ...@@ -196,7 +194,6 @@ public class RowList {
row.setKey(key); row.setKey(key);
row.setVersion(version); row.setVersion(version);
row.setDeleted(deleted); row.setDeleted(deleted);
row.setSessionId(sessionId);
return row; return row;
} }
......
...@@ -142,14 +142,6 @@ public class RegularTable extends TableBase { ...@@ -142,14 +142,6 @@ public class RegularTable extends TableBase {
analyzeIfRequired(session); analyzeIfRequired(session);
} }
@Override
public void commit(short operation, Row row) {
lastModificationId = database.getNextModificationDataId();
for (Index index : indexes) {
index.commit(operation, row);
}
}
private void checkRowCount(Session session, Index index, int offset) { private void checkRowCount(Session session, Index index, int offset) {
if (SysProperties.CHECK) { if (SysProperties.CHECK) {
if (!(index instanceof PageDelegateIndex)) { if (!(index instanceof PageDelegateIndex)) {
......
...@@ -224,17 +224,6 @@ public abstract class Table extends SchemaObjectBase { ...@@ -224,17 +224,6 @@ public abstract class Table extends SchemaObjectBase {
addRow(session, newRow); addRow(session, newRow);
} }
/**
* Commit an operation (when using multi-version concurrency).
*
* @param operation the operation
* @param row the row
*/
@SuppressWarnings("unused")
public void commit(short operation, Row row) {
// nothing to do
}
/** /**
* Check if this table supports ALTER TABLE. * Check if this table supports ALTER TABLE.
* *
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论