-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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-18592: Cleanup ReplicaManager #18621
Conversation
isFromConsumer: Boolean, | ||
fetchOnlyFromLeader: Boolean): Seq[Long] = { | ||
val partition = getPartitionOrException(topicPartition) | ||
partition.legacyFetchOffsetsForTimestamp(timestamp, maxNumOffsets, isFromConsumer, fetchOnlyFromLeader) |
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.
Could we remove it from partition also?
def hasDelayedElectionOperations: Boolean = delayedElectLeaderPurgatory.numDelayed != 0 | ||
|
||
def tryCompleteElection(key: DelayedOperationKey): Unit = { | ||
val completed = delayedElectLeaderPurgatory.checkAndComplete(key) |
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.
Could we remove the purgatory too?
34db24b
to
5b59263
Compare
@@ -302,9 +302,6 @@ class ReplicaManager(val config: KafkaConfig, | |||
new DelayedOperationPurgatory[DelayedDeleteRecords]( | |||
"DeleteRecords", config.brokerId, | |||
config.deleteRecordsPurgatoryPurgeIntervalRequests)) | |||
val delayedElectLeaderPurgatory = delayedElectLeaderPurgatoryParam.getOrElse( |
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.
please remove delayedElectLeaderPurgatoryParam
also
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.
Also, this also remove the following metrics.
- kafka.server:type=DelayedOperationPurgatory,delayedOperation=ElectLeader,name=PurgatorySize
- kafka.server:type=DelayedOperationPurgatory,delayedOperation=ElectLeader,name=NumDelayedOperations
please add them into zk2kraft.html
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.
Interesting, we still allow elect leader to be called. Why are these metrics no longer relevant?
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.
The zk broker waits for the metadata update before returning a response to the ElectLeader
request, whereas the Kraft broker does not. Consequently, the Kraft broker does not need delayedOperation metrics for ElectLeader requests. Instead, kraft broker has ForwardingManager
metrics to monitor the forwarded requests.
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.
Thanks for the explanation.
2d70136
to
f142c30
Compare
f142c30
to
a2c5502
Compare
Please resolve the conflicts. |
a2c5502
to
1f80a44
Compare
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.
Thanks, a few comments.
isFromConsumer: Boolean, | ||
fetchOnlyFromLeader: Boolean): Seq[Long] = inReadLock(leaderIsrUpdateLock) { | ||
val localLog = localLogWithEpochOrThrow(Optional.empty(), fetchOnlyFromLeader) | ||
val allOffsets = localLog.legacyFetchOffsetsBefore(timestamp, maxNumOffsets) |
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.
Perhaps it can be removed from LocalLog
too (in a follow-up).
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.
You are right.
If this PR gets merged, this method would only be invoked in tests.
I will file a JIRA for this one.
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.
docs/zk2kraft.html
Outdated
@@ -176,5 +176,14 @@ <h5 class="anchor-heading">Removal metrics</h5> | |||
Kafka remove all zookeeper dependencies, so the metrics is removed. | |||
</p> | |||
</li> | |||
<li> | |||
<p> | |||
Remove the metrics which is monitoring the leader election. |
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.
This seems misleading - I think these metrics are related to the purgatory for the ElectLeader operation - we still have metrics for monitoring leader election.
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.
Thanks for pointing out.
I have just updated the description. 🙇🏼
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.
Do we need to explain the usage for each removed metric? Since there are numerous removed metrics, I propose adding a listed item to include all of them. This was also the suggestion I made in #18654.
@ijuma @frankvicky WDYT?
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.
Make sense to me.
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.
I think it may be helpful to indicate which metrics replace the ones being removed or if they're not applicable anymore. That would be useful, I believe.
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.
1f80a44
to
af3dff4
Compare
JIRA: KAFKA-18592 There are few methods in ReplicaManager unused now, we should remove them. # Conflicts: # docs/zk2kraft.html
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.
Thanks for the contribution! A small comment from my side
return this; | ||
} | ||
|
||
public ReplicaManagerBuilder setDelayedDeleteRecordsPurgatory(DelayedOperationPurgatory<DelayedDeleteRecords> delayedDeleteRecordsPurgatory) { |
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.
Is there a reason why you can't remove the field(s) associated with this setter (and others) as well? As far as I can see it is only used as an argument for creating a ReplicaManager and you could just leave the instantiation of the purgatory in the constructor of ReplicaManager. I am happy for this to be done in a follow-up as long as it has already been accounted for and it isn't just a miss.
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.
You are right. These fields are something we miss and also need to be clean.
I will file a jira for this one.
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.
af3dff4
to
76a7eee
Compare
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.
With my last comment addressed, I am happy for this to go in assuming the tests pass
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.
LGTM
I'm going to merge this PR and #18654 will revise the zk2kraft.html
Reviewers: Ismael Juma <[email protected]>, Christo Lolov <[email protected]>, Chia-Ping Tsai <[email protected]>
Reviewers: Ismael Juma <[email protected]>, Christo Lolov <[email protected]>, Chia-Ping Tsai <[email protected]>
JIRA: KAFKA-18592
There are a few methods in
ReplicaManager
unused now, we should remove them.Committer Checklist (excluded from commit message)