Skip to content

Commit

Permalink
cls/rgw: make usage_iterate_range()'s "truncated" parameter trustworthy
Browse files Browse the repository at this point in the history
Set it to false whenever we identify that we've reached the end of our
range, even if the underlying OSD op says it could have given us more
results. Then rely on that instead of weird iter-based logic to tell
our client that it doesn't need to do more work.

Fixes: https://tracker.ceph.com/issues/22963

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
(cherry picked from commit 7ea8ca8)
  • Loading branch information
gregsfortytwo authored and theanalyst committed Apr 12, 2018
1 parent 207f12b commit 880027b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cls/rgw/cls_rgw.cc
Expand Up @@ -2958,12 +2958,18 @@ static int usage_iterate_range(cls_method_context_t hctx, uint64_t start, uint64

if (!by_user && key.compare(end_key) >= 0) {
CLS_LOG(20, "usage_iterate_range reached key=%s, done", key.c_str());
if (truncated) {
*truncated = false;
}
key_iter = key;
return 0;
}

if (by_user && key.compare(0, user_key.size(), user_key) != 0) {
CLS_LOG(20, "usage_iterate_range reached key=%s, done", key.c_str());
if (truncated) {
*truncated = false;
}
key_iter = key;
return 0;
}
Expand Down Expand Up @@ -3080,7 +3086,7 @@ int rgw_user_usage_log_trim(cls_method_context_t hctx, bufferlist *in, bufferlis
if (ret < 0)
return ret;

if (!more && iter.empty())
if (!more)
return -ENODATA;

return 0;
Expand Down

0 comments on commit 880027b

Please sign in to comment.