From 059ed62ff937ce63b7255d72bf9b3cf687c4b532 Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Mon, 4 Jul 2016 15:01:51 +0200 Subject: [PATCH] rgw: remove bucket index objects when deleting the bucket Fixes: http://tracker.ceph.com/issues/16412 Signed-off-by: Orit Wasserman (cherry picked from commit 3ae276390641ad5fc4fef0c03971db95948880b4) --- src/rgw/rgw_rados.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index d10d37def25ae..fa68072d8c3ce 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -7063,8 +7063,8 @@ bool RGWRados::is_syncing_bucket_meta(rgw_bucket& bucket) int RGWRados::delete_bucket(rgw_bucket& bucket, RGWObjVersionTracker& objv_tracker) { librados::IoCtx index_ctx; - string oid; - int r = open_bucket_index(bucket, index_ctx, oid); + map bucket_objs; + int r = open_bucket_index(bucket, index_ctx, bucket_objs); if (r < 0) return r; @@ -7105,6 +7105,11 @@ int RGWRados::delete_bucket(rgw_bucket& bucket, RGWObjVersionTracker& objv_track if (r < 0) { return r; } + /* remove bucket index objects*/ + map::const_iterator biter; + for (biter = bucket_objs.begin(); biter != bucket_objs.end(); ++biter) { + index_ctx.remove(biter->second); + } } return 0; } -- 2.39.5