C_MDS_RestartReplay(MDS *mds_, uint64_t old_read_pos_) :
mds(mds_), old_read_pos(old_read_pos_) {}
void finish(int r) {
- if (old_read_pos < mds->mdlog->get_journaler()->get_expire_pos()) {
+ if (old_read_pos < mds->mdlog->get_journaler()->get_trimmed_pos()) {
cerr << "standby MDS fell behind active MDS journal's expire_pos, restarting" << std::endl;
mds->respawn(); /* we're too far back, and this is easier than
trying to reset everything in the cache, etc */
write_pos = flush_pos = h.write_pos;
expire_pos = h.expire_pos;
trimmed_pos = h.trimmed_pos;
+ init_headers(h);
state = STATE_ACTIVE;
finish->finish(r);
}
read_pos = requested_pos = received_pos = expire_pos = h.expire_pos;
trimmed_pos = trimming_pos = h.trimmed_pos;
+ init_headers(h);
+
dout(1) << "_finish_read_head " << h << ". probing for end of log (from " << write_pos << ")..." << dendl;
C_ProbeEnd *fin = new C_ProbeEnd(this);
state = STATE_PROBING;
class C_Trim;
friend class C_Trim;
+ // only init_headers when following or first reading off-disk
+ void init_headers(Header& h) {
+ assert(readonly ||
+ state == STATE_READHEAD);
+ last_written = last_committed = h;
+ }
+
public:
Journaler(inodeno_t ino_, int pool, const char *mag, Objecter *obj, Logger *l, int lkey, SafeTimer *tim) :
last_written(mag), last_committed(mag),