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

[KYUUBI #2644] Add etcd discovery client for HA #2767

Closed
wants to merge 6 commits into from

Conversation

hddong
Copy link
Contributor

@hddong hddong commented May 27, 2022

Why are the changes needed?

Add etcd discovery client for HA

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before make a pull request

@hddong hddong marked this pull request as draft May 27, 2022 09:47
@hddong hddong self-assigned this May 27, 2022
@github-actions github-actions bot added the kind:infra license, community building, project builds, asf infra related, etc. label May 30, 2022
@codecov-commenter
Copy link

codecov-commenter commented May 31, 2022

Codecov Report

Merging #2767 (6fa3757) into master (1bc3916) will increase coverage by 0.13%.
The diff coverage is 74.05%.

@@             Coverage Diff              @@
##             master    #2767      +/-   ##
============================================
+ Coverage     50.42%   50.55%   +0.13%     
  Complexity        6        6              
============================================
  Files           454      455       +1     
  Lines         25480    25631     +151     
  Branches       3576     3589      +13     
============================================
+ Hits          12848    12959     +111     
- Misses        11409    11436      +27     
- Partials       1223     1236      +13     
Impacted Files Coverage Δ
...he/kyuubi/ha/client/etcd/EtcdDiscoveryClient.scala 72.41% <72.41%> (ø)
...la/org/apache/kyuubi/ha/HighAvailabilityConf.scala 98.23% <85.71%> (-0.84%) ⬇️
...ubi/ha/client/zookeeper/ZookeeperACLProvider.scala 85.00% <100.00%> (ø)
.../ha/client/zookeeper/ZookeeperClientProvider.scala 71.01% <100.00%> (ø)
...ha/client/zookeeper/ZookeeperDiscoveryClient.scala 69.87% <100.00%> (ø)
...ain/scala/org/apache/kyuubi/engine/EngineRef.scala 75.23% <100.00%> (ø)
.../org/apache/kyuubi/operation/KyuubiOperation.scala 67.60% <0.00%> (-1.41%) ⬇️
...in/scala/org/apache/kyuubi/config/KyuubiConf.scala 97.24% <0.00%> (-0.10%) ⬇️
...a/org/apache/kyuubi/service/TFrontendService.scala 91.44% <0.00%> (+0.29%) ⬆️
...n/scala/org/apache/kyuubi/engine/ProcBuilder.scala 83.75% <0.00%> (+0.62%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1bc3916...6fa3757. Read the comment docs.

@hddong hddong marked this pull request as ready for review May 31, 2022 05:56
@hddong
Copy link
Contributor Author

hddong commented May 31, 2022

cc @yaooqinn @pan3793

@hddong hddong changed the title [KYUUBI #2644][WIP] Add etcd discovery client for HA [KYUUBI #2644] Add etcd discovery client for HA May 31, 2022
val ns = DiscoveryPaths.makePath(null, namespace)
create(ns, "PERSISTENT")

val session = conf.get(HA_ZK_ENGINE_REF_ID)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should rename this configuration as it is used in both ETCD and ZK

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for feedback late, done.

@hddong hddong force-pushed the etcd-support branch 2 times, most recently from afb980e to 0680687 Compare June 6, 2022 01:16
@hddong
Copy link
Contributor Author

hddong commented Jun 9, 2022

@yaooqinn @pan3793 : Please have a review when free.

@@ -59,6 +68,7 @@ jakarta.validation-api/2.0.2//jakarta.validation-api-2.0.2.jar
jakarta.ws.rs-api/2.1.6//jakarta.ws.rs-api-2.1.6.jar
jakarta.xml.bind-api/2.3.2//jakarta.xml.bind-api-2.3.2.jar
javassist/3.25.0-GA//javassist-3.25.0-GA.jar
javax.annotation-api/1.3.2//javax.annotation-api-1.3.2.jar
Copy link
Member

Choose a reason for hiding this comment

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

We don't need this, jakarta.annotation-api is a drop-in replacement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@@ -87,9 +101,15 @@ metrics-json/4.2.8//metrics-json-4.2.8.jar
metrics-jvm/4.2.8//metrics-jvm-4.2.8.jar
netty-all/4.1.73.Final//netty-all-4.1.73.Final.jar
netty-buffer/4.1.73.Final//netty-buffer-4.1.73.Final.jar
netty-codec-dns/4.1.74.Final//netty-codec-dns-4.1.74.Final.jar
Copy link
Member

@pan3793 pan3793 Jun 12, 2022

Choose a reason for hiding this comment

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

gRPC uses a shaded netty, why do we need those netty stuff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gRPC uses a shaded netty, why do we need those netty stuff?

These netty jars are a dependency of jetcd, had try to use netty-shaded, but got ClassNoDefException. Classes in netty-shaded have prefix io.grpc, jetcd can not recognized. Any suggestions?

Copy link
Member

Choose a reason for hiding this comment

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

etcd-io/jetcd#1068 seems going to provide an all-in-one client jar then we can get rid of those dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

etcd-io/jetcd#1068 seems going to provide an all-in-one client jar then we can get rid of those dependencies.

Yep, we can provide an additional pr to change to shaded jar after it was merged and released

@@ -0,0 +1,3 @@
io.grpc.internal.PickFirstLoadBalancerProvider
io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider
io.grpc.grpclb.GrpclbLoadBalancerProvider
Copy link
Member

Choose a reason for hiding this comment

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

What doesn't relocate them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What doesn't relocate them?

Had do this, and got

Caused by: java.lang.IllegalArgumentException: cannot find a NameResolver for ip:///100.71.36.42:2389
        at org.apache.kyuubi.shade.io.grpc.internal.ManagedChannelImpl.getNameResolver(ManagedChannelImpl.java:776)
        at org.apache.kyuubi.shade.io.grpc.internal.ManagedChannelImpl.getNameResolver(ManagedChannelImpl.java:785)
        at org.apache.kyuubi.shade.io.grpc.internal.ManagedChannelImpl.<init>(ManagedChannelImpl.java:665)
        at org.apache.kyuubi.shade.io.grpc.internal.ManagedChannelImplBuilder.build(ManagedChannelImplBuilder.java:630)
        at org.apache.kyuubi.shade.io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:297)
        at org.apache.kyuubi.shade.io.vertx.grpc.VertxChannelBuilder.build(VertxChannelBuilder.java:302)
        at io.etcd.jetcd.impl.ClientConnectionManager.getChannel(ClientConnectionManager.java:89)

Although we provide IPResolverProvider in nameresolverprovider, NameResolver can not load IPResolverProvider, we can relocate them after a solution is found.

@@ -43,7 +43,7 @@ trait DiscoveryClient extends Logging {
/**
* Get the stored data under path.
*/
def getData(path: String): Array[Byte]
def getData(path: String): String
Copy link
Member

Choose a reason for hiding this comment

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

We'd better avoid changing the API as much as possible.

val pathPrefix = DiscoveryPaths.makePath(
namespace,
s"serviceUri=$instance;version=${version.getOrElse(KYUUBI_VERSION)};${session}sequence=")
val znodeData = instance
Copy link
Member

Choose a reason for hiding this comment

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

znode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -0,0 +1,3 @@
io.grpc.internal.PickFirstLoadBalancerProvider
Copy link
Member

Choose a reason for hiding this comment

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

license can be added here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

license can be added here

Done

@@ -0,0 +1,4 @@
io.etcd.jetcd.resolver.DnsSrvResolverProvider
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
@hddong hddong force-pushed the etcd-support branch 2 times, most recently from 017cf11 to aef68b8 Compare June 22, 2022 07:53
@hddong hddong force-pushed the etcd-support branch 5 times, most recently from 297233a to ef0e51c Compare June 24, 2022 09:42
@hddong
Copy link
Contributor Author

hddong commented Jul 1, 2022

@yaooqinn @pan3793 @zwangsheng : Took some time to fix the tests, can review this again.

Copy link
Contributor

@zwangsheng zwangsheng left a comment

Choose a reason for hiding this comment

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

LGTM


val conf: KyuubiConf = {
KyuubiConf()
.set(HA_CLIENT_CLASS, classOf[EtcdDiscoveryClient].getName)
Copy link
Contributor

Choose a reason for hiding this comment

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

How about we describe the option EtcdDiscoveryClient in the HA_CLIENT_CLASS docs, after all, ETCD is not mentioned in the docs at present.

.rat-excludes Outdated
Comment on lines 47 to 48
**/io.grpc.LoadBalancerProvider
**/io.grpc.NameResolverProvider
Copy link
Member

Choose a reason for hiding this comment

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

nit: remove them from rat-ex

@yaooqinn yaooqinn added this to the v1.6.0 milestone Jul 12, 2022
@yaooqinn yaooqinn closed this in 32970ce Jul 12, 2022
@yaooqinn
Copy link
Member

thanks, merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:build kind:documentation Documentation is a feature! kind:infra license, community building, project builds, asf infra related, etc. module:ha module:server module:spark
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants