summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_metadata.cc
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@redhat.com>2017-10-13 23:40:28 +0200
committerYehuda Sadeh <yehuda@redhat.com>2018-04-10 17:05:38 +0200
commitfe0807fc371ab9a75e1bf53817d1e7685d669f62 (patch)
tree50fdd2f0e831262979abd45a98b16a538eb80196 /src/rgw/rgw_metadata.cc
parentrgw: aws sync, add hooks for decoding/encoding rest obj (diff)
downloadceph-fe0807fc371ab9a75e1bf53817d1e7685d669f62.tar.xz
ceph-fe0807fc371ab9a75e1bf53817d1e7685d669f62.zip
rgw: recover from empty meta.history object
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>
Diffstat (limited to '')
-rw-r--r--src/rgw/rgw_metadata.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc
index 8baa3dd3087..0c6ac0a9224 100644
--- a/src/rgw/rgw_metadata.cc
+++ b/src/rgw/rgw_metadata.cc
@@ -364,6 +364,16 @@ int read_history(RGWRados *store, RGWMetadataLogHistory *state,
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);