summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2012-12-19 10:33:40 -0800
committerSamuel Just <sam.just@inktank.com>2012-12-19 10:33:40 -0800
commit6122a9f62f9eeae1410d1703fecb8939a35fb03f (patch)
tree3fba6713d3517c209e02aff91949f8374166f121
parent2395af9f7a7224491f023be97cd592bc9f5709dc (diff)
downloadceph-6122a9f62f9eeae1410d1703fecb8939a35fb03f.tar.gz
OSDMonitor: remove temp pg mappings with no up pgs
Otherwise, the pg won't be validly mapped until one of the temp pgs comes back up. Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r--src/mon/OSDMonitor.cc24
-rw-r--r--src/mon/OSDMonitor.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index 5c8b08e43a2..7522bc133ad 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -302,6 +302,27 @@ void OSDMonitor::remove_redundant_pg_temp()
}
}
+void OSDMonitor::remove_down_pg_temp()
+{
+ dout(10) << "remove_down_pg_temp" << dendl;
+ OSDMap tmpmap(osdmap);
+ tmpmap.apply_incremental(pending_inc);
+
+ for (map<pg_t,vector<int> >::iterator p = tmpmap.pg_temp->begin();
+ p != tmpmap.pg_temp->end();
+ p++) {
+ unsigned num_up = 0;
+ for (vector<int>::iterator i = p->second.begin();
+ i != p->second.end();
+ ++i) {
+ if (!tmpmap.is_down(*i))
+ ++num_up;
+ }
+ if (num_up == 0)
+ pending_inc.new_pg_temp[p->first].clear();
+ }
+}
+
/* Assign a lower weight to overloaded OSDs.
*
* The osds that will get a lower weight are those with with a utilization
@@ -391,6 +412,9 @@ void OSDMonitor::create_pending()
// drop any redundant pg_temp entries
remove_redundant_pg_temp();
+
+ // drop any pg_temp entries with no up entries
+ remove_down_pg_temp();
}
diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h
index 4faa90e2902..9529f731c84 100644
--- a/src/mon/OSDMonitor.h
+++ b/src/mon/OSDMonitor.h
@@ -165,6 +165,7 @@ private:
void send_incremental(epoch_t first, entity_inst_t& dest, bool onetime);
void remove_redundant_pg_temp();
+ void remove_down_pg_temp();
int reweight_by_utilization(int oload, std::string& out_str);
bool preprocess_failure(class MOSDFailure *m);