Share with peers and write to disk on scrub completion.
Signed-off-by: Sage Weil <sage@newdream.net>
info.stats.reported.inc(info.history.same_primary_since);
info.stats.version = info.last_update;
info.stats.created = info.history.epoch_created;
+ info.stats.last_scrub = info.history.last_scrub;
+ info.stats.last_scrub_stamp = info.history.last_scrub_stamp;
pg_stats_valid = true;
pg_stats_stable = info.stats;
pg_stats_stable.state = state;
state_clear(PG_STATE_REPAIR);
// finish up
- info.stats.last_scrub = info.last_update;
- info.stats.last_scrub_stamp = g_clock.now();
+ info.history.last_scrub = info.last_update;
+ info.history.last_scrub_stamp = g_clock.now();
+ {
+ ObjectStore::Transaction *t = new ObjectStore::Transaction;
+ write_info(*t);
+ int tr = osd->store->queue_transaction(&osr, t);
+ assert(tr == 0);
+ }
+
+ share_pg_info();
out:
state_clear(PG_STATE_SCRUBBING);
unlock();
}
+void PG::share_pg_info()
+{
+ dout(10) << "share_pg_info" << dendl;
+
+ // share new PG::Info with replicas
+ for (unsigned i=1; i<acting.size(); i++) {
+ int peer = acting[i];
+ MOSDPGInfo *m = new MOSDPGInfo(osd->osdmap->get_epoch());
+ m->pg_info.push_back(info);
+ osd->cluster_messenger->send_message(m, osd->osdmap->get_cluster_inst(peer));
+ }
+}
+
+
unsigned int PG::Missing::num_missing() const
{
return missing.size();
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.
+
+ eversion_t last_scrub;
+ utime_t last_scrub_stamp;
+
History() :
epoch_created(0),
last_epoch_started(0), last_epoch_split(0),
last_epoch_started = other.last_epoch_started;
if (last_epoch_split < other.last_epoch_started)
last_epoch_split = other.last_epoch_started;
+ if (other.last_scrub > last_scrub)
+ last_scrub = other.last_scrub;
+ if (other.last_scrub_stamp > last_scrub_stamp)
+ last_scrub_stamp = other.last_scrub_stamp;
}
void encode(bufferlist &bl) const {
- __u8 struct_v = 1;
+ __u8 struct_v = 2;
::encode(struct_v, bl);
::encode(epoch_created, bl);
::encode(last_epoch_started, bl);
::encode(same_acting_since, bl);
::encode(same_up_since, bl);
::encode(same_primary_since, bl);
+ ::encode(last_scrub, bl);
+ ::encode(last_scrub_stamp, bl);
}
void decode(bufferlist::iterator &bl) {
__u8 struct_v;
::decode(same_acting_since, bl);
::decode(same_up_since, bl);
::decode(same_primary_since, bl);
+ if (struct_v >= 2) {
+ ::decode(last_scrub, bl);
+ ::decode(last_scrub_stamp, bl);
+ }
}
} history;
void queue_snap_trim();
+ void share_pg_info();
// abstract bits
int tr = osd->store->queue_transaction(&osr, t);
assert(tr == 0);
- // share new PG::Info with replicas
- for (unsigned i=1; i<acting.size(); i++) {
- int peer = acting[i];
- MOSDPGInfo *m = new MOSDPGInfo(osd->osdmap->get_epoch());
- m->pg_info.push_back(info);
- osd->cluster_messenger->
- send_message(m, osd->osdmap->get_cluster_inst(peer));
- }
+ share_pg_info();
unlock();
// flush, to make sure the collection adjustments we just made are