From 880027bf0812329bcb84ce0cb6720581e585d9e1 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Mon, 5 Mar 2018 16:40:41 -0800 Subject: [PATCH] cls/rgw: make usage_iterate_range()'s "truncated" parameter trustworthy 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 (cherry picked from commit 7ea8ca81f7c5ec9d3a6fc627be4f024a17397497) --- src/cls/rgw/cls_rgw.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index dbf61a40a1385..cff718e6229d6 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -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; } @@ -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; -- 2.39.5