summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-07-21 17:16:10 -0700
committerSage Weil <sage@inktank.com>2013-07-21 17:16:10 -0700
commitc4193013d5e6fdf480fa9e9b14fec5c748c7f87d (patch)
treef65f1eea44d5ec7cf95efd9ee15f125f3a28ee11
parent6d386bda93099dc2e450cde7139487b5983f8889 (diff)
parent73b4003f6545ae1ed9efd3abc3b25bd3ebd73c46 (diff)
downloadceph-wip-5672.tar.gz
Merge remote-tracking branch 'gh/next' into wip-5672wip-5672
-rwxr-xr-xsrc/ceph.in2
-rw-r--r--src/mon/OSDMonitor.cc98
-rw-r--r--src/mon/OSDMonitor.h5
-rw-r--r--src/mon/PaxosService.h5
-rwxr-xr-xsrc/pybind/ceph_rest_api.py3
5 files changed, 35 insertions, 78 deletions
diff --git a/src/ceph.in b/src/ceph.in
index 0f7179b8aed..6ba92c99b18 100755
--- a/src/ceph.in
+++ b/src/ceph.in
@@ -290,6 +290,8 @@ def admin_socket(asok_path, cmd):
sock.sendall(' '.join(cmd) + '\0')
len_str = sock.recv(4)
+ if len(len_str) < 4:
+ raise RuntimeError("no data returned from admin socket")
l, = struct.unpack(">I", len_str)
ret = ''
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index c8baac58c83..20e4eac88cb 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -185,8 +185,11 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
mon->pgmon()->check_osd_map(osdmap.epoch);
}
- update_logger();
+ check_subs();
+
share_map_with_random_osd();
+ update_logger();
+
process_failures();
// make sure our feature bits reflect the latest map
@@ -294,9 +297,6 @@ void OSDMonitor::on_active()
{
update_logger();
- send_to_waiting();
- check_subs();
-
if (thrash_map) {
if (mon->is_leader()) {
if (thrash())
@@ -310,22 +310,25 @@ void OSDMonitor::on_active()
mon->clog.info() << "osdmap " << osdmap << "\n";
if (!mon->is_leader()) {
- kick_all_failures();
+ list<MOSDFailure*> ls;
+ take_all_failures(ls);
+ while (!ls.empty()) {
+ dispatch(ls.front());
+ ls.pop_front();
+ }
}
}
void OSDMonitor::on_shutdown()
{
dout(10) << __func__ << dendl;
- map<epoch_t, list<PaxosServiceMessage*> >::iterator p = waiting_for_map.begin();
- while (p != waiting_for_map.end()) {
- while (!p->second.empty()) {
- Message *m = p->second.front();
- dout(20) << " discarding " << m << " " << *m << dendl;
- m->put();
- p->second.pop_front();
- }
- waiting_for_map.erase(p++);
+
+ // discard failure info, waiters
+ list<MOSDFailure*> ls;
+ take_all_failures(ls);
+ while (!ls.empty()) {
+ ls.front()->put();
+ ls.pop_front();
}
}
@@ -1049,23 +1052,16 @@ void OSDMonitor::process_failures()
}
}
-void OSDMonitor::kick_all_failures()
+void OSDMonitor::take_all_failures(list<MOSDFailure*>& ls)
{
- dout(10) << "kick_all_failures on " << failure_info.size() << " osds" << dendl;
- assert(!mon->is_leader());
+ dout(10) << __func__ << " on " << failure_info.size() << " osds" << dendl;
- list<MOSDFailure*> ls;
for (map<int,failure_info_t>::iterator p = failure_info.begin();
p != failure_info.end();
++p) {
p->second.take_report_messages(ls);
}
failure_info.clear();
-
- while (!ls.empty()) {
- dispatch(ls.front());
- ls.pop_front();
- }
}
@@ -1311,7 +1307,6 @@ void OSDMonitor::_reply_map(PaxosServiceMessage *m, epoch_t e)
{
dout(7) << "_reply_map " << e
<< " from " << m->get_orig_source_inst()
- << " for " << m
<< dendl;
send_latest(m, e);
}
@@ -1450,53 +1445,15 @@ bool OSDMonitor::prepare_remove_snaps(MRemoveSnaps *m)
// ---------------
// map helpers
-void OSDMonitor::send_to_waiting()
-{
- dout(10) << "send_to_waiting " << osdmap.get_epoch() << dendl;
-
- map<epoch_t, list<PaxosServiceMessage*> >::iterator p = waiting_for_map.begin();
- while (p != waiting_for_map.end()) {
- epoch_t from = p->first;
-
- if (from) {
- if (from <= osdmap.get_epoch()) {
- while (!p->second.empty()) {
- send_incremental(p->second.front(), from);
- p->second.front()->put();
- p->second.pop_front();
- }
- } else {
- dout(10) << "send_to_waiting from " << from << dendl;
- ++p;
- continue;
- }
- } else {
- while (!p->second.empty()) {
- send_full(p->second.front());
- p->second.front()->put();
- p->second.pop_front();
- }
- }
-
- waiting_for_map.erase(p++);
- }
-}
-
void OSDMonitor::send_latest(PaxosServiceMessage *m, epoch_t start)
{
- if (is_readable()) {
- dout(5) << "send_latest to " << m->get_orig_source_inst()
- << " start " << start << dendl;
- if (start == 0)
- send_full(m);
- else
- send_incremental(m, start);
- m->put();
- } else {
- dout(5) << "send_latest to " << m->get_orig_source_inst()
- << " start " << start << " later" << dendl;
- waiting_for_map[start].push_back(m);
- }
+ dout(5) << "send_latest to " << m->get_orig_source_inst()
+ << " start " << start << dendl;
+ if (start == 0)
+ send_full(m);
+ else
+ send_incremental(m, start);
+ m->put();
}
@@ -1651,6 +1608,7 @@ epoch_t OSDMonitor::blacklist(const entity_addr_t& a, utime_t until)
void OSDMonitor::check_subs()
{
+ dout(10) << __func__ << dendl;
string type = "osdmap";
if (mon->session_map.subs.count(type) == 0)
return;
@@ -1664,6 +1622,8 @@ void OSDMonitor::check_subs()
void OSDMonitor::check_sub(Subscription *sub)
{
+ dout(10) << __func__ << " " << sub << " next " << sub->next
+ << (sub->onetime ? " (onetime)":" (ongoing)") << dendl;
if (sub->next <= osdmap.get_epoch()) {
if (sub->next >= 1)
send_incremental(sub->next, sub->session->inst, sub->incremental_onetime);
diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h
index d6553228321..d7cb8fdf369 100644
--- a/src/mon/OSDMonitor.h
+++ b/src/mon/OSDMonitor.h
@@ -118,8 +118,6 @@ public:
OSDMap osdmap;
private:
- map<epoch_t, list<PaxosServiceMessage*> > waiting_for_map;
-
// [leader]
OSDMap::Incremental pending_inc;
map<int, failure_info_t> failure_info;
@@ -192,7 +190,6 @@ private:
bool can_mark_in(int o);
// ...
- void send_to_waiting(); // send current map to waiters.
MOSDMap *build_latest_full();
MOSDMap *build_incremental(epoch_t first, epoch_t last);
void send_full(PaxosServiceMessage *m);
@@ -212,7 +209,7 @@ private:
bool prepare_failure(class MOSDFailure *m);
bool prepare_mark_me_down(class MOSDMarkMeDown *m);
void process_failures();
- void kick_all_failures();
+ void take_all_failures(list<MOSDFailure*>& ls);
bool preprocess_boot(class MOSDBoot *m);
bool prepare_boot(class MOSDBoot *m);
diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h
index a5761d19ad8..74d5a90494c 100644
--- a/src/mon/PaxosService.h
+++ b/src/mon/PaxosService.h
@@ -438,8 +438,9 @@ public:
/**
* This is called when the Paxos state goes to active.
*
- * @remarks It's a courtesy method, in case the class implementing this
- * service has anything it wants/needs to do at that time.
+ * On the peon, this is after each election.
+ * On the leader, this is after each election, *and* after each completed
+ * proposal.
*
* @note This function may get called twice in certain recovery cases.
*/
diff --git a/src/pybind/ceph_rest_api.py b/src/pybind/ceph_rest_api.py
index 4841022e1d6..fdfe84ee3cb 100755
--- a/src/pybind/ceph_rest_api.py
+++ b/src/pybind/ceph_rest_api.py
@@ -2,11 +2,8 @@
# vim: ts=4 sw=4 smarttab expandtab
import os
-import sys
-import argparse
import collections
import ConfigParser
-import errno
import json
import logging
import logging.handlers