]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: record cap flush tid in log event
authorYan, Zheng <zyan@redhat.com>
Wed, 3 Jun 2015 10:57:52 +0000 (18:57 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 18 Aug 2015 08:49:50 +0000 (16:49 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/events/EMetaBlob.h
src/mds/journal.cc

index 16171404523cb0b88d27094838de47e2c4dc747f..7d219e936391c8948be0b726fee3ac02ad51049f 100644 (file)
@@ -314,6 +314,7 @@ private:
 
   // idempotent op(s)
   list<pair<metareqid_t,uint64_t> > client_reqs;
+  list<pair<metareqid_t,uint64_t> > client_flushes;
 
  public:
   void encode(bufferlist& bl) const;
@@ -346,6 +347,9 @@ private:
   void add_client_req(metareqid_t r, uint64_t tid=0) {
     client_reqs.push_back(pair<metareqid_t,uint64_t>(r, tid));
   }
+  void add_client_flush(metareqid_t r, uint64_t tid=0) {
+    client_flushes.push_back(pair<metareqid_t,uint64_t>(r, tid));
+  }
 
   void add_table_transaction(int table, version_t tid) {
     table_tids.push_back(pair<__u8, version_t>(table, tid));
index ee94dd392cc4973ebaaa91bc6f1215dd6a3bbba9..406a929ac544ff4af3ddc8910fe5151ecd30697d 100644 (file)
@@ -753,7 +753,7 @@ void EMetaBlob::dirlump::generate_test_instances(list<dirlump*>& ls)
  */
 void EMetaBlob::encode(bufferlist& bl) const
 {
-  ENCODE_START(7, 5, bl);
+  ENCODE_START(8, 5, bl);
   ::encode(lump_order, bl);
   ::encode(lump_map, bl);
   ::encode(roots, bl);
@@ -778,6 +778,7 @@ void EMetaBlob::encode(bufferlist& bl) const
     ::encode(i, bl);
     ::encode(b, bl);
   }
+  ::encode(client_flushes, bl);
   ENCODE_FINISH(bl);
 }
 void EMetaBlob::decode(bufferlist::iterator &bl)
@@ -827,6 +828,9 @@ void EMetaBlob::decode(bufferlist::iterator &bl)
     ::decode(i, bl);
     ::decode(b, bl);
   }
+  if (struct_v >= 8) {
+    ::decode(client_flushes, bl);
+  }
   DECODE_FINISH(bl);
 }
 
@@ -1607,6 +1611,21 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
     }
   }
 
+  // client flushes
+  for (list<pair<metareqid_t, uint64_t> >::iterator p = client_flushes.begin();
+       p != client_flushes.end();
+       ++p) {
+    if (p->first.name.is_client()) {
+      dout(10) << "EMetaBlob.replay flush " << p->first << " trim_to " << p->second << dendl;
+      Session *session = mds->sessionmap.get_session(p->first.name);
+      if (session) {
+       session->add_completed_flush(p->first.tid);
+       if (p->second)
+         session->trim_completed_flushes(p->second);
+      }
+    }
+  }
+
   // update segment
   update_segment(logseg);