Decouple StoredValue and HashTable class 70/78170/7
authorSriram Ganesan <sriram@couchbase.com>
Mon, 15 May 2017 22:26:46 +0000 (15:26 -0700)
committerDave Rigby <daver@couchbase.com>
Wed, 17 May 2017 13:14:33 +0000 (13:14 +0000)
A StoredValue object doesn't necessarily have to be part of
a HashTable. Hence, decouple the two

Change-Id: I6b88a3e010494989d3c1ad938c329a230c79d91d
Reviewed-on: http://review.couchbase.org/78170
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>
src/hash_table.cc
src/hash_table.h
src/stored-value.cc
src/stored-value.h
src/stored_value_factories.h
src/vbucket.cc
tests/module_tests/hash_table_test.cc
tests/module_tests/stored_value_test.cc

index f9f27ed..d6e6678 100644 (file)
@@ -304,7 +304,8 @@ MutationStatus HashTable::unlocked_updateStoredValue(
     }
 
     /* setValue() will mark v as undeleted if required */
-    v.setValue(itm, *this);
+    setValue(itm, v);
+
     return status;
 }
 
@@ -323,7 +324,10 @@ StoredValue* HashTable::unlocked_addNewStoredValue(const HashBucketLock& hbl,
     }
 
     // Create a new StoredValue and link it into the head of the bucket chain.
-    auto v = (*valFact)(itm, std::move(values[hbl.getBucketNum()]), *this);
+    auto v = (*valFact)(itm, std::move(values[hbl.getBucketNum()]));
+    increaseMetaDataSize(stats, v->metaDataSize());
+    increaseCacheSize(v->size());
+
     if (v->isTempItem()) {
         ++numTempItems;
     } else {
@@ -359,7 +363,7 @@ HashTable::unlocked_replaceByCopy(const HashBucketLock& hbl,
 
     /* Copy the StoredValue and link it into the head of the bucket chain. */
     auto newSv = valFact->copyStoredValue(
-            vToCopy, std::move(values[hbl.getBucketNum()]), *this);
+            vToCopy, std::move(values[hbl.getBucketNum()]));
     if (newSv->isTempItem()) {
         ++numTempItems;
     } else {
@@ -389,7 +393,10 @@ void HashTable::unlocked_softDelete(const std::unique_lock<std::mutex>& htLock,
             ++numItems;
             ++numTotalItems;
         }
-        v.del(*this);
+        size_t len = v.valuelen();
+        if (v.del()) {
+            reduceCacheSize(len);
+        }
     }
     if (!alreadyDeleted) {
         ++numDeletedItems;
@@ -447,8 +454,8 @@ StoredValue::UniquePtr HashTable::unlocked_release(
     }
 
     // Update statistics now the item has been removed.
-    StoredValue::reduceCacheSize(*this, released->size());
-    StoredValue::reduceMetaDataSize(*this, stats, released->metaDataSize());
+    reduceCacheSize(released->size());
+    reduceMetaDataSize(stats, released->metaDataSize());
     if (released->isTempItem()) {
         --numTempItems;
     } else {
@@ -624,8 +631,9 @@ bool HashTable::unlocked_ejectItem(StoredValue*& vptr,
                 "Unable to delete NULL StoredValue");
     }
     if (policy == VALUE_ONLY) {
-        bool rv = vptr->ejectValue(*this, policy);
-        if (rv) {
+        if (vptr->eligibleForEviction(policy)) {
+            reduceCacheSize(vptr->valuelen());
+            vptr->ejectValue();
             ++stats.numValueEjects;
             ++numNonResidentItems;
             ++numEjects;
@@ -636,9 +644,8 @@ bool HashTable::unlocked_ejectItem(StoredValue*& vptr,
         }
     } else { // full eviction.
         if (vptr->eligibleForEviction(policy)) {
-            StoredValue::reduceMetaDataSize(*this, stats,
-                                            vptr->metaDataSize());
-            StoredValue::reduceCacheSize(*this, vptr->size());
+            reduceMetaDataSize(stats, vptr->metaDataSize());
+            reduceCacheSize(vptr->size());
             int bucket_num = getBucketForHash(vptr->getKey().hash());
 
             // Remove the item from the hash table.
@@ -698,7 +705,7 @@ bool HashTable::unlocked_restoreValue(
 
     v.restoreValue(itm);
 
-    StoredValue::increaseCacheSize(*this, v.getValue()->length());
+    increaseCacheSize(v.getValue()->length());
     return true;
 }
 
@@ -726,6 +733,32 @@ void HashTable::unlocked_restoreMeta(const std::unique_lock<std::mutex>& htLock,
     }
 }
 
+void HashTable::increaseCacheSize(size_t by) {
+    cacheSize.fetch_add(by);
+    memSize.fetch_add(by);
+}
+
+void HashTable::reduceCacheSize(size_t by) {
+    cacheSize.fetch_sub(by);
+    memSize.fetch_sub(by);
+}
+
+void HashTable::increaseMetaDataSize(EPStats& st, size_t by) {
+    metaDataMemory.fetch_add(by);
+    st.currentSize.fetch_add(by);
+}
+
+void HashTable::reduceMetaDataSize(EPStats &st, size_t by) {
+    metaDataMemory.fetch_sub(by);
+    st.currentSize.fetch_sub(by);
+}
+
+void HashTable::setValue(const Item& itm, StoredValue& v) {
+    reduceCacheSize(v.size());
+    v.setValue(itm);
+    increaseCacheSize(v.size());
+}
+
 std::ostream& operator<<(std::ostream& os, const HashTable& ht) {
     os << "HashTable[" << &ht << "] with"
        << " numInMemory:" << ht.getNumInMemoryItems()
index f9eea91..fa2d053 100644 (file)
@@ -308,6 +308,15 @@ public:
     MutationStatus set(Item& val);
 
     /**
+     * Set item into StoredValue
+     *
+     * @param itm the Item to store
+     * @param   v the stored value in which itm needs
+     *            to be stored
+     */
+    void setValue(const Item& itm, StoredValue& v);
+
+    /**
      * Updates an existing StoredValue in the HT.
      * Assumes that HT bucket lock is grabbed.
      *
@@ -662,6 +671,26 @@ private:
 
     void clear_UNLOCKED(bool deactivate);
 
+    /**
+     * Increase the size of the cache
+     */
+    void increaseCacheSize(size_t by);
+
+    /**
+     * Reduce the size of the cache
+     */
+    void reduceCacheSize(size_t by);
+
+    /**
+     * Increase the size of the meta data
+     */
+    void increaseMetaDataSize(EPStats& st, size_t by);
+
+    /**
+     * Reduce the size of the meta data
+     */
+    void reduceMetaDataSize(EPStats &st, size_t by);
+
     DISALLOW_COPY_AND_ASSIGN(HashTable);
 };
 
index b6b59c8..2399d73 100644 (file)
 
 #include "config.h"
 #include <platform/cb_malloc.h>
-
 #include "stored-value.h"
 
-#include "hash_table.h"
-
 double StoredValue::mutation_mem_threshold = 0.9;
 const int64_t StoredValue::state_deleted_key = -3;
 const int64_t StoredValue::state_non_existent_key = -4;
 const int64_t StoredValue::state_temp_init = -5;
 const int64_t StoredValue::state_collection_open = -6;
 
-void StoredValue::setValue(const Item& itm, HashTable& ht) {
-    if (isOrdered) {
-        return static_cast<OrderedStoredValue*>(this)->setValueImpl(itm, ht);
+StoredValue::StoredValue(const Item& itm,
+                         UniquePtr n,
+                         EPStats& stats,
+                         bool isOrdered)
+    : value(itm.getValue()),
+      chain_next_or_replacement(std::move(n)),
+      cas(itm.getCas()),
+      revSeqno(itm.getRevSeqno()),
+      bySeqno(itm.getBySeqno()),
+      lock_expiry_or_delete_time(0),
+      exptime(itm.getExptime()),
+      flags(itm.getFlags()),
+      datatype(itm.getDataType()),
+      deleted(itm.isDeleted()),
+      newCacheItem(true),
+      isOrdered(isOrdered),
+      nru(itm.getNRUValue()),
+      stale(false) {
+    // Placement-new the key which lives in memory directly after this
+    // object.
+    new (key()) SerialisedDocKey(itm.getKey());
+
+    if (isTempInitialItem()) {
+        markClean();
     } else {
-        return this->setValueImpl(itm, ht);
+        markDirty();
     }
-}
 
-bool StoredValue::ejectValue(HashTable &ht, item_eviction_policy_t policy) {
-    if (eligibleForEviction(policy)) {
-        reduceCacheSize(ht, value->length());
+    if (isTempItem()) {
         markNotResident();
-        value = NULL;
-        return true;
     }
-    return false;
+
+    ObjectRegistry::onCreateStoredValue(this);
+}
+
+StoredValue::StoredValue(const StoredValue& other,
+                         UniquePtr n,
+                         EPStats& stats)
+    : value(other.value),
+      chain_next_or_replacement(std::move(n)),
+      cas(other.cas),
+      revSeqno(other.revSeqno),
+      bySeqno(other.bySeqno),
+      lock_expiry_or_delete_time(other.lock_expiry_or_delete_time),
+      exptime(other.exptime),
+      flags(other.flags),
+      datatype(other.datatype),
+      _isDirty(other._isDirty),
+      deleted(other.deleted),
+      newCacheItem(other.newCacheItem),
+      isOrdered(other.isOrdered),
+      nru(other.nru),
+      stale(false) {
+    // Placement-new the key which lives in memory directly after this
+    // object.
+    StoredDocKey sKey(other.getKey());
+    new (key()) SerialisedDocKey(sKey);
+
+    ObjectRegistry::onCreateStoredValue(this);
+}
+
+void StoredValue::setValue(const Item& itm) {
+    if (isOrdered) {
+        return static_cast<OrderedStoredValue*>(this)->setValueImpl(itm);
+    } else {
+        return this->setValueImpl(itm);
+    }
+}
+
+void StoredValue::ejectValue() {
+    markNotResident();
+    value = nullptr;
 }
 
 void StoredValue::referenced() {
@@ -103,11 +156,11 @@ void StoredValue::restoreMeta(const Item& itm) {
     }
 }
 
-void StoredValue::del(HashTable& ht) {
+bool StoredValue::del() {
     if (isOrdered) {
-        return static_cast<OrderedStoredValue*>(this)->deleteImpl(ht);
+        return static_cast<OrderedStoredValue*>(this)->deleteImpl();
     } else {
-        return this->deleteImpl(ht);
+        return this->deleteImpl();
     }
 }
 
@@ -117,28 +170,6 @@ void StoredValue::setMutationMemoryThreshold(double memThreshold) {
     }
 }
 
-// TODO: Move these two methods to HashTable (it doesn't do anything with
-// StoredValue objects).
-void StoredValue::increaseCacheSize(HashTable &ht, size_t by) {
-    ht.cacheSize.fetch_add(by);
-    ht.memSize.fetch_add(by);
-}
-
-void StoredValue::reduceCacheSize(HashTable &ht, size_t by) {
-    ht.cacheSize.fetch_sub(by);
-    ht.memSize.fetch_sub(by);
-}
-
-void StoredValue::increaseMetaDataSize(HashTable &ht, EPStats &st, size_t by) {
-    ht.metaDataMemory.fetch_add(by);
-    st.currentSize.fetch_add(by);
-}
-
-void StoredValue::reduceMetaDataSize(HashTable &ht, EPStats &st, size_t by) {
-    ht.metaDataMemory.fetch_sub(by);
-    st.currentSize.fetch_sub(by);
-}
-
 /**
  * Is there enough space for this thing?
  */
@@ -236,23 +267,22 @@ bool StoredValue::operator==(const StoredValue& other) const {
             getKey() == other.getKey());
 }
 
-void StoredValue::deleteImpl(HashTable& ht) {
+bool StoredValue::deleteImpl() {
     if (isDeleted() && !getValue()) {
         // SV is already marked as deleted and has no value - no further
         // deletion possible.
-        return;
+        return false;
     }
 
-    reduceCacheSize(ht, valuelen());
     markNotResident();
     // item no longer resident once value is reset
     deleted = true;
     markDirty();
+
+    return true;
 }
 
-void StoredValue::setValueImpl(const Item& itm, HashTable& ht) {
-    size_t currSize = size();
-    reduceCacheSize(ht, currSize);
+void StoredValue::setValueImpl(const Item& itm) {
     value = itm.getValue();
     deleted = itm.isDeleted();
     flags = itm.getFlags();
@@ -275,9 +305,6 @@ void StoredValue::setValueImpl(const Item& itm, HashTable& ht) {
     if (isTempItem()) {
         markNotResident();
     }
-
-    size_t newSize = size();
-    increaseCacheSize(ht, newSize);
 }
 
 std::ostream& operator<<(std::ostream& os, const StoredValue& sv) {
@@ -342,16 +369,18 @@ rel_time_t OrderedStoredValue::getDeletedTime() const {
     }
 }
 
-void OrderedStoredValue::deleteImpl(HashTable& ht) {
-    StoredValue::deleteImpl(ht);
-
-    // Need to record the time when an item is deleted for subsequent purging
-    // (ephemeral_metadata_purge_age).
-    setDeletedTime(ep_current_time());
+bool OrderedStoredValue::deleteImpl() {
+    if (StoredValue::deleteImpl()) {
+        // Need to record the time when an item is deleted for subsequent
+        //purging (ephemeral_metadata_purge_age).
+        setDeletedTime(ep_current_time());
+        return true;
+    }
+    return false;
 }
 
-void OrderedStoredValue::setValueImpl(const Item& itm, HashTable& ht) {
-    StoredValue::setValueImpl(itm, ht);
+void OrderedStoredValue::setValueImpl(const Item& itm) {
+    StoredValue::setValueImpl(itm);
 
     // Update the deleted time (note - even if it was already deleted we should
     // refresh this).
index 5921345..596b7b9 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <boost/intrusive/list.hpp>
 
-class HashTable;
 class OrderedStoredValue;
 
 /**
@@ -249,9 +248,8 @@ public:
      * Set a new value for this item.
      *
      * @param itm the item with a new value
-     * @param ht the hashtable that contains this StoredValue instance
      */
-    void setValue(const Item& itm, HashTable& ht);
+    void setValue(const Item& itm);
 
     void markDeleted() {
         deleted = true;
@@ -260,9 +258,8 @@ public:
 
     /**
      * Eject an item value from memory.
-     * @param ht the hashtable that contains this StoredValue instance
      */
-    bool ejectValue(HashTable &ht, item_eviction_policy_t policy);
+    void ejectValue();
 
     /**
      * Restore the value for this item.
@@ -452,9 +449,10 @@ public:
     }
 
     /**
-     * Logically delete this object.
+     * Logically delete this object
+     * @return true if the item was deleted
      */
-    void del(HashTable &ht);
+    bool del();
 
     uint64_t getRevSeqno() const {
         return revSeqno;
@@ -599,47 +597,12 @@ protected:
      *           ownership of. (Typically the top of the hash bucket into
      *           which the new item is being inserted).
      * @param stats EPStats to update for this new StoredValue
-     * @param ht HashTable to update stats for this new StoredValue.
      * @param isOrdered Are we constructing an OrderedStoredValue?
      */
     StoredValue(const Item& itm,
                 UniquePtr n,
                 EPStats& stats,
-                HashTable& ht,
-                bool isOrdered)
-        : value(itm.getValue()),
-          chain_next_or_replacement(std::move(n)),
-          cas(itm.getCas()),
-          revSeqno(itm.getRevSeqno()),
-          bySeqno(itm.getBySeqno()),
-          lock_expiry_or_delete_time(0),
-          exptime(itm.getExptime()),
-          flags(itm.getFlags()),
-          datatype(itm.getDataType()),
-          deleted(itm.isDeleted()),
-          newCacheItem(true),
-          isOrdered(isOrdered),
-          nru(itm.getNRUValue()),
-          stale(false) {
-        // Placement-new the key which lives in memory directly after this
-        // object.
-        new (key()) SerialisedDocKey(itm.getKey());
-
-        if (isTempInitialItem()) {
-            markClean();
-        } else {
-            markDirty();
-        }
-
-        if (isTempItem()) {
-            markNotResident();
-        }
-
-        increaseMetaDataSize(ht, stats, metaDataSize());
-        increaseCacheSize(ht, size());
-
-        ObjectRegistry::onCreateStoredValue(this);
-    }
+                bool isOrdered);
 
     // Destructor. protected, as needs to be carefully deleted (via
     // StoredValue::Destructor) depending on the value of isOrdered flag.
@@ -657,37 +620,10 @@ protected:
      *           ownership of. (Typically the top of the hash bucket into
      *           which the new item is being inserted).
      * @param stats EPStats to update for this new StoredValue
-     * @param ht HashTable to update stats for this new StoredValue.
      */
     StoredValue(const StoredValue& other,
                 UniquePtr n,
-                EPStats& stats,
-                HashTable& ht)
-        : value(other.value),
-          chain_next_or_replacement(std::move(n)),
-          cas(other.cas),
-          revSeqno(other.revSeqno),
-          bySeqno(other.bySeqno),
-          lock_expiry_or_delete_time(other.lock_expiry_or_delete_time),
-          exptime(other.exptime),
-          flags(other.flags),
-          datatype(other.datatype),
-          _isDirty(other._isDirty),
-          deleted(other.deleted),
-          newCacheItem(other.newCacheItem),
-          isOrdered(other.isOrdered),
-          nru(other.nru),
-          stale(false) {
-        // Placement-new the key which lives in memory directly after this
-        // object.
-        StoredDocKey sKey(other.getKey());
-        new (key()) SerialisedDocKey(sKey);
-
-        increaseMetaDataSize(ht, stats, metaDataSize());
-        increaseCacheSize(ht, size());
-
-        ObjectRegistry::onCreateStoredValue(this);
-    }
+                EPStats& stats);
 
     /* Do not allow assignment */
     StoredValue& operator=(const StoredValue& other) = delete;
@@ -702,16 +638,14 @@ protected:
      * Implementation for StoredValue instances (dispatched to by del() based
      * on isOrdered==false).
      */
-    void deleteImpl(HashTable& ht);
+    bool deleteImpl();
 
     /* Update the value for this SV from the given item.
      * Implementation for StoredValue instances (dispatched to by setValue()).
      */
-    void setValueImpl(const Item& itm, HashTable& ht);
+    void setValueImpl(const Item& itm);
 
-    friend class HashTable;
     friend class StoredValueFactory;
-    friend std::ostream& operator<<(std::ostream& os, const HashTable& ht);
 
     value_t            value;          // 8 bytes
 
@@ -752,10 +686,6 @@ protected:
     // Note (2): Only 1 bit of this is currently used; rest is "spare".
     std::atomic<bool> stale;
 
-    static void increaseMetaDataSize(HashTable &ht, EPStats &st, size_t by);
-    static void reduceMetaDataSize(HashTable &ht, EPStats &st, size_t by);
-    static void increaseCacheSize(HashTable &ht, size_t by);
-    static void reduceCacheSize(HashTable &ht, size_t by);
     static double mutation_mem_threshold;
 
     friend std::ostream& operator<<(std::ostream& os, const StoredValue& sv);
@@ -847,13 +777,13 @@ protected:
      * OrderedStoredValue instances (dispatched to by del() based on
      * isOrdered==true).
      */
-    void deleteImpl(HashTable& ht);
+    bool deleteImpl();
 
     /* Update the value for this OSV from the given item.
      * Implementation for OrderedStoredValue instances (dispatched to by
      *  setValue()).
      */
-    void setValueImpl(const Item& itm, HashTable& ht);
+    void setValueImpl(const Item& itm);
 
     /**
      * Set the time the item was deleted to the specified time.
@@ -865,9 +795,8 @@ private:
     // OrderedStoredValueFactory.
     OrderedStoredValue(const Item& itm,
                        UniquePtr n,
-                       EPStats& stats,
-                       HashTable& ht)
-        : StoredValue(itm, std::move(n), stats, ht, /*isOrdered*/ true) {
+                       EPStats& stats)
+        : StoredValue(itm, std::move(n), stats, /*isOrdered*/ true) {
     }
 
     // Copy Constructor. Private, as needs to be carefully created via
@@ -878,9 +807,8 @@ private:
     // data structure.
     OrderedStoredValue(const StoredValue& other,
                        UniquePtr n,
-                       EPStats& stats,
-                       HashTable& ht)
-        : StoredValue(other, std::move(n), stats, ht) {
+                       EPStats& stats)
+        : StoredValue(other, std::move(n), stats) {
     }
 
     /* Do not allow assignment */
index aa5f85f..cbd39a8 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <memory>
 
-#include "hash_table.h"
 #include "stored-value.h"
 
 /**
@@ -41,12 +40,9 @@ public:
      *             the hash bucket chain, which this new item will take
      *             ownership of. (Typically the top of the hash bucket into
      *             which the new item is being inserted).
-     * @param ht the hashtable that will contain the StoredValue instance
-     *           created
      */
     virtual StoredValue::UniquePtr operator()(const Item& itm,
-                                              StoredValue::UniquePtr next,
-                                              HashTable& ht) = 0;
+                                              StoredValue::UniquePtr next) = 0;
 
     /**
      * Create a new StoredValue (or subclass) from the given StoredValue.
@@ -55,12 +51,9 @@ public:
      * @param next The StoredValue which will follow the new StoredValue (the
      *             copy) in the hash bucket chain (typically the top of the
      *             hash bucket into which the new item is being inserted).
-     * @param ht the hashtable that will contain the StoredValue instance
-     *           created
      */
     virtual StoredValue::UniquePtr copyStoredValue(const StoredValue& other,
-                                                   StoredValue::UniquePtr next,
-                                                   HashTable& ht) = 0;
+                                                   StoredValue::UniquePtr next) = 0;
 };
 
 /**
@@ -77,8 +70,7 @@ public:
      * Create an concrete StoredValue object.
      */
     StoredValue::UniquePtr operator()(const Item& itm,
-                                      StoredValue::UniquePtr next,
-                                      HashTable& ht) override {
+                                      StoredValue::UniquePtr next) override {
         // Allocate a buffer to store the StoredValue and any trailing bytes
         // that maybe required.
         return StoredValue::UniquePtr(
@@ -86,13 +78,11 @@ public:
                         StoredValue(itm,
                                     std::move(next),
                                     *stats,
-                                    ht,
                                     /*isOrdered*/ false));
     }
 
     StoredValue::UniquePtr copyStoredValue(const StoredValue& other,
-                                           StoredValue::UniquePtr next,
-                                           HashTable& ht) override {
+                                           StoredValue::UniquePtr next) override {
         throw std::logic_error("Copy of StoredValue is not supported");
     }
 
@@ -114,27 +104,25 @@ public:
      * Create a new OrderedStoredValue with the given item.
      */
     StoredValue::UniquePtr operator()(const Item& itm,
-                                      StoredValue::UniquePtr next,
-                                      HashTable& ht) override {
+                                      StoredValue::UniquePtr next) override {
         // Allocate a buffer to store the OrderStoredValue and any trailing
         // bytes required for the key.
         return StoredValue::UniquePtr(
                 new (::operator new(
                         OrderedStoredValue::getRequiredStorage(itm)))
-                        OrderedStoredValue(itm, std::move(next), *stats, ht));
+                        OrderedStoredValue(itm, std::move(next), *stats));
     }
 
     /**
      * Create a copy of OrderedStoredValue from the given one.
      */
     StoredValue::UniquePtr copyStoredValue(const StoredValue& other,
-                                           StoredValue::UniquePtr next,
-                                           HashTable& ht) override {
+                                           StoredValue::UniquePtr next) override {
         // Allocate a buffer to store the copy ofOrderStoredValue and any
         // trailing bytes required for the key.
         return StoredValue::UniquePtr(
                 new (::operator new(other.getObjectSize()))
-                        OrderedStoredValue(other, std::move(next), *stats, ht));
+                        OrderedStoredValue(other, std::move(next), *stats));
     }
 
 private:
index 5b47f62..75455bf 100644 (file)
@@ -390,7 +390,7 @@ void VBucket::handlePreExpiry(StoredValue& v) {
                           v.getNRUValue());
 
             new_item.setDeleted();
-            v.setValue(new_item, ht);
+            ht.setValue(new_item, v);
         }
     }
 }
@@ -1348,7 +1348,7 @@ void VBucket::deleteExpiredItem(const Item& it,
                                      TrackReference::No);
                 v->setDeleted();
                 v->setRevSeqno(it.getRevSeqno());
-                v->setValue(it, ht);
+                ht.setValue(it, *v);
                 VBNotifyCtx notifyCtx;
                 std::tie(std::ignore, std::ignore, notifyCtx) =
                         processExpiredItem(hbl, *v);
index 4328026..a4fcd73 100644 (file)
@@ -466,7 +466,7 @@ TEST_F(HashTableTest, ItemAge) {
     // Check changing age when new value is used.
     Item item2(key, 0, 0, "value2", strlen("value2"));
     item2.getValue()->incrementAge();
-    v->setValue(item2, ht);
+    ht.setValue(item2, *v);
     EXPECT_EQ(1, v->getValue()->getAge());
 }
 
index 289255a..e461ef1 100644 (file)
@@ -45,7 +45,7 @@ public:
     void SetUp() override {
         // Create an initial stored value for testing - key length (3) and
         // value length (5).
-        sv = factory(item, {}, ht);
+        sv = factory(item, {});
     }
 
     /// Returns the number of bytes in the Fixed part of StoredValue
@@ -107,7 +107,7 @@ TYPED_TEST(ValueTest, valuelenDeletedWithValue) {
 
 TYPED_TEST(ValueTest, valuelenDeletedWithoutValue) {
     // Check valuelen reports correctly for a StoredValue logically delete
-    this->sv->del(this->ht);
+    this->sv->del();
     EXPECT_EQ(0, this->sv->valuelen())
             << "valuelen() expected to be 0 as we do not want to keep deleted "
                "body";