summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2012-09-19 17:30:43 -0700
committerSamuel Just <sam.just@inktank.com>2012-12-05 11:34:18 -0800
commit6e67a27f892cd551cc84c7c19a9add349948759b (patch)
tree371e3c69af78b103e0184a61f463cee18563ff02
parent36c0fd220ef02b1ffd7a3ae0d98e0fdec6b55a5b (diff)
downloadceph-6e67a27f892cd551cc84c7c19a9add349948759b.tar.gz
osd/: splitting a pg now triggers a new interval
Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r--src/osd/OSD.cc1
-rw-r--r--src/osd/PG.cc18
-rw-r--r--src/osd/PG.h1
-rw-r--r--src/osd/osd_types.cc7
-rw-r--r--src/osd/osd_types.h1
5 files changed, 22 insertions, 6 deletions
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index 27d6829bdf1..f9ea8624be1 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -1532,6 +1532,7 @@ void OSD::build_past_intervals_parallel()
pg->info.history.last_epoch_clean,
cur_map, last_map,
pg->info.pgid.pool(),
+ pg->info.pgid,
&pg->past_intervals,
&debug);
if (new_interval) {
diff --git a/src/osd/PG.cc b/src/osd/PG.cc
index 8c4c29ba7e7..89ae7d06d79 100644
--- a/src/osd/PG.cc
+++ b/src/osd/PG.cc
@@ -869,6 +869,7 @@ void PG::generate_past_intervals()
cur_map,
last_map,
info.pgid.pool(),
+ info.pgid,
&past_intervals,
&debug);
if (new_interval) {
@@ -4318,6 +4319,13 @@ bool PG::may_need_replay(const OSDMapRef osdmap) const
return crashed;
}
+bool PG::is_split(OSDMapRef lastmap, OSDMapRef nextmap)
+{
+ return info.pgid.is_split(
+ lastmap->get_pg_num(pool.id),
+ nextmap->get_pg_num(pool.id),
+ 0);
+}
bool PG::acting_up_affected(const vector<int>& newup, const vector<int>& newacting)
{
@@ -4426,14 +4434,14 @@ void PG::start_peering_interval(const OSDMapRef lastmap,
info.history.same_interval_since,
info.history.last_epoch_clean,
osdmap,
- lastmap, info.pgid.pool(), &past_intervals);
+ lastmap, info.pgid.pool(), info.pgid, &past_intervals);
if (new_interval) {
dout(10) << " noting past " << past_intervals.rbegin()->second << dendl;
dirty_info = true;
}
}
- if (oldacting != acting || oldup != up) {
+ if (oldacting != acting || oldup != up || is_split(lastmap, osdmap)) {
info.history.same_interval_since = osdmap->get_epoch();
}
if (oldup != up) {
@@ -4968,7 +4976,8 @@ boost::statechart::result PG::RecoveryState::Started::react(const AdvMap& advmap
{
dout(10) << "Started advmap" << dendl;
PG *pg = context< RecoveryMachine >().pg;
- if (pg->acting_up_affected(advmap.newup, advmap.newacting)) {
+ if (pg->acting_up_affected(advmap.newup, advmap.newacting) ||
+ pg->is_split(advmap.lastmap, advmap.osdmap)) {
dout(10) << "up or acting affected, transitioning to Reset" << dendl;
post_event(advmap);
return transit< Reset >();
@@ -5020,7 +5029,8 @@ boost::statechart::result PG::RecoveryState::Reset::react(const AdvMap& advmap)
pg->generate_past_intervals();
pg->remove_down_peer_info(advmap.osdmap);
- if (pg->acting_up_affected(advmap.newup, advmap.newacting)) {
+ if (pg->acting_up_affected(advmap.newup, advmap.newacting) ||
+ pg->is_split(advmap.lastmap, advmap.osdmap)) {
dout(10) << "up or acting affected, calling start_peering_interval again"
<< dendl;
pg->start_peering_interval(advmap.lastmap, advmap.newup, advmap.newacting);
diff --git a/src/osd/PG.h b/src/osd/PG.h
index b9693fb072a..536f04dda64 100644
--- a/src/osd/PG.h
+++ b/src/osd/PG.h
@@ -1729,6 +1729,7 @@ public:
void fulfill_info(int from, const pg_query_t &query,
pair<int, pg_info_t> &notify_info);
void fulfill_log(int from, const pg_query_t &query, epoch_t query_epoch);
+ bool is_split(OSDMapRef lastmap, OSDMapRef nextmap);
bool acting_up_affected(const vector<int>& newup, const vector<int>& newacting);
// OpRequest queueing
diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc
index 4a1b3fcf2ef..c65797b9988 100644
--- a/src/osd/osd_types.cc
+++ b/src/osd/osd_types.cc
@@ -1478,14 +1478,17 @@ bool pg_interval_t::check_new_interval(
OSDMapRef osdmap,
OSDMapRef lastmap,
int64_t pool_id,
+ pg_t pgid,
map<epoch_t, pg_interval_t> *past_intervals,
std::ostream *out)
{
// remember past interval
if (new_acting != old_acting || new_up != old_up ||
(!(lastmap->get_pools().count(pool_id))) ||
- lastmap->get_pools().find(pool_id)->second.min_size !=
- osdmap->get_pools().find(pool_id)->second.min_size) {
+ (lastmap->get_pools().find(pool_id)->second.min_size !=
+ osdmap->get_pools().find(pool_id)->second.min_size) ||
+ pgid.is_split(lastmap->get_pg_num(pgid.pool()),
+ osdmap->get_pg_num(pgid.pool()), 0)) {
pg_interval_t& i = (*past_intervals)[same_interval_since];
i.first = same_interval_since;
i.last = osdmap->get_epoch() - 1;
diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h
index da2b2abf319..0cc961965d7 100644
--- a/src/osd/osd_types.h
+++ b/src/osd/osd_types.h
@@ -1144,6 +1144,7 @@ struct pg_interval_t {
std::tr1::shared_ptr<const OSDMap> osdmap, ///< [in] current map
std::tr1::shared_ptr<const OSDMap> lastmap, ///< [in] last map
int64_t poolid, ///< [in] pool for pg
+ pg_t pgid, ///< [in] pgid for pg
map<epoch_t, pg_interval_t> *past_intervals,///< [out] intervals
ostream *out = 0 ///< [out] debug ostream
);