Fixes: http://tracker.ceph.com/issues/21802
Empty meta.history object is problematic, as when reading it when doing
meta log trimming, we'd just initialize it to an empty structure, and
end up asserting because cursor is empty. Cannot just return -ENOENT
here, because it wouldn't solve the issue.
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
if (ret < 0) {
return ret;
}
+ if (bl.length() == 0) {
+ /* bad history object, remove it */
+ rgw_raw_obj obj(pool, oid);
+ ret = store->delete_system_obj(obj);
+ if (ret < 0) {
+ ldout(store->ctx(), 0) << "ERROR: meta history is empty, but cannot remove it (" << cpp_strerror(-ret) << ")" << dendl;
+ return ret;
+ }
+ return -ENOENT;
+ }
try {
auto p = bl.begin();
state->decode(p);