]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commit
rgw: initialize member variables of rgw_log_entry
authorKefu Chai <kchai@redhat.com>
Thu, 26 Dec 2019 13:42:18 +0000 (21:42 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 26 Dec 2019 13:42:20 +0000 (21:42 +0800)
commit19f1c55541b15afbed15cdc460b37a4c2b07aa3d
tree9237a79b7bcac8e4b0e13d76dd3e70e8637d9e64
parenta3045a7332516577bcb1a8072cec89eb02e55074
rgw: initialize member variables of rgw_log_entry

`check-generated.sh` tests the dencoder of a class by:

ceph-dencoder type rgw_log_entry select_test 2 dump_json > /tmp/foo
ceph-dencoder type rgw_log_entry select_test 2 encode decode dump_json > /tmp/bar
cmp /tmp/foo /tmp/bar

but the second test instance created by
`rgw_log_entry::generate_test_instances` is created using the default
constructor of `rgw_log_entry`. if any of the member variable is created
using random bits in the heap, there is chance that the test fails like:

2 rgw_log_entry
/tmp/typ-l5omDhmDf /tmp/typ-4aoRVkoiV differ: char 315, line 15
**** rgw_log_entry test 2 dump_json check failed ****
   ceph-dencoder type rgw_log_entry select_test 2 dump_json > /tmp/typ-l5omDhmDf
   ceph-dencoder type rgw_log_entry select_test 2 encode decode dump_json > /tmp/typ-4aoRVkoiV
15c15
<     "obj_size": 809908640,
---
>     "obj_size": 1122974112,

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/rgw/rgw_log.h