osd/SnapMapper: debug keys inserted, removed, and iterated

Hunting bug http://tracker.ceph.com/issues/19943

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-06-13 16:46:41 -04:00
parent 867ada5bd5
commit c5d129b526

View File

@ -166,6 +166,11 @@ void SnapMapper::clear_snaps(
assert(check(oid));
set<string> to_remove;
to_remove.insert(to_object_key(oid));
if (g_conf->subsys.should_gather(ceph_subsys_osd, 20)) {
for (auto& i : to_remove) {
dout(20) << __func__ << " rm " << i << dendl;
}
}
backend.remove_keys(to_remove, t);
}
@ -180,6 +185,11 @@ void SnapMapper::set_snaps(
::encode(in, bl);
to_set[to_object_key(oid)] = bl;
dout(20) << __func__ << " " << oid << " " << in.snaps << dendl;
if (g_conf->subsys.should_gather(ceph_subsys_osd, 20)) {
for (auto& i : to_set) {
dout(20) << __func__ << " set " << i.first << dendl;
}
}
backend.set_keys(to_set, t);
}
@ -214,6 +224,11 @@ int SnapMapper::update_snaps(
to_remove.insert(to_raw_key(make_pair(*i, oid)));
}
}
if (g_conf->subsys.should_gather(ceph_subsys_osd, 20)) {
for (auto& i : to_remove) {
dout(20) << __func__ << " rm " << i << dendl;
}
}
backend.remove_keys(to_remove, t);
return 0;
}
@ -240,6 +255,11 @@ void SnapMapper::add_oid(
++i) {
to_add.insert(to_raw(make_pair(*i, oid)));
}
if (g_conf->subsys.should_gather(ceph_subsys_osd, 20)) {
for (auto& i : to_add) {
dout(20) << __func__ << " set " << i.first << dendl;
}
}
backend.set_keys(to_add, t);
}
@ -259,6 +279,8 @@ int SnapMapper::get_next_objects_to_trim(
while (out->size() < max) {
pair<string, bufferlist> next;
r = backend.get_next(pos, &next);
dout(20) << __func__ << " get_next(" << pos << ") returns " << r
<< " " << next << dendl;
if (r != 0) {
break; // Done
}
@ -270,6 +292,7 @@ int SnapMapper::get_next_objects_to_trim(
assert(is_mapping(next.first));
dout(20) << __func__ << " " << next.first << dendl;
pair<snapid_t, hobject_t> next_decoded(from_raw(next));
assert(next_decoded.first == snap);
assert(check(next_decoded.second));
@ -313,6 +336,11 @@ int SnapMapper::_remove_oid(
++i) {
to_remove.insert(to_raw_key(make_pair(*i, oid)));
}
if (g_conf->subsys.should_gather(ceph_subsys_osd, 20)) {
for (auto& i : to_remove) {
dout(20) << __func__ << " rm " << i << dendl;
}
}
backend.remove_keys(to_remove, t);
return 0;
}