From 962969c74923765d1b9173c97fc4bfcc91f83df2 Mon Sep 17 00:00:00 2001 From: Neha Ojha Date: Sun, 3 Mar 2019 20:29:05 -0800 Subject: [PATCH] osd/PG: skip rollforward when !transaction_applied during append_log() Earlier, we did pg_log.roll_forward(&handler), when !transaction_applied, which advanced the crt and trimmed the entries in rollforward(). Due to this, during _merge_object_divergent_entries(), when we tried to rollback entries, those objects were not found in the backend, and thus we hit this bug http://tracker.ceph.com/issues/36739. With this change, we are advancing the crt value, without deleting the objects, so that _merge_object_divergent_entries() does not fail because of deleted objects. Fixes: http://tracker.ceph.com/issues/36739 Signed-off-by: Neha Ojha (cherry picked from commit 17419ee39342257f5a6f41c792e8e45a8e243720) --- src/osd/PG.cc | 7 ++++++- src/osd/PGLog.h | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index f7f536265c433..4ef0e9fe1766c 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3899,8 +3899,13 @@ void PG::append_log( /* We must be a backfill peer, so it's ok if we apply * out-of-turn since we won't be considered when * determining a min possible last_update. + * + * We skip_rollforward() here, which advances the crt, without + * doing an actual rollforward. This avoids cleaning up entries + * from the backend and we do not end up in a situation, where the + * object is deleted before we can _merge_object_divergent_entries(). */ - pg_log.roll_forward(&handler); + pg_log.skip_rollforward(); } for (vector::const_iterator p = logv.begin(); diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index b920cc6491213..1a4a5a5428e60 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -728,6 +728,10 @@ public: h); } + void skip_rollforward() { + log.skip_can_rollback_to_to_head(); + } + //////////////////// get or set log & missing //////////////////// void reset_backfill_claim_log(const pg_log_t &o, LogEntryHandler *h) { -- 2.39.5