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>
{
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) {}