From 22701b3c9a01484c9b6ccfd966e3dd7fae37348c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 15 Dec 2009 14:13:12 -0800 Subject: [PATCH] osd: include last_epoch_split in PG::Info::History Also drop backward compat encoding for same_up_since; overall osd format as reved since then. --- src/osd/OSD.cc | 1 + src/osd/PG.h | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 76ac7fb9987b2..c7d256087c71d 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2780,6 +2780,7 @@ void OSD::split_pg(PG *parent, map& children, ObjectStore::Transaction child->info.log_tail = parent->log.tail; child->info.log_backlog = parent->log.backlog; child->info.snap_trimq = parent->info.snap_trimq; + child->info.history.last_epoch_split = osdmap->get_epoch(); dout(20) << " child " << p->first << " log now "; child->log.print(*_dout); diff --git a/src/osd/PG.h b/src/osd/PG.h index f8c1d4888d17f..42ce2e95ec15c 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -98,13 +98,14 @@ public: struct History { epoch_t epoch_created; // epoch in which PG was created epoch_t last_epoch_started; // lower bound on last epoch started (anywhere, not necessarily locally) + epoch_t last_epoch_split; // as parent epoch_t same_up_since; // same acting set since epoch_t same_acting_since; // same acting set since epoch_t same_primary_since; // same primary at least back through this epoch. History() : epoch_created(0), - last_epoch_started(0), + last_epoch_started(0), last_epoch_split(0), same_up_since(0), same_acting_since(0), same_primary_since(0) {} void merge(const History &other) { @@ -112,11 +113,14 @@ public: epoch_created = other.epoch_created; if (last_epoch_started < other.last_epoch_started) last_epoch_started = other.last_epoch_started; + if (last_epoch_split < other.last_epoch_started) + last_epoch_split = other.last_epoch_started; } void encode(bufferlist &bl) const { ::encode(epoch_created, bl); ::encode(last_epoch_started, bl); + ::encode(last_epoch_split, bl); ::encode(same_acting_since, bl); ::encode(same_up_since, bl); ::encode(same_primary_since, bl); @@ -124,11 +128,10 @@ public: void decode(bufferlist::iterator &bl, version_t v) { ::decode(epoch_created, bl); ::decode(last_epoch_started, bl); + if (v >= 21) + ::decode(last_epoch_split, bl); ::decode(same_acting_since, bl); - if (v >= 20) - ::decode(same_up_since, bl); - else - same_up_since = same_acting_since; + ::decode(same_up_since, bl); ::decode(same_primary_since, bl); } } history; @@ -141,7 +144,7 @@ public: bool dne() const { return history.epoch_created == 0; } void encode(bufferlist &bl) const { - __u8 v = 20; + __u8 v = 21; ::encode(v, bl); ::encode(pgid, bl); -- 2.39.5