]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: hold reloader using unique_ptr 36770/head
authorKefu Chai <kchai@redhat.com>
Fri, 7 Aug 2020 16:26:21 +0000 (00:26 +0800)
committerNathan Cutler <ncutler@suse.com>
Mon, 24 Aug 2020 13:49:52 +0000 (15:49 +0200)
instead of using optional<> for holding reloader, use unique_ptr<>.
as `RGWRealmReloader` is neither
trivially_copy_{assignable,constructible} nor
is_trivially_move_{assignable, constructible}, because of the `Cond`
member variable. but Clang++ and libc++ still tries to rely on a
delgating copy constructor for constructing the
optional<RGWRealmReloader> instance even the optional object is
created `in_place`.

in this change, to workaround this issue, reloader is instead
constructed using make_unique<>

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 2494ddbef5ad20cdfccf59911fccadb6f9848da0)

src/rgw/rgw_main.cc

index 44609741ed742c33c7c0ac68a13aeef88f535fae..c0c43a6ebf7b1c61daaf5f6cf078e30f317e1c19 100644 (file)
@@ -565,8 +565,8 @@ int main(int argc, const char **argv)
   // add a watcher to respond to realm configuration changes
   RGWPeriodPusher pusher(store);
   RGWFrontendPauser pauser(fes, implicit_tenant_context, &pusher);
-  std::optional<RGWRealmReloader> reloader(std::in_place, store,
-                                           service_map_meta, &pauser);
+  auto reloader = std::make_unique<RGWRealmReloader>(store,
+                                                    service_map_meta, &pauser);
 
   RGWRealmWatcher realm_watcher(g_ceph_context, store->svc.zone->get_realm());
   realm_watcher.add_watcher(RGWRealmNotify::Reload, *reloader);