Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shade Netty into r2. #780

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and what APIs have changed, if applicable.

## [Unreleased]

## [29.38.0] - 2022-08-25
- Introduce restli-netty, a shaded Netty dependency for use with r2.

## [29.37.15] - 2022-08-23
- Exclude transitive Netty dependency for ZooKeeper client.

Expand Down Expand Up @@ -5309,7 +5312,8 @@ patch operations can re-use these classes for generating patch messages.

## [0.14.1]

[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.37.15...master
[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.38.0...master
[29.38.0]: https://github.com/linkedin/rest.li/compare/v29.37.15...v29.38.0
[29.37.15]: https://github.com/linkedin/rest.li/compare/v29.37.14...v29.37.15
[29.37.14]: https://github.com/linkedin/rest.li/compare/v29.37.13...v29.37.14
[29.37.13]: https://github.com/linkedin/rest.li/compare/v29.37.12...v29.37.13
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

buildscript {
repositories {
gradlePluginPortal()
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0'
classpath 'org.jacoco:org.jacoco.core:0.8.7'
}
Expand Down
14 changes: 11 additions & 3 deletions build_script/publications.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,21 @@ def manipulatePomXml = {
publishing {
publications {
// Define the "release" publication
release(MavenPublication) {
from components.java
release(MavenPublication) { publication ->
if (project.name == 'restli-netty' || project.name == 'restli-zookeeper') {
apply plugin: 'com.github.johnrengelman.shadow'
evanw555 marked this conversation as resolved.
Show resolved Hide resolved
project.shadow.component(publication)
} else {
from components.java
}

afterEvaluate {
// Add all extra archives (sources, javadoc, any custom archives e.g. all)
project.configurations.archives.allArtifacts.forEach {
if (it.classifier) {
// Skip 'slim' identifier, otherwise this logic attemps to publish the disabled slim jar for restli-netty.
// This requirement is related to the workaround for IDEA-163411 in the restli-netty project. When that bug
// is resolved this can be simplified.
if (it.classifier && it.classifier != 'slim') {
jpstewart marked this conversation as resolved.
Show resolved Hide resolved
artifact it
}
}
Expand Down
5 changes: 1 addition & 4 deletions d2-int-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ dependencies {
compile project(':data')
compile project(':pegasus-common')
compile project(':li-jersey-uri')
implementation project(path: ':restli-zookeeper', configuration: 'shadow')
compile fileTree(dir: 'lib', include: '*.jar')
compile externalDependency.commonsCodec
compile externalDependency.commonsIo
compile externalDependency.commonsHttpClient
compile(externalDependency.zookeeper) {
exclude group: 'io.netty'
}
compile externalDependency.jdkTools
compile externalDependency.netty
testCompile externalDependency.testng
testCompile externalDependency.commonsIo
testCompile externalDependency.metricsCore
Expand Down
18 changes: 9 additions & 9 deletions d2-int-test/src/test/java/com/linkedin/d2/quorum/ZKPeer.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.io.FileUtils;
import org.apache.zookeeper.server.NIOServerCnxnFactory;
import org.apache.zookeeper.server.ZKDatabase;
import org.apache.zookeeper.server.ZooKeeperServer;
import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
import org.apache.zookeeper.server.quorum.Election;
import org.apache.zookeeper.server.quorum.QuorumPeer;
import org.apache.zookeeper.server.quorum.QuorumPeer.LearnerType;
import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
import org.apache.zookeeper.server.quorum.flexible.QuorumMaj;
import com.linkedin.pegasus.org.apache.zookeeper.server.NIOServerCnxnFactory;
import com.linkedin.pegasus.org.apache.zookeeper.server.ZKDatabase;
import com.linkedin.pegasus.org.apache.zookeeper.server.ZooKeeperServer;
import com.linkedin.pegasus.org.apache.zookeeper.server.persistence.FileTxnSnapLog;
import com.linkedin.pegasus.org.apache.zookeeper.server.quorum.Election;
import com.linkedin.pegasus.org.apache.zookeeper.server.quorum.QuorumPeer;
import com.linkedin.pegasus.org.apache.zookeeper.server.quorum.QuorumPeer.LearnerType;
import com.linkedin.pegasus.org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
import com.linkedin.pegasus.org.apache.zookeeper.server.quorum.flexible.QuorumMaj;

import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import java.util.Iterator;
import java.util.Map;

import org.apache.zookeeper.server.quorum.QuorumPeer;
import org.apache.zookeeper.server.quorum.QuorumPeer.LearnerType;
import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
import org.apache.zookeeper.server.ZooKeeperServer;
import com.linkedin.pegasus.org.apache.zookeeper.server.quorum.QuorumPeer;
import com.linkedin.pegasus.org.apache.zookeeper.server.quorum.QuorumPeer.LearnerType;
import com.linkedin.pegasus.org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
import com.linkedin.pegasus.org.apache.zookeeper.server.ZooKeeperServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
1 change: 1 addition & 0 deletions d2-test-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dependencies {
compile project(':d2')
implementation project(path: ':restli-zookeeper', configuration: 'shadow')
compile externalDependency.testng
compile externalDependency.metricsCore
compile externalDependency.xerialSnappy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import java.net.InetSocketAddress;
import java.util.concurrent.CountDownLatch;
import org.apache.commons.io.FileUtils;
import org.apache.zookeeper.server.NIOServerCnxn;
import org.apache.zookeeper.server.NIOServerCnxnFactory;
import org.apache.zookeeper.server.ZooKeeperServer;
import com.linkedin.pegasus.org.apache.zookeeper.server.NIOServerCnxn;
import com.linkedin.pegasus.org.apache.zookeeper.server.NIOServerCnxnFactory;
import com.linkedin.pegasus.org.apache.zookeeper.server.ZooKeeperServer;

/**
* Very simple wrapper around ZooKeeper server, intended only for TEST use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package com.linkedin.d2.discovery.stores.zk;

import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import com.linkedin.pegasus.org.apache.zookeeper.WatchedEvent;
import com.linkedin.pegasus.org.apache.zookeeper.Watcher;
import org.testng.Assert;

import java.io.File;
Expand Down
4 changes: 1 addition & 3 deletions d2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ dependencies {
compile project(':data')
compile project(':pegasus-common')
compile project(':li-jersey-uri')
implementation project(path: ':restli-zookeeper', configuration: 'shadow')
compile externalDependency.commonsCodec
compile externalDependency.commonsIo
compile externalDependency.commonsCli
compile externalDependency.commonsHttpClient
compile externalDependency.httpclient
compile externalDependency.httpcore
compile externalDependency.hdrhistogram
compile(externalDependency.zookeeper) {
exclude group: 'io.netty'
}
compile externalDependency.jacksonCore
compile externalDependency.jacksonDataBind
compile externalDependency.jdkTools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;

import org.apache.zookeeper.KeeperException;
import com.linkedin.pegasus.org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import com.linkedin.d2.balancer.properties.UriProperties;
import com.linkedin.d2.discovery.stores.zk.ZooKeeperEphemeralStore;

import org.apache.zookeeper.KeeperException;
import com.linkedin.pegasus.org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.io.FileUtils;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import com.linkedin.pegasus.org.apache.zookeeper.Watcher.Event.KeeperState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.jvmstat.monitor.HostIdentifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import com.linkedin.d2.discovery.stores.zk.ZooKeeper;
import java.util.Collections;
import java.util.List;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.Stat;
import com.linkedin.pegasus.org.apache.zookeeper.AsyncCallback;
import com.linkedin.pegasus.org.apache.zookeeper.KeeperException;
import com.linkedin.pegasus.org.apache.zookeeper.data.Stat;

/**
* @author Steven Ihde
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.Watcher;
import com.linkedin.pegasus.org.apache.zookeeper.KeeperException;
import com.linkedin.pegasus.org.apache.zookeeper.Watcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package com.linkedin.d2.discovery.stores.zk;

import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;
import com.linkedin.pegasus.org.apache.zookeeper.AsyncCallback;
import com.linkedin.pegasus.org.apache.zookeeper.CreateMode;
import com.linkedin.pegasus.org.apache.zookeeper.KeeperException;
import com.linkedin.pegasus.org.apache.zookeeper.Watcher;
import com.linkedin.pegasus.org.apache.zookeeper.data.ACL;
import com.linkedin.pegasus.org.apache.zookeeper.data.Stat;

import java.util.List;

Expand Down Expand Up @@ -207,7 +207,7 @@ public void sync(final String path, AsyncCallback.VoidCallback cb, Object ctx)
}

@Override
public org.apache.zookeeper.ZooKeeper.States getState()
public com.linkedin.pegasus.org.apache.zookeeper.ZooKeeper.States getState()
{
return _zk.getState();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import com.linkedin.common.util.None;
import com.linkedin.d2.discovery.PropertySerializationException;
import com.linkedin.d2.discovery.PropertySerializer;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.Stat;
import com.linkedin.pegasus.org.apache.zookeeper.AsyncCallback;
import com.linkedin.pegasus.org.apache.zookeeper.KeeperException;
import com.linkedin.pegasus.org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package com.linkedin.d2.discovery.stores.zk;

import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;
import com.linkedin.pegasus.org.apache.zookeeper.AsyncCallback;
import com.linkedin.pegasus.org.apache.zookeeper.CreateMode;
import com.linkedin.pegasus.org.apache.zookeeper.Watcher;
import com.linkedin.pegasus.org.apache.zookeeper.KeeperException;
import com.linkedin.pegasus.org.apache.zookeeper.data.ACL;
import com.linkedin.pegasus.org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package com.linkedin.d2.discovery.stores.zk;

import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.data.ACL;
import com.linkedin.pegasus.org.apache.zookeeper.AsyncCallback;
import com.linkedin.pegasus.org.apache.zookeeper.CreateMode;
import com.linkedin.pegasus.org.apache.zookeeper.data.ACL;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package com.linkedin.d2.discovery.stores.zk;

import com.linkedin.d2.discovery.PropertySerializer;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.data.ACL;
import com.linkedin.pegasus.org.apache.zookeeper.AsyncCallback;
import com.linkedin.pegasus.org.apache.zookeeper.CreateMode;
import com.linkedin.pegasus.org.apache.zookeeper.Watcher;
import com.linkedin.pegasus.org.apache.zookeeper.data.ACL;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

import com.linkedin.d2.discovery.PropertySerializationException;
import com.linkedin.d2.discovery.PropertySerializer;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;
import com.linkedin.pegasus.org.apache.zookeeper.AsyncCallback;
import com.linkedin.pegasus.org.apache.zookeeper.CreateMode;
import com.linkedin.pegasus.org.apache.zookeeper.KeeperException;
import com.linkedin.pegasus.org.apache.zookeeper.WatchedEvent;
import com.linkedin.pegasus.org.apache.zookeeper.Watcher;
import com.linkedin.pegasus.org.apache.zookeeper.data.ACL;
import com.linkedin.pegasus.org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package com.linkedin.d2.discovery.stores.zk;

import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;
import com.linkedin.pegasus.org.apache.zookeeper.AsyncCallback;
import com.linkedin.pegasus.org.apache.zookeeper.CreateMode;
import com.linkedin.pegasus.org.apache.zookeeper.KeeperException;
import com.linkedin.pegasus.org.apache.zookeeper.Watcher;
import com.linkedin.pegasus.org.apache.zookeeper.data.ACL;
import com.linkedin.pegasus.org.apache.zookeeper.data.Stat;

import java.io.IOException;
import java.util.List;
Expand All @@ -34,23 +34,23 @@
*/
public class VanillaZooKeeperAdapter implements ZooKeeper
{
private final org.apache.zookeeper.ZooKeeper _zk;
private final com.linkedin.pegasus.org.apache.zookeeper.ZooKeeper _zk;

public VanillaZooKeeperAdapter(org.apache.zookeeper.ZooKeeper zk)
public VanillaZooKeeperAdapter(com.linkedin.pegasus.org.apache.zookeeper.ZooKeeper zk)
{
_zk = zk;
}

public VanillaZooKeeperAdapter(String connectString, int sessionTimeout, Watcher watcher)
throws IOException
{
_zk = new org.apache.zookeeper.ZooKeeper(connectString, sessionTimeout, watcher);
_zk = new com.linkedin.pegasus.org.apache.zookeeper.ZooKeeper(connectString, sessionTimeout, watcher);
}

public VanillaZooKeeperAdapter(String connectString, int sessionTimeout, Watcher watcher,
long sessionId, byte[] sessionPasswd) throws IOException
{
_zk = new org.apache.zookeeper.ZooKeeper(connectString, sessionTimeout, watcher, sessionId, sessionPasswd);
_zk = new com.linkedin.pegasus.org.apache.zookeeper.ZooKeeper(connectString, sessionTimeout, watcher, sessionId, sessionPasswd);
}

@Override
Expand Down Expand Up @@ -218,7 +218,7 @@ public void sync(final String path, AsyncCallback.VoidCallback cb, Object ctx)
}

@Override
public org.apache.zookeeper.ZooKeeper.States getState()
public com.linkedin.pegasus.org.apache.zookeeper.ZooKeeper.States getState()
{
return _zk.getState();
}
Expand Down
Loading