提交 f45a31b0 authored 作者: Thomas Mueller's avatar Thomas Mueller

MVStoreTableEngine

上级 4ff230dc
...@@ -23,7 +23,7 @@ Change Log ...@@ -23,7 +23,7 @@ Change Log
in a strange exception of the type "column x must be included in the group by list". in a strange exception of the type "column x must be included in the group by list".
</li><li>Issue 454: Use Charset for type-safety. </li><li>Issue 454: Use Charset for type-safety.
</li><li>Queries with both LIMIT and OFFSET could throw an IllegalArgumentException. </li><li>Queries with both LIMIT and OFFSET could throw an IllegalArgumentException.
</li><li>MVStore: multiple issues were fixed: 460, 461, 462, 464. </li><li>MVStore: multiple issues were fixed: 460, 461, 462, 464, 466.
</li><li>MVStore: larger stores (multiple GB) are now much faster. </li><li>MVStore: larger stores (multiple GB) are now much faster.
</li><li>When using local temporary tables and not dropping them manually before closing the session, </li><li>When using local temporary tables and not dropping them manually before closing the session,
and then killing the process could result in a database that couldn't be opened (except when using and then killing the process could result in a database that couldn't be opened (except when using
......
...@@ -926,8 +926,8 @@ public class MVMap<K, V> extends AbstractMap<K, V> ...@@ -926,8 +926,8 @@ public class MVMap<K, V> extends AbstractMap<K, V>
"This map is read-only"); "This map is read-only");
} }
checkConcurrentWrite(); checkConcurrentWrite();
writing = true;
store.beforeWrite(); store.beforeWrite();
writing = true;
} }
/** /**
......
...@@ -192,7 +192,8 @@ public class MVPrimaryIndex extends BaseIndex { ...@@ -192,7 +192,8 @@ public class MVPrimaryIndex extends BaseIndex {
@Override @Override
public Row getRow(Session session, long key) { public Row getRow(Session session, long key) {
TransactionMap<Value, Value> map = getMap(session); TransactionMap<Value, Value> map = getMap(session);
ValueArray array = (ValueArray) map.get(ValueLong.get(key)); Value v = map.get(ValueLong.get(key));
ValueArray array = (ValueArray) v;
Row row = new Row(array.getList(), 0); Row row = new Row(array.getList(), 0);
row.setKey(key); row.setKey(key);
return row; return row;
......
...@@ -97,7 +97,7 @@ public class MVSecondaryIndex extends BaseIndex { ...@@ -97,7 +97,7 @@ public class MVSecondaryIndex extends BaseIndex {
TransactionMap<Value, Value> map = getMap(session); TransactionMap<Value, Value> map = getMap(session);
ValueArray array = getKey(row); ValueArray array = getKey(row);
if (indexType.isUnique()) { if (indexType.isUnique()) {
array.getList()[keyColumns - 1] = ValueLong.get(0); array.getList()[keyColumns - 1] = ValueLong.get(Long.MIN_VALUE);
ValueArray key = (ValueArray) map.ceilingKey(array); ValueArray key = (ValueArray) map.ceilingKey(array);
if (key != null) { if (key != null) {
SearchRow r2 = getRow(key.getList()); SearchRow r2 = getRow(key.getList());
...@@ -125,7 +125,10 @@ public class MVSecondaryIndex extends BaseIndex { ...@@ -125,7 +125,10 @@ public class MVSecondaryIndex extends BaseIndex {
@Override @Override
public Cursor find(Session session, SearchRow first, SearchRow last) { public Cursor find(Session session, SearchRow first, SearchRow last) {
Value min = getKey(first); ValueArray min = getKey(first);
if (min != null) {
min.getList()[keyColumns - 1] = ValueLong.get(Long.MIN_VALUE);
}
TransactionMap<Value, Value> map = getMap(session); TransactionMap<Value, Value> map = getMap(session);
return new MVStoreCursor(session, map.keyIterator(min), last); return new MVStoreCursor(session, map.keyIterator(min), last);
} }
......
...@@ -373,11 +373,6 @@ public class TransactionStore { ...@@ -373,11 +373,6 @@ public class TransactionStore {
*/ */
final TransactionStore store; final TransactionStore store;
/**
* The version of the store at the time the transaction was started.
*/
final long startVersion;
/** /**
* The transaction id. * The transaction id.
*/ */
...@@ -394,7 +389,6 @@ public class TransactionStore { ...@@ -394,7 +389,6 @@ public class TransactionStore {
Transaction(TransactionStore store, long transactionId, int status, String name, long logId) { Transaction(TransactionStore store, long transactionId, int status, String name, long logId) {
this.store = store; this.store = store;
this.startVersion = store.store.getCurrentVersion();
this.transactionId = transactionId; this.transactionId = transactionId;
this.status = status; this.status = status;
this.name = name; this.name = name;
...@@ -1091,7 +1085,13 @@ public class TransactionStore { ...@@ -1091,7 +1085,13 @@ public class TransactionStore {
VersionedValue v = (VersionedValue) obj; VersionedValue v = (VersionedValue) obj;
DataUtils.writeVarLong(buff, v.transactionId); DataUtils.writeVarLong(buff, v.transactionId);
DataUtils.writeVarLong(buff, v.logId); DataUtils.writeVarLong(buff, v.logId);
return valueType.write(buff, v.value); if (v.value == null) {
buff.put((byte) 0);
} else {
buff.put((byte) 1);
buff = valueType.write(buff, v.value);
}
return buff;
} }
@Override @Override
...@@ -1099,7 +1099,9 @@ public class TransactionStore { ...@@ -1099,7 +1099,9 @@ public class TransactionStore {
VersionedValue v = new VersionedValue(); VersionedValue v = new VersionedValue();
v.transactionId = DataUtils.readVarLong(buff); v.transactionId = DataUtils.readVarLong(buff);
v.logId = DataUtils.readVarLong(buff); v.logId = DataUtils.readVarLong(buff);
v.value = valueType.read(buff); if (buff.get() == 1) {
v.value = valueType.read(buff);
}
return v; return v;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论