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

(WIP)bugfix:Fix problems while using etcd3 as registry #7191

Closed
wants to merge 22 commits into from
Closed
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
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ jobs:
MODE: standalone
SPRING_SECURITY_ENABLED: false
options: --health-cmd="curl -f http://localhost:8848/nacos" --health-interval=10s --health-timeout=5s --health-retries=3 --health-start-period=30s
etcd3:
image: bitnami/etcd:3.5
ports:
- 2379:2379
env:
ALLOW_NONE_AUTHENTICATION: yes
options: --health-cmd="/opt/bitnami/scripts/etcd/healthcheck.sh" --health-interval=10s --health-timeout=5s --health-retries=5 --health-start-period=30s
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
21 changes: 2 additions & 19 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
<jettison.version>1.5.4</jettison.version>
<consul-clients.version>1.4.2</consul-clients.version>
<nacos-client.version>1.4.6</nacos-client.version>
<etcd-client-v3.version>0.5.0</etcd-client-v3.version>
<testcontainers.version>1.11.2</testcontainers.version>
<etcd-client-v3.version>0.7.7</etcd-client-v3.version>
<guava.version>32.1.3-jre</guava.version>
<javax-inject.version>1</javax-inject.version>
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
Expand All @@ -79,7 +78,7 @@
<sofa.hessian.version>4.0.3</sofa.hessian.version>
<sofa.bolt.version>1.6.7</sofa.bolt.version>
<protobuf.version>3.25.4</protobuf.version>
<grpc.version>1.55.1</grpc.version>
<grpc.version>1.60.0</grpc.version>
<kryo.version>5.4.0</kryo.version>
<kryo-serializers.version>0.45</kryo-serializers.version>
<hessian.version>4.0.63</hessian.version>
Expand Down Expand Up @@ -550,22 +549,6 @@
</exclusions>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-launcher</artifactId>
<version>${etcd-client-v3.version}</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>${testcontainers.version}</version>
<exclusions>
<exclusion>
<groupId>org.scijava</groupId>
<artifactId>native-lib-loader</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.scijava</groupId>
<artifactId>native-lib-loader</artifactId>
Expand Down
16 changes: 4 additions & 12 deletions discovery/seata-discovery-etcd3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,19 @@
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!--test-->
<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scijava</groupId>
<artifactId>native-lib-loader</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ private void process() {
try {
//1.get TTL
LeaseTimeToLiveResponse leaseTimeToLiveResponse = this.leaseClient.timeToLive(this.leaseId, LeaseOption.DEFAULT).get();
final long tTl = leaseTimeToLiveResponse.getTTl();
final long tTl = leaseTimeToLiveResponse.getTTL();
if (tTl <= LIFE_KEEP_CRITICAL) {
//2.refresh the TTL
this.leaseClient.keepAliveOnce(this.leaseId).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
import io.etcd.jetcd.ByteSequence;
import io.etcd.jetcd.Client;
import io.etcd.jetcd.Watch;
import io.etcd.jetcd.launcher.junit4.EtcdClusterResource;
import io.etcd.jetcd.options.DeleteOption;
import io.etcd.jetcd.options.GetOption;
import io.etcd.jetcd.watch.WatchResponse;
import org.apache.seata.discovery.registry.etcd3.EtcdRegistryProvider;
import org.apache.seata.discovery.registry.etcd3.EtcdRegistryServiceImpl;
import org.apache.seata.discovery.registry.RegistryService;
import org.junit.Rule;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
Expand All @@ -45,16 +44,14 @@
public class EtcdRegistryServiceImplTest {
private static final String REGISTRY_KEY_PREFIX = "registry-seata-";
private static final String CLUSTER_NAME = "default";
@Rule
private final static EtcdClusterResource etcd = new EtcdClusterResource(CLUSTER_NAME, 1);

private final Client client = Client.builder().endpoints(etcd.getClientEndpoints()).build();
private final Client client = Client.builder().endpoints("http://etcd3:2379").build();
private final static String HOST = "127.0.0.1";
private final static int PORT = 8091;

@BeforeAll
public static void beforeClass() throws Exception {
System.setProperty(EtcdRegistryServiceImpl.TEST_ENDPONT, etcd.getClientEndpoints().get(0).toString());
System.setProperty(EtcdRegistryServiceImpl.TEST_ENDPONT, "http://etcd3:2379");
}

@AfterAll
Expand Down
2 changes: 1 addition & 1 deletion integration/grpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.25.4:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.55.1:exe:${os.detected.classifier}</pluginArtifact>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.60.0:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ seata:
tokenValidityInMilliseconds: 1800000
csrf-ignore-urls: /metadata/v1/**
ignore:
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login,/version.json,/health,/error,/vgroup/v1/**
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login,/version.json,/health,/error,/vgroup/v1/**
4 changes: 2 additions & 2 deletions test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>
io.grpc:protoc-gen-grpc-java:1.55.1:exe:${os.detected.classifier}
io.grpc:protoc-gen-grpc-java:1.60.0:exe:${os.detected.classifier}
</pluginArtifact>
</configuration>
<executions>
Expand Down Expand Up @@ -191,4 +191,4 @@
</dependencies>


</project>
</project>
Loading