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

treewide: address newer clang-tidy warnings #17401

Merged
merged 6 commits into from
Apr 2, 2024

Conversation

rockwotj
Copy link
Contributor

Running the public build with clang 17 and clang-tidy picks up some new warnings.

There are way too many to fix the not used rvalue warnings, but hopefully we can chip away at those overtime.

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
  • v23.3.x
  • v23.2.x

Release Notes

  • none

This fails in a bunch of ways right now, so let's disable it. Ideally
it's re-enabled later

Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
src/v/cluster/tests/partition_allocator_fixture.h Outdated Show resolved Hide resolved
src/v/cluster/bootstrap_backend.cc Outdated Show resolved Hide resolved
src/v/cluster/bootstrap_backend.cc Outdated Show resolved Hide resolved
src/v/storage/log_manager.cc Show resolved Hide resolved
@rockwotj rockwotj force-pushed the fix-clang-tidy branch 2 times, most recently from e696393 to 88fa2f5 Compare March 27, 2024 02:03
@rockwotj
Copy link
Contributor Author

Force pushes: fix inverted bools 🤦

@redpanda-data redpanda-data deleted a comment from vbotbuildovich Mar 27, 2024
dotnwat
dotnwat previously approved these changes Mar 27, 2024
Cleanup some code:
- emplace_back directly
- remove extra add node calls that failed

Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Newer versions of clang tidy treat this as nodiscard, make sure we're
not discarding it.

Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
This shouldn't happen as we shouldn't be recoverying in bootstraping,
but this is better than dropping the std::error_code

Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
These cropped up in newer clang versions but what we're doing works
and is valid AFAIK.

Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
@rockwotj
Copy link
Contributor Author

Force push: fix some unit tests because std::error_code{} != cluster::make_error_code(cluster::errc::success)

@rockwotj rockwotj requested a review from dotnwat March 27, 2024 15:09
@vbotbuildovich
Copy link
Collaborator

new failures in https://buildkite.com/redpanda/redpanda/builds/46893#018e80a5-f5ac-412d-bd4d-402ee591c22b:

"rptest.tests.e2e_shadow_indexing_test.EndToEndShadowIndexingTest.test_reset_from_cloud.cloud_storage_type=CloudStorageType.ABS"

@rockwotj
Copy link
Contributor Author

rockwotj commented Apr 2, 2024

gentle ping

@@ -259,15 +256,15 @@ struct partition_balancer_planner_fixture {

workers.allocator.local().register_node(
create_allocation_node(model::node_id(last_node_idx), 4));
new_brokers.push_back(model::broker(
new_brokers.emplace_back(
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused about this change. It looks like before this change that we added some entries into new_brokers (above), and then later added some more (this line).

But

  • remove extra add node calls that failed

Presumably this test was passing, and this commit is about a clean-up. But this is a logic change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before, we re-added all the existing nodes, which caused an error to be returned (that we ignored). Should I split that out into another change?

Copy link
Member

@dotnwat dotnwat Apr 2, 2024

Choose a reason for hiding this comment

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

ahh i see, nah it's all good. tests passed before, passes after? haha

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tests passed before, passes after?

Yupp :)

@@ -203,7 +203,14 @@ bootstrap_backend::apply(bootstrap_cluster_cmd cmd, model::offset offset) {
[o = offset,
m = cmd.value.recovery_state->manifest,
b = cmd.value.recovery_state->bucket](auto& recovery_table) {
recovery_table.apply(o, m, b, wait_for_nodes::yes);
auto ec = recovery_table.apply(o, m, b, wait_for_nodes::yes);
Copy link
Member

Choose a reason for hiding this comment

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

This shouldn't happen

throwing sounds good to me, but it sounds like we could also vassert no failure?

Copy link
Member

Choose a reason for hiding this comment

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

cc @ztlpn

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'm okay with that I had talked to @andrwng about this

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, we don't expect to get here since this is happening at bootstrap, and recoveries aren’t allowed to be started if we haven’t bootstrapped yet.

That said, if we want to be more conservative, we could alternatively handle errc::update_in_progress specifically like we do earlier in the function when we bootstrap users.

Copy link
Contributor Author

@rockwotj rockwotj Apr 2, 2024

Choose a reason for hiding this comment

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

I think I'll leave this - if someone else feels strongly feel free to send a followup patch (I will happily review)

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, throwing from an apply method is pretty nasty - if this happens when a snapshot is applied, the exception will be converted to an assert, and if this is a regular command, controller stm fiber will stall, leaving the node in a weird state (but at least operational). Pick your poison.

OTOH this method throws in other places, so I guess the patch is not making matters worse :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrwng sent a followup to change this: #17563

@rockwotj rockwotj merged commit 6fb8d6d into redpanda-data:dev Apr 2, 2024
17 checks passed
@rockwotj rockwotj deleted the fix-clang-tidy branch April 2, 2024 21:28
@vbotbuildovich
Copy link
Collaborator

/backport v23.3.x

@dotnwat
Copy link
Member

dotnwat commented Apr 3, 2024

@rockwotj why backport?

@rockwotj
Copy link
Contributor Author

rockwotj commented Apr 3, 2024

To fix to use after move in storage and the bootstrap error being dropped. However there were build issues so I gave up

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.

None yet

5 participants