]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
cls/queue: always set member variables in ctor 54920/head
authorKefu Chai <tchaikov@gmail.com>
Fri, 15 Dec 2023 12:20:46 +0000 (20:20 +0800)
committerKefu Chai <tchaikov@gmail.com>
Fri, 15 Dec 2023 14:24:31 +0000 (22:24 +0800)
commit186540c112df9c1a2e467fe99b36d0cc13256535
tree6a14bf1a55db0d04370aa1631729a0038b4837c9
parent7911eea5fb03aeb9f93bfcf5048597461b3a260c
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>
src/cls/2pc_queue/cls_2pc_queue_types.h