[Commits] 6b3b684f6: Make Transaction_BaseImpl::{Put, Delete, SingleDelete} not take locks in range-locking mode
revision-id: 6b3b684f69a5b6ad968f2270e54e92de1a42d468 (v5.8-1903-g6b3b684f6) parent(s): a35d075533e60892819eeaedd63744bf538e4386 author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2020-01-05 22:22:13 +0300 message: Make Transaction_BaseImpl::{Put,Delete,SingleDelete} not take locks in range-locking mode --- utilities/transactions/transaction_base.cc | 42 +++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/utilities/transactions/transaction_base.cc b/utilities/transactions/transaction_base.cc index bbbfc8bc6..f9a8b3b74 100644 --- a/utilities/transactions/transaction_base.cc +++ b/utilities/transactions/transaction_base.cc @@ -379,8 +379,11 @@ Status TransactionBaseImpl::Put(ColumnFamilyHandle* column_family, const Slice& key, const Slice& value, const bool assume_tracked) { const bool do_validate = !assume_tracked; - Status s = TryLock(column_family, key, false /* read_only */, - true /* exclusive */, do_validate, assume_tracked); + Status s; + if (do_key_tracking_) { + s = TryLock(column_family, key, false /* read_only */, + true /* exclusive */, do_validate, assume_tracked); + } if (s.ok()) { s = GetBatchForWrite()->Put(column_family, key, value); @@ -396,8 +399,11 @@ Status TransactionBaseImpl::Put(ColumnFamilyHandle* column_family, const SliceParts& key, const SliceParts& value, const bool assume_tracked) { const bool do_validate = !assume_tracked; - Status s = TryLock(column_family, key, false /* read_only */, - true /* exclusive */, do_validate, assume_tracked); + Status s; + if (do_key_tracking_) { + s = TryLock(column_family, key, false /* read_only */, + true /* exclusive */, do_validate, assume_tracked); + } if (s.ok()) { s = GetBatchForWrite()->Put(column_family, key, value); @@ -430,8 +436,11 @@ Status TransactionBaseImpl::Delete(ColumnFamilyHandle* column_family, const Slice& key, const bool assume_tracked) { const bool do_validate = !assume_tracked; - Status s = TryLock(column_family, key, false /* read_only */, - true /* exclusive */, do_validate, assume_tracked); + Status s; + if (do_key_tracking_) { + s = TryLock(column_family, key, false /* read_only */, + true /* exclusive */, do_validate, assume_tracked); + } if (s.ok()) { s = GetBatchForWrite()->Delete(column_family, key); @@ -447,8 +456,11 @@ Status TransactionBaseImpl::Delete(ColumnFamilyHandle* column_family, const SliceParts& key, const bool assume_tracked) { const bool do_validate = !assume_tracked; - Status s = TryLock(column_family, key, false /* read_only */, - true /* exclusive */, do_validate, assume_tracked); + Status s; + if (do_key_tracking_) { + s = TryLock(column_family, key, false /* read_only */, + true /* exclusive */, do_validate, assume_tracked); + } if (s.ok()) { s = GetBatchForWrite()->Delete(column_family, key); @@ -464,8 +476,11 @@ Status TransactionBaseImpl::SingleDelete(ColumnFamilyHandle* column_family, const Slice& key, const bool assume_tracked) { const bool do_validate = !assume_tracked; - Status s = TryLock(column_family, key, false /* read_only */, - true /* exclusive */, do_validate, assume_tracked); + Status s; + if (do_key_tracking_) { + s = TryLock(column_family, key, false /* read_only */, + true /* exclusive */, do_validate, assume_tracked); + } if (s.ok()) { s = GetBatchForWrite()->SingleDelete(column_family, key); @@ -481,8 +496,11 @@ Status TransactionBaseImpl::SingleDelete(ColumnFamilyHandle* column_family, const SliceParts& key, const bool assume_tracked) { const bool do_validate = !assume_tracked; - Status s = TryLock(column_family, key, false /* read_only */, - true /* exclusive */, do_validate, assume_tracked); + Status s; + if (do_key_tracking_) { + s = TryLock(column_family, key, false /* read_only */, + true /* exclusive */, do_validate, assume_tracked); + } if (s.ok()) { s = GetBatchForWrite()->SingleDelete(column_family, key);
participants (1)
-
psergey