From: Huber-ming Date: Wed, 10 Nov 2021 12:37:44 +0000 (+0800) Subject: rgw: init bucket index only if putting bucket instance info succeeds X-Git-Tag: v15.2.17~75^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=33303d680c8fb6287d4d7ec1074a5deb01143c12;p=ceph.git rgw: init bucket index only if putting bucket instance info succeeds Signed-off-by: Huber-ming (cherry picked from commit 6e97f2a32df80f00d44ed3daceac381c46c17026) Conflicts: src/rgw/rgw_reshard.cc Cherry-pick notes: - pub_bucket_instance_info and init_index don't take prefix provider arg on Octopus --- diff --git a/src/rgw/rgw_reshard.cc b/src/rgw/rgw_reshard.cc index b5733b240f32..8294ac57aaf7 100644 --- a/src/rgw/rgw_reshard.cc +++ b/src/rgw/rgw_reshard.cc @@ -338,15 +338,15 @@ static int create_new_bucket_instance(rgw::sal::RGWRadosStore *store, new_bucket_info.new_bucket_instance_id.clear(); new_bucket_info.reshard_status = cls_rgw_reshard_status::NOT_RESHARDING; - int ret = store->svc()->bi->init_index(new_bucket_info); + int ret = store->getRados()->put_bucket_instance_info(new_bucket_info, true, real_time(), &attrs); if (ret < 0) { - cerr << "ERROR: failed to init new bucket indexes: " << cpp_strerror(-ret) << std::endl; + cerr << "ERROR: failed to store new bucket instance info: " << cpp_strerror(-ret) << std::endl; return ret; } - ret = store->getRados()->put_bucket_instance_info(new_bucket_info, true, real_time(), &attrs); + ret = store->svc()->bi->init_index(new_bucket_info); if (ret < 0) { - cerr << "ERROR: failed to store new bucket instance info: " << cpp_strerror(-ret) << std::endl; + cerr << "ERROR: failed to init new bucket indexes: " << cpp_strerror(-ret) << std::endl; return ret; }