]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: chain binfo_cache to multiple cache entries
authorYehuda Sadeh <yehuda@inktank.com>
Fri, 23 May 2014 23:50:41 +0000 (16:50 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Wed, 11 Jun 2014 06:08:58 +0000 (23:08 -0700)
Need to chain it to both the entry point and to the instance.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_cache.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index c402352a02ad65ae46da3d302ba44ef8a4ed37e0..9eb4a4bb765af6826cd422815146b1df87f6eb91 100644 (file)
@@ -61,14 +61,16 @@ bool ObjectCache::chain_cache_entry(rgw_cache_entry_info& cache_info, RGWChained
 {
   RWLock::WLocker l(lock);
 
-  ldout(cct, 10) << "cache put: name=" << cache_info.cache_locator << dendl;
+  ldout(cct, 10) << "chain_cache_entry: cache_locator=" << cache_info.cache_locator << dendl;
   map<string, ObjectCacheEntry>::iterator iter = cache_map.find(cache_info.cache_locator);
   if (iter == cache_map.end()) {
+    ldout(cct, 20) << "chain_cache_entry: couldn't find cachce locator" << dendl;
     return false;
   }
 
   ObjectCacheEntry& entry = iter->second;
   if (entry.gen != cache_info.gen) {
+    ldout(cct, 20) << "chain_cache_entry: entry.gen (" << entry.gen << ") != cache_info.gen (" << cache_info.gen << ")" << dendl;
     return false;
   }
 
index 8fbb1382d5fffc53e2c8997259ff9ee8b5021571..468c932532dbd85db3305f303a958a477ddf7494 100644 (file)
@@ -5394,11 +5394,12 @@ int RGWRados::get_bucket_entrypoint_info(void *ctx, const string& bucket_name,
                                          RGWBucketEntryPoint& entry_point,
                                          RGWObjVersionTracker *objv_tracker,
                                          time_t *pmtime,
-                                         map<string, bufferlist> *pattrs)
+                                         map<string, bufferlist> *pattrs,
+                                         rgw_cache_entry_info *cache_info)
 {
   bufferlist bl;
 
-  int ret = rgw_get_system_obj(this, ctx, zone.domain_root, bucket_name, bl, objv_tracker, pmtime, pattrs);
+  int ret = rgw_get_system_obj(this, ctx, zone.domain_root, bucket_name, bl, objv_tracker, pmtime, pattrs, cache_info);
   if (ret < 0) {
     return ret;
   }
@@ -5474,7 +5475,8 @@ int RGWRados::get_bucket_info(void *ctx, const string& bucket_name, RGWBucketInf
   RGWBucketEntryPoint entry_point;
   time_t ep_mtime;
   RGWObjVersionTracker ot;
-  int ret = get_bucket_entrypoint_info(ctx, bucket_name, entry_point, &ot, &ep_mtime, pattrs);
+  rgw_cache_entry_info entry_cache_info;
+  int ret = get_bucket_entrypoint_info(ctx, bucket_name, entry_point, &ot, &ep_mtime, pattrs, &entry_cache_info);
   if (ret < 0) {
     info.bucket.name = bucket_name; /* only init this field */
     return ret;
@@ -5520,7 +5522,10 @@ int RGWRados::get_bucket_info(void *ctx, const string& bucket_name, RGWBucketInf
   if (pattrs)
     *pattrs = e.attrs;
 
-  binfo_cache.put(this, bucket_name, &e, cache_info);
+  /* chain to both bucket entry point and bucket instance */
+  if (binfo_cache.put(this, bucket_name, &e, entry_cache_info)) {
+    binfo_cache.put(this, bucket_name, &e, cache_info);
+  }
 
   return 0;
 }
index 5fe817c2a3035d726c3d3c210f1d6afcce076301..04128e0fd836c4ebfde3cd568b73faa1a83919d5 100644 (file)
@@ -1750,7 +1750,7 @@ public:
                                  map<string, bufferlist> *pattrs);
   int put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, time_t mtime, map<string, bufferlist> *pattrs);
   int get_bucket_entrypoint_info(void *ctx, const string& bucket_name, RGWBucketEntryPoint& entry_point, RGWObjVersionTracker *objv_tracker, time_t *pmtime,
-                                 map<string, bufferlist> *pattrs);
+                                 map<string, bufferlist> *pattrs, rgw_cache_entry_info *cache_info = NULL);
   int get_bucket_instance_info(void *ctx, const string& meta_key, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
   int get_bucket_instance_info(void *ctx, rgw_bucket& bucket, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
   int get_bucket_instance_from_oid(void *ctx, string& oid, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs,