]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cls/user: reset stats only returns marker when truncated
authorCasey Bodley <cbodley@redhat.com>
Thu, 19 Sep 2024 16:19:19 +0000 (12:19 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 7 Oct 2024 13:56:45 +0000 (09:56 -0400)
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 <cbodley@redhat.com>
(cherry picked from commit 5400aab8d92b1260d331e72ae81030424a1e1797)

src/cls/user/cls_user.cc

index e278ad7fc12834ae2fc355d4cf6232f29a34eddf..c0c37911d1c21b9b91faad87681fa9b50da253ce 100644 (file)
@@ -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;