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.
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.
I don't understand the question - what do you mean it's zk logic?
There was a problem hiding this comment.
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.
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.
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.
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 <payang@apache.org>
f3d7a74 to
df2ae15
Compare
|
|
||
| import scala.jdk.CollectionConverters._ | ||
|
|
||
| class FinalizedFeatureCacheTest { |
There was a problem hiding this comment.
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.
mimaison
left a comment
There was a problem hiding this comment.
Thanks for the PR. It looks good overall, I just left a couple of minor suggestions.
| 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.
It looks like Map imported just below is unused, so we can delete it.
| import org.apache.kafka.server.BrokerFeatures | ||
| import org.apache.kafka.image.{MetadataDelta, MetadataImage, MetadataProvenance} | ||
| import org.apache.kafka.server.config.ReplicationConfigs | ||
| import org.apache.kafka.server.common.{MetadataVersion, OffsetAndEpoch} |
There was a problem hiding this comment.
scala.collection.Map imported below seems unused, can we delete it too?
Signed-off-by: PoAn Yang <payang@apache.org>
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ismael Juma <ismael@juma.me.uk>
|
Applied to 4.0 too: be5b5f3 |
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ismael Juma <ismael@juma.me.uk>
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ismael Juma <ismael@juma.me.uk>
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ismael Juma <ismael@juma.me.uk>
Committer Checklist (excluded from commit message)