提交 39f4df3f authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Remove session id and commit() from row

上级 e2035ba4
......@@ -692,20 +692,6 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
}
removeTemporaryLobs(true);
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();
rows.add(entry.getRow());
undoLog.removeLast(false);
}
for (Row r : rows) {
r.commit();
}
}
}
undoLog.clear();
}
if (!ddl) {
......@@ -925,10 +911,6 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
}
}
undoLog.add(log);
} else {
if (database.isMVStore()) {
row.commit();
}
}
}
......
......@@ -106,9 +106,6 @@ public class UndoLogRecord {
try {
table.addRow(session, row);
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) {
if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF
&& e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) {
......@@ -137,7 +134,6 @@ public class UndoLogRecord {
buff.writeByte(row.isDeleted() ? (byte) 1 : (byte) 0);
buff.writeInt(log.getTableId(table));
buff.writeLong(row.getKey());
buff.writeInt(row.getSessionId());
int count = row.getColumnCount();
buff.writeInt(count);
for (int i = 0; i < count; i++) {
......@@ -212,7 +208,6 @@ public class UndoLogRecord {
boolean deleted = buff.readByte() == 1;
table = log.getTable(buff.readInt());
long key = buff.readLong();
int sessionId = buff.readInt();
int columnCount = buff.readInt();
Value[] values = new Value[columnCount];
for (int i = 0; i < columnCount; i++) {
......@@ -221,7 +216,6 @@ public class UndoLogRecord {
row = getTable().getDatabase().createRow(values, Row.MEMORY_CALCULATE);
row.setKey(key);
row.setDeleted(deleted);
row.setSessionId(sessionId);
state = IN_MEMORY_INVALID;
}
......
......@@ -53,25 +53,6 @@ public interface Row extends SearchRow {
*/
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.
*
......
......@@ -22,7 +22,6 @@ public class RowImpl implements Row {
private int memory;
private int version;
private boolean deleted;
private int sessionId;
public RowImpl(Value[] data, int memory) {
this.data = data;
......@@ -41,7 +40,6 @@ public class RowImpl implements Row {
RowImpl r2 = new RowImpl(d2, memory);
r2.key = key;
r2.version = version + 1;
r2.sessionId = sessionId;
return r2;
}
......@@ -154,24 +152,6 @@ public class RowImpl implements Row {
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
public boolean isDeleted() {
return deleted;
......
......@@ -56,7 +56,6 @@ public class RowList {
buff.writeLong(r.getKey());
buff.writeInt(r.getVersion());
buff.writeInt(r.isDeleted() ? 1 : 0);
buff.writeInt(r.getSessionId());
for (int i = 0; i < columnCount; i++) {
Value v = r.getValue(i);
buff.checkCapacity(1);
......@@ -174,7 +173,6 @@ public class RowList {
key = 0;
}
boolean deleted = buff.readInt() == 1;
int sessionId = buff.readInt();
Value[] values = new Value[columnCount];
for (int i = 0; i < columnCount; i++) {
Value v;
......@@ -196,7 +194,6 @@ public class RowList {
row.setKey(key);
row.setVersion(version);
row.setDeleted(deleted);
row.setSessionId(sessionId);
return row;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论