clintropolis commented on a change in pull request #7264: Fix
testIncrementalHandOffReadsThroughEndOffsets in Kafka/KinesisIndexTaskTest
URL: https://github.com/apache/incubator-druid/pull/7264#discussion_r265785628
##########
File path:
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaIndexTaskTest.java
##########
@@ -928,34 +929,68 @@ public void
testIncrementalHandOffReadsThroughEndOffsets() throws Exception
null
)
);
- final ListenableFuture<TaskStatus> future = runTask(task);
- while (task.getRunner().getStatus() != Status.PAUSED) {
+ final KafkaIndexTask staleReplica = createTask(
+ null,
+ new KafkaIndexTaskIOConfig(
+ 0,
+ baseSequenceName,
+ startPartitions,
+ endPartitions,
+ consumerProps,
+ KafkaSupervisorIOConfig.DEFAULT_POLL_TIMEOUT_MILLIS,
+ true,
+ null,
+ null
+ )
+ );
+
+ final ListenableFuture<TaskStatus> normalReplicaFuture =
runTask(normalReplica);
+ // Simulating one replica is slower than the other
+ final ListenableFuture<TaskStatus> staleReplicaFuture =
ListenableFutures.transformAsync(
+ taskExec.submit(() -> {
+ Thread.sleep(1000);
+ return staleReplica;
+ }),
+ this::runTask
+ );
+
+ while (normalReplica.getRunner().getStatus() != Status.PAUSED) {
+ Thread.sleep(10);
+ }
+ staleReplica.getRunner().pause();
+ while (staleReplica.getRunner().getStatus() != Status.PAUSED) {
Thread.sleep(10);
}
- Map<Integer, Long> currentOffsets =
ImmutableMap.copyOf(task.getRunner().getCurrentOffsets());
+ Map<Integer, Long> currentOffsets =
ImmutableMap.copyOf(normalReplica.getRunner().getCurrentOffsets());
Assert.assertEquals(checkpoint1.getPartitionSequenceNumberMap(),
currentOffsets);
- // Simulating the case when another replica has consumed up to the offset
of 8
- task.getRunner().setEndOffsets(ImmutableMap.of(0, 8L), false);
+ normalReplica.getRunner().setEndOffsets(currentOffsets, false);
+ staleReplica.getRunner().setEndOffsets(currentOffsets, false);
Review comment:
Is it assumed that `staleReplica` has offsets behind `normalReplica`
offsets? Is this testable?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]