Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/ceph_objectstore_tool: fix 'dup' unable to duplicate meta PG #17623

Merged
merged 1 commit into from Sep 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/osd/PG.cc
Expand Up @@ -5968,10 +5968,8 @@ void PG::update_store_on_load()
// legacy filestore didn't store collection bit width; fix.
int bits = osd->store->collection_bits(coll);
if (bits < 0) {
if (coll.is_meta())
bits = 0;
else
bits = info.pgid.get_split_bits(pool.info.get_pg_num());
assert(!coll.is_meta()); // otherwise OSD::load_pgs() did a bad thing
bits = info.pgid.get_split_bits(pool.info.get_pg_num());
lderr(cct) << __func__ << " setting bit width to " << bits << dendl;
ObjectStore::Transaction t;
t.collection_set_bits(coll, bits);
Expand Down
10 changes: 7 additions & 3 deletions src/tools/ceph_objectstore_tool.cc
Expand Up @@ -2286,9 +2286,13 @@ int dup(string srcpath, ObjectStore *src, string dstpath, ObjectStore *dst)
ObjectStore::Transaction t;
int bits = src->collection_bits(cid);
if (bits < 0) {
cerr << "cannot get bit count for collection " << cid << ": "
<< cpp_strerror(bits) << std::endl;
goto out;
if (src->get_type() == "filestore" && cid.is_meta()) {
bits = 0;
} else {
cerr << "cannot get bit count for collection " << cid << ": "
<< cpp_strerror(bits) << std::endl;
goto out;
}
}
t.create_collection(cid, bits);
dst->apply_transaction(&osr, std::move(t));
Expand Down