diff options
author | Kefu Chai <kchai@redhat.com> | 2019-12-26 14:42:18 +0100 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2019-12-26 14:42:20 +0100 |
commit | 19f1c55541b15afbed15cdc460b37a4c2b07aa3d (patch) | |
tree | 9237a79b7bcac8e4b0e13d76dd3e70e8637d9e64 /src/rgw/rgw_log.h | |
parent | Merge pull request #32150 from ricardoasmarques/set-osd-device-class (diff) | |
download | ceph-19f1c55541b15afbed15cdc460b37a4c2b07aa3d.tar.xz ceph-19f1c55541b15afbed15cdc460b37a4c2b07aa3d.zip |
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>
Diffstat (limited to '')
-rw-r--r-- | src/rgw/rgw_log.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/rgw/rgw_log.h b/src/rgw/rgw_log.h index dc3200f5f51..e8ac71cc053 100644 --- a/src/rgw/rgw_log.h +++ b/src/rgw/rgw_log.h @@ -26,9 +26,9 @@ struct rgw_log_entry { string uri; string http_status; string error_code; - uint64_t bytes_sent; - uint64_t bytes_received; - uint64_t obj_size; + uint64_t bytes_sent = 0; + uint64_t bytes_received = 0; + uint64_t obj_size = 0; Clock::duration total_time{}; string user_agent; string referrer; |