Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cluster: serde_fields for various structs #23118

Merged
merged 11 commits into from
Aug 30, 2024

Conversation

oleiman
Copy link
Member

@oleiman oleiman commented Aug 29, 2024

In #22782, we aim to require explicit serde_fields for serde structs that would otherwise use aggregate field order. This is one in a series of pull requests that add serde_fields to existing structs, to be followed by a PR to remove the aggregate order fallback from serde itself.

The primary acceptance criterion for this PR should be "field order unchanged". Any functional change is a bug.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.2.x
  • v24.1.x
  • v23.3.x

Release Notes

  • none

- archival_metadata_stm::segment
- archival_metadata_stm::start_offset_with_delta
- archival_metadata_stm::truncate_archive_commit_cmd

Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
- entity_value
- alter_quotas_request

Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
- empty_request
- get_status_response
- netcheck_request
- netcheck_response

Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
@oleiman oleiman self-assigned this Aug 29, 2024
@oleiman oleiman marked this pull request as ready for review August 29, 2024 00:34
dotnwat
dotnwat previously approved these changes Aug 29, 2024
@@ -164,6 +171,8 @@ struct archival_metadata_stm::spillover_cmd
static constexpr cmd_key key{9};
Copy link
Member

Choose a reason for hiding this comment

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

i wonder why serde doesn't encode static fields

Copy link
Member Author

Choose a reason for hiding this comment

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

presumably you could, but I suppose it's strictly wasted bits since the value wouldn't change per instance. or maybe more straightforwardly, "the same reason statics don't appear in structured bindings".

Copy link
Member

Choose a reason for hiding this comment

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

oh yeh i think it makes sense that they do not appear in the encodings!

@dotnwat dotnwat requested a review from ztlpn August 29, 2024 04:53
ztlpn
ztlpn previously approved these changes Aug 29, 2024
- copy_target

Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
- node_status_metadata
- node_status_request

Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
@oleiman oleiman dismissed stale reviews from ztlpn and dotnwat via 9f93962 August 29, 2024 16:27
@oleiman
Copy link
Member Author

oleiman commented Aug 29, 2024

force push to fix merge conflict

@oleiman oleiman requested review from dotnwat and ztlpn August 29, 2024 16:29
@oleiman
Copy link
Member Author

oleiman commented Aug 29, 2024

serialization_rt_test_rpunit::serde_reflection_roundtrip is demonstrably flaky (I can reproduce this locally). That seems...wrong. Failure looks like this:

/home/orenleiman/co/redpanda/src/v/cluster/tests/serialization_rt_test.cc(786): Entering test case "serde_reflection_roundtrip"
Failed serde roundtrip on N7cluster29configuration_with_assignmentINS_19topic_configurationEEE
/home/orenleiman/co/redpanda/src/v/cluster/tests/serialization_rt_test.cc(502): fatal error: in "serde_reflection_roundtrip": critical check original == from_serde has failed
Dump 780 bytes:
  00000000 | 00 00 06 03 00 00 02 00  6e 00 00 00 14 00 00 00  | ........n.......
  00000010 | 69 7a 68 56 37 30 77 44  63 71 49 62 42 4d 79 77  | izhV70wDcqIbBMyw
  00000020 | 6d 66 43 38 14 00 00 00  41 63 5a 63 30 31 42 4e  | mfC8....AcZc01BN
  00000030 | 64 35 6f 44 53 6e 46 65  65 66 47 64 61 00 00 00  | d5oDSnFeefGda...
  00000040 | 08 00 09 00 31 00 00 00  00 00 01 00 00 00 00 00  | ....1...........
  00000050 | 00 ff 01 00 9f 37 6f a3  8e ab 3b 00 01 00 00 00  | .....7o...;.....
/home/orenleiman/co/redpanda/src/v/cluster/tests/serialization_rt_test.cc(786): Leaving test case "serde_reflection_roundtrip"; testing time: 364us

Which looks genuine to me. Trying this out on dev right now.

@oleiman
Copy link
Member Author

oleiman commented Aug 29, 2024

Same failure on dev, specific to configuration_with_assignment<topic_configuration> aka topic_configuration_assignment.

@oleiman
Copy link
Member Author

oleiman commented Aug 30, 2024

This ought to fix it: #23149

@oleiman
Copy link
Member Author

oleiman commented Aug 30, 2024

/ci-repeat 1

@oleiman oleiman merged commit 817450a into redpanda-data:dev Aug 30, 2024
17 checks passed
@oleiman
Copy link
Member Author

oleiman commented Sep 1, 2024

@oleiman Curious why the force push removed this serde_fields() method?

https://github.com/redpanda-data/redpanda/compare/fd06016c90f15837c926d8141b1c390f4dd6a6b1..9f93962754e97eee718a06ca07d4bb1ae122d7a7#diff-a37731b2d2f3426c8e6eebf80be94745c8a7dfd547ccd9f6c60688f57f28ca4dL125

Oh yeah, ha, that's confusing. The reason is that it was added already upstream:

auto serde_fields() { return std::tie(hint); }

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.

4 participants