[RocksDB] Move last_sequence and last_flushed_sequence_ update back into lock protected area

Summary: A previous diff moved these outside of lock protected area. Moved back in now. Also moved tmp_batch_ update outside of lock protected area, as only the single write thread can access it.

Test Plan: make check

Reviewers: dhruba

Reviewed By: dhruba

CC: leveldb

Differential Revision: https://reviews.facebook.net/D13137
main
Haobo Xu 11 years ago
parent 08740b15a4
commit 0c4040681a
  1. 4
      db/db_impl.cc

@ -2496,10 +2496,12 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* my_batch) {
throw std::runtime_error("In memory WriteBatch corruption!"); throw std::runtime_error("In memory WriteBatch corruption!");
} }
SetTickerCount(options_.statistics, SEQUENCE_NUMBER, last_sequence); SetTickerCount(options_.statistics, SEQUENCE_NUMBER, last_sequence);
}
mutex_.Lock();
if (status.ok()) {
versions_->SetLastSequence(last_sequence); versions_->SetLastSequence(last_sequence);
last_flushed_sequence_ = current_sequence; last_flushed_sequence_ = current_sequence;
} }
mutex_.Lock();
} }
if (updates == &tmp_batch_) tmp_batch_.Clear(); if (updates == &tmp_batch_) tmp_batch_.Clear();
} }

Loading…
Cancel
Save