summaryrefslogtreecommitdiffstats
path: root/src/cls
diff options
context:
space:
mode:
authorKefu Chai <tchaikov@gmail.com>2023-12-15 13:20:46 +0100
committerKefu Chai <tchaikov@gmail.com>2023-12-15 15:24:31 +0100
commit186540c112df9c1a2e467fe99b36d0cc13256535 (patch)
tree6a14bf1a55db0d04370aa1631729a0038b4837c9 /src/cls
parentMerge pull request #54878 from yuvalif/wip-yuval-split-rgw-tools (diff)
downloadceph-186540c112df9c1a2e467fe99b36d0cc13256535.tar.xz
ceph-186540c112df9c1a2e467fe99b36d0cc13256535.zip
cls/queue: always set member variables in ctor
this should address the test failures like ``` /tmp/typ-WWFeFl6yK /tmp/typ-sMfwoaGMU differ: byte 24, line 1 **** cls_2pc_reservation test 2 binary reencode check failed **** ceph-dencoder type cls_2pc_reservation select_test 2 encode export /tmp/typ-WWFeFl6yK ceph-dencoder type cls_2pc_reservation select_test 2 encode decode encode export /tmp/typ-sMfwoaGMU 2c2 < 00000010 00 00 00 00 00 00 c0 c6 92 10 |..........| --- > 00000010 00 00 00 00 00 00 c0 e6 cd 53 |.........S| ``` where we 1. encode the 2nd sample created by `generate_test_instances()`, 2. encode, decode, and encode again, the same sample and compare the encoded blobs. but if we fail to set any of the fields in `cls_2pc_reservation`, we are at the mercy of the random bits on stack/heap. in this change, all bits are initialized. the flaky test was introduced by 1d7cabf3 Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Diffstat (limited to 'src/cls')
-rw-r--r--src/cls/2pc_queue/cls_2pc_queue_types.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cls/2pc_queue/cls_2pc_queue_types.h b/src/cls/2pc_queue/cls_2pc_queue_types.h
index b270c9d6e79..093b69cb193 100644
--- a/src/cls/2pc_queue/cls_2pc_queue_types.h
+++ b/src/cls/2pc_queue/cls_2pc_queue_types.h
@@ -8,9 +8,9 @@ struct cls_2pc_reservation
{
using id_t = uint32_t;
inline static const id_t NO_ID{0};
- uint64_t size; // how much size to reserve (bytes)
+ uint64_t size = 0; // how much size to reserve (bytes)
ceph::coarse_real_time timestamp; // when the reservation was done (used for cleaning stale reservations)
- uint32_t entries; // how many entries are reserved
+ uint32_t entries = 0; // how many entries are reserved
cls_2pc_reservation(uint64_t _size, ceph::coarse_real_time _timestamp, uint32_t _entries) :
size(_size), timestamp(_timestamp), entries(_entries) {}