chia7712 commented on code in PR #15962:
URL: https://github.com/apache/kafka/pull/15962#discussion_r1601282218
##########
storage/src/test/java/org/apache/kafka/server/log/remote/metadata/storage/TopicBasedRemoteLogMetadataManagerHarness.java:
##########
@@ -119,9 +120,6 @@ public void
onPartitionLeadershipChanges(Set<TopicIdPartition> leaderPartitions,
log.debug("TopicBasedRemoteLogMetadataManager configs after adding
overridden properties: {}", configs);
topicBasedRemoteLogMetadataManager.configure(configs);
- if (remoteLogMetadataTopicPartitioner != null) {
-
topicBasedRemoteLogMetadataManager.setRlmTopicPartitioner(remoteLogMetadataTopicPartitioner);
Review Comment:
`setRlmTopicPartitioner` gets unused now, so could you please remove it?
##########
storage/src/test/java/org/apache/kafka/server/log/remote/metadata/storage/TopicBasedRemoteLogMetadataManagerMultipleSubscriptionsTest.java:
##########
@@ -108,7 +114,23 @@ public void testMultiplePartitionSubscriptions() throws
Exception {
final TopicIdPartition followerTopicIdPartition = new
TopicIdPartition(Uuid.randomUuid(), new TopicPartition(followerTopic, 0));
final TopicIdPartition emptyTopicIdPartition = new
TopicIdPartition(Uuid.randomUuid(), new TopicPartition(topicWithNoMessages, 0));
- RemoteLogMetadataTopicPartitioner partitioner = new
RemoteLogMetadataTopicPartitioner(10) {
+ final RemotePartitionMetadataStore spyRemotePartitionMetadataStore =
spy(new RemotePartitionMetadataStore());
+
+ Phaser initializationPhaser = new Phaser(2); // 1 to register test
thread, 1 to register leaderTopicIdPartition
+ doAnswer(invocationOnMock -> {
+ Object result = invocationOnMock.callRealMethod();
+ initializationPhaser.arriveAndDeregister();
Review Comment:
Maybe we can use `CountDownLatch` instead? And we can override the stub (i.e
create `doAnswer` again) before running `onPartitionLeadershipChanges`? For
example:
```java
CountDownLatch latch = new CountDownLatch(1);
doAnswer(invocationOnMock -> {
Object result = invocationOnMock.callRealMethod();
latch.countDown();
return result;
}).when(spyRemotePartitionMetadataStore).markInitialized(any());
...
latch.await(30_000, TimeUnit.MILLISECONDS);
...
CountDownLatch latch2 = new CountDownLatch(1);
doAnswer(invocationOnMock -> {
Object result = invocationOnMock.callRealMethod();
latch2.countDown();
return result;
}).when(spyRemotePartitionMetadataStore).markInitialized(any());
...
rlmm().onPartitionLeadershipChanges(Collections.singleton(emptyTopicIdPartition),
Collections.singleton(followerTopicIdPartition));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]