Skip to content

Commit

Permalink
Merge branch '2.x' into test-CodeQL
Browse files Browse the repository at this point in the history
  • Loading branch information
xingfudeshi authored Sep 11, 2024
2 parents be79766 + 42f3ae7 commit 8a34d03
Show file tree
Hide file tree
Showing 42 changed files with 470 additions and 230 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ jobs:
ports:
- 6379:6379
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
nacos:
image: nacos/nacos-server:v2.4.2
ports:
- 8848:8848
env:
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
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
19 changes: 19 additions & 0 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6624](https://github.com/apache/incubator-seata/pull/6624)] fix Alibaba Dubbo convert error
- [[#6627](https://github.com/apache/incubator-seata/pull/6627)] fix the issue of xaEnded not being reset
- [[#6626](https://github.com/apache/incubator-seata/pull/6626)] fix hsf ConsumerModel convert error
- [[#6816](https://github.com/apache/incubator-seata/pull/6816)] Fix NPE when getting branchType in a non-global transaction context
- [[#6642](https://github.com/apache/incubator-seata/pull/6642)] codecov token not found
- [[#6661](https://github.com/apache/incubator-seata/pull/6661)] fix `tableMeta` cache scheduled refresh issue
- [[#6486](https://github.com/apache/incubator-seata/pull/6486)] fix mysql undo log update sql data more than max allowed packet
Expand All @@ -23,15 +24,25 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6707](https://github.com/apache/incubator-seata/pull/6707)] fix readonly branch commit errors in Oracle XA transactions
- [[#6711](https://github.com/apache/incubator-seata/pull/6711)] fix dameng rollback info un compress fail
- [[#6714](https://github.com/apache/incubator-seata/pull/6714)] fix dameng delete undo fail
- [[#6511](https://github.com/apache/incubator-seata/pull/6511)] fix the failure of rollbacking back of the delete SQL at AT mode when using SQLServer
- [[#6701](https://github.com/apache/incubator-seata/pull/6728)] fix support serialization for dm.jdbc.driver.DmdbTimestamp
- [[#6757](https://github.com/apache/incubator-seata/pull/6757)] the bug where multiple nodes cannot be retrieved from the naming server
- [[#6769](https://github.com/apache/incubator-seata/pull/6769)] fix tcc fence deadLock
- [[#6778](https://github.com/apache/incubator-seata/pull/6778)] fix namingserver node term
- [[#6765](https://github.com/apache/incubator-seata/pull/6765)] fix MySQL driver loading by replacing custom classloader with system classloader for better compatibility and simplified process
- [[#6781](https://github.com/apache/incubator-seata/pull/6781)] the issue where the TC occasionally fails to go offline from the NamingServer
- [[#6785](https://github.com/apache/incubator-seata/pull/6785)] fix prometheus fail to return seata metrics data when using Nacos
- [[#6797](https://github.com/apache/incubator-seata/pull/6797)] fall back to any of available cluster address when query cluster address is empty
- [[#6800](https://github.com/apache/incubator-seata/pull/6800)] make exception message generic for all database drivers
- [[#6759](https://github.com/apache/incubator-seata/pull/6759)] fix the error of active refresh failure of cross-database table metadata
- [[#6812](https://github.com/apache/incubator-seata/pull/6812)] bugfix: change group and node offline status are not pushed in real time
- [[#6817](https://github.com/apache/incubator-seata/pull/6817)] bugfix: fix namingserver changVgroup failed
- [[#6820](https://github.com/apache/incubator-seata/pull/6820)] Fix file path error in the Dockerfile
- [[#6825](https://github.com/apache/incubator-seata/pull/6825)] Fix the issue of XA mode transaction timeout and inability to roll back in Postgres
- [[#6833](https://github.com/apache/incubator-seata/pull/6833)] SQLIntegrityConstraintViolationException capture incorrectly when inserting a globallock
- [[#6835](https://github.com/apache/incubator-seata/pull/6835)] Fix the issue of missing request body of post method in HttpClientUtil
- [[#6840](https://github.com/apache/incubator-seata/pull/6840)] Fix the issue of unsafe deserialization in ProcessorYaml.java
- [[#6843](https://github.com/apache/incubator-seata/pull/6843)] Fix 403 error when sending a POST request from the console


### optimize:
Expand Down Expand Up @@ -79,6 +90,9 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6794](https://github.com/apache/incubator-seata/pull/6794)] optimize NacosMockTest UT case
- [[#6806](https://github.com/apache/incubator-seata/pull/6806)] optimize `tableMeta` cache scheduled refresh issue
- [[#6808](https://github.com/apache/incubator-seata/pull/6808)] change version to 2.2.0-SNAPSHOT
- [[#6819](https://github.com/apache/incubator-seata/pull/6819)] merge the packaging processes of namingserver and seata-server
- [[#6827](https://github.com/apache/incubator-seata/pull/6827)] rename namingserver registry type
- [[#6836](https://github.com/apache/incubator-seata/pull/6836)] add independent nacos for the CI process


### refactor:
Expand All @@ -95,6 +109,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6764](https://github.com/apache/incubator-seata/pull/6764)] add Apollo mock test case
- [[#6750](https://github.com/apache/incubator-seata/pull/6750)] increase spring autoconfigure module unit test converage
- [[#6773](https://github.com/apache/incubator-seata/pull/6773)] fix the wrong code coverage from codecov icon in default branch
- [[#6821](https://github.com/apache/incubator-seata/pull/6821)] fix the test case assertions


Thanks to these contributors for their code commits. Please report an unintended omission.
Expand All @@ -120,11 +135,15 @@ Thanks to these contributors for their code commits. Please report an unintended
- [GoodBoyCoder](https://github.com/GoodBoyCoder)
- [liuqiufeng](https://github.com/liuqiufeng)
- [caohdgege](https://github.com/caohdgege)
- [TakeActionNow2019](https://github.com/TakeActionNow2019)
- [imashimaro](https://github.com/hmj776521114)
- [lyl2008dsg](https://github.com/lyl2008dsg)
- [lightClouds917](https://github.com/lightClouds917)
- [l81893521](https://github.com/l81893521)
- [laywin](https://github.com/laywin)
- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)
- [LegGasai](https://github.com/LegGasai)
- [yangli-stu](https://github.com/yangli-stu)


Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
23 changes: 20 additions & 3 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- [[#6624](https://github.com/apache/incubator-seata/pull/6624)] 修复 Alibaba Dubbo 转换错误
- [[#6627](https://github.com/apache/incubator-seata/pull/6627)] 修复 xaEnded 没有重置
- [[#6626](https://github.com/apache/incubator-seata/pull/6626)] 修复 hsf ConsumerModel 转换错误
- [[#6816](https://github.com/apache/incubator-seata/pull/6816)] 修复在非全局事务上下文中获取branchType时的NPE问题
- [[#6640](https://github.com/apache/incubator-seata/pull/6640)] 优化codecov相关配置
- [[#6642](https://github.com/apache/incubator-seata/pull/6642)] 修复codecov token找不到导致无法提交单测覆盖度报告
- [[#6661](https://github.com/apache/incubator-seata/pull/6661)] 修复`tableMeta`缓存定时刷新失效问题
Expand All @@ -24,16 +25,25 @@
- [[#6707](https://github.com/apache/incubator-seata/pull/6707)] 修复Oracle XA事务中只读分支提交出错的问题
- [[#6711](https://github.com/apache/incubator-seata/pull/6711)] 修复达梦数据库的getRollbackInfo没有解压缩的问题
- [[#6714](https://github.com/apache/incubator-seata/pull/6714)] 修复达梦数据库的delete sql回滚失败的问题
- [[#6511](https://github.com/apache/incubator-seata/pull/6511)] 修复在使用SQLServer时,AT模式delete语句无法正常回滚的问题
- [[#6701](https://github.com/apache/incubator-seata/pull/6728)] 修复达梦数据库的对dm.jdbc.driver.DmdbTimestamp的支持
- [[#6757](https://github.com/apache/incubator-seata/pull/6757)] 修复client通过namingserver只能获取到一个tc节点的bug
- [[#6769](https://github.com/apache/incubator-seata/pull/6769)] 修复tcc fence死锁
- [[#6778](https://github.com/apache/incubator-seata/pull/6778)] 修复namingserver的节点term为0问题
- [[#6765](https://github.com/apache/incubator-seata/pull/6765)] 改进MySQL驱动加载机制,将自定义类加载器替换为系统类加载器,更兼容简化流程
- [[#6781](https://github.com/apache/incubator-seata/pull/6781)] 修复tc下线时,由于定时任务没有先关闭,导致下线后还会被注册上,需要靠namingserver的健康检查来下线的bug
- [[#6785](https://github.com/apache/incubator-seata/pull/6785)] 修复 prometheus 在与 Nacos 集成时无法返回 seata metrics 数据的问题
- [[#6797](https://github.com/apache/incubator-seata/pull/6797)] 当查询的集群地址为空时,获取可用的任意集群地址
- [[#6800](https://github.com/apache/incubator-seata/pull/6800)] 使异常消息对所有数据库驱动程序通用

- [[#6812](https://github.com/apache/incubator-seata/pull/6812)] 修复切换事务分组和节点下线时namingserver没有实时感知和推送的bug
- [[#6759](https://github.com/apache/incubator-seata/pull/6759)] 修复跨库表主动刷新`tableMeta`的异常问题
- [[#6817](https://github.com/apache/incubator-seata/pull/6817)] 修复namingserver切换事务分组失效的问题
- [[#6820](https://github.com/apache/incubator-seata/pull/6820)] 修复Dockerfile得文件结构错误
- [[#6825](https://github.com/apache/incubator-seata/pull/6825)] 修复Postgres的XA模式事务超时无法回滚问题
- [[#6833](https://github.com/apache/incubator-seata/pull/6833)] 插入全局锁时 SQLIntegrityConstraintViolationException 捕获不正确
- [[#6835](https://github.com/apache/incubator-seata/pull/6835)] 修复HttpClientUtil中post方法请求体缺失的问题
- [[#6840](https://github.com/apache/incubator-seata/pull/6840)] 修复ProcessorYaml中不安全的反序列化
- [[#6843](https://github.com/apache/incubator-seata/pull/6843)] 修复从控制台发送POST请求时出现的403错误

### optimize:
- [[#6499](https://github.com/apache/incubator-seata/pull/6499)] 拆分 committing 和 rollbacking 状态的任务线程池
Expand Down Expand Up @@ -80,6 +90,10 @@
- [[#6793](https://github.com/apache/incubator-seata/pull/6795)] 独立server的meta信息初始化逻辑
- [[#6806](https://github.com/apache/incubator-seata/pull/6806)] 优化`tableMeta`缓存定时刷新问题
- [[#6808](https://github.com/apache/incubator-seata/pull/6808)] 修改版本号为2.2.0-SNAPSHOT
- [[#6819](https://github.com/apache/incubator-seata/pull/6819)] namingserver与server的合并打包
- [[#6827](https://github.com/apache/incubator-seata/pull/6827)] 重命名namingserver注册类型改为seata
- [[#6836](https://github.com/apache/incubator-seata/pull/6836)] 为CI流程增加独立nacos


### refactor:

Expand All @@ -96,7 +110,7 @@
- [[#6764](https://github.com/apache/incubator-seata/pull/6764)] 增加 Apollo Mock 测试用例
- [[#6750](https://github.com/apache/incubator-seata/pull/6750)] 提升spring autoconfigure模块单测覆盖率
- [[#6773](https://github.com/apache/incubator-seata/pull/6773)] 修复codecov图标显示错误的代码覆盖率

- [[#6821](https://github.com/apache/incubator-seata/pull/6821)] 修复单元测试断言


非常感谢以下 contributors 的代码贡献。若有无意遗漏,请报告。
Expand All @@ -122,12 +136,15 @@
- [GoodBoyCoder](https://github.com/GoodBoyCoder)
- [liuqiufeng](https://github.com/liuqiufeng)
- [caohdgege](https://github.com/caohdgege)
- [TakeActionNow2019](https://github.com/TakeActionNow2019)
- [imashimaro](https://github.com/hmj776521114)
- [lyl2008dsg](https://github.com/lyl2008dsg)
- [lightClouds917](https://github.com/lightClouds917)
- [l81893521](https://github.com/l81893521)
- [laywin](https://github.com/laywin)

- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)
- [LegGasai](https://github.com/LegGasai)
- [yangli-stu](https://github.com/yangli-stu)


同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ public interface ConfigurationKeys {
/**
* The constant NAMING_SERVER
*/
String NAMING_SERVER = "namingserver";
String NAMING_SERVER = "seata";

/**
* The constant APPLICATION_ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public interface DefaultValues {
/**
* the const DEFAULT_METRICS_ENABLED
*/
boolean DEFAULT_METRICS_ENABLED = false;
boolean DEFAULT_METRICS_ENABLED = true;

/**
* the const DEFAULT_METRICS_REGISTRY_TYPE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.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,6 +53,7 @@ public class HttpClientUtil {

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

static {
POOLING_HTTP_CLIENT_CONNECTION_MANAGER.setMaxTotal(10);
Expand Down Expand Up @@ -89,6 +91,10 @@ public static CloseableHttpResponse doPost(String url, Map<String, String> param
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)) {
String requestBody = OBJECT_MAPPER.writeValueAsString(params);
StringEntity stringEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
httpPost.setEntity(stringEntity);
}
}
CloseableHttpClient client = HTTP_CLIENT_MAP.computeIfAbsent(timeout,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package io.seata.core.context;


import java.util.Map;

import javax.annotation.Nonnull;
Expand All @@ -42,7 +43,11 @@ public class RootContext {
public static final String KEY_BRANCH_TYPE = "TX_BRANCH_TYPE";

private static BranchType convertIoSeata(org.apache.seata.core.model.BranchType branchType) {
return BranchType.get(branchType.name());
if (branchType == null) {
return null;
} else {
return BranchType.get(branchType.name());
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

import org.apache.seata.common.loader.LoadLevel;
import org.apache.seata.common.util.MapUtil;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;

import java.util.Map;
import java.util.Properties;
Expand All @@ -34,7 +36,7 @@ public class ProcessorYaml implements Processor {
@Override
public Properties processor(String config) {
Properties properties = new Properties();
Map<String, Object> configMap = MapUtil.asMap(new Yaml().load(config));
Map<String, Object> configMap = MapUtil.asMap(new Yaml(new SafeConstructor(new LoaderOptions())).load(config));
properties.putAll(MapUtil.getFlattenedMap(configMap));
return properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

public class NacosMockTest {
private static ConfigService configService;
private static final String NACOS_ENDPOINT = "console.nacos.io:80";
private static final String NACOS_ENDPOINT = "127.0.0.1:8848";

private static final String NACOS_GROUP = "SEATA_GROUP";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ registry {

nacos {
application = "seata-server"
serverAddr = "console.nacos.io:80"
serverAddr = "127.0.0.1:8848"
group = "SEATA_GROUP"
namespace = ""
username = ""
Expand Down Expand Up @@ -77,7 +77,7 @@ config {
type = "nacos"

nacos {
serverAddr = "console.nacos.io:80"
serverAddr = "127.0.0.1:8848"
namespace = ""
group = "SEATA_GROUP"
dataId = "seata-mock"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ config {
dataId = "seata.properties"
}
test {
serverAddr = "console.nacos.io:80"
serverAddr = "127.0.0.1:8848"
namespace = ""
group = "SEATA_GROUP"
dataId = ""
Expand Down
2 changes: 1 addition & 1 deletion config/seata-config-nacos/src/test/resources/registry.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ registry {

nacos {
application = "seata-server"
serverAddr = "console.nacos.io:80"
serverAddr = "127.0.0.1:8848"
group = "SEATA_GROUP"
namespace = ""
username = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;

/**
* Spring security config
Expand Down Expand Up @@ -101,7 +102,8 @@ protected void configure(HttpSecurity http) throws Exception {
// custom token authorize exception handler
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
// since we use jwt, session is not necessary
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).disable();
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).disable()
.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());
// don't disable csrf, jwt may be implemented based on cookies
http.addFilterBefore(new JwtAuthenticationTokenFilter(tokenProvider),
UsernamePasswordAuthenticationFilter.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public enum RegistryType {
*/
Custom,
/**
* NamingServer registry type
* Seata namingServer registry type
*/
NamingServer;
Seata;

/**
* Gets type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.seata.discovery.registry.RegistryService;


@LoadLevel(name = "NamingServer", order = 1)
@LoadLevel(name = "Seata", order = 1)
public class NamingserverRegistryProvider implements RegistryProvider {
@Override
public RegistryService provide() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class NamingserverRegistryServiceImpl implements RegistryService<NamingLi
private static final String NAMING_SERVICE_URL_KEY = "server-addr";
private static final String FILE_ROOT_REGISTRY = "registry";
private static final String FILE_CONFIG_SPLIT_CHAR = ".";
private static final String REGISTRY_TYPE = "namingserver";
private static final String REGISTRY_TYPE = "seata";
private static final String HTTP_PREFIX = "http://";
private static final String TIME_OUT_KEY = "timeout";

Expand Down Expand Up @@ -362,7 +362,6 @@ public List<InetSocketAddress> refreshGroup(String vGroup) throws IOException {
throw new NamingRegistryException("cannot lookup server list in vgroup: " + vGroup);
}
String jsonResponse = EntityUtils.toString(response.getEntity(), "UTF-8");
response.close();
// jsonResponse -> MetaResponse
MetaResponse metaResponse = OBJECT_MAPPER.readValue(jsonResponse, new TypeReference<MetaResponse>() {
});
Expand All @@ -375,6 +374,7 @@ public List<InetSocketAddress> refreshGroup(String vGroup) throws IOException {
term = metaResponse.getTerm();
}
VGROUP_ADDRESS_MAP.put(vGroup, newAddressList);
removeOfflineAddressesIfNecessary(vGroup,vGroup,newAddressList);
} catch (IOException e) {
LOGGER.error(e.getMessage());
throw new RemoteException();
Expand Down
Loading

0 comments on commit 8a34d03

Please sign in to comment.