private void DoRollback() { var enumerator = new LogRecordEnumerator(_logManager, _bufferManager); do { var record = enumerator.Current; if (record.TransactionNumber == _transactionNumber) { if (record.Type == LogRecordType.Start) { return; } record.Undo(); } } while (enumerator.MoveNext()); }
private void DoRecover() { var commitedTransactions = new HashSet <int>(); var enumerator = new LogRecordEnumerator(_logManager, _bufferManager); do { var record = enumerator.Current; if (record.Type == LogRecordType.Checkpoint) { return; } if (record.Type == LogRecordType.Commit) { commitedTransactions.Add(record.TransactionNumber); } else if (!commitedTransactions.Contains(record.TransactionNumber)) { record.Undo(); } } while (enumerator.MoveNext()); }