]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: separate type for gratuitous debug ESubtreeMaps
authorSage Weil <sage@newdream.net>
Thu, 28 Jul 2011 21:51:06 +0000 (14:51 -0700)
committerSage Weil <sage@newdream.net>
Thu, 28 Jul 2011 23:01:07 +0000 (16:01 -0700)
Give these a different type so they are not interpreted as subtree
boundaries during replay.  Otherwise we break the truncate_finish code,
which references the truncate_start logsegment by offset.  Probably other
stuff too.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/LogEvent.cc
src/mds/LogEvent.h
src/mds/MDCache.cc
src/mds/MDLog.cc
src/mds/MDLog.h

index f02f0521719e32f975e6a6712ef9fcf6a2852508..0c3b965f86a3acceb01f6a242846c6d0158ea9e8 100644 (file)
@@ -55,6 +55,10 @@ LogEvent *LogEvent::decode(bufferlist& bl)
   case EVENT_STRING: le = new EString; break;
 
   case EVENT_SUBTREEMAP: le = new ESubtreeMap; break;
+  case EVENT_SUBTREEMAP_TEST: 
+    le = new ESubtreeMap;
+    le->set_type(type);
+    break;
   case EVENT_EXPORT: le = new EExport; break;
   case EVENT_IMPORTSTART: le = new EImportStart; break;
   case EVENT_IMPORTFINISH: le = new EImportFinish; break;
index 87489a7bbe2695bde5b39d5b17ea21229b4445e4..075257899a5b0b78f78896008a9e7a9965848de3 100644 (file)
@@ -36,6 +36,7 @@
 #define EVENT_TABLECLIENT  42
 #define EVENT_TABLESERVER  43
 
+#define EVENT_SUBTREEMAP_TEST   50
 
 
 #include <string>
@@ -65,11 +66,13 @@ protected:
     : _type(t), _start_off(0), _segment(0) { }
   virtual ~LogEvent() { }
 
-  int get_type() { return _type; }
+  int get_type() const { return _type; }
+  void set_type(int t) { _type = t; }
+
   uint64_t get_start_off() const { return _start_off; }
   void set_start_off(uint64_t o) { _start_off = o; }
-  utime_t get_stamp() const { return stamp; }
 
+  utime_t get_stamp() const { return stamp; }
   void set_stamp(utime_t t) { stamp = t; }
 
   // encoding
index 2fc4e36ec01fb3b786b829730ea75c545e1ff047..9bc39703355c59e6cc9b8a4a14f1dac40548283d 100644 (file)
@@ -5243,8 +5243,10 @@ struct C_MDC_TruncateLogged : public Context {
 void MDCache::truncate_inode_finish(CInode *in, LogSegment *ls)
 {
   dout(10) << "truncate_inode_finish " << *in << dendl;
-
-  ls->truncating_inodes.erase(in);
+  
+  set<CInode*>::iterator p = ls->truncating_inodes.find(in);
+  assert(p != ls->truncating_inodes.end());
+  ls->truncating_inodes.erase(p);
 
   // update
   inode_t *pi = in->project_inode();
@@ -5289,12 +5291,14 @@ void MDCache::truncate_inode_logged(CInode *in, Mutation *mut)
 
 void MDCache::add_recovered_truncate(CInode *in, LogSegment *ls)
 {
+  dout(20) << "add_recovered_truncate " << *in << " in " << ls << " offset " << ls->offset << dendl;
   ls->truncating_inodes.insert(in);
   in->get(CInode::PIN_TRUNCATING);
 }
 
 void MDCache::remove_recovered_truncate(CInode *in, LogSegment *ls)
 {
+  dout(20) << "remove_recovered_truncate " << *in << " in " << ls << " offset " << ls->offset << dendl;
   // if we have the logseg the truncate started in, it must be in our list.
   set<CInode*>::iterator p = ls->truncating_inodes.find(in);
   assert(p != ls->truncating_inodes.end());
index a06adbed80047627b3a5ed12003b920927c191fd..a228ddecb2be8157a7466a4d1dd73e2738fda453 100644 (file)
@@ -212,9 +212,14 @@ void MDLog::submit_entry(LogEvent *le, Context *c)
             << ", cur pos = " << journaler->get_write_pos() << dendl;
     start_new_segment();
   } else if (g_conf->mds_debug_subtrees &&
+            le->get_type() != EVENT_SUBTREEMAP_TEST &&
             le->get_type() != EVENT_SUBTREEMAP) {
-    // debug: journal this every time to catch subtree replay bugs
-    submit_entry(mds->mdcache->create_subtree_map());
+    // debug: journal this every time to catch subtree replay bugs.
+    // use a different event id so it doesn't get interpreted as a
+    // LogSegment boundary on replay.
+    LogEvent *le = mds->mdcache->create_subtree_map();
+    le->set_type(EVENT_SUBTREEMAP_TEST);
+    submit_entry(le);
   }
 
   delete le;
index d062a21d5f38a188fde483fc77902a04dc9eb4ad..7ecfc5638e88b9c7457d158af73da8db42c662b4 100644 (file)
@@ -162,7 +162,6 @@ public:
     return NULL;
   }
 
-
   void flush_logger();
 
   size_t get_num_events() { return num_events; }