]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: update_iterator() in RGWObjManifest::set_explicit()
authorKefu Chai <kchai@redhat.com>
Sat, 24 Aug 2019 06:12:06 +0000 (14:12 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 27 Aug 2019 04:41:57 +0000 (12:41 +0800)
we should update the end iterator when updating RGWObjManifest with its
parts

Fixes: https://tracker.ceph.com/issues/41416
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/rgw/rgw_dencoder.cc
src/rgw/rgw_obj_manifest.h

index 74b688f3fe8fbc870ae28a07145df39d96a2095e..4fef224f33ec4433f683654ae828f46c049c1eed 100644 (file)
@@ -146,6 +146,8 @@ void RGWObjManifest::obj_iterator::update_explicit_pos()
 void RGWObjManifest::generate_test_instances(std::list<RGWObjManifest*>& o)
 {
   RGWObjManifest *m = new RGWObjManifest;
+  map<uint64_t, RGWObjManifestPart> 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<RGWObjManifest*>& 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);
 }
 
index 78c7a05914daea94eac8e39e64e095220700e7ea..3912b5048e55dbda932331a62a06d5b046e199cd 100644 (file)
@@ -204,8 +204,8 @@ public:
 
   void set_explicit(uint64_t _size, map<uint64_t, RGWObjManifestPart>& _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);