ObjectStore: Add "need_journal" interface to make aware of journal device

Impl feature #9580

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
This commit is contained in:
Haomai Wang 2014-09-30 13:45:10 +08:00
parent ccf3e06a7c
commit 2955b3da4e
5 changed files with 22 additions and 0 deletions

View 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;

View File

@ -96,6 +96,7 @@ public:
return target_version;
}
bool need_journal() { return true; }
int peek_journal_fsid(uuid_d *fsid);
struct FSPerfTracker {

View 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;

View 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() {

View 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
*/