]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RGW: Fix rgw crash issue
authorSamarah <samarah.uriarte@ibm.com>
Mon, 19 Jun 2023 15:58:36 +0000 (11:58 -0400)
committerPritha Srivastava <prsrivas@redhat.com>
Tue, 2 Apr 2024 15:54:50 +0000 (21:24 +0530)
Signed-off-by: Samarah <samarah.uriarte@ibm.com>
src/rgw/driver/d4n/d4n_policy.cc
src/rgw/driver/d4n/rgw_sal_d4n.cc

index f648519ab500ee0579d89b0433dd322450e0a3ff..0e75692fcc6cd4eac558309bb065d6447c02f12d 100644 (file)
@@ -248,7 +248,7 @@ CacheBlock LFUDAPolicy::find_victim(const DoutPrefixProvider* dpp, rgw::cache::C
 }
 
 int LFUDAPolicy::get_block(const DoutPrefixProvider* dpp, CacheBlock* block, rgw::cache::CacheDriver* cacheNode) {
-/*  std::string key = "rgw-object:" + block->cacheObj.objName + ":directory";
+  std::string key = "rgw-object:" + block->cacheObj.objName + ":directory";
   std::string localWeightStr = cacheNode->get_attr(dpp, block->cacheObj.objName, "localWeight"); // change to block name eventually -Sam
   int localWeight = -1;
 
@@ -267,13 +267,13 @@ int LFUDAPolicy::get_block(const DoutPrefixProvider* dpp, CacheBlock* block, rgw
 
   int age = get_age();
 
-  if (cacheNode->key_exists(dpp, block->cacheObj.objName)) { 
+  if (cacheNode->key_exists(dpp, block->cacheObj.objName)) { /* Local copy */ 
     localWeight += age;
   } else {
     std::string hosts;
     uint64_t freeSpace = cacheNode->get_free_space(dpp);
 
-    while (freeSpace < block->size)
+    while (freeSpace < block->size) /* Not enough space in local cache */
       freeSpace += eviction(dpp, cacheNode);
 
     if (exist_key(key)) {
@@ -293,19 +293,21 @@ int LFUDAPolicy::get_block(const DoutPrefixProvider* dpp, CacheBlock* block, rgw
     }
 
     // should not hold local cache IP if in this else statement -Sam
-    if (hosts.length() > 0) {
+    if (hosts.length() > 0) { /* Remote copy */
       int globalWeight = get_global_weight(key);
       globalWeight += age;
       
       if (set_global_weight(key, globalWeight))
        return -1;
-    } else { 
+    } else { /* No remote copy */
       // do I need to add the block to the local cache here? -Sam
       // update hosts list for block as well? check read workflow -Sam
       localWeight += age;
       return cacheNode->set_attr(dpp, block->cacheObj.objName, "localWeight", std::to_string(localWeight));
     }
-  }*/ 
+  } 
+
+  return 0;
 }
 
 uint64_t LFUDAPolicy::eviction(const DoutPrefixProvider* dpp, rgw::cache::CacheDriver* cacheNode) {
index e5fdffc41b0dbf0aace231287d9507d2c1a1a039..9e5474ed472df9f84fa977c5554e548ab63db187 100644 (file)
@@ -412,7 +412,6 @@ int D4NFilterObject::D4NFilterReadOp::iterate(const DoutPrefixProvider* dpp, int
   /* Local cache check */
   if (source->driver->get_policy_driver()->cacheDriver->key_exists(dpp, oid)) { // Entire object for now -Sam
     ret = source->driver->get_policy_driver()->cacheDriver->get(dpp, source->get_key().get_oid(), ofs, len, bl, source->get_attrs());
-    dout(0) << "Sam: correct" << dendl;
     cb->handle_data(bl, ofs, len);
   } else {
     /* Block directory check */