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>
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:
void RGWRados::finalize()
{
+ if (need_watch_notify()) {
+ finalize_watch();
+ }
delete meta_mgr;
delete data_log;
if (use_gc_thread) {
}
}
+ 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;
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);