]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ObjectStore: Add "need_journal" interface to make aware of journal device 2607/head
authorHaomai Wang <haomaiwang@gmail.com>
Tue, 30 Sep 2014 05:45:10 +0000 (13:45 +0800)
committerHaomai Wang <haomaiwang@gmail.com>
Wed, 1 Oct 2014 02:40:09 +0000 (10:40 +0800)
Impl feature #9580

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
src/ceph_osd.cc
src/os/FileStore.h
src/os/KeyValueStore.h
src/os/MemStore.h
src/os/ObjectStore.h

index 1ee236468ad7ea103fd57c06eb07ff4562378da9..d4734d225eb1804fba70f6fa641d40cb0ca2ec7a 100644 (file)
@@ -107,6 +107,7 @@ int main(int argc, const char **argv)
   bool get_journal_fsid = false;
   bool get_osd_fsid = false;
   bool get_cluster_fsid = false;
+  bool check_need_journal = false;
   std::string dump_pg_log;
 
   std::string val;
@@ -136,6 +137,8 @@ int main(int argc, const char **argv)
       get_osd_fsid = true;
     } else if (ceph_argparse_flag(args, i, "--get-journal-fsid", "--get-journal-uuid", (char*)NULL)) {
       get_journal_fsid = true;
+    } else if (ceph_argparse_flag(args, i, "--check-needs-journal", (char*)NULL)) {
+      check_need_journal = true;
     } else {
       ++i;
     }
@@ -308,6 +311,14 @@ int main(int argc, const char **argv)
     exit(r);
   }
 
+  if (check_need_journal) {
+    if (store->check_need_journal())
+      cout << "yes" << std::endl;
+    else
+      cout << "no" << std::endl;
+    exit(0);
+  }
+
   string magic;
   uuid_d cluster_fsid, osd_fsid;
   int w;
index f6ed7bb4b713009799c0277de58810c42f8bb2d2..2486a80e59a48cd9f7f4fddf73a6d77e9c50bdc6 100644 (file)
@@ -96,6 +96,7 @@ public:
     return target_version;
   }
 
+  bool need_journal() { return true; }
   int peek_journal_fsid(uuid_d *fsid);
 
   struct FSPerfTracker {
index 9ed47c70f41c96a0880f2ceed13976e2bbdfbff8..86cd7aec69d24f5cd9b1b93ae810712edce91233 100644 (file)
@@ -484,6 +484,7 @@ class KeyValueStore : public ObjectStore,
   uint32_t get_target_version() {
     return target_version;
   }
+  bool need_journal() { return false; };
   int peek_journal_fsid(uuid_d *id) {
     *id = fsid;
     return 0;
index dbdc7f7be0e2947c5bc5e6288f6cb2b646094b9f..fa16b07ef0bcef37bb1a8aca6b5146a204585dd8 100644 (file)
@@ -242,6 +242,7 @@ public:
     return 1;
   }
 
+  bool need_journal() { return false; };
   int peek_journal_fsid(uuid_d *fsid);
 
   bool test_mount_in_use() {
index 20f925bc66beff317155f91b5263f108a3c95ccf..1043547a1c21f6a37efd5bcd8fb447f2abd635b3 100644 (file)
@@ -1248,6 +1248,14 @@ public:
    */
   virtual uint32_t get_target_version() = 0;
 
+  /**
+   * check whether need journal device
+   *
+   * It's not constant for backend store. FileStore could have journaless mode
+   * and KeyValueStore could have journal device for special backend.
+   */
+  virtual bool need_journal() = 0;
+
   /**
    * check the journal uuid/fsid, without opening
    */