summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2013-07-17 12:51:19 -0700
committerSamuel Just <sam.just@inktank.com>2013-07-19 14:51:43 -0700
commit15eadb31cbf685749933067e51d52cfcfcf0b428 (patch)
tree909df8b97ab8f4f7d2b48a09336509da5fa4f1de
parentaf98a39c64c713d5c5ff80c209605d534f00c822 (diff)
downloadceph-15eadb31cbf685749933067e51d52cfcfcf0b428.tar.gz
ReplicatedPG: replace clean_up_local with a debug check
Stray objects should have been cleaned up in the merge_log transactions. Only on the primary have those operations necessarily been flushed at activate(). Fixes: 5084 Signed-off-by: Samuel Just <sam.just@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com> (cherry picked from commit 278c7b59228f614addf830cb0afff4988c9bc8cb)
-rw-r--r--src/common/config_opts.h1
-rw-r--r--src/osd/PG.cc5
-rw-r--r--src/osd/PG.h2
-rw-r--r--src/osd/ReplicatedPG.cc27
-rw-r--r--src/osd/ReplicatedPG.h2
5 files changed, 24 insertions, 13 deletions
diff --git a/src/common/config_opts.h b/src/common/config_opts.h
index 4fe4277a50d..7940cc760a1 100644
--- a/src/common/config_opts.h
+++ b/src/common/config_opts.h
@@ -453,6 +453,7 @@ OPTION(osd_debug_drop_pg_create_duration, OPT_INT, 1)
OPTION(osd_debug_drop_op_probability, OPT_DOUBLE, 0) // probability of stalling/dropping a client op
OPTION(osd_debug_op_order, OPT_BOOL, false)
OPTION(osd_debug_verify_snaps_on_info, OPT_BOOL, false)
+OPTION(osd_debug_verify_stray_on_activate, OPT_BOOL, false)
OPTION(osd_debug_skip_full_check_in_backfill_reservation, OPT_BOOL, false)
OPTION(osd_op_history_size, OPT_U32, 20) // Max number of completed ops to track
OPTION(osd_op_history_duration, OPT_U32, 600) // Oldest completed op to track
diff --git a/src/osd/PG.cc b/src/osd/PG.cc
index fb8b26ff389..c1bf790fe78 100644
--- a/src/osd/PG.cc
+++ b/src/osd/PG.cc
@@ -1527,8 +1527,9 @@ void PG::activate(ObjectStore::Transaction& t,
dirty_info = true;
dirty_big_info = true; // maybe
- // clean up stray objects
- clean_up_local(t);
+ // verify that there are no stray objects
+ if (is_primary())
+ check_local();
// find out when we commit
tfin.push_back(new C_PG_ActivateCommitted(this, query_epoch));
diff --git a/src/osd/PG.h b/src/osd/PG.h
index 9446334bb53..b959a9f8490 100644
--- a/src/osd/PG.h
+++ b/src/osd/PG.h
@@ -834,7 +834,7 @@ public:
return missing.num_missing() - missing_loc.size();
}
- virtual void clean_up_local(ObjectStore::Transaction& t) = 0;
+ virtual void check_local() = 0;
virtual int start_recovery_ops(int max, RecoveryCtx *prctx) = 0;
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc
index c01d328a512..860e7dd4546 100644
--- a/src/osd/ReplicatedPG.cc
+++ b/src/osd/ReplicatedPG.cc
@@ -7095,16 +7095,19 @@ void ReplicatedPG::scan_range(hobject_t begin, int min, int max, BackfillInterva
}
-/** clean_up_local
- * remove any objects that we're storing but shouldn't.
- * as determined by log.
+/** check_local
+ *
+ * verifies that stray objects have been deleted
*/
-void ReplicatedPG::clean_up_local(ObjectStore::Transaction& t)
+void ReplicatedPG::check_local()
{
- dout(10) << "clean_up_local" << dendl;
+ dout(10) << __func__ << dendl;
assert(info.last_update >= log.tail); // otherwise we need some help!
+ if (!g_conf->osd_debug_verify_stray_on_activate)
+ return;
+
// just scan the log.
set<hobject_t> did;
for (list<pg_log_entry_t>::reverse_iterator p = log.log.rbegin();
@@ -7115,11 +7118,17 @@ void ReplicatedPG::clean_up_local(ObjectStore::Transaction& t)
did.insert(p->soid);
if (p->is_delete()) {
- dout(10) << " deleting " << p->soid
- << " when " << p->version << dendl;
- remove_snap_mapped_object(t, p->soid);
+ dout(10) << " checking " << p->soid
+ << " at " << p->version << dendl;
+ struct stat st;
+ int r = osd->store->stat(coll, p->soid, &st);
+ if (r != -ENOENT) {
+ dout(10) << "Object " << p->soid << " exists, but should have been "
+ << "deleted" << dendl;
+ assert(0 == "erroneously present object");
+ }
} else {
- // keep old(+missing) objects, just for kicks.
+ // ignore old(+missing) objects
}
}
}
diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h
index 644a277f0dc..e70dd0a84f1 100644
--- a/src/osd/ReplicatedPG.h
+++ b/src/osd/ReplicatedPG.h
@@ -721,7 +721,7 @@ protected:
int prepare_transaction(OpContext *ctx);
// pg on-disk content
- void clean_up_local(ObjectStore::Transaction& t);
+ void check_local();
void _clear_recovery_state();