mirror of
https://github.com/ceph/ceph
synced 2024-12-22 03:22:00 +00:00
ceph-kvstore-tool: compact{,-prefix,-range}
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
d7f74d86e9
commit
852f4da3b1
@ -211,6 +211,16 @@ class StoreTool
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void compact() {
|
||||
db->compact();
|
||||
}
|
||||
void compact_prefix(string prefix) {
|
||||
db->compact_prefix(prefix);
|
||||
}
|
||||
void compact_range(string prefix, string start, string end) {
|
||||
db->compact_range(prefix, start, end);
|
||||
}
|
||||
};
|
||||
|
||||
void usage(const char *pname)
|
||||
@ -227,6 +237,9 @@ void usage(const char *pname)
|
||||
<< " set <prefix> <key> [ver <N>|in <file>]\n"
|
||||
<< " store-copy <path> [num-keys-per-tx]\n"
|
||||
<< " store-crc <path>\n"
|
||||
<< " compact\n"
|
||||
<< " compact-prefix <prefix>\n"
|
||||
<< " compact-range <prefix> <start> <end>\n"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
@ -426,6 +439,24 @@ int main(int argc, const char *argv[])
|
||||
uint32_t crc = st.traverse(string(), true, NULL);
|
||||
std::cout << "store at '" << path << "' crc " << crc << std::endl;
|
||||
|
||||
} else if (cmd == "compact") {
|
||||
st.compact();
|
||||
} else if (cmd == "compact-prefix") {
|
||||
if (argc < 5) {
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
string prefix(url_unescape(argv[4]));
|
||||
st.compact_prefix(prefix);
|
||||
} else if (cmd == "compact-range") {
|
||||
if (argc < 7) {
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
string prefix(url_unescape(argv[4]));
|
||||
string start(url_unescape(argv[5]));
|
||||
string end(url_unescape(argv[6]));
|
||||
st.compact_range(prefix, start, end);
|
||||
} else {
|
||||
std::cerr << "Unrecognized command: " << cmd << std::endl;
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user