Skip to content

Commit

Permalink
[improve][pom] Remove redundant pulsar-zookeeper-utils module (apache…
Browse files Browse the repository at this point in the history
…#16109)

### Motivation

As PIP-45 moved forward, pulsar-zookeeper-utils is redundant to be a dedicated module. Move the remaining classes to pulsar-broker.

### Modifications

Remove pulsar-zookeeper-utils module and move remaining utils to pulsar-broker module.

### Verifying this change

- [x] Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

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

*If `yes` was chosen, please highlight the changes*

  - Dependencies (does it add or upgrade a dependency): **yes**

This change will remove the pulsar-zookeeper-utils module. Since we release pulsar modules simultaneously, I suggest it won't be a big deal.

  - The public API: (no)
  - The schema: (no)
  - The default values of configurations: (no)
  - The wire protocol: (no)
  - The rest endpoints: (no)
  - The admin cli options: (no)
  - Anything that affects deployment: (no)

### Documentation

Check the box below or label this PR directly.

Need to update docs? 

- [ ] `doc-required` 
(Your PR needs to update docs and you will update later)
  
- [x] `doc-not-needed` 
(Please explain why)
  
- [ ] `doc` 
(Your PR contains doc changes)

- [ ] `doc-complete`
(Docs have been already added)
  • Loading branch information
tisonkun authored Jun 21, 2022
1 parent 771fd54 commit b0828aa
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 366 deletions.
2 changes: 0 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2083,7 +2083,6 @@ flexible messaging model and an intuitive client API.</description>
<module>pulsar-client-all</module>
<module>pulsar-websocket</module>
<module>pulsar-proxy</module>
<module>pulsar-zookeeper-utils</module>
<module>pulsar-testclient</module>
<module>pulsar-broker-auth-athenz</module>
<module>pulsar-client-auth-athenz</module>
Expand Down Expand Up @@ -2146,7 +2145,6 @@ flexible messaging model and an intuitive client API.</description>
<module>pulsar-client-tools-test</module>
<module>pulsar-websocket</module>
<module>pulsar-proxy</module>
<module>pulsar-zookeeper-utils</module>
<module>pulsar-testclient</module>
<module>pulsar-broker-auth-sasl</module>
<module>pulsar-client-auth-sasl</module>
Expand Down
19 changes: 13 additions & 6 deletions pulsar-broker-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@
<description>Common classes used in multiple broker modules</description>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-zookeeper-utils</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-metadata</artifactId>
Expand All @@ -50,6 +44,11 @@
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_jetty</artifactId>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
Expand All @@ -70,6 +69,14 @@
<artifactId>jjwt-jackson</artifactId>
</dependency>

<!-- test -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bc-fips</artifactId>
<version>${bouncycastlefips.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
Expand Down
51 changes: 37 additions & 14 deletions pulsar-broker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,38 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>

<dependency>
<groupId>org.apache.bookkeeper</groupId>
<artifactId>stream-storage-server</artifactId>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-all</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.curator</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.bookkeeper.tests</groupId>
<artifactId>stream-storage-tests-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</exclusion>
<exclusion>
<groupId>org.inferred</groupId>
<artifactId>freebuilder</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.bookkeeper</groupId>
<artifactId>bookkeeper-tools-framework</artifactId>
Expand Down Expand Up @@ -119,12 +151,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-zookeeper-utils</artifactId>
<version>${project.version}</version>
</dependency>

<!-- zookeeper server -->
<dependency>
<groupId>io.dropwizard.metrics</groupId>
Expand Down Expand Up @@ -281,6 +307,11 @@
<artifactId>simpleclient_hotspot</artifactId>
</dependency>

<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_caffeine</artifactId>
</dependency>

<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
Expand Down Expand Up @@ -616,14 +647,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-zookeeper-utils</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-package-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.pulsar.stats;

import lombok.experimental.UtilityClass;

@UtilityClass
public class CacheMetricsCollector {

public static final io.prometheus.client.cache.caffeine.CacheMetricsCollector CAFFEINE =
new io.prometheus.client.cache.caffeine.CacheMetricsCollector()
.register();
new io.prometheus.client.cache.caffeine.CacheMetricsCollector().register();
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
/**

/*
* This file is derived from LocalBookkeeperEnsemble from Apache BookKeeper
* http://bookkeeper.apache.org
*/
Expand Down Expand Up @@ -169,11 +170,11 @@ public LocalBookkeeperEnsemble(int numberOfBookies,
// BookKeeper variables
String bkDataDirName;
LifecycleComponentStack[] bookieComponents;
ServerConfiguration bsConfs[];
ServerConfiguration[] bsConfs;

// Stream/Table Storage
StreamStorageLifecycleComponent streamStorage;
Integer streamStoragePort = 4181;
int streamStoragePort;

// directories created by this instance
// it is safe to drop them on stop
Expand Down Expand Up @@ -231,7 +232,7 @@ public void disconnectZookeeper(ZooKeeper zooKeeper) {
ServerCnxn serverCnxn = getZookeeperServerConnection(zooKeeper);
try {
LOG.info("disconnect ZK server side connection {}", serverCnxn);
Class disconnectReasonClass = Class.forName("org.apache.zookeeper.server.ServerCnxn$DisconnectReason");
Class<?> disconnectReasonClass = Class.forName("org.apache.zookeeper.server.ServerCnxn$DisconnectReason");
Method method = serverCnxn.getClass().getMethod("close", disconnectReasonClass);
method.invoke(serverCnxn, Stream.of(disconnectReasonClass.getEnumConstants()).filter(s ->
s.toString().equals("CONNECTION_CLOSE_FORCED")).findFirst().get());
Expand Down Expand Up @@ -289,7 +290,7 @@ private void runBookies(ServerConfiguration baseConf) throws Exception {

File bkDataDir = isNotBlank(bkDataDirName)
? Files.createDirectories(Paths.get(bkDataDirName + i)).toFile()
: createTempDirectory("bk" + Integer.toString(i) + "test");
: createTempDirectory("bk" + i + "test");

if (this.clearOldData) {
cleanDirectory(bkDataDir);
Expand Down
6 changes: 0 additions & 6 deletions pulsar-proxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-zookeeper-utils</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-broker-common</artifactId>
Expand Down
6 changes: 0 additions & 6 deletions pulsar-websocket/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-zookeeper-utils</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down
Loading

0 comments on commit b0828aa

Please sign in to comment.