I have a question about the pool's `MAX AVAIL` of `ceph df`.
When i out a osd, the `MAX AVAIL` doesn't change. Only when i remove the osd from the crush map of the pool, the `MAX AVAIL` decrese.
For example, I have a pool with 10 osd. When 9 osds out, `ceph df` still output the MAX AVAIL with 10 osds, not the remained 1 osd. Only when i remove the out osds from the crush map, the MAX AVAIL changed to the remained size.
But in my understanding, when the osd out, the recovery begin. When the recovery begins, the out osd has no use for the pool. If `MAX AVAIL` doesn't change, It may provide error avail size for the users.
The calculate logic is in `PGMap::get_rules_avail`. Maybe after called `get_rule_weight_osd_map`, we could recalculate the weight map to remove the osd which `osd_info.kb` is zero.
Or could modify the `get_rule_weight_osd_map`, but i don't know whether there is some other impact.
int64_tget_rule_avail(int ruleno)const{ auto i = avail_space_by_rule.find(ruleno); if (i != avail_space_by_rule.end()) return avail_space_by_rule[ruleno]; else return0; }
cluster_state.with_osdmap([&](const OSDMap& osdmap) { // FIXME: no easy way to get mon features here. this will do for // now, though, as long as we don't make a backward-incompat change. pg_map.encode_digest(osdmap, m->get_data(), CEPH_FEATURES_ALL);
class OSDMonitor *osdmon() { return (class OSDMonitor *)paxos_service[PAXOS_OSDMAP]; }
其实计算的时候, 还需要一个osd_stat
所以有没有办法得到完整的PGMap?
资源池存在,但是crush rule是新建的这种.
复现了. emm.
第一种:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
(gdb) bt #0 PGMap::get_rules_avail (this=this@entry=0x5627ee1b9f90, osdmap=..., avail_map=avail_map@entry=0x5627ee1b9fc0) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mon/PGMap.cc:940 #1 0x00005627e27d4846 in PGMap::encode_digest (this=this@entry=0x5627ee1b9f90, osdmap=..., bl=..., features=features@entry=4611087853746454523) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mon/PGMap.cc:1579 #2 0x00005627e28193a3 in operator() (osdmap=..., __closure=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/DaemonServer.cc:1454 #3 with_osdmap<DaemonServer::send_report()::__lambda31::__lambda32> (cb=<optimized out>, this=0x7ffe277a5fa0) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/osdc/Objecter.h:2045 #4 with_osdmap<DaemonServer::send_report()::__lambda31::__lambda32> (this=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/ClusterState.h:129 #5 operator() (pg_map=..., __closure=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/DaemonServer.cc:1470 #6 with_pgmap<DaemonServer::send_report()::__lambda31> (cb=<optimized out>, this=0x5627ee1b9c30) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/ClusterState.h:105 #7 DaemonServer::send_report (this=this@entry=0x5627ee1ba930) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/DaemonServer.cc:1471 #8 0x00005627e286ba2e in Mgr::tick (this=0x5627ee1b9800) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/Mgr.cc:626 #9 0x00005627e28621fd in MgrStandby::tick (this=0x7ffe277a59e0) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/MgrStandby.cc:197 #10 0x00005627e282668a in operator() (a0=<optimized out>, this=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/build/boost/include/boost/function/function_template.hpp:760 #11 FunctionContext::finish (this=<optimized out>, r=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/include/Context.h:493 #12 0x00005627e2821bc9 in Context::complete (this=0x5627ed8f6c30, r=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/include/Context.h:70 #13 0x00005627e2999074 in SafeTimer::timer_thread (this=0x7ffe277a76f0) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/common/Timer.cc:97 #14 0x00005627e299aa9d in SafeTimerThread::entry (this=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/common/Timer.cc:30 #15 0x00007f365a1dedd5 in start_thread () from /lib64/libpthread.so.0 #16 0x00007f36592b9ead in clone () from /lib64/libc.so.6
(gdb) bt #0 PGMap::get_rules_avail (this=this@entry=0x559f786fff90, osdmap=..., avail_map=avail_map@entry=0x559f786fffc0) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mon/PGMap.cc:940 #1 0x0000559f6d4bbe50 in PGMap::dump_pool_stats_full (this=0x559f786fff90, osd_map=..., ss=0x0, f=0x7ff400f95f60, verbose=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mon/PGMap.h:454 #2 0x0000559f6d4ecb7d in operator() (osd_map=..., __closure=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/ActivePyModules.cc:296 #3 with_osdmap<ActivePyModules::get_python(const string&)::__lambda17::__lambda18> (cb=<optimized out>, this=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/osdc/Objecter.h:2045 #4 with_osdmap<ActivePyModules::get_python(const string&)::__lambda17::__lambda18> (this=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/ClusterState.h:129 #5 operator() (pg_map=..., __closure=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/ActivePyModules.cc:297 #6 with_pgmap<ActivePyModules::get_python(const string&)::__lambda17> (cb=<optimized out>, this=0x559f786ffc30) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/ClusterState.h:105 #7 ActivePyModules::get_python (this=0x559f779abe00, what="df") at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/ActivePyModules.cc:298 #8 0x0000559f6d50b1fd in ceph_state_get (self=0x7ff4015c10a0, args=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/BaseMgrModule.cc:334 #9 0x00007ff42b518cf0 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0 #10 0x00007ff42b5186bd in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0 #11 0x00007ff42b5186bd in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0 #12 0x00007ff42b51b03d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0 #13 0x00007ff42b4a4978 in function_call () from /lib64/libpython2.7.so.1.0 #14 0x00007ff42b47fa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0 #15 0x00007ff42b48ea55 in instancemethod_call () from /lib64/libpython2.7.so.1.0 #16 0x00007ff42b47fa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0 #17 0x00007ff42b47fb45 in call_function_tail () from /lib64/libpython2.7.so.1.0 #18 0x00007ff42b47fe7b in PyObject_CallMethod () from /lib64/libpython2.7.so.1.0 #19 0x0000559f6d50fcff in ActivePyModule::notify (this=0x559f7841f440, notify_type="pg_summary", notify_id="") at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/mgr/ActivePyModule.cc:90 #20 0x0000559f6d4da68a in operator() (a0=<optimized out>, this=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/build/boost/include/boost/function/function_template.hpp:760 #21 FunctionContext::finish (this=<optimized out>, r=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/include/Context.h:493 #22 0x0000559f6d4d5bc9 in Context::complete (this=0x559f78b0e6f0, r=<optimized out>) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/include/Context.h:70 #23 0x0000559f6d64f748 in Finisher::finisher_thread_entry (this=0x559f786ff940) at /home/wangchao/rpmbuild/BUILD/ceph-12.2.12/src/common/Finisher.cc:72 #24 0x00007ff4295a9dd5 in start_thread () from /lib64/libpthread.so.0 #25 0x00007ff428684ead in clone () from /lib64/libc.so.6