Skip to content

ceph-dencoder: OSD - Add missing types#52482

Closed
NitzanMordhai wants to merge 1 commit intomainfrom
wip-nitzan-ceph-dencoder-extend-osd-type-available
Closed

ceph-dencoder: OSD - Add missing types#52482
NitzanMordhai wants to merge 1 commit intomainfrom
wip-nitzan-ceph-dencoder-extend-osd-type-available

Conversation

@NitzanMordhai
Copy link
Contributor

@NitzanMordhai NitzanMordhai commented Jul 17, 2023

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 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

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@NitzanMordhai NitzanMordhai requested review from a team as code owners July 17, 2023 12:34
@NitzanMordhai NitzanMordhai force-pushed the wip-nitzan-ceph-dencoder-extend-osd-type-available branch 4 times, most recently from 664f0cb to 45e7bac Compare July 20, 2023 11:46
@@ -0,0 +1,160 @@
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look like a mds- or osd-targetting change. Maybe we have it (+ directly related parts) in a separated commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, need to delete it from that commit


print("Passed {} tests.".format(numtests))

if __name__ == "__main__":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who's going to execute readable.py? I can't find a caller in this PR.

TYPE_FEATUREFUL(pool_opts_t)
TYPE_FEATUREFUL(pg_missing_item)
TYPE(eversion_t)
//TYPE(compact_interval_t) decliered in .cc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@NitzanMordhai NitzanMordhai force-pushed the wip-nitzan-ceph-dencoder-extend-osd-type-available branch from 45e7bac to d650b0d Compare July 25, 2023 12:16
@NitzanMordhai NitzanMordhai changed the title ceph-dencoder: Add missing osd and mds types to ceph-dencoder for ac… ceph-dencoder: Add missing osd types to ceph-dencoder for acurate encode-decode comparison Jul 25, 2023
@NitzanMordhai NitzanMordhai requested a review from rzarzynski July 25, 2023 12:18
Copy link
Contributor

@Matan-B Matan-B left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good (and useful), left a few comments

Do we have a test that iterates through all the dencoder supported types? Might be useful before merging

template <bool TrackChanges>
class pg_missing_set : public pg_missing_const_i {
using item = pg_missing_item;
using item = pg_missing_item;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit extra space

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

};

#define TYPE(t) plugin->emplace<DencoderImplNoFeature<t>>(#t, false, false);
#define TYPE_VARARGS(t, ...) plugin->emplace<DencoderImplNoFeature<t>>(#t, false, false, ##__VA_ARGS__);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this definition have any users?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, but for future use with arguments


#include "include/denc.h"
#include "include/stringify.h"
#include "common/Formatter.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to include Formatter here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving it to .cc file

}
void dump(ceph::Formatter *f) const {
f->dump_unsigned("create_epoch", create_epoch);
f->dump_unsigned("create_epoch1", create_epoch);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep.. removing

Comment on lines +157 to +166
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, "");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SnapMapper support was already useful for my local branches 👍


void PastIntervals::pg_interval_t::encode(ceph::buffer::list& bl) const
{

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

void PastIntervals::pg_interval_t::decode(ceph::buffer::list::const_iterator& bl)
void PastIntervals::pg_interval_t::decode(ceph::buffer::list::const_iterator& bl)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit extra space

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

WRITE_CLASS_ENCODER(PastIntervals::pg_interval_t)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit extra new line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +28 to +30
TYPE(PastIntervals::pg_interval_t)
using pg_interval_t = PastIntervals::pg_interval_t;
TYPE(pg_interval_t)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Matan-B
Copy link
Contributor

Matan-B commented Aug 3, 2023

#52623 #52482 #52481 #52210 are all sharing (roughly) the same title.
May I suggest the following title format?
ceph-dencoder: < component > - Add missing types

@NitzanMordhai
Copy link
Contributor Author

Overall looks good (and useful), left a few comments

Do we have a test that iterates through all the dencoder supported types? Might be useful before merging

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>
@NitzanMordhai NitzanMordhai force-pushed the wip-nitzan-ceph-dencoder-extend-osd-type-available branch from d650b0d to fb11471 Compare August 6, 2023 08:16
@NitzanMordhai NitzanMordhai changed the title ceph-dencoder: Add missing osd types to ceph-dencoder for acurate encode-decode comparison ceph-dencoder: OSD - Add missing types Aug 6, 2023
Comment on lines +124 to +126
TYPE(bluestore_onode_t::shard_info)
using shard_info = bluestore_onode_t::shard_info;
TYPE(shard_info)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

full namespace can be used exclusively for consistency

@Matan-B
Copy link
Contributor

Matan-B commented Aug 6, 2023

check-generated.sh is failing with few failed to decode

error: void MonCommand::decode(ceph::buffer::list::const_iterator &) decode past end of struct encoding: Malformed input [buffer:3]
        /home/jenkins-build/build/workspace/ceph-pull-requests/ceph-object-corpus/archive/0.80-rc1-35-g4812150/objects/SnapMapper::object_snaps
**** failed to decode /home/jenkins-build/build/workspace/ceph-pull-requests/ceph-object-corpus/archive/0.80-rc1-35-g4812150/objects/MonCommand/6cde3066e02a9ab7fce3758724e719bb ****

@NitzanMordhai
Copy link
Contributor Author

jenkins test make check

Copy link
Contributor

@rzarzynski rzarzynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM! Just nits and few questions.


void dump(ceph::Formatter *f) const {
f->open_array_section("report");
for (auto& i : report) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should be sorted alphabetically (c precedes i).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

#include <cstdint>
#include <ostream>
#include "include/denc.h"
#include "common/Formatter.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should be sorted alphabetically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


#include "mgr/OSDPerfMetricTypes.h"

#include "common/Formatter.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should be sorted alphabetically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

static void generate_test_instances(std::list<Transaction*>& o);
};
WRITE_CLASS_ENCODER(Transaction)
WRITE_CLASS_ENCODER(ceph::os::Transaction)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason behind stripping these test instances?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i missed that change, hit some segfault and didn't place it back, added it back

*/
struct pg_missing_item {
eversion_t need, have;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do we need this blank?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, please continue review #52871

TYPE_FEATUREFUL(pg_missing_item)
TYPE(eversion_t)
//TYPE(compact_interval_t) declared in .cc
//TYPE(pg_missing_t::item)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: a doubled newline.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, please continue review #52871

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants