KAFKA-14540: Fix DataOutputStreamWritable#writeByteBuffer#13032
Merged
viktorsomogyi merged 3 commits intoapache:trunkfrom Jan 10, 2023
Merged
KAFKA-14540: Fix DataOutputStreamWritable#writeByteBuffer#13032viktorsomogyi merged 3 commits intoapache:trunkfrom
viktorsomogyi merged 3 commits intoapache:trunkfrom
Conversation
eolivelli
approved these changes
Dec 21, 2022
showuon
reviewed
Dec 21, 2022
Member
showuon
left a comment
There was a problem hiding this comment.
@michaeljmarshall , thanks for the PR. Nice catch! Left some comments.
clients/src/main/java/org/apache/kafka/common/protocol/DataOutputStreamWritable.java
Outdated
Show resolved
Hide resolved
clients/src/test/java/org/apache/kafka/common/protocol/DataOutputStreamWritableTest.java
Show resolved
Hide resolved
lhotari
approved these changes
Dec 21, 2022
viktorsomogyi
approved these changes
Jan 3, 2023
viktorsomogyi
requested changes
Jan 3, 2023
Contributor
viktorsomogyi
left a comment
There was a problem hiding this comment.
Realized that there are tests failures when running these with gradle (although weirly enough they were fine in intellij), please fix them.
clients/src/test/java/org/apache/kafka/common/protocol/DataOutputStreamWritableTest.java
Outdated
Show resolved
Hide resolved
clients/src/test/java/org/apache/kafka/common/protocol/DataOutputStreamWritableTest.java
Outdated
Show resolved
Hide resolved
Member
Author
|
Thanks for catching my mistake @viktorsomogyi. My mistake was trusting IntelliJ to run the test. |
viktorsomogyi
approved these changes
Jan 9, 2023
Contributor
viktorsomogyi
left a comment
There was a problem hiding this comment.
LGTM, I'll wait some time for others if they have any more comments and also the rebuild, after that I'll merge it.
Member
|
Nice catch for |
Contributor
|
Looks like there are 3 flaky test failures, I'll merge this one. |
ijuma
added a commit
to fvaleri/kafka
that referenced
this pull request
Jan 13, 2023
* apache-github/trunk: KAFKA-14601: Improve exception handling in KafkaEventQueue apache#13089 KAFKA-14367; Add `OffsetCommit` to the new `GroupCoordinator` interface (apache#12886) KAFKA-14530: Check state updater more often (apache#13017) KAFKA-14304 Use boolean for ZK migrating brokers in RPC/record (apache#13103) KAFKA-14003 Kafka Streams JUnit4 to JUnit5 migration part 2 (apache#12301) KAFKA-14607: Move Scheduler/KafkaScheduler to server-common (apache#13092) KAFKA-14367; Add `OffsetFetch` to the new `GroupCoordinator` interface (apache#12870) KAFKA-14557; Lock metadata log dir (apache#13058) MINOR: Implement toString method for TopicAssignment and PartitionAssignment (apache#13101) KAFKA-12558: Do not prematurely mutate internal partition state in Mirror Maker 2 (apache#11818) KAFKA-14540: Fix DataOutputStreamWritable#writeByteBuffer (apache#13032) KAFKA-14600: Reduce flakiness in ProducerIdExpirationTest (apache#13087) KAFKA-14279: Add 3.3.x streams system tests (apache#13077) MINOR: bump streams quickstart pom versions and add to list in gradle.properties (apache#13064) MINOR: Update KRaft cluster upgrade documentation for 3.4 (apache#13063) KAFKA-14493: Introduce Zk to KRaft migration state machine STUBs in KRaft controller. (apache#12998) KAFKA-14570: Fix parenthesis in verifyFullFetchResponsePartitions output (apache#13072) MINOR: Remove public mutable fields from ProducerAppendInfo (apache#13091)
ijuma
added a commit
to confluentinc/kafka
that referenced
this pull request
Jan 17, 2023
…master * apache-github/trunk: (23 commits) MINOR: Include the inner exception stack trace when re-throwing an exception (apache#12229) MINOR: Fix docs to state that sendfile implemented in `TransferableRecords` instead of `MessageSet` (apache#13109) Update ProducerConfig.java (apache#13115) KAFKA-14618; Fix off by one error in snapshot id (apache#13108) KAFKA-13709 (follow-up): Avoid mention of 'exactly-once delivery' or 'delivery guarantees' in Connect (apache#13106) KAFKA-14367; Add `TxnOffsetCommit` to the new `GroupCoordinator` interface (apache#12901) KAFKA-14568: Move FetchDataInfo and related to storage module (apache#13085) KAFKA-14612: Make sure to write a new topics ConfigRecords to metadata log iff the topic is created (apache#13104) KAFKA-14601: Improve exception handling in KafkaEventQueue apache#13089 KAFKA-14367; Add `OffsetCommit` to the new `GroupCoordinator` interface (apache#12886) KAFKA-14530: Check state updater more often (apache#13017) KAFKA-14304 Use boolean for ZK migrating brokers in RPC/record (apache#13103) KAFKA-14003 Kafka Streams JUnit4 to JUnit5 migration part 2 (apache#12301) KAFKA-14607: Move Scheduler/KafkaScheduler to server-common (apache#13092) KAFKA-14367; Add `OffsetFetch` to the new `GroupCoordinator` interface (apache#12870) KAFKA-14557; Lock metadata log dir (apache#13058) MINOR: Implement toString method for TopicAssignment and PartitionAssignment (apache#13101) KAFKA-12558: Do not prematurely mutate internal partition state in Mirror Maker 2 (apache#11818) KAFKA-14540: Fix DataOutputStreamWritable#writeByteBuffer (apache#13032) KAFKA-14600: Reduce flakiness in ProducerIdExpirationTest (apache#13087) ...
guozhangwang
pushed a commit
to guozhangwang/kafka
that referenced
this pull request
Jan 25, 2023
When writing a ByteBuffer backed by a HeapBuffer to a DataOutputStream, it is necessary to pass in the offset and the position, not just the position. It is also necessary to pass the remain length, not the limit. The current code results in writing the wrong data to DataOutputStream. While the DataOutputStreamWritable is used in the project, I do not see any references that would utilize this code path, so this bug fix is relatively minor. I added a new test to cover the exact bug. The test fails without this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When writing a
ByteBufferbacked by aHeapBufferto aDataOutputStream, it is necessary to pass in the offset and the position, not just the position. It is also necessary to pass the remain length, not the limit. The current code results in writing the wrong data toDataOutputStream. While theDataOutputStreamWritableis used in the project, I do not see any references that would utilize this code path, so this bug fix is relatively minor.I added a new test to cover the exact bug. The test fails without this change.
Committer Checklist (excluded from commit message)