diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-08-19 08:40:16 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-23 15:37:18 -0700 |
commit | 4cf6996803ef66f2b6083f73593259d45e2740a3 (patch) | |
tree | 41e87e0782249b28d05066754726e332f8c7db68 | |
parent | aea6de532b0b843c3a8bb76d10bab8476f0d7c09 (diff) | |
download | ceph-4cf6996803ef66f2b6083f73593259d45e2740a3.tar.gz |
rgw: change cache / watch-notify init sequence
Fixes: #6046
We were initializing the watch-notify (through the cache
init) before reading the zone info which was much too
early, as we didn't have the control pool name yet. Now
simplifying init/cleanup a bit, cache doesn't call watch/notify
init and cleanup directly, but rather states its need
through a virtual callback.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit d26ba3ab0374e77847c742dd00cb3bc9301214c2)
-rw-r--r-- | src/rgw/rgw_cache.h | 9 | ||||
-rw-r--r-- | src/rgw/rgw_rados.cc | 11 | ||||
-rw-r--r-- | src/rgw/rgw_rados.h | 1 |
3 files changed, 16 insertions, 5 deletions
diff --git a/src/rgw/rgw_cache.h b/src/rgw/rgw_cache.h index b6c4e15eede..601fcdfc963 100644 --- a/src/rgw/rgw_cache.h +++ b/src/rgw/rgw_cache.h @@ -177,14 +177,13 @@ class RGWCache : public T if (ret < 0) return ret; - ret = T::init_watch(); - return ret; + return 0; } - void finalize() { - T::finalize_watch(); - T::finalize(); + bool need_watch_notify() { + return true; } + int distribute_cache(const string& normal_name, rgw_obj& obj, ObjectCacheInfo& obj_info, int op); int watch_cb(int opcode, uint64_t ver, bufferlist& bl); public: diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 222b79a7d2e..0bbbf177b7a 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -817,6 +817,9 @@ void RGWRadosCtx::set_prefetch_data(rgw_obj& obj) { void RGWRados::finalize() { + if (need_watch_notify()) { + finalize_watch(); + } delete meta_mgr; delete data_log; if (use_gc_thread) { @@ -909,6 +912,14 @@ int RGWRados::init_complete() } } + if (need_watch_notify()) { + ret = init_watch(); + if (ret < 0) { + lderr(cct) << "ERROR: failed to initialize watch" << dendl; + return ret; + } + } + map<string, RGWZone>::iterator ziter; for (ziter = region.zones.begin(); ziter != region.zones.end(); ++ziter) { const string& name = ziter->first; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index d01f76ec224..e6ab244afa9 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1254,6 +1254,7 @@ public: virtual int update_containers_stats(map<string, RGWBucketEnt>& m); virtual int append_async(rgw_obj& obj, size_t size, bufferlist& bl); + virtual bool need_watch_notify() { return false; } virtual int init_watch(); virtual void finalize_watch(); virtual int distribute(const string& key, bufferlist& bl); |