From: Xiaoxi Chen Date: Thu, 11 Jun 2015 08:11:56 +0000 (+0800) Subject: os/RocksDBStore:Drop buffer_list and key_list in transaction. X-Git-Tag: v9.0.3~101^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F4928%2Fhead;p=ceph.git os/RocksDBStore:Drop buffer_list and key_list in transaction. We dont need to keep this inside the transaction. Signed-off-by: Xiaoxi Chen --- diff --git a/src/os/RocksDBStore.cc b/src/os/RocksDBStore.cc index cc06bd36a9a8..ad6022d09b70 100644 --- a/src/os/RocksDBStore.cc +++ b/src/os/RocksDBStore.cc @@ -237,21 +237,19 @@ void RocksDBStore::RocksDBTransactionImpl::set( const string &k, const bufferlist &to_set_bl) { - buffers.push_back(to_set_bl); - bufferlist &bl = *(buffers.rbegin()); string key = combine_strings(prefix, k); - keys.push_back(key); - bat->Delete(rocksdb::Slice(*(keys.rbegin()))); - bat->Put(rocksdb::Slice(*(keys.rbegin())), - rocksdb::Slice(bl.c_str(), bl.length())); + //bufferlist::c_str() is non-constant, so we need to make a copy + bufferlist val = to_set_bl; + bat->Delete(rocksdb::Slice(key)); + bat->Put(rocksdb::Slice(key), + rocksdb::Slice(val.c_str(), val.length())); } void RocksDBStore::RocksDBTransactionImpl::rmkey(const string &prefix, const string &k) { string key = combine_strings(prefix, k); - keys.push_back(key); - bat->Delete(rocksdb::Slice(*(keys.rbegin()))); + bat->Delete(rocksdb::Slice(k)); } void RocksDBStore::RocksDBTransactionImpl::rmkeys_by_prefix(const string &prefix) @@ -261,8 +259,7 @@ void RocksDBStore::RocksDBTransactionImpl::rmkeys_by_prefix(const string &prefix it->valid(); it->next()) { string key = combine_strings(prefix, it->key()); - keys.push_back(key); - bat->Delete(*(keys.rbegin())); + bat->Delete(key); } } diff --git a/src/os/RocksDBStore.h b/src/os/RocksDBStore.h index e44977f3e46b..2955bea82cbd 100644 --- a/src/os/RocksDBStore.h +++ b/src/os/RocksDBStore.h @@ -131,8 +131,6 @@ public: class RocksDBTransactionImpl : public KeyValueDB::TransactionImpl { public: rocksdb::WriteBatch *bat; - list buffers; - list keys; RocksDBStore *db; RocksDBTransactionImpl(RocksDBStore *_db);