ceph-dencoder: OSD - Add missing types#52482
Conversation
664f0cb to
45e7bac
Compare
src/test/encoding/readble.py
Outdated
| @@ -0,0 +1,160 @@ | |||
| #!/usr/bin/env python3 | |||
There was a problem hiding this comment.
This doesn't look like a mds- or osd-targetting change. Maybe we have it (+ directly related parts) in a separated commit?
There was a problem hiding this comment.
thanks, need to delete it from that commit
src/test/encoding/readble.py
Outdated
|
|
||
| print("Passed {} tests.".format(numtests)) | ||
|
|
||
| if __name__ == "__main__": |
There was a problem hiding this comment.
Who's going to execute readable.py? I can't find a caller in this PR.
src/tools/ceph-dencoder/osd_types.h
Outdated
| TYPE_FEATUREFUL(pool_opts_t) | ||
| TYPE_FEATUREFUL(pg_missing_item) | ||
| TYPE(eversion_t) | ||
| //TYPE(compact_interval_t) decliered in .cc |
45e7bac to
d650b0d
Compare
src/osd/osd_types.h
Outdated
| template <bool TrackChanges> | ||
| class pg_missing_set : public pg_missing_const_i { | ||
| using item = pg_missing_item; | ||
| using item = pg_missing_item; |
| }; | ||
|
|
||
| #define TYPE(t) plugin->emplace<DencoderImplNoFeature<t>>(#t, false, false); | ||
| #define TYPE_VARARGS(t, ...) plugin->emplace<DencoderImplNoFeature<t>>(#t, false, false, ##__VA_ARGS__); |
There was a problem hiding this comment.
Does this definition have any users?
There was a problem hiding this comment.
Not yet, but for future use with arguments
src/mgr/OSDPerfMetricTypes.h
Outdated
|
|
||
| #include "include/denc.h" | ||
| #include "include/stringify.h" | ||
| #include "common/Formatter.h" |
There was a problem hiding this comment.
Why do we need to include Formatter here?
There was a problem hiding this comment.
moving it to .cc file
src/mon/CreatingPGs.h
Outdated
| } | ||
| void dump(ceph::Formatter *f) const { | ||
| f->dump_unsigned("create_epoch", create_epoch); | ||
| f->dump_unsigned("create_epoch1", create_epoch); |
There was a problem hiding this comment.
yep.. removing
| void dump(ceph::Formatter *f) const { | ||
| f->dump_unsigned("snap", snap); | ||
| f->dump_stream("hoid") << hoid; | ||
| } | ||
| static void generate_test_instances(std::list<Mapping*>& o) { | ||
| o.push_back(new Mapping); | ||
| o.push_back(new Mapping); | ||
| o.back()->snap = 1; | ||
| o.back()->hoid = hobject_t(object_t("objname"), "key", 123, 456, 0, ""); | ||
| } |
There was a problem hiding this comment.
SnapMapper support was already useful for my local branches 👍
src/osd/osd_types.cc
Outdated
|
|
||
| void PastIntervals::pg_interval_t::encode(ceph::buffer::list& bl) const | ||
| { | ||
|
|
src/osd/osd_types.cc
Outdated
| } | ||
|
|
||
| void PastIntervals::pg_interval_t::decode(ceph::buffer::list::const_iterator& bl) | ||
| void PastIntervals::pg_interval_t::decode(ceph::buffer::list::const_iterator& bl) |
src/osd/osd_types.cc
Outdated
| } | ||
|
|
||
| WRITE_CLASS_ENCODER(PastIntervals::pg_interval_t) | ||
|
|
src/tools/ceph-dencoder/osd_types.h
Outdated
| TYPE(PastIntervals::pg_interval_t) | ||
| using pg_interval_t = PastIntervals::pg_interval_t; | ||
| TYPE(pg_interval_t) |
There was a problem hiding this comment.
Why do we need both the namespace alias and the original namespaces declared?
I noticed that this was the case also with ceph::os::Transaction, MgrMap::StandbyInfo, etc.
There was a problem hiding this comment.
ceph-dencoder doesn't know how to find type when it doesn't have its namespace, and since we dumped the type without namespace we will "lose" checks for older version, but yes, i'll change that to skip those types, but will add dump for the full namespace
Running it for each PR change ../src/test/encoding/check-generated.sh |
Currently, ceph-dencoder lacks certain osd types, preventing us from accurately checking the ceph corpus for encode-decode mismatches. This pull request aims to address this issue by adding the missing types to ceph-dencoder. To successfully incorporate these types into ceph-dencoder, we need to introduce the necessary `dump` and `generate_test_instances` functions that was missing in some types. These functions are essential for proper encode and decode of the added types. This PR will enhance the functionality of ceph-dencoder by including the missing types, enabling a comprehensive analysis of encode-decode consistency. With the addition of these types, we can ensure the robustness and correctness of the ceph corpus. This update will significantly contribute to improving the overall reliability and accuracy of ceph-dencoder. It allows for a more comprehensive assessment of the encode-decode behavior, leading to enhanced data integrity and stability within the ceph ecosystem. Fixes: https://tracker.ceph.com/issues/61788 Signed-off-by: Nitzan Mordechai <nmordech@redhat.com>
d650b0d to
fb11471
Compare
| TYPE(bluestore_onode_t::shard_info) | ||
| using shard_info = bluestore_onode_t::shard_info; | ||
| TYPE(shard_info) |
There was a problem hiding this comment.
full namespace can be used exclusively for consistency
|
check-generated.sh is failing with few |
|
jenkins test make check |
rzarzynski
left a comment
There was a problem hiding this comment.
Overall LGTM! Just nits and few questions.
|
|
||
| void dump(ceph::Formatter *f) const { | ||
| f->open_array_section("report"); | ||
| for (auto& i : report) { |
There was a problem hiding this comment.
C++17's structured bindings could useful to provide names for the std::pair's members (query & report?).
|
|
||
| #include "include/buffer.h" | ||
| #include "include/types.h" | ||
| #include "common/Formatter.h" |
There was a problem hiding this comment.
nit: should be sorted alphabetically (c precedes i).
| #include <cstdint> | ||
| #include <ostream> | ||
| #include "include/denc.h" | ||
| #include "common/Formatter.h" |
There was a problem hiding this comment.
nit: should be sorted alphabetically.
|
|
||
| #include "mgr/OSDPerfMetricTypes.h" | ||
|
|
||
| #include "common/Formatter.h" |
There was a problem hiding this comment.
Our includes should appear after any standard ones. I know it's non-new but it would be really nice if we can fix that.
| #include "include/denc.h" | ||
| #include "include/stringify.h" | ||
|
|
||
| #include "common/ceph_json.h" |
There was a problem hiding this comment.
nit: should be sorted alphabetically.
| static void generate_test_instances(std::list<Transaction*>& o); | ||
| }; | ||
| WRITE_CLASS_ENCODER(Transaction) | ||
| WRITE_CLASS_ENCODER(ceph::os::Transaction) |
There was a problem hiding this comment.
Why this is needed? Just one line below we still have Transaction::TransactionData.
| { | ||
| o.push_back(new pg_notify_t(shard_id_t(3), shard_id_t::NO_SHARD, 1, 1, | ||
| pg_info_t(), PastIntervals())); | ||
| o.push_back(new pg_notify_t(shard_id_t(0), shard_id_t(0), 3, 10, |
There was a problem hiding this comment.
What's the reason behind stripping these test instances?
There was a problem hiding this comment.
i missed that change, hit some segfault and didn't place it back, added it back
| */ | ||
| struct pg_missing_item { | ||
| eversion_t need, have; | ||
|
|
There was a problem hiding this comment.
nit: do we need this blank?
| TYPE_FEATUREFUL(pg_missing_item) | ||
| TYPE(eversion_t) | ||
| //TYPE(compact_interval_t) declared in .cc | ||
| //TYPE(pg_missing_t::item) |
There was a problem hiding this comment.
i left it there just as a note, we currently can't include those types.
| //TYPE(compact_interval_t) declared in .cc | ||
| //TYPE(pg_missing_t::item) | ||
|
|
||
|
|
Currently, ceph-dencoder lacks certain osd type, preventing us from accurately checking the ceph corpus for encode-decode mismatches. This pull request aims to address this issue by adding the missing types to ceph-dencoder.
To successfully incorporate these types into ceph-dencoder, we need to introduce the necessary
dumpandgenerate_test_instancesfunctions that was missing in some types. These functions are essential for proper encode and decode of the added types.This PR will enhance the functionality of ceph-dencoder by including the missing types, enabling a comprehensive analysis of encode-decode consistency. With the addition of these types, we can ensure the robustness and correctness of the ceph corpus.
This update will significantly contribute to improving the overall reliability and accuracy of ceph-dencoder. It allows for a more comprehensive assessment of the encode-decode behavior, leading to enhanced data integrity and stability within the ceph ecosystem.
Fixes: https://tracker.ceph.com/issues/61788
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows