提交 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 ...@@ -692,20 +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();
rows.add(entry.getRow());
undoLog.removeLast(false);
}
for (Row r : rows) {
r.commit();
}
}
}
undoLog.clear(); undoLog.clear();
} }
if (!ddl) { if (!ddl) {
...@@ -925,10 +911,6 @@ public class Session extends SessionWithState implements TransactionStore.Rollba ...@@ -925,10 +911,6 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
} }
} }
undoLog.add(log); undoLog.add(log);
} else {
if (database.isMVStore()) {
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;
} }
......
...@@ -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;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论