From: Greg Farnum Date: Thu, 22 Oct 2009 05:48:12 +0000 (-0700) Subject: mon: On every incoming MPGStats, check for a full/near-full OSD and mark map if needed. X-Git-Tag: v0.18~171^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=89686faa9b3b3c54c0c966f8a0f54792d9edddcd;p=ceph.git mon: On every incoming MPGStats, check for a full/near-full OSD and mark map if needed. --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 971049a4b4c6..2ba4307c590b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -271,6 +271,11 @@ bool OSDMonitor::should_propose(double& delay) if (pending_inc.fullmap.length()) return true; + if (pending_inc.new_flags & CEPH_OSDMAP_FULL) { //get that info out there! + delay = 0.0; + return true; + } + // adjust osd weights? if (osd_weight.size() == (unsigned)osdmap.get_max_osd()) { dout(0) << " adjusting osd weights based on " << osd_weight << dendl; @@ -802,6 +807,9 @@ void OSDMonitor::tick() } } + //if map is set to full, get that info out there! + if (pending_inc.new_flags & CEPH_OSDMAP_FULL) + do_propose = true; // --------------- #define SWAP_PRIMARIES_AT_START 0 diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 1caa0fac0de7..35dc36c60d58 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -163,6 +163,11 @@ private: void check_subs(); void check_sub(Subscription *sub); + void add_flag(int flag) { + if (pending_inc.new_flags < 0) + pending_inc.new_flags = osdmap.flags; + pending_inc.new_flags |= flag; + } }; #endif diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 1e6d5309e827..f6ad0f69a031 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -75,6 +75,7 @@ void PGMonitor::tick() // safely use mon->osdmon->osdmap } */ + } void PGMonitor::create_initial(bufferlist& bl) @@ -324,6 +325,20 @@ bool PGMonitor::prepare_pg_stats(MPGStats *stats) else dout(10) << " got osd " << from << " " << stats->osd_stat << " (first report)" << dendl; + //Check how full the OSD is; set OSDMap to full/near-full if needed + float ratio = ((float)stats->osd_stat.kb_used) / (float) stats->osd_stat.kb; + if ( ratio > CEPH_OSD_FULL_RATIO ) { + dout(5) << "osd" << from << " has ratio " << ratio + << "which is beyond CEPH_OSD_FULL_RATIO " + << CEPH_OSD_FULL_RATIO << dendl; + mon->osdmon()->add_flag(CEPH_OSDMAP_FULL); + } else if ( ratio > CEPH_OSD_NEARFULL_RATIO ) { + dout(10) << "osd" << from << " has ratio " << ratio + << "which is beyond CEPH_OSD_NEARFULL_RATIO " + << CEPH_OSD_NEARFULL_RATIO << dendl; + mon->osdmon()->add_flag(CEPH_OSDMAP_NEARFULL); + } + // apply to live map too (screw consistency) /* actually, no, don't. that screws up our "latest" stash. and can diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 1473f34b3956..d4bce24ffe70 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -26,7 +26,8 @@ #define CEPH_OSD_ONDISK_MAGIC "ceph osd volume v024" - +#define CEPH_OSD_NEARFULL_RATIO .8 +#define CEPH_OSD_FULL_RATIO .95