From 791e29d118505e527ae29be7bc30fc671484d4b7 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 19 Sep 2024 12:19:19 -0400 Subject: [PATCH] cls/user: reset stats only returns marker when truncated the returned marker is a bucket name. when bucket names are long, the response can overflow the 64-byte limit on responses to write operations with librados::OPERATION_RETURNVEC. this leads to errors like: > ERROR: could not reset user stats: (75) Value too large for defined data type however, the client only needs this marker string to resume listing after a truncated response. if the listing is not truncated, we can omit the marker to save space in general, users will have less than MAX_ENTRIES=1000 buckets, so won't get truncated listings Fixes: https://tracker.ceph.com/issues/51786 Signed-off-by: Casey Bodley (cherry picked from commit 5400aab8d92b1260d331e72ae81030424a1e1797) --- src/cls/user/cls_user.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cls/user/cls_user.cc b/src/cls/user/cls_user.cc index e278ad7fc12..c0c37911d1c 100644 --- a/src/cls/user/cls_user.cc +++ b/src/cls/user/cls_user.cc @@ -478,10 +478,6 @@ static int cls_user_reset_stats2(cls_method_context_t hctx, add_header_stats(&ret.acc_stats, e); } - /* try-update marker */ - if(!keys.empty()) - ret.marker = (--keys.cend())->first; - if (! ret.truncated) { buffer::list bl; header.last_stats_update = op.time; @@ -496,6 +492,10 @@ static int cls_user_reset_stats2(cls_method_context_t hctx, return rc; } + /* try-update marker */ + if(!keys.empty()) + ret.marker = (--keys.cend())->first; + /* return partial result */ encode(ret, *out); return 0; -- 2.39.5