Skip to content

Conversation

@dlg99
Copy link
Contributor

@dlg99 dlg99 commented Jun 17, 2021

Motivation

KafkaApiTest is failing

Modifications

  1. conversion between Pulsar topic name and Kafka TopicPartition ended up with TopicPartition using name with "-partition-"

  2. Seek was not working correctly:

PulsarKafkaConsumer seeks to beginning, as asked.
Clears lastReceivedOffset in the process.

on poll it checks

            if (lastReceivedOffset.get(tp) == null && !unpolledPartitions.contains(tp)) {
                	log.info("When polling offsets, invalid offsets were detected. Resetting topic partition {}", tp);
                	resetOffsets(tp);
            } 

seek didn't update unpolledPartitions - reset offset uses default strategy to reset => seeks to the end

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is already covered by existing tests, such as KafkaApiTest.

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

No

Documentation

  • Does this pull request introduce a new feature? NO

@dlg99
Copy link
Contributor Author

dlg99 commented Jun 17, 2021

KafkaProducerSimpleConsumerTest dosn't fail on local runs but failed on CI. I added couple of delays, it worked.

KafkaApisTest passes now.

Failing integration test is org.apache.pulsar.spark.SparkStreamingPulsarReceiverTest, can be addressed separately

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dlg99
Copy link
Contributor Author

dlg99 commented Jun 17, 2021

also fixed SparkStreamingPulsarReceiverTest

@dlg99 dlg99 changed the title Fixing integration tests KafkaApiTest Fixed integration tests Jun 17, 2021
@lhotari
Copy link
Member

lhotari commented Jun 18, 2021

@codelipenghui @sijie Please review. This PR makes CI green and we should then be ready for the 2.8.0 release of pulsar-adapters.

Copy link
Contributor

@codelipenghui codelipenghui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just left a minor comment about the test.

producer.send(message);
}
producer.close();
Thread.sleep(500);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to avoid using sleep in the test, could you please use Awaitility instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it would be nice, but I suggest we merge this to unblock the release + add an issue to fix it later (it will take time to figure out what to wait for specifically, especially given that this test failed only on CI and passed on local runs) + there are other tests that rely on sleep: https://github.com/apache/pulsar-adapters/search?q=Thread.Sleep

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine for keeping Sleep for now.
it is not clear what we have to wait for at the moment

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with the current approach, especially if @dlg99 will follow up and create an issue to remove the Thread.sleep

producer.send(message);
}
producer.close();
Thread.sleep(500);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine for keeping Sleep for now.
it is not clear what we have to wait for at the moment

@eolivelli
Copy link
Contributor

@codelipenghui
I like the fact that with this patch all tests passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants