]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: store system object meta in cache when creating it 7615/head
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 5 Feb 2016 20:57:44 +0000 (12:57 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 11 Mar 2016 00:51:50 +0000 (16:51 -0800)
Fixes: #14678
When creating the system object we can easily also get the object's meta, so
keep it in the cache.

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

index 03c3b050e3fd65b6d9bc3af4a14ffe7879592272..cdd470c3b76fa91e735294a586664299215502be 100644 (file)
@@ -52,7 +52,7 @@ int ObjectCache::get(string& name, ObjectCacheInfo& info, uint32_t mask, rgw_cac
     if(perfcounter) perfcounter->inc(l_rgw_cache_miss);
     return -ENOENT;
   }
-  ldout(cct, 10) << "cache get: name=" << name << " : hit" << dendl;
+  ldout(cct, 10) << "cache get: name=" << name << " : hit (requested=" << mask << ", cached=" << src.flags << ")" << dendl;
 
   info = src;
   if (cache_info) {
@@ -119,7 +119,7 @@ void ObjectCache::put(string& name, ObjectCacheInfo& info, rgw_cache_entry_info
     return;
   }
 
-  ldout(cct, 10) << "cache put: name=" << name << dendl;
+  ldout(cct, 10) << "cache put: name=" << name << " info.flags=" << info.flags << dendl;
   map<string, ObjectCacheEntry>::iterator iter = cache_map.find(name);
   if (iter == cache_map.end()) {
     ObjectCacheEntry entry;
index 9cdc53d2616780d44fdb59d49f68bdb4f8725c0f..25649563a3035bf7182792415718ac1b45d3ec69 100644 (file)
@@ -401,13 +401,19 @@ int RGWCache<T>::put_system_obj_impl(rgw_obj& obj, uint64_t size, time_t *mtime,
   info.status = 0;
   info.flags = CACHE_FLAG_XATTRS;
   info.data = data;
-  info.flags |= CACHE_FLAG_DATA;
+  info.flags |= CACHE_FLAG_DATA | CACHE_FLAG_META;
   if (objv_tracker) {
     info.version = objv_tracker->write_version;
     info.flags |= CACHE_FLAG_OBJV;
   }
-  int ret = T::put_system_obj_impl(obj, size, mtime, attrs, flags, data,
+  time_t result_mtime;
+  int ret = T::put_system_obj_impl(obj, size, &result_mtime, attrs, flags, data,
                                    objv_tracker, set_mtime);
+  if (mtime) {
+    *mtime = result_mtime;
+  }
+  info.meta.mtime = result_mtime;
+  info.meta.size = size;
   string name = normal_name(bucket, oid);
   if (ret >= 0) {
     cache.put(name, info, NULL);