[Feature][Registry] Support etcd as registry #10981
Conversation
| private Long retryDelay=60L; | ||
| private Long retryMaxDelay=300L; |
There was a problem hiding this comment.
Consider also using Duration type, and format the codes please.
There was a problem hiding this comment.
The time unit for these two parameters is set by the ChronUnitRetry in jetcd. The type of these two parameters is long, but the type of retryMaxDuration is Duration.
You can see the reference of these three parameters in EtcdRegistry.java line 51 to 54.
There was a problem hiding this comment.
The time unit for these two parameters is set by the ChronUnitRetry in jetcd. The type of these two parameters is long, but the type of retryMaxDuration is Duration.
You can see the reference of these three parameters in EtcdRegistry.java line 51 to 54.
Hi, you don't have to just copy the type from JETCD client, using Duration as type in our own configurations is for users' convenient, they can just set something like 1s, 500ms, without knowing what's the time unit of the config. Also, users don't care what types we pass into EtcdRegistry.java, let's provide simplicity to users
There was a problem hiding this comment.
The time unit for these two parameters is set by the ChronUnitRetry in jetcd. The type of these two parameters is long, but the type of retryMaxDuration is Duration.
You can see the reference of these three parameters in EtcdRegistry.java line 51 to 54.Hi, you don't have to just copy the type from JETCD client, using
Durationas type in our own configurations is for users' convenient, they can just set something like1s,500ms, without knowing what's the time unit of the config. Also, users don't care what types we pass intoEtcdRegistry.java, let's provide simplicity to users
You are right,I fix this in Modify the type of delay
| // RetryPolicy | ||
| private Long retryDelay=60L; | ||
| private Long retryMaxDelay=300L; | ||
| private Duration retryMaxDuration=Duration.ofMillis(1500);; |
There was a problem hiding this comment.
| private Duration retryMaxDuration=Duration.ofMillis(1500);; | |
| private Duration retryMaxDuration=Duration.ofMillis(1500); |
| <dependency> | ||
| <groupId>io.etcd</groupId> | ||
| <artifactId>jetcd-test</artifactId> | ||
| </dependency> |
| <properties> | ||
| <maven.compiler.source>8</maven.compiler.source> | ||
| <maven.compiler.target>8</maven.compiler.target> | ||
| </properties> |
|
|
||
| # How to use | ||
|
|
||
| If you want to set the registry center as mysql,You need to set the registry properties in master/worker/api's appplication.yml |
There was a problem hiding this comment.
| If you want to set the registry center as mysql,You need to set the registry properties in master/worker/api's appplication.yml | |
| If you want to set the registry center as mysql, you need to set the registry properties in master/worker/api's appplication.yml |
...nscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-etcd/pom.xml
Show resolved
Hide resolved
| private Long retryDelay=60L; | ||
| private Long retryMaxDelay=300L; |
There was a problem hiding this comment.
The time unit for these two parameters is set by the ChronUnitRetry in jetcd. The type of these two parameters is long, but the type of retryMaxDuration is Duration.
You can see the reference of these three parameters in EtcdRegistry.java line 51 to 54.
Hi, you don't have to just copy the type from JETCD client, using Duration as type in our own configurations is for users' convenient, they can just set something like 1s, 500ms, without knowing what's the time unit of the config. Also, users don't care what types we pass into EtcdRegistry.java, let's provide simplicity to users
| public void put(String key, String value, boolean deleteOnDisconnect) { | ||
| try{ | ||
| if(deleteOnDisconnect) { | ||
| // keep the key by lease, if disconnected, the lease will ,the key will delete |
There was a problem hiding this comment.
This sentence is not complete...
| try { | ||
| Field connectField =client.getClass().getDeclaredField("connectManager"); | ||
| if(!connectField.isAccessible()){ | ||
| connectField.setAccessible(true); | ||
| } | ||
| Object connection = connectField.get(client); | ||
| Method channel = connection.getClass().getDeclaredMethod("getChannel"); | ||
| if (!channel.isAccessible()) { | ||
| channel.setAccessible(true); | ||
| } | ||
| return (ManagedChannel) channel.invoke(connection); | ||
| } catch (Exception e) { | ||
| throw new RegistryException("Failed to get the etcd client channel", e); | ||
| } |
There was a problem hiding this comment.
I don't think this is a good way to implement the connectivity state listener, why do you choose to use reflection instead of some native method of jetcd client?
There was a problem hiding this comment.
Ok, I will try to use keepalive in lease client to listen for connection status.
There was a problem hiding this comment.
I don't think this is a good way to implement the connectivity state listener, why do you choose to use reflection instead of some native method of jetcd client?
I made the problem complicated. I only need to periodically try to connect to Etcd, and the connection status can be judged by the connection result.
I have removed the reflection related code. Now, i use the client to apply for a lease to determine whether the connection is successful in Using the lease to listen connection state
|
Many files are missing license headers |
|
Hi @wjf222 please add the doc of the registry together. |
I fixed this in the Add license header |
I add the doc in [Document] Add readme and comments.Do you need to add other documents here? |
|
@kezhenxu94 @caishunfeng @ruanwenjun Please help continue to review. Thank you very much |
kezhenxu94
left a comment
There was a problem hiding this comment.
Generally looks good to me, please fix conflict
.../main/java/org/apache/dolphinscheduler/plugin/registry/etcd/EtcdConnectionStateListener.java
Outdated
Show resolved
Hide resolved
...gistry-etcd/src/main/java/org/apache/dolphinscheduler/plugin/registry/etcd/EtcdRegistry.java
Outdated
Show resolved
Hide resolved
…lphinscheduler-registry-etcd/src/main/java/org/apache/dolphinscheduler/plugin/registry/etcd/EtcdRegistry.java Co-authored-by: kezhenxu94 <kezhenxu94@apache.org>
…lphinscheduler-registry-etcd/src/main/java/org/apache/dolphinscheduler/plugin/registry/etcd/EtcdConnectionStateListener.java Co-authored-by: kezhenxu94 <kezhenxu94@apache.org>
@kezhenxu94 Thanks, I have fixed the conflict |
|
@wjf222 Please fix the conflicts. |
@caishunfeng I have fixed the conflict. Test bugs are due to new 3rd party packages introduced in other commits |
|
@caishunfeng Please pass the review, I have fixed the conflict. Thank you. |
|
@kezhenxu94 @caishunfeng @ruanwenjun Due to previous conflicts, modifications have been made, and I hope to pass this review again. Thank you very much. |
|
@wjf222 Please resolve the dependency check failure. |
24227e4 to
290c15c
Compare
|
Kudos, SonarCloud Quality Gate passed! |
@ruanwenjun I have fixed the conflict. Thank you. |
|
@kezhenxu94 @caishunfeng @ruanwenjun I have passed the test.Please apprve the review.Thank you. |
1 similar comment
|
@kezhenxu94 @caishunfeng @ruanwenjun I have passed the test.Please apprve the review.Thank you. |
ruanwenjun
left a comment
There was a problem hiding this comment.
LGTM, I will merged this to dev branch, and this feature will be released at 3.1.0, thanks for your contribution. @wjf222
(cherry picked from commit 2eb8b9f)








Purpose of the pull request
Close #8975
Brief change log
Add CRUD
Add Subscribe
Add Lock
Add ConnectStateListener
Verify this pull request
This change added tests and can be verified as follows:
Add persistTest to test for CRUD
Add lockTest for lock
TODO add connectStateListener Test