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

KAFKA-17367: Share coordinator impl. New merge batches algorithm. [3/N] #17149

Merged
merged 43 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2128532
KAFKA-17367: Share coordinator impl. Added additional tests. [3/N]
smjn Sep 10, 2024
5f377fb
Improved test names.
smjn Sep 10, 2024
8fecb1d
removed extraneous comment.
smjn Sep 10, 2024
7042155
removed incorrect comment, added another overlap test.
smjn Sep 10, 2024
a299752
Modified combine batches logic.
smjn Sep 11, 2024
2e1d9a5
Added start offset based pruning.
smjn Sep 11, 2024
080d422
fixed comment.
smjn Sep 11, 2024
bce0cb3
Handle overlapping input.
smjn Sep 11, 2024
f112e0c
renamed method arg.
smjn Sep 11, 2024
fca3dcb
fixed bug in merge logic.
smjn Sep 11, 2024
1e88e7d
add delivery count as a sort dimension.
smjn Sep 11, 2024
0c7aadf
minor refactoring.
smjn Sep 11, 2024
e483bd2
merge logic overhaul.
smjn Sep 12, 2024
65f3b7b
minor optimization, fixed comments.
smjn Sep 12, 2024
fc548d2
added generator for tests.
smjn Sep 12, 2024
9049ab6
further optimized merge.
smjn Sep 12, 2024
1d1eb19
minor perf tweaks.
smjn Sep 13, 2024
c892bb0
removed extraneous prune.
smjn Sep 13, 2024
8fb168e
fixed comment.
smjn Sep 13, 2024
6993671
incorporated review comments.
smjn Sep 13, 2024
d20624b
incorporated further comments.
smjn Sep 18, 2024
6561d87
incorporated comments.
smjn Sep 23, 2024
d747dd3
Merge remote-tracking branch 'ak/trunk' into KAFKA-17367-3n
smjn Sep 25, 2024
60bda5d
Merge remote-tracking branch 'ak/trunk' into KAFKA-17367-3n
smjn Sep 25, 2024
2e5003c
Moved state batch merge code to util class.
smjn Sep 25, 2024
088bbf1
fixed documentation.
smjn Sep 25, 2024
32db0a6
incorporated review comments.
smjn Sep 26, 2024
4d2eaac
changed byte, short to int in tests.
smjn Sep 26, 2024
9928084
converted batch util to class.
smjn Sep 27, 2024
86d1237
renamed a few private methods.
smjn Sep 27, 2024
5e98616
added comprehensive javadoc.
smjn Sep 27, 2024
7a63481
minor bug fix.
smjn Sep 27, 2024
9d2e834
minor refactoring.
smjn Sep 28, 2024
0c7436d
create new arraylist from arguments.
smjn Sep 28, 2024
6f1725f
incorporated comments.
smjn Sep 30, 2024
3fa3bd8
removed tests with overlapping batches in current state.
smjn Oct 1, 2024
f58cc0b
refactored write state method.
smjn Oct 1, 2024
e10f7ec
incorporated comments.
smjn Oct 1, 2024
3313a62
added key to exception message.
smjn Oct 1, 2024
7a2ecdc
Merge remote-tracking branch 'ak/trunk' into KAFKA-17367-3n
smjn Oct 1, 2024
ad7bfc6
add back factories in SharePartitionKey.
smjn Oct 1, 2024
10780fc
incorported comments.
smjn Oct 2, 2024
a9f9f01
removed null checks in favor of containsKey.
smjn Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions checkstyle/import-control-share-coordinator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<allow pkg="org.apache.kafka.server.util.timer" />
<allow pkg="org.apache.kafka.timeline" />
<allow pkg="org.junit.jupiter.api" />
<allow pkg="org.junit.jupiter.params" />
<allow pkg="org.junit.jupiter.provider" />
<allow pkg="org.mockito" />
<allow pkg="org.slf4j" />
<subpackage name="generated">
Expand Down
6 changes: 6 additions & 0 deletions checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@
<suppress checks="NPathComplexity"
files="CoordinatorRuntime.java"/>

<!-- share coordinator -->
<suppress checks="NPathComplexity"
files="ShareCoordinatorShard.java"/>
<suppress checks="CyclomaticComplexity"
files="ShareCoordinatorShard.java"/>

<!-- storage -->
<suppress checks="CyclomaticComplexity"
files="(LogValidator|RemoteLogManagerConfig|RemoteLogManager).java"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
/**
* This class contains the information for a single batch of state information for use by the {@link Persister}.
*/
public class PersisterStateBatch {
public class PersisterStateBatch implements Comparable {
private final long firstOffset;
private final long lastOffset;
private final byte deliveryState;
private final short deliveryCount;
private final byte deliveryState;

public PersisterStateBatch(long firstOffset, long lastOffset, byte deliveryState, short deliveryCount) {
this.firstOffset = firstOffset;
Expand Down Expand Up @@ -77,22 +77,40 @@ public boolean equals(Object o) {
PersisterStateBatch that = (PersisterStateBatch) o;
return firstOffset == that.firstOffset &&
lastOffset == that.lastOffset &&
deliveryState == that.deliveryState &&
deliveryCount == that.deliveryCount;
deliveryCount == that.deliveryCount &&
deliveryState == that.deliveryState;
}

@Override
public int hashCode() {
return Objects.hash(firstOffset, lastOffset, deliveryState, deliveryCount);
return Objects.hash(firstOffset, lastOffset, deliveryCount, deliveryState);
}

@Override
public String toString() {
return "PersisterStateBatch(" +
"firstOffset=" + firstOffset + "," +
"lastOffset=" + lastOffset + "," +
"deliveryState=" + deliveryState + "," +
"deliveryCount=" + deliveryCount +
"deliveryCount=" + deliveryCount + "," +
"deliveryState=" + deliveryState +
")";
}

@Override
public int compareTo(Object o) {
PersisterStateBatch that = (PersisterStateBatch) o;
int deltaFirst = Long.compare(this.firstOffset(), that.firstOffset());
if (deltaFirst == 0) {
int deltaLast = Long.compare(this.lastOffset(), that.lastOffset());
if (deltaLast == 0) {
int deltaCount = this.deliveryCount() - that.deliveryCount();
if (deltaCount == 0) {
return Byte.compare(this.deliveryState(), that.deliveryState());
}
return deltaCount;
}
return deltaLast;
}
return deltaFirst;
}
}

This file was deleted.

Loading
Loading