提交 72b5d5cc authored 作者: Andrei Tokar's avatar Andrei Tokar

replace faulty assertion

上级 44047777
...@@ -30,19 +30,22 @@ final class RollbackDecisionMaker extends MVMap.DecisionMaker<Object[]> { ...@@ -30,19 +30,22 @@ final class RollbackDecisionMaker extends MVMap.DecisionMaker<Object[]> {
@Override @Override
public MVMap.Decision decide(Object[] existingValue, Object[] providedValue) { public MVMap.Decision decide(Object[] existingValue, Object[] providedValue) {
assert decision == null; assert decision == null;
assert existingValue != null; // normaly existingValue will always be there except of db initialization
VersionedValue valueToRestore = (VersionedValue) existingValue[2]; // where some undo log enty was captured on disk but actual map entry was not
long operationId; if (existingValue != null ) {
if (valueToRestore == null || VersionedValue valueToRestore = (VersionedValue) existingValue[2];
(operationId = valueToRestore.getOperationId()) == 0 || long operationId;
TransactionStore.getTransactionId(operationId) == transactionId if (valueToRestore == null ||
&& TransactionStore.getLogId(operationId) < toLogId) { (operationId = valueToRestore.getOperationId()) == 0 ||
int mapId = (Integer) existingValue[0]; TransactionStore.getTransactionId(operationId) == transactionId
MVMap<Object, VersionedValue> map = store.openMap(mapId); && TransactionStore.getLogId(operationId) < toLogId) {
if (map != null && !map.isClosed()) { int mapId = (Integer) existingValue[0];
Object key = existingValue[1]; MVMap<Object, VersionedValue> map = store.openMap(mapId);
VersionedValue previousValue = map.operate(key, valueToRestore, MVMap.DecisionMaker.DEFAULT); if (map != null && !map.isClosed()) {
listener.onRollback(map, key, previousValue, valueToRestore); Object key = existingValue[1];
VersionedValue previousValue = map.operate(key, valueToRestore, MVMap.DecisionMaker.DEFAULT);
listener.onRollback(map, key, previousValue, valueToRestore);
}
} }
} }
decision = MVMap.Decision.REMOVE; decision = MVMap.Decision.REMOVE;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论