Merge pull request #17939 from mkogan1/wip-rgw-21196

rgw: update the usage read iterator in truncated scenario
This commit is contained in:
Matt Benjamin 2017-10-05 13:43:09 -04:00 committed by GitHub
commit 58909e799b

View File

@ -2895,9 +2895,7 @@ static int usage_iterate_range(cls_method_context_t hctx, uint64_t start, uint64
bool by_user = !user.empty();
uint32_t i = 0;
string user_key;
if (truncated)
*truncated = false;
bool truncated_status = false;
if (!by_user) {
usage_record_prefix_by_time(end, end_key);
@ -2917,11 +2915,14 @@ static int usage_iterate_range(cls_method_context_t hctx, uint64_t start, uint64
}
CLS_LOG(20, "usage_iterate_range start_key=%s", start_key.c_str());
int ret = cls_cxx_map_get_vals(hctx, start_key, filter_prefix, max_entries, &keys, truncated);
int ret = cls_cxx_map_get_vals(hctx, start_key, filter_prefix, max_entries, &keys, &truncated_status);
if (ret < 0)
return ret;
if (truncated) {
*truncated = truncated_status;
}
map<string, bufferlist>::iterator iter = keys.begin();
if (iter == keys.end())
return 0;
@ -2934,11 +2935,17 @@ 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_status) {
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_status) {
key_iter = key;
}
return 0;
}