Skip to content

Commit

Permalink
Issues/23555 (#57)
Browse files Browse the repository at this point in the history
* Fix issue: apache/pulsar#23555.
Upgrade Pulsar to 3.0.7

* Fix issue: apache/pulsar#23555.
- Use `jdk17`
- Upgrade `maven-shade-plugin` to support `jdk17`

* Fix issue: apache/pulsar#23555.
- Fix UT

* Fix issue: apache/pulsar#23555.
- Fix UT

* Fix issue: apache/pulsar#23555.
- remove useless variable

* Fix issue: apache/pulsar#23555.
- Use jdk8

* Fix issue: apache/pulsar#23555.
- Remove useless property
  • Loading branch information
visxu authored Nov 14, 2024
1 parent 5aeddbb commit 4092d48
Show file tree
Hide file tree
Showing 29 changed files with 67 additions and 42 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ jobs:
distribution: 'adopt'
java-version: 17

- name: install org.apache.pulsar.tests:integration:jar:tests:2.11.0
- name: install org.apache.pulsar.tests:integration:jar:tests:3.0.7
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: |
cd ~
git clone --depth 50 --single-branch --branch v2.11.0 https://github.com/apache/pulsar
git clone --depth 50 --single-branch --branch v3.0.7 https://github.com/apache/pulsar
cd pulsar
mvn -B -ntp -f tests/pom.xml -pl org.apache.pulsar.tests:tests-parent,org.apache.pulsar.tests:integration install
- name: build apachepulsar/pulsar-test-latest-version:latest
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: |
docker pull apachepulsar/pulsar-all:2.11.0
docker pull apachepulsar/pulsar:2.11.0
docker tag apachepulsar/pulsar-all:2.11.0 apachepulsar/pulsar-all:latest
docker tag apachepulsar/pulsar:2.11.0 apachepulsar/pulsar:latest
docker pull apachepulsar/pulsar-all:3.0.7
docker pull apachepulsar/pulsar:3.0.7
docker tag apachepulsar/pulsar-all:3.0.7 apachepulsar/pulsar-all:latest
docker tag apachepulsar/pulsar:3.0.7 apachepulsar/pulsar:latest
cd ~/pulsar
mvn -B -ntp -f tests/docker-images/pom.xml install -pl org.apache.pulsar.tests:latest-version-image -am -Pdocker,-main -DskipTests
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ mvn install
In order to build this repository the linked Pulsar release must be released to Maven Central
other wise you have to build it locally.

For instance if this code depends on Pulsar 2.11.0 you have to build Pulsar 2.11.0 locally
For instance if this code depends on Pulsar 3.0.7 you have to build Pulsar 3.0.7 locally

```
git clone https://github.com/apache/pulsar
git checkout v2.11.0
git checkout v3.0.7
mvn clean install -DskipTests
```

Expand Down
4 changes: 2 additions & 2 deletions examples/kafka-streams/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.pulsar.examples</groupId>
<artifactId>pulsar-adapters-examples</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
</parent>

<artifactId>kafka-streams</artifactId>
Expand All @@ -35,7 +35,7 @@
<dependency>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-kafka</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
</dependency>

<!-- Apache Kafka dependencies -->
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-adapters</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
</parent>

<groupId>org.apache.pulsar.examples</groupId>
Expand Down
2 changes: 1 addition & 1 deletion examples/spark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.pulsar.examples</groupId>
<artifactId>pulsar-adapters-examples</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
</parent>

<artifactId>spark</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-adapters</artifactId>

<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>

<name>Pulsar Adapters</name>
<description>A collections of Pulsar adapters.</description>
Expand Down Expand Up @@ -76,7 +76,7 @@
</issueManagement>

<properties>
<pulsar.version>2.11.0</pulsar.version>
<pulsar.version>3.0.7</pulsar.version>
<kafka-client.version>2.7.2</kafka-client.version>
<storm.version>2.0.0</storm.version>
<kafka_0_8.version>0.8.1.1</kafka_0_8.version>
Expand Down Expand Up @@ -123,7 +123,7 @@
<surefire.version>3.0.0-M3</surefire.version>
<maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
<maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
<maven-shade-plugin>3.2.4</maven-shade-plugin>
<maven-shade-plugin>3.4.1</maven-shade-plugin>
<maven-antrun-plugin.version>3.0.0</maven-antrun-plugin.version>
<nifi-nar-maven-plugin.version>1.2.0</nifi-nar-maven-plugin.version>
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
Expand Down
2 changes: 1 addition & 1 deletion pulsar-client-kafka-compat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-adapters</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-kafka-compat</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-kafka-compat</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-kafka-compat</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand Down
7 changes: 6 additions & 1 deletion pulsar-client-kafka-compat/pulsar-client-kafka-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-kafka-compat</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand All @@ -36,6 +36,11 @@

<description>Tests to verify the correct shading configuration for the pulsar-client-kafka wrapper</description>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-kafka-compat</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand All @@ -36,6 +36,11 @@

<description>Tests to verify the correct shading configuration for the pulsar-client-kafka wrapper</description>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-kafka-compat</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand All @@ -36,6 +36,11 @@

<description>Tests to verify the correct shading configuration for the pulsar-client-kafka wrapper</description>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
2 changes: 1 addition & 1 deletion pulsar-client-kafka-compat/pulsar-client-kafka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-kafka-compat</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ public void subscribe(Collection<String> topics, ConsumerRebalanceListener callb
for (String topic : topics) {
// Create individual subscription on each partition, that way we can keep using the
// acknowledgeCumulative()
int numberOfPartitions = ((PulsarClientImpl) client).getNumberOfPartitions(topic).get();
int numberOfPartitions = ((PulsarClientImpl) client).getPartitionedTopicMetadata(topic, true, false)
.thenApply(metadata -> metadata.partitions).get();

ConsumerBuilder<byte[]> consumerBuilder = PulsarConsumerKafkaConfig.getConsumerBuilder(client, properties);
consumerBuilder.subscriptionType(SubscriptionType.Failover);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static class Bar {
@ObjectFactory
// Necessary to make PowerMockito.mockStatic work with TestNG.
public IObjectFactory getObjectFactory() {
return new org.powermock.modules.testng.PowerMockObjectFactory();
return new org.powermock.modules.testng.internal.PowerMockClassloaderObjectFactory();
}

@Test
Expand Down
7 changes: 6 additions & 1 deletion pulsar-client-kafka-compat/pulsar-client-kafka_0_8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-kafka-compat</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand All @@ -36,6 +36,11 @@

<description>Kafka client library that publishes and consumes messages on Pulsar topics</description>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion pulsar-client-kafka-compat/pulsar-client-kafka_0_9/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-kafka-compat</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ public void subscribe(List<String> topics, ConsumerRebalanceListener callback) {
for (String topic : topics) {
// Create individual subscription on each partition, that way we can keep using the
// acknowledgeCumulative()
int numberOfPartitions = ((PulsarClientImpl) client).getNumberOfPartitions(topic).get();
int numberOfPartitions = ((PulsarClientImpl) client).getPartitionedTopicMetadata(topic, true, false)
.thenApply(metadata -> metadata.partitions).get();

ConsumerBuilder<byte[]> consumerBuilder = PulsarConsumerKafkaConfig.getConsumerBuilder(client, properties);
consumerBuilder.subscriptionType(SubscriptionType.Failover);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static class Bar {
@ObjectFactory
// Necessary to make PowerMockito.mockStatic work with TestNG.
public IObjectFactory getObjectFactory() {
return new org.powermock.modules.testng.PowerMockObjectFactory();
return new org.powermock.modules.testng.internal.PowerMockClassloaderObjectFactory();
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion pulsar-log4j2-appender/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-adapters</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pulsar-spark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-adapters</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pulsar-storm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-adapters</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<relativePath>..</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ public void execute(Tuple input) {
}
collector.ack(input);
} else {
final long messageSizeToBeSent = ((TypedMessageBuilderImpl<byte[]>) msgBuilder).getContent()
.remaining();
msgBuilder.sendAsync().handle((msgId, ex) -> {
synchronized (collector) {
if (ex != null) {
Expand All @@ -140,7 +138,7 @@ public void execute(Tuple input) {
} else {
collector.ack(input);
++messagesSent;
messageSizeSent += messageSizeToBeSent;
messageSizeSent += ((TypedMessageBuilderImpl<byte[]>) msgBuilder).getContent().remaining();
if (LOG.isDebugEnabled()) {
LOG.debug("[{}] Message sent with id {}", boltId, msgId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.apache.pulsar.client.api.PulsarClient;
import org.apache.pulsar.client.api.PulsarClientException;
import org.apache.pulsar.client.api.Reader;
import org.apache.pulsar.client.impl.Backoff;
import org.apache.pulsar.common.util.Backoff;
import org.apache.pulsar.client.impl.ClientBuilderImpl;
import org.apache.pulsar.client.impl.conf.ClientConfigurationData;
import org.apache.pulsar.client.impl.conf.ConsumerConfigurationData;
Expand Down
2 changes: 1 addition & 1 deletion tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-adapters</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
</parent>
<groupId>org.apache.pulsar.tests</groupId>
<artifactId>adapters-tests-parent</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion tests/pulsar-kafka-compat-client-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.pulsar.tests</groupId>
<artifactId>adapters-tests-parent</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
</parent>

<artifactId>pulsar-kafka-compat-client-test</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions tests/pulsar-spark-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.pulsar.tests</groupId>
<artifactId>adapters-tests-parent</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
</parent>

<artifactId>pulsar-spark-test</artifactId>
Expand All @@ -41,7 +41,7 @@
<dependency>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-spark</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<scope>test</scope>
</dependency>

Expand Down
9 changes: 7 additions & 2 deletions tests/pulsar-storm-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,24 @@
<parent>
<groupId>org.apache.pulsar.tests</groupId>
<artifactId>adapters-tests-parent</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
</parent>

<artifactId>pulsar-storm-test</artifactId>
<packaging>jar</packaging>
<name>Pulsar Storm adapter Tests</name>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>

<dependency>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-storm</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>3.0.7</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand Down

0 comments on commit 4092d48

Please sign in to comment.