Manually remove a broken Swift container

Manually remove a broken Swift container

All Swift container operations such as updating a container metadata or removing a container fail if the name of the Swift container includes a forward slash (/) character. Typically, Swift does not accept container names that begin with the forward slash character. However, if you have such containers, you must remove them manually as described below. For example, you may get the following errors when trying to remove a bucket:

radosgw-admin bucket rm --bucket='{bucket_name}'
2020-04-23 21:17:37.581515 7f8880047e40 -1 ERROR: get_bucket_instance_from_oid failed: -2
2020-04-23 21:17:37.581535 7f8880047e40  0 could not get bucket info for bucket={bucket_name}

Note

RADOS Gateway uses the term bucket to describe a data container since it may be construed as the equivalent of the term container used within Swift.

Warning

The following procedure includes changes in an underlying RADOS GATEWAY object and can cause a major malfunction of Swift if performed incorrectly.

To remove a broken Swift container manually:

  1. Optional. Identify the ID of the user who created the affected bucket. Run radosgw-admin user check against each user causing an inconsistency error.

    radosgw-admin user list | grep \" | cut -d\" -f2 | while read uid; do echo '--- $uid'; rdosgw-admin user check --uid $uid; done
    --- {user_id}
    

    Example of system response:

    --- {user_id1}
    --- {user_id2}
    --- {user_id3}
    --- {user_id4}
    --- {user_id5}
    --- {user_id6}
    --- {user_id7}
    2020-04-23 21:17:37.581515 7f8880047e40 -1 ERROR: get_bucket_instance_from_oid failed: -2
    2020-04-23 21:17:37.581535 7f8880047e40  0 could not get bucket info for bucket={bucket_name}
    --- {user_id8}
    --- {user_id9}
    
  2. Remove the link between the user and the bucket:

    rados -p default.rgw.meta -N users.uid rmomapkey {user_id}.buckets {bucket_name}
    
  3. List all metadata objects for the broken bucket. The output contains a unique ID of the RADOS Gateway object.

    rados -p default.rgw.meta ls --all | grep {bucket_name}
    

    Example of system response:

    root 8ea1a1093ba949deb63010c23caaff5a/{bucket_name}
    root .bucket.meta.8ea1a1093ba949deb63010c23caaff5a:{bucket_name}:4d1cb33f-c11c-42ea-8f84-08f1ac56907a.96818.3
    
  4. Remove the object using the bucket ID from the previous step. For example:

    rados -p default.rgw.meta -N root rm 8ea1a1093ba949deb63010c23caaff5a/{bucket_name}
    rados -p default.rgw.meta -N root rm .bucket.meta.8ea1a1093ba949deb63010c23caaff5a:{bucket_name}:4d1cb33f-c11c-42ea-8f84-08f1ac56907a.96818.3