[Commits] 55e2dc5e4: make check-format
revision-id: 55e2dc5e4f2f06efb25b53c48020dce5ea819b66 (v5.8-3069-g55e2dc5e4) parent(s): ce0df6a41388f73fac44be21a0629854de2cf836 author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2020-11-16 23:38:46 +0300 message: make check-format --- include/rocksdb/utilities/transaction_db.h | 2 +- .../transactions/lock/point/point_lock_manager.h | 7 +++---- .../lock/point/point_lock_manager_test.cc | 3 +-- .../lock/point/point_lock_manager_test.h | 17 ++++++----------- .../transactions/lock/range/range_locking_test.cc | 7 ++----- .../range/range_tree/lib/locktree/lock_request.cc | 2 +- .../range/range_tree/lib/locktree/lock_request.h | 2 +- .../lock/range/range_tree/range_tree_lock_manager.cc | 20 ++++++++++---------- 8 files changed, 25 insertions(+), 35 deletions(-) diff --git a/include/rocksdb/utilities/transaction_db.h b/include/rocksdb/utilities/transaction_db.h index 7b89ffb77..b9daf84a3 100644 --- a/include/rocksdb/utilities/transaction_db.h +++ b/include/rocksdb/utilities/transaction_db.h @@ -72,7 +72,7 @@ struct RangeDeadlockPath { int64_t deadlock_time; explicit RangeDeadlockPath(std::vector<RangeDeadlockInfo> path_entry, - const int64_t& dl_time) + const int64_t& dl_time) : path(path_entry), limit_exceeded(false), deadlock_time(dl_time) {} // empty path, limit exceeded constructor and default constructor diff --git a/utilities/transactions/lock/point/point_lock_manager.h b/utilities/transactions/lock/point/point_lock_manager.h index 966700c2a..3c541eb3a 100644 --- a/utilities/transactions/lock/point/point_lock_manager.h +++ b/utilities/transactions/lock/point/point_lock_manager.h @@ -27,15 +27,13 @@ struct LockInfo; struct LockMap; struct LockMapStripe; - -template<class Path> +template <class Path> class DeadlockInfoBufferTempl { private: std::vector<Path> paths_buffer_; uint32_t buffer_idx_; std::mutex paths_buffer_mutex_; - std::vector<Path> Normalize() { auto working = paths_buffer_; @@ -47,7 +45,8 @@ class DeadlockInfoBufferTempl { if (paths_buffer_[buffer_idx_].empty()) { working.resize(buffer_idx_); } else { - std::rotate(working.begin(), working.begin() + buffer_idx_, working.end()); + std::rotate(working.begin(), working.begin() + buffer_idx_, + working.end()); } return working; diff --git a/utilities/transactions/lock/point/point_lock_manager_test.cc b/utilities/transactions/lock/point/point_lock_manager_test.cc index 367f3310c..206a0395a 100644 --- a/utilities/transactions/lock/point/point_lock_manager_test.cc +++ b/utilities/transactions/lock/point/point_lock_manager_test.cc @@ -40,8 +40,7 @@ TEST_F(PointLockManagerTest, LockStatus) { ASSERT_EQ(s.count(cf_id), 2u); auto range = s.equal_range(cf_id); for (auto it = range.first; it != range.second; it++) { - ASSERT_TRUE(it->second.key == "k1" || - it->second.key == "k2"); + ASSERT_TRUE(it->second.key == "k1" || it->second.key == "k2"); if (it->second.key == "k1") { ASSERT_EQ(it->second.exclusive, true); ASSERT_EQ(it->second.ids.size(), 1u); diff --git a/utilities/transactions/lock/point/point_lock_manager_test.h b/utilities/transactions/lock/point/point_lock_manager_test.h index b6534b5ca..63c580501 100644 --- a/utilities/transactions/lock/point/point_lock_manager_test.h +++ b/utilities/transactions/lock/point/point_lock_manager_test.h @@ -1,14 +1,12 @@ -#include "utilities/transactions/lock/point/point_lock_manager.h" - #include "file/file_util.h" #include "port/port.h" #include "port/stack_trace.h" #include "rocksdb/utilities/transaction_db.h" #include "test_util/testharness.h" #include "test_util/testutil.h" +#include "utilities/transactions/lock/point/point_lock_manager.h" #include "utilities/transactions/pessimistic_transaction_db.h" - #include "utilities/transactions/transaction_db_mutex_impl.h" namespace ROCKSDB_NAMESPACE { @@ -53,7 +51,7 @@ class PointLockManagerTest : public testing::Test { // CAUTION: This test creates a separate lock manager object (right, NOT // the one that the TransactionDB is using!), and runs tests on it. locker_.reset(new PointLockManager( - static_cast<PessimisticTransactionDB*>(db_), txn_opt)); + static_cast<PessimisticTransactionDB*>(db_), txn_opt)); wait_sync_point_name_ = "PointLockManager::AcquireWithTimeout:WaitingTxn"; } @@ -72,7 +70,7 @@ class PointLockManagerTest : public testing::Test { protected: Env* env_; std::shared_ptr<LockManager> locker_; - const char *wait_sync_point_name_; + const char* wait_sync_point_name_; friend void PointLockManagerTestExternalSetup(PointLockManagerTest*); private: @@ -80,13 +78,11 @@ class PointLockManagerTest : public testing::Test { TransactionDB* db_; }; - typedef void (*init_func_t)(PointLockManagerTest*); class AnyLockManagerTest : public PointLockManagerTest, - public testing::WithParamInterface<init_func_t> -{ -public: + public testing::WithParamInterface<init_func_t> { + public: void SetUp() override { // If a custom setup function was provided, use it. Otherwise, use what we // have inherited. @@ -189,7 +185,7 @@ TEST_P(AnyLockManagerTest, LockConflict) { delete txn2; } -port::Thread BlockUntilWaitingTxn(const char *sync_point_name, +port::Thread BlockUntilWaitingTxn(const char* sync_point_name, std::function<void()> f) { std::atomic<bool> reached(false); ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( @@ -278,4 +274,3 @@ TEST_P(AnyLockManagerTest, Deadlock) { } } // namespace ROCKSDB_NAMESPACE - diff --git a/utilities/transactions/lock/range/range_locking_test.cc b/utilities/transactions/lock/range/range_locking_test.cc index 48d96d7d0..b5051dbee 100644 --- a/utilities/transactions/lock/range/range_locking_test.cc +++ b/utilities/transactions/lock/range/range_locking_test.cc @@ -17,11 +17,10 @@ #include "rocksdb/perf_context.h" #include "rocksdb/utilities/transaction.h" #include "rocksdb/utilities/transaction_db.h" +#include "utilities/transactions/lock/point/point_lock_manager_test.h" #include "utilities/transactions/pessimistic_transaction_db.h" #include "utilities/transactions/transaction_test.h" -#include "utilities/transactions/lock/point/point_lock_manager_test.h" - using std::string; namespace ROCKSDB_NAMESPACE { @@ -221,9 +220,7 @@ TEST_F(RangeLockingTest, MultipleTrxLockStatusData) { delete txn1; } - -void PointLockManagerTestExternalSetup(PointLockManagerTest* self) -{ +void PointLockManagerTestExternalSetup(PointLockManagerTest* self) { self->env_ = Env::Default(); self->db_dir_ = test::PerThreadDBPath("point_lock_manager_test"); ASSERT_OK(self->env_->CreateDir(self->db_dir_)); diff --git a/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc b/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc index 471eb42b7..9df8f3cb3 100644 --- a/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc +++ b/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc @@ -179,7 +179,7 @@ bool lock_request::deadlock_exists(const txnid_set &conflicts) { lock_request *req = find_lock_request(a); if (req) { m_deadlock_cb(req->m_txnid, (req->m_type == lock_request::WRITE), - req->m_left_key,req->m_right_key); + req->m_left_key, req->m_right_key); } }; } diff --git a/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.h b/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.h index f2e8bcb54..1dce4973f 100644 --- a/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.h +++ b/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.h @@ -226,7 +226,7 @@ class lock_request { void (*m_retry_test_callback)(void); public: - std::function<void(TXNID, bool, const DBT*, const DBT*)> m_deadlock_cb; + std::function<void(TXNID, bool, const DBT *, const DBT *)> m_deadlock_cb; friend class lock_request_unit_test; }; diff --git a/utilities/transactions/lock/range/range_tree/range_tree_lock_manager.cc b/utilities/transactions/lock/range/range_tree/range_tree_lock_manager.cc index 7e039083d..32c678688 100644 --- a/utilities/transactions/lock/range/range_tree/range_tree_lock_manager.cc +++ b/utilities/transactions/lock/range/range_tree/range_tree_lock_manager.cc @@ -96,7 +96,7 @@ Status RangeTreeLockManager::TryLock(PessimisticTransaction* txn, std::vector<RangeDeadlockInfo> di_path; request.m_deadlock_cb = [&](TXNID txnid, bool is_exclusive, - const DBT *start_dbt, const DBT *end_dbt) { + const DBT* start_dbt, const DBT* end_dbt) { EndpointWithString start; EndpointWithString end; deserialize_endpoint(start_dbt, &start); @@ -161,8 +161,8 @@ Status RangeTreeLockManager::TryLock(PessimisticTransaction* txn, return Status::Busy(Status::SubCode::kLockLimit); case DB_LOCK_DEADLOCK: { std::reverse(di_path.begin(), di_path.end()); - dlock_buffer_.AddNewPath(RangeDeadlockPath(di_path, - request.get_start_time())); + dlock_buffer_.AddNewPath( + RangeDeadlockPath(di_path, request.get_start_time())); return Status::Busy(Status::SubCode::kDeadlock); } default: @@ -331,7 +331,8 @@ RangeTreeLockManager::RangeTreeLockManager( ltm_.create(on_create, on_destroy, on_escalate, NULL, mutex_factory_); } -void RangeTreeLockManager::SetRangeDeadlockInfoBufferSize(uint32_t target_size) { +void RangeTreeLockManager::SetRangeDeadlockInfoBufferSize( + uint32_t target_size) { dlock_buffer_.Resize(target_size); } @@ -339,7 +340,8 @@ void RangeTreeLockManager::Resize(uint32_t target_size) { SetRangeDeadlockInfoBufferSize(target_size); } -std::vector<RangeDeadlockPath> RangeTreeLockManager::GetRangeDeadlockInfoBuffer() { +std::vector<RangeDeadlockPath> +RangeTreeLockManager::GetRangeDeadlockInfoBuffer() { return dlock_buffer_.PrepareBuffer(); } @@ -351,15 +353,14 @@ std::vector<DeadlockPath> RangeTreeLockManager::GetDeadlockInfoBuffer() { std::vector<DeadlockInfo> path; for (auto it2 = it->path.begin(); it2 != it->path.end(); ++it2) { - path.push_back({it2->m_txn_id, it2->m_cf_id, it2->m_exclusive, - it2->m_start.slice}); + path.push_back( + {it2->m_txn_id, it2->m_cf_id, it2->m_exclusive, it2->m_start.slice}); } res.push_back(DeadlockPath(path, it->deadlock_time)); } return res; } - /* @brief Lock Escalation Callback function @@ -528,7 +529,6 @@ struct LOCK_PRINT_CONTEXT { uint32_t cfh_id; // Column Family whose tree we are traversing }; - // Report left endpoints of the acquired locks LockManager::PointLockStatus RangeTreeLockManager::GetPointLockStatus() { PointLockStatus res; @@ -536,7 +536,7 @@ LockManager::PointLockStatus RangeTreeLockManager::GetPointLockStatus() { // report left endpoints for (auto it = data.begin(); it != data.end(); ++it) { auto& val = it->second; - res.insert({ it->first, { val.start.slice, val.ids, val.exclusive}}); + res.insert({it->first, {val.start.slice, val.ids, val.exclusive}}); } return res; }
participants (1)
-
psergey