-
Notifications
You must be signed in to change notification settings - Fork 14k
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
Changes from 19 commits
2128532
5f377fb
8fecb1d
7042155
a299752
2e1d9a5
080d422
bce0cb3
f112e0c
fca3dcb
1e88e7d
0c7aadf
e483bd2
65f3b7b
fc548d2
9049ab6
1d1eb19
c892bb0
8fb168e
6993671
d20624b
6561d87
d747dd3
60bda5d
2e5003c
088bbf1
32db0a6
4d2eaac
9928084
86d1237
5e98616
7a63481
9d2e834
0c7436d
6f1725f
3fa3bd8
f58cc0b
e10f7ec
3313a62
7a2ecdc
ad7bfc6
10780fc
a9f9f01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
/** | ||
* 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; | ||
|
@@ -95,4 +95,22 @@ public String toString() { | |
"deliveryCount=" + deliveryCount + | ||
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. firstOffset, lastOffset, deliveryCount and deliveryState is the order, so probably ought to have them in that order in the toString too. |
||
")"; | ||
} | ||
|
||
@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 countDelta = this.deliveryCount() - that.deliveryCount(); | ||
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. Surely |
||
if (countDelta == 0) { | ||
return Byte.compare(this.deliveryState(), that.deliveryState()); | ||
} | ||
return countDelta; | ||
} | ||
return deltaLast; | ||
} | ||
return deltaFirst; | ||
} | ||
} |
This file was deleted.
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.
In sorting terms, this is <firstOffset, lastOffset, deliveryCount, deliveryState>. I suggest putting the member variables in the same order.