mds: update pending_for_mds during table server replay

Otherwise we our replay of AGREE after recovery is wrong; we just replay
what was saved, without taking additional journaled items into account.
This commit is contained in:
Sage Weil 2009-11-23 15:43:36 -08:00
parent fd21693fa6
commit cd6f381710
3 changed files with 12 additions and 4 deletions

View File

@ -46,9 +46,6 @@ void MDSTableServer::handle_prepare(MMDSTableRequest *req)
bufferlist bl = req->bl;
_prepare(req->bl, req->reqid, from);
pending_for_mds[version].mds = from;
pending_for_mds[version].reqid = req->reqid;
pending_for_mds[version].tid = version;
ETableServer *le = new ETableServer(table, TABLESERVER_OP_PREPARE, req->reqid, from, version, version);
le->mutation = bl; // original request, NOT modified return value coming out of _prepare!
@ -76,7 +73,6 @@ void MDSTableServer::handle_commit(MMDSTableRequest *req)
if (pending_for_mds.count(tid)) {
_commit(tid);
pending_for_mds.erase(tid);
mds->mdlog->submit_entry(new ETableServer(table, TABLESERVER_OP_COMMIT, 0, -1, tid, version));
mds->mdlog->wait_for_sync(new C_Commit(this, req));
}

View File

@ -78,6 +78,16 @@ private:
virtual void _rollback(version_t tid) = 0;
virtual void _server_update(bufferlist& bl) { assert(0); }
void _note_prepare(int mds, __u64 reqid) {
pending_for_mds[version].mds = mds;
pending_for_mds[version].reqid = reqid;
pending_for_mds[version].tid = version;
}
void _note_commit(__u64 tid) {
pending_for_mds.erase(tid);
}
MDSTableServer(MDS *m, int tab) : MDSTable(m, get_mdstable_name(tab), false), table(tab) {}
virtual ~MDSTableServer() {}

View File

@ -779,9 +779,11 @@ void ETableServer::replay(MDS *mds)
switch (op) {
case TABLESERVER_OP_PREPARE:
server->_prepare(mutation, reqid, bymds);
server->_note_prepare(bymds, reqid);
break;
case TABLESERVER_OP_COMMIT:
server->_commit(tid);
server->_note_commit(tid);
break;
case TABLESERVER_OP_SERVER_UPDATE:
server->_server_update(mutation);