]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: make automatically marking of unfound as lost optional
authorSage Weil <sage@newdream.net>
Tue, 24 May 2011 16:42:39 +0000 (09:42 -0700)
committerSage Weil <sage@newdream.net>
Tue, 24 May 2011 16:42:39 +0000 (09:42 -0700)
We may not want to do this automatically until we have more confidense in
the recovery code.  Even then, possible not.  In particular, the OSDs may
believe they have contact all possible homes for the data even though there
is some long-lost OSD that has the data on disk that if offline.

For now, we make the marking process explicit so that the administrator can
make the call.

Signed-off-by: Sage Weil <sage@newdream.net>
src/common/config.cc
src/common/config.h
src/osd/PG.cc

index 0794dcaa73fa40a1f53cf1b1747d370915e5b2bb..3e74315780706ff205ba9afea895e7bee8d75460 100644 (file)
@@ -361,6 +361,7 @@ struct config_option config_optionsp[] = {
   OPTION(osd_min_down_reports, OPT_INT, 3),     // number of times a down OSD must be reported for it to count
   OPTION(osd_replay_window, OPT_INT, 45),
   OPTION(osd_preserve_trimmed_log, OPT_BOOL, true),
+  OPTION(osd_auto_mark_unfound_lost, OPT_BOOL, false),
   OPTION(osd_recovery_delay_start, OPT_FLOAT, 15),
   OPTION(osd_recovery_max_active, OPT_INT, 5),
   OPTION(osd_recovery_max_chunk, OPT_U64, 1<<20),  // max size of push chunk
index 76a0674d33cc590951576e0918c29ba407d51ab8..5e325af7222a154c016c6f333d6072ee0f1083a5 100644 (file)
@@ -433,6 +433,7 @@ public:
   int   osd_min_down_reports;
   int   osd_replay_window;
   bool  osd_preserve_trimmed_log;
+  bool  osd_auto_mark_unfound_lost;
 
   float osd_recovery_delay_start;
   int osd_recovery_max_active;
index 27e85f82227b361b0bfa27c324ba1157ddb6911f..8e58d884dd7815b554a40f50104213bdcff8318e 100644 (file)
@@ -4115,10 +4115,15 @@ PG::RecoveryState::Active::react(const ActMap&) {
   if (g_conf.osd_check_for_log_corruption)
     pg->check_log_for_corruption(pg->osd->store);
 
-  if (pg->missing.num_missing() > pg->missing_loc.size()) {
-    if (pg->all_unfound_are_lost(pg->osd->osdmap)) {
+  int unfound = pg->missing.num_missing() - pg->missing_loc.size();
+  if (unfound > 0 &&
+      pg->all_unfound_are_lost(pg->osd->osdmap)) {
+    if (g_conf.osd_auto_mark_unfound_lost) {
+      pg->osd->clog.error() << pg->info.pgid << " has " << unfound
+                           << " objects unfound and apparently lost, automatically marking lost\n";
       pg->mark_all_unfound_as_lost(*context< RecoveryMachine >().get_cur_transaction());
-    }
+    } else
+      pg->osd->clog.error() << pg->info.pgid << " has " << unfound << " objects unfound and apparently lost\n";
   }
 
   if (!pg->snap_trimq.empty() &&