-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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-18373: Remove ZkMetadataCache #18553
Conversation
We should also remove casts to the KRaft metadata cache as part of this JIRA or a file a separate issue for that. |
Yes, I will do it in this PR. Thanks for the reminder. |
@FrankYang0529 please fix the conflicts |
2515937
to
b6c67f6
Compare
If |
Sorry, I did some quick survey. I would like to make sure we're on the same page first. Do we want to remove |
// TODO: support raft code? | ||
private var metadataCache = new ZkMetadataCache(0, MetadataVersion.latestTesting(), BrokerFeatures.createEmpty()) | ||
metadataCache.updateMetadata(0, updateMetadataRequest) | ||
private val metadataDelta = new MetadataDelta(MetadataImage.EMPTY) |
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.
Should we need this? it more like zk logic.
I have a similar fix https://github.com/apache/kafka/pull/18354/files
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 don't understand the question - what do you mean it's zk logic?
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 believe @TaiJuWu is suggesting that this data was previously used by zk-related tests. Since these zk-related tests have already been removed, there is no longer a need to set this data.
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.
That seems a bit odd. This class is testing functionality that is independent of zk. In such cases, we have to be very careful that we're deleting tests that are actually zk specific versus testing functionality that is general but were never converted to the kraft way.
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.
My bad. previous what I think was this setting is test for IBP2.6
but it was deleted by #18468
After checking (checkout to 3.9 and deleted metadataCache.updateMetadata
), I found all tests are passed so I am not sure what it is for.
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.
OK, so this is perhaps just dead code (zk or otherwise). That's a nice catch. :)
No, we should not change all the codebase to use the Kraft metadata cache. Instead, we should move the relevant methods from the Kraft implementation to the interface so we don't need to cast - that should not be a large change (but someone needs to check). |
Apologies for closing accidentally - I reopened. |
5cf16eb
to
f3d7a74
Compare
Signed-off-by: PoAn Yang <[email protected]>
f3d7a74
to
df2ae15
Compare
|
||
import scala.jdk.CollectionConverters._ | ||
|
||
class FinalizedFeatureCacheTest { |
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.
Don't we need this with kraft?
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.
Yes, in this test, most of cases test ZkMetadataCache#updateFeaturesOrThrow
. IIUC, in KRaft, it receives update via setImage
, so it doesn't have similar cases as ZkMetadataCache
.
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.
OK, thanks.
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 PR. It looks good overall, I just left a couple of minor suggestions.
@@ -42,7 +42,7 @@ import org.mockito.ArgumentMatchers.{any, anyBoolean} | |||
import org.mockito.Mockito.{doNothing, mock, never, times, verify, verifyNoInteractions, verifyNoMoreInteractions, when} | |||
import org.mockito.{ArgumentCaptor, ArgumentMatchers, Mockito} | |||
|
|||
import java.util.{Collections, Optional, OptionalInt, OptionalLong} | |||
import java.util.{Optional, OptionalInt, OptionalLong} |
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.
It looks like Map
imported just below is unused, so we can delete it.
import org.apache.kafka.server.config.ReplicationConfigs | ||
import org.apache.kafka.server.common.{MetadataVersion, OffsetAndEpoch} |
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.
scala.collection.Map
imported below seems unused, can we delete it too?
Signed-off-by: PoAn Yang <[email protected]>
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
Reviewers: Mickael Maison <[email protected]>, Ismael Juma <[email protected]>
Applied to 4.0 too: be5b5f3 |
Reviewers: Mickael Maison <[email protected]>, Ismael Juma <[email protected]>
Reviewers: Mickael Maison <[email protected]>, Ismael Juma <[email protected]>
Reviewers: Mickael Maison <[email protected]>, Ismael Juma <[email protected]>
Committer Checklist (excluded from commit message)