-
Notifications
You must be signed in to change notification settings - Fork 15.1k
KAFKA-10173: Fix suppress changelog binary schema compatibility #8905
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
Merged
vvcephei
merged 23 commits into
apache:trunk
from
vvcephei:kafka-10173-improve-header-comparison
Jun 27, 2020
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
4c39333
KAFKA-10173: Directly use Arrays.equals for version comparison
98786b3
converting upgrade test to smoke test
5ba0c59
wip debugging suppress buffer
f556a41
asdf
7af7935
fix
495aebc
upgrade test passed (2.3.1 -> trunk)
e29728f
wip
738eef7
cleanup
9cd927a
cleanup
2396458
fix test
29ab207
direct encoding of restore test vx
dab0fc1
direct encoding of restore test v1
776efb6
add v2 and v3
e6e0b48
cleanup
65a549f
adding other old versions
41a4db1
fallback to make 2.4 work
63f1cc3
remove 2.1. cf KAFKA-10203
2465162
reduce cyclomatic complexity
d513fe8
Remove ParallelGC jvm param
7b8deb8
cleanup
844321f
fix attempt to allocate arbitrary sized array
c420099
factor out system test changes
f5cc0b7
style
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,9 @@ | |
| import java.util.Arrays; | ||
| import java.util.Objects; | ||
|
|
||
| import static org.apache.kafka.common.utils.Utils.getNullableArray; | ||
| import static org.apache.kafka.common.utils.Utils.getNullableSizePrefixedArray; | ||
|
|
||
| public final class BufferValue { | ||
| private static final int NULL_VALUE_SENTINEL = -1; | ||
| private static final int OLD_PREV_DUPLICATE_VALUE_SENTINEL = -2; | ||
|
|
@@ -67,35 +70,21 @@ ProcessorRecordContext context() { | |
| static BufferValue deserialize(final ByteBuffer buffer) { | ||
| final ProcessorRecordContext context = ProcessorRecordContext.deserialize(buffer); | ||
|
|
||
| final byte[] priorValue = extractValue(buffer); | ||
| final byte[] priorValue = getNullableSizePrefixedArray(buffer); | ||
|
|
||
| final byte[] oldValue; | ||
| final int oldValueLength = buffer.getInt(); | ||
| if (oldValueLength == NULL_VALUE_SENTINEL) { | ||
| oldValue = null; | ||
| } else if (oldValueLength == OLD_PREV_DUPLICATE_VALUE_SENTINEL) { | ||
| if (oldValueLength == OLD_PREV_DUPLICATE_VALUE_SENTINEL) { | ||
| oldValue = priorValue; | ||
| } else { | ||
| oldValue = new byte[oldValueLength]; | ||
| buffer.get(oldValue); | ||
| oldValue = getNullableArray(buffer, oldValueLength); | ||
| } | ||
|
|
||
| final byte[] newValue = extractValue(buffer); | ||
| final byte[] newValue = getNullableSizePrefixedArray(buffer); | ||
|
|
||
| return new BufferValue(priorValue, oldValue, newValue, context); | ||
| } | ||
|
|
||
| private static byte[] extractValue(final ByteBuffer buffer) { | ||
| final int valueLength = buffer.getInt(); | ||
| if (valueLength == NULL_VALUE_SENTINEL) { | ||
| return null; | ||
| } else { | ||
| final byte[] value = new byte[valueLength]; | ||
| buffer.get(value); | ||
| return value; | ||
| } | ||
| } | ||
|
|
||
| ByteBuffer serialize(final int endPadding) { | ||
|
|
||
| final int sizeOfValueLength = Integer.BYTES; | ||
|
|
@@ -120,7 +109,7 @@ ByteBuffer serialize(final int endPadding) { | |
|
|
||
| if (oldValue == null) { | ||
| buffer.putInt(NULL_VALUE_SENTINEL); | ||
| } else if (priorValue == oldValue) { | ||
| } else if (Arrays.equals(priorValue, oldValue)) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was correct before, since we check equality and enforce identity in the constructor, but |
||
| buffer.putInt(OLD_PREV_DUPLICATE_VALUE_SENTINEL); | ||
| } else { | ||
| buffer.putInt(sizeOfOldValue); | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only used in the test now, so I moved it.