From 0c4040681aeca9ed1d61b819c7502dbf28347ca9 Mon Sep 17 00:00:00 2001 From: Haobo Xu Date: Thu, 26 Sep 2013 16:04:12 -0700 Subject: [PATCH] [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 --- db/db_impl.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index 8124b18f3..5ca043c53 100644 --- a/db/db_impl.cc +++ b/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!"); } SetTickerCount(options_.statistics, SEQUENCE_NUMBER, last_sequence); + } + mutex_.Lock(); + if (status.ok()) { versions_->SetLastSequence(last_sequence); last_flushed_sequence_ = current_sequence; } - mutex_.Lock(); } if (updates == &tmp_batch_) tmp_batch_.Clear(); }