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

MINIFICPP-2479 Update librdkafka and add lz4, zstd support #1885

Closed

Conversation

martinzink
Copy link
Member

Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically main)?

  • Is your initial contribution a single, squashed commit?

For code changes:

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file?
  • If applicable, have you updated the NOTICE file?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.

@martinzink martinzink marked this pull request as ready for review October 24, 2024 17:18
extensions/kafka/ConsumeKafka.h Outdated Show resolved Hide resolved
extensions/kafka/PublishKafka.h Show resolved Hide resolved
extensions/kafka/PublishKafka.cpp Outdated Show resolved Hide resolved
cmake/Fetchlibrdkafka.cmake Outdated Show resolved Hide resolved
cmake/Fetchlibrdkafka.cmake Outdated Show resolved Hide resolved
cmake/LZ4.cmake Show resolved Hide resolved
Comment on lines +46 to +52
install(EXPORT Lz4Targets
FILE Lz4Targets.cmake # Generate Lz4Targets.cmake file
NAMESPACE lz4:: # Set the namespace to lz4::
DESTINATION lib/cmake/Lz4 # Where to install the CMake config
)
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 not sure about the install calls, they usually install files in the release tarball, and through that the user's machine. Are you sure these are not doing that?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not quite sure if this was the right approach, but without this librdkafka cmake calls fail due to
install(EXPORT "RdKafkaTargets" ...) includes target "rdkafka" which requires target "lz4_static" that is not in any export set.

extensions/kafka/ConsumeKafka.h Outdated Show resolved Hide resolved
extensions/kafka/KafkaConnection.h Show resolved Hide resolved
Copy link
Contributor

@fgerlits fgerlits left a comment

Choose a reason for hiding this comment

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

dank dev branch name, it's bussin, no cap

extensions/kafka/PublishKafka.cpp Show resolved Hide resolved
Copy link
Member

@szaszm szaszm left a comment

Choose a reason for hiding this comment

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

There are a lot of if statements that went from multiline from single line, and some property builder calls that are also on a single long line now. I don't think that's necessarily a readability improvement, unless the statement is trivial.

If your IDE did it automatically, I suggest to turn off automatic shortening to a single line. If you did it manually after a conscious decision, then it's fine, I'm rarely criticizing formatting style choices, but I would be less aggressive with putting too much logic on a single line.

Comment on lines 188 to 189
const gsl::owner<rd_kafka_headers_t*> result{ rd_kafka_headers_new(8) };
if (!result) { throw std::bad_alloc{}; }
Copy link
Member

Choose a reason for hiding this comment

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

the null check is missing in the new version

Copy link
Member Author

Choose a reason for hiding this comment

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

I've readded it in readd nullcheck after malloc
although I don't think we check every malloc/new in the codebase, but it couldnt hurt either

@martinzink
Copy link
Member Author

martinzink commented Oct 30, 2024

There are a lot of if statements that went from multiline from single line, and some property builder calls that are also on a single long line now. I don't think that's necessarily a readability improvement, unless the statement is trivial.

If your IDE did it automatically, I suggest to turn off automatic shortening to a single line. If you did it manually after a conscious decision, then it's fine, I'm rarely criticizing formatting style choices, but I would be less aggressive with putting too much logic on a single line.

I've utilized the new .clang-format to reformat the extension, I agree that its a bit aggressive so I've refined the clang-format so we don't target the linter's 200 long max line length, but rather a more reasonable 125.
I don't want to manually correct these so I think its better to correct the clang-format file (if possible) so we can safely autoformat the code.

@szaszm
Copy link
Member

szaszm commented Oct 30, 2024

I thought "AllowShortIfStatementsOnASingleLine" means allow, so don't reformat single line ones where they see them, but reformat otherwise.

Comment on lines 127 to 137
"Specifies whether or not MiNiFi should honor transactional guarantees when communicating with Kafka. If "
"false, the Processor will use "
"an \"isolation level\" of "
"read_uncomitted. This means that messages will be received as soon as they are written to Kafka but will be "
"pulled, even if the "
"producer cancels the transactions. "
"If this value is true, MiNiFi will not receive any messages for which the producer's transaction was "
"canceled, but this can result in "
"some latency since the consumer "
"must wait for the producer to finish its entire transaction instead of pulling as the messages become "
"available.")
Copy link
Member

Choose a reason for hiding this comment

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

This clang-format reflow resulted in some unnecessary shorter lines. Please check the rest of the file too, there are more of these.

Comment on lines 426 to 427
result =
rd_kafka_conf_set(conf_.get(), "message.max.bytes", max_message_size->c_str(), err_chars.data(), err_chars.size());
Copy link
Member

Choose a reason for hiding this comment

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

I don't like this formatting change either :/

@szaszm
Copy link
Member

szaszm commented Nov 26, 2024

The failures look like a rebase issue

@szaszm szaszm closed this in d6dcc24 Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants