syhily commented on a change in pull request #17119:
URL: https://github.com/apache/flink/pull/17119#discussion_r702456944
##########
File path:
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/enumerator/PulsarSourceEnumerator.java
##########
@@ -148,8 +162,42 @@ public void close() {
* @return Set of subscribed {@link TopicPartition}s
*/
private Set<TopicPartition> getSubscribedTopicPartitions() {
- return subscriber.getSubscribedTopicPartitions(
- pulsarAdmin, rangeGenerator, context.currentParallelism());
+ int parallelism = context.currentParallelism();
+ Set<TopicPartition> partitions =
+ subscriber.getSubscribedTopicPartitions(pulsarAdmin,
rangeGenerator, parallelism);
+
+ // Seek start position for given partitions.
+ seekStartPosition(partitions);
Review comment:
Yep, you are totally right. This is my mistake.
##########
File path:
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/reader/split/PulsarOrderedPartitionSplitReader.java
##########
@@ -75,7 +78,30 @@ protected void finishedPollMessage(Message<byte[]> message) {
@Override
protected void startConsumer(PulsarPartitionSplit split, Consumer<byte[]>
consumer) {
- initialStartPosition(split, consumer);
+ MessageId latestConsumedId = split.getLatestConsumedId();
+
+ // Reset the start position for ordered pulsar consumer.
+ if (latestConsumedId != null) {
+ StartCursor startCursor =
StartCursor.fromMessageId(latestConsumedId, false);
+ TopicPartition partition = split.getPartition();
+
+ try {
+ startCursor.seekPosition(
+ partition.getTopic(), partition.getPartitionId(),
consumer);
Review comment:
I have changed the serialization logic, the `latestConsumedId` shouldn't
be `null` here when we restart.
--
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]