Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.x' into test-os-2.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/build.yml
#	.github/workflows/test-druid.yml
#	.github/workflows/test.yml
  • Loading branch information
wangliang181230 committed Nov 29, 2023
2 parents b37e94f + 30f88b6 commit 5426f69
Show file tree
Hide file tree
Showing 29 changed files with 712 additions and 162 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ jobs:
run: |
./mvnw -T 4C clean test \
-Dcheckstyle.skip=false -Dlicense.skip=false \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
-Dmaven.git-commit-id.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
# step 4.2
- name: "Test with Maven and Java${{ matrix.java }}"
if: matrix.java != '8'
run: |
./mvnw -T 4C clean test \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
-Dmaven.git-commit-id.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
# step 5
- name: "Codecov"
if: matrix.java == '8'
Expand Down Expand Up @@ -69,6 +69,7 @@ jobs:
apt-get install maven -y && \
mvn -version && \
mvn clean install \
-DskipTests \
-Prelease-seata \
-DskipTests \
-Dmaven.git-commit-id.skip=true \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
1 change: 1 addition & 0 deletions .github/workflows/test-druid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ jobs:
run: |
./mvnw -T 4C clean test \
-Ddruid.version=${{ matrix.druid }} \
-Dmaven.git-commit-id.skip=true \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
./mvnw -T 4C clean install \
-P args-for-client-test \
-Dspring-boot.version=${{ matrix.springboot }} \
-Dmaven.git-commit-id.skip=true \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
# job 2
Expand Down Expand Up @@ -83,4 +84,5 @@ jobs:
-P args-for-client-test \
-Dspring-boot.version=${{ matrix.springboot }} \
-Dkotlin-maven-plugin.version=1.7.22 \
-Dmaven.git-commit-id.skip=true \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
36 changes: 32 additions & 4 deletions build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@
<junit-jupiter.version>5.8.2</junit-jupiter.version>
<junit-platform.version>1.8.2</junit-platform.version>

<!-- For test -->
<junit-jupiter.version>5.8.2</junit-jupiter.version>
<junit-platform.version>1.8.2</junit-platform.version>

<!-- Maven plugin versions -->
<!-- Build -->
<easyj-maven-plugin.version>1.1.5</easyj-maven-plugin.version>
Expand Down Expand Up @@ -124,6 +120,7 @@
<checkstyle.skip>true</checkstyle.skip>
<license.skip>true</license.skip>
<maven.test.skip>false</maven.test.skip>
<maven.git-commit-id.skip>false</maven.git-commit-id.skip>
<maven.surefire.argLine></maven.surefire.argLine>
<maven.surefire.excludes></maven.surefire.excludes>
<gpg.keyname>37F181C60AACE24BD5C1D3925583F79497E8E293</gpg.keyname>
Expand Down Expand Up @@ -204,6 +201,32 @@
<useTabIndent>true</useTabIndent>
</configuration>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>${git-commit-id-plugin.version}</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>${maven.git-commit-id.skip}</skip>
<verbose>true</verbose>
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/seata-git.properties</generateGitPropertiesFilename>
<includeOnlyProperties>
<includeOnlyProperty>git.branch</includeOnlyProperty>
<includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
<includeOnlyProperty>^git.commit.(id|time)$</includeOnlyProperty>
<includeOnlyProperty>git.dirty</includeOnlyProperty>
</includeOnlyProperties>
</configuration>
</plugin>
</plugins>
</pluginManagement>

Expand Down Expand Up @@ -300,6 +323,11 @@
</execution>
</executions>
</plugin>
<!-- Git commit id -->
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down
4 changes: 4 additions & 0 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ Add changes here for all PR submitted to the 2.x branch.
### optimize:
- [[#6061](https://github.com/seata/seata/pull/6061)] merge the rpcMergeMessageSend threads of rm and tm and increase the thread hibernation duration
- [[#6031](https://github.com/seata/seata/pull/6031)] add a check for the existence of the undolog table
- [[#6089](https://github.com/seata/seata/pull/6089)] modify the semantics of RaftServerFactory and remove unnecessary singleton
- [[#4473](https://github.com/seata/seata/pull/4473)] rm appdata size limit
- [[#6071](https://github.com/seata/seata/pull/6071)] add git infos to jars


### security:
- [[#6069](https://github.com/seata/seata/pull/6069)] Upgrade Guava dependencies to fix security vulnerabilities
Expand All @@ -32,5 +35,6 @@ Thanks to these contributors for their code commits. Please report an unintended
- [DroidEye2ONGU](https://github.com/DroidEye2ONGU)
- [funky-eyes](https://github.com/funky-eyes)
- [Bughue](https://github.com/Bughue)
- [wangliang181230](https://github.com/wangliang181230)

Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
3 changes: 3 additions & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
### optimize:
- [[#6061](https://github.com/seata/seata/pull/6061)] 合并rm和tm的rpcMergeMessageSend线程,增加线程休眠时长
- [[#6031](https://github.com/seata/seata/pull/6031)] 添加undo_log表的存在性校验
- [[#6089](https://github.com/seata/seata/pull/6089)] 修改RaftServerFactory语义并删除不必要的单例构建
- [[#4473](https://github.com/seata/seata/pull/4473)] rm appdata大小限制
- [[#6071](https://github.com/seata/seata/pull/6071)] 添加git信息到JAR包中


### security:
Expand All @@ -33,5 +35,6 @@
- [DroidEye2ONGU](https://github.com/DroidEye2ONGU)
- [funky-eyes](https://github.com/funky-eyes)
- [Bughue](https://github.com/Bughue)
- [wangliang181230](https://github.com/wangliang181230)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
4 changes: 4 additions & 0 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,9 @@
<artifactId>httpclient</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.common.exception;


/**
* Exception indicating authentication failure. This exception is typically thrown
* when the authentication process fails, and it extends SecurityException to
* signal that it is a security-related issue.
*/
public class AuthenticationFailedException extends SecurityException {

/**
* Constructs a new AuthenticationFailedException with no detailed message.
*/
public AuthenticationFailedException() {
super();
}

/**
* Constructs a new AuthenticationFailedException with the specified detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the getMessage() method).
*/
public AuthenticationFailedException(String message) {
super(message);
}

/**
* Constructs a new AuthenticationFailedException with the specified cause.
*
* @param cause the cause (which is saved for later retrieval by the
* getCause() method).
*/
public AuthenticationFailedException(Throwable cause) {
super(cause);
}

/**
* Constructs a new AuthenticationFailedException with the specified detail
* message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the getMessage() method).
* @param cause the cause (which is saved for later retrieval by the
* getCause() method).
*/
public AuthenticationFailedException(String message, Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.common.exception;



/**
* Exception indicating a retryable failure. This exception is typically thrown
* when a retryable process fails, and it extends RuntimeException to
* signal that it is an unchecked exception.
*/
public class RetryableException extends Exception {

/**
* Constructs a new RetryableException with no detailed message.
*/
public RetryableException() {
super();
}

/**
* Constructs a new RetryableException with the specified detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the getMessage() method).
*/
public RetryableException(String message) {
super(message);
}

/**
* Constructs a new RetryableException with the specified cause.
*
* @param cause the cause (which is saved for later retrieval by the
* getCause() method).
*/
public RetryableException(Throwable cause) {
super(cause);
}

/**
* Constructs a new RetryableException with the specified detail
* message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the getMessage() method).
* @param cause the cause (which is saved for later retrieval by the
* getCause() method).
*/
public RetryableException(String message, Throwable cause) {
super(message, cause);
}
}

35 changes: 23 additions & 12 deletions common/src/main/java/io/seata/common/util/HttpClientUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.seata.common.util;


import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.config.RequestConfig;
Expand Down Expand Up @@ -52,7 +53,7 @@ public class HttpClientUtil {
private static final Map<Integer/*timeout*/, CloseableHttpClient> HTTP_CLIENT_MAP = new ConcurrentHashMap<>();

private static final PoolingHttpClientConnectionManager POOLING_HTTP_CLIENT_CONNECTION_MANAGER =
new PoolingHttpClientConnectionManager();
new PoolingHttpClientConnectionManager();

static {
POOLING_HTTP_CLIENT_CONNECTION_MANAGER.setMaxTotal(10);
Expand All @@ -66,25 +67,35 @@ public class HttpClientUtil {
})));
}


// post request
public static CloseableHttpResponse doPost(String url, Map<String, String> params, Map<String, String> header,
int timeout) throws IOException {
int timeout) throws IOException {
try {
URIBuilder builder = new URIBuilder(url);
URI uri = builder.build();
HttpPost httpPost = new HttpPost(uri);
String contentType = "";
if (header != null) {
header.forEach(httpPost::addHeader);
contentType = header.get("Content-Type");
}
if (StringUtils.isNotBlank(contentType)) {
if (ContentType.APPLICATION_FORM_URLENCODED.getMimeType().equals(contentType)) {
List<NameValuePair> nameValuePairs = new ArrayList<>();
params.forEach((k, v) -> {
nameValuePairs.add(new BasicNameValuePair(k, v));
});
String requestBody = URLEncodedUtils.format(nameValuePairs, StandardCharsets.UTF_8);
StringEntity stringEntity = new StringEntity(requestBody, ContentType.APPLICATION_FORM_URLENCODED);
httpPost.setEntity(stringEntity);
} else if (ContentType.APPLICATION_JSON.getMimeType().equals(contentType)) {
ObjectMapper objectMapper = new ObjectMapper();
String requestBody = objectMapper.writeValueAsString(params);
StringEntity stringEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
httpPost.setEntity(stringEntity);
}
}
List<NameValuePair> nameValuePairs = new ArrayList<>();
params.forEach((k, v) -> {
nameValuePairs.add(new BasicNameValuePair(k, v));
});
String requestBody = URLEncodedUtils.format(nameValuePairs, StandardCharsets.UTF_8);

StringEntity stringEntity = new StringEntity(requestBody, ContentType.APPLICATION_FORM_URLENCODED);
httpPost.setEntity(stringEntity);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
CloseableHttpClient client = HTTP_CLIENT_MAP.computeIfAbsent(timeout,
k -> HttpClients.custom().setConnectionManager(POOLING_HTTP_CLIENT_CONNECTION_MANAGER)
.setDefaultRequestConfig(RequestConfig.custom().setConnectionRequestTimeout(timeout)
Expand All @@ -99,7 +110,7 @@ public static CloseableHttpResponse doPost(String url, Map<String, String> param

// get request
public static CloseableHttpResponse doGet(String url, Map<String, String> param, Map<String, String> header,
int timeout) throws IOException {
int timeout) throws IOException {
try {
URIBuilder builder = new URIBuilder(url);
if (param != null) {
Expand Down
Loading

0 comments on commit 5426f69

Please sign in to comment.