From 1efc7b1d740dc2323281010d0c34f0ad136e7660 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 24 Aug 2019 14:12:06 +0800 Subject: [PATCH] rgw: update_iterator() in RGWObjManifest::set_explicit() we should update the end iterator when updating RGWObjManifest with its parts Fixes: https://tracker.ceph.com/issues/41416 Signed-off-by: Kefu Chai --- src/rgw/rgw_dencoder.cc | 9 +++++---- src/rgw/rgw_obj_manifest.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/rgw/rgw_dencoder.cc b/src/rgw/rgw_dencoder.cc index 74b688f3fe8..4fef224f33e 100644 --- a/src/rgw/rgw_dencoder.cc +++ b/src/rgw/rgw_dencoder.cc @@ -146,6 +146,8 @@ void RGWObjManifest::obj_iterator::update_explicit_pos() void RGWObjManifest::generate_test_instances(std::list& o) { RGWObjManifest *m = new RGWObjManifest; + map objs; + uint64_t total_size = 0; for (int i = 0; i<10; i++) { RGWObjManifestPart p; rgw_bucket b; @@ -153,12 +155,11 @@ void RGWObjManifest::generate_test_instances(std::list& o) p.loc = rgw_obj(b, "object"); p.loc_ofs = 0; p.size = 512 * 1024; - m->objs[(uint64_t)i * 512 * 1024] = p; + total_size += p.size; + objs[total_size] = p; } - m->obj_size = 5 * 1024 * 1024; - + m->set_explicit(total_size, objs); o.push_back(m); - o.push_back(new RGWObjManifest); } diff --git a/src/rgw/rgw_obj_manifest.h b/src/rgw/rgw_obj_manifest.h index 78c7a05914d..3912b5048e5 100644 --- a/src/rgw/rgw_obj_manifest.h +++ b/src/rgw/rgw_obj_manifest.h @@ -204,8 +204,8 @@ public: void set_explicit(uint64_t _size, map& _objs) { explicit_objs = true; - obj_size = _size; objs.swap(_objs); + set_obj_size(_size); } void get_implicit_location(uint64_t cur_part_id, uint64_t cur_stripe, uint64_t ofs, string *override_prefix, rgw_obj_select *location); -- 2.39.5