diff --git a/utilities/transactions/lock/point/point_lock_tracker.cc b/utilities/transactions/lock/point/point_lock_tracker.cc index 837f377de..6204a8f02 100644 --- a/utilities/transactions/lock/point/point_lock_tracker.cc +++ b/utilities/transactions/lock/point/point_lock_tracker.cc @@ -44,25 +44,12 @@ class TrackedKeysIterator : public LockTracker::KeyIterator { void PointLockTracker::Track(const PointLockRequest& r) { auto& keys = tracked_keys_[r.column_family_id]; -#ifdef __cpp_lib_unordered_map_try_emplace - // use c++17's try_emplace if available, to avoid rehashing the key - // in case it is not already in the map auto result = keys.try_emplace(r.key, r.seq); auto it = result.first; if (!result.second && r.seq < it->second.seq) { // Now tracking this key with an earlier sequence number it->second.seq = r.seq; } -#else - auto it = keys.find(r.key); - if (it == keys.end()) { - auto result = keys.emplace(r.key, TrackedKeyInfo(r.seq)); - it = result.first; - } else if (r.seq < it->second.seq) { - // Now tracking this key with an earlier sequence number - it->second.seq = r.seq; - } -#endif // else we do not update the seq. The smaller the tracked seq, the stronger it // the guarantee since it implies from the seq onward there has not been a // concurrent update to the key. So we update the seq if it implies stronger