]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: allow (some) log trim when degraded, but not during recovery
authorSage Weil <sage@inktank.com>
Sat, 23 Feb 2013 01:01:53 +0000 (17:01 -0800)
committerSage Weil <sage@inktank.com>
Fri, 8 Mar 2013 22:14:03 +0000 (14:14 -0800)
We allow some trim during degraded, although we keep more entries around to
improve our chances of a restarting OSD of doing log-based recovery.

Still disallow during recovery...

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 6d89b34e5608c71b49ef33ab58340e90bd8da6e4)

src/common/config_opts.h
src/osd/ReplicatedPG.cc

index daa1c76d892f8e87e3332985696864508c0196be..dd94245892b989ac14a71688d35e422113a83fcb 100644 (file)
@@ -361,7 +361,8 @@ OPTION(osd_use_stale_snap, OPT_BOOL, false)
 OPTION(osd_rollback_to_cluster_snap, OPT_STR, "")
 OPTION(osd_default_notify_timeout, OPT_U32, 30) // default notify timeout in seconds
 OPTION(osd_kill_backfill_at, OPT_INT, 0)
-OPTION(osd_min_pg_log_entries, OPT_U32, 1000) // number of entries to keep in the pg log when trimming it
+OPTION(osd_min_pg_log_entries, OPT_U32, 1000)  // number of entries to keep in the pg log when trimming it
+OPTION(osd_max_pg_log_entries, OPT_U32, 10000) // max entries, say when degraded, before we trim
 OPTION(osd_op_complaint_time, OPT_FLOAT, 30) // how many seconds old makes an op complaint-worthy
 OPTION(osd_command_max_records, OPT_INT, 256)
 OPTION(osd_op_log_threshold, OPT_INT, 5) // how many op log messages to show in one go
index 5681cd36ea4b3e851c7cd14ee5e841db8e02070a..c8096efb1807f3b6b2e23d23dec1c7a26c82d87b 100644 (file)
@@ -563,8 +563,12 @@ void ReplicatedPG::do_pg_op(OpRequestRef op)
 
 void ReplicatedPG::calc_trim_to()
 {
-  if (is_degraded() || !is_clean()) {
-    dout(10) << "calc_trim_to no trim while degraded or not clean" << dendl;
+  if (state_test(PG_STATE_RECOVERING |
+                PG_STATE_RECOVERY_WAIT |
+                PG_STATE_BACKFILL |
+                PG_STATE_BACKFILL_WAIT |
+                PG_STATE_BACKFILL_TOOFULL)) {
+    dout(10) << "calc_trim_to no trim during recovery" << dendl;
     pg_trim_to = eversion_t();
     return;
   }
@@ -576,6 +580,9 @@ void ReplicatedPG::calc_trim_to()
   }
 
   size_t target = g_conf->osd_min_pg_log_entries;
+  if (is_degraded())
+    target = g_conf->osd_max_pg_log_entries;
+
   if (min_last_complete_ondisk != eversion_t() &&
       min_last_complete_ondisk != pg_trim_to &&
       log.approx_size() > target) {