Skip to content

Commit

Permalink
Merge branch '1114_for_5073' of https://github.com/zw201913/seata int…
Browse files Browse the repository at this point in the history
…o 1114_for_5073

* '1114_for_5073' of https://github.com/zw201913/seata:
  bugfix: hikari datasource auto proxy fail (apache#5134)
  bugfix: rollback active xa connection fail (apache#5131)
  optimize: support oracle on delete tccfence logs  (apache#5124)
  feature: support passing `contextPath` parameter to Nacos client (apache#5111)
  bugfix:NPE caused when there is no @GlobalTransactional annotation on the RM side  (apache#5109)
  bugfix: Druid disable oracle implicit cache (apache#5098)
  bugfix: fix access key loss after server restart (apache#5097)
  optimize: remove druid dependency in ConnectionProxy (apache#5104)
  bugfix:fix ClassNotFoundException during the ZK unit test (apache#5101)
  bugfix: fix when seata and jpa are used together, their AutoConfiguration order is incorrect (apache#5092)
  optimize: lock priority attempts to insert (apache#4681)
  bugfix: update join condition placeholder param error (apache#5052)
  • Loading branch information
Dodge-Z committed Dec 12, 2022
2 parents a4415a4 + 9f4ea67 commit 0c839b9
Show file tree
Hide file tree
Showing 48 changed files with 756 additions and 72 deletions.
2 changes: 2 additions & 0 deletions changes/en-us/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The version is updated as follows:
### bugfix:
- [[#1234](https://github.com/seata/seata/pull/1234)] Please delete the sample later
- [[#4626](https://github.com/seata/seata/pull/4626)] Replace `flatten-maven-plugin` with `easyj-maven-plugin` to fix the conflict between `shade` and `flatten`
- [[#5098](https://github.com/seata/seata/pull/5098)] Druid disable oracle implicit cache

### optimize:
- [[#4567](https://github.com/seata/seata/pull/4567)] Support where method condition(find_in_set)
Expand All @@ -36,6 +37,7 @@ Thanks to these contributors for their code commits. Please report an unintended
- [slievrly](https://github.com/slievrly)
- [doubleDimple](https://github.com/doubleDimple)
- [Bughue](https://github.com/Bughue)
- [miaoxueyu](https://github.com/miaoxueyu)

Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.

Expand Down
17 changes: 15 additions & 2 deletions changes/en-us/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Add changes here for all PR submitted to the develop branch.
- [[#4877](https://github.com/seata/seata/pull/4877)] seata client support jdk17
- [[#4468](https://github.com/seata/seata/pull/4968)] support kryo 5.3.0
- [[#4914](https://github.com/seata/seata/pull/4914)] support mysql update join sql
- [[#5111](https://github.com/seata/seata/pull/5111)] support passing contextPath parameter to Nacos client


### bugfix:
Expand All @@ -34,9 +35,14 @@ Add changes here for all PR submitted to the develop branch.
- [[#5033](https://github.com/seata/seata/pull/5023)] fix mysql InsertOnDuplicateUpdate insert value type recognize error
- [[#5038](https://github.com/seata/seata/pull/5038)] remove @EnableConfigurationProperties({SagaAsyncThreadPoolProperties.class})
- [[#5050](https://github.com/seata/seata/pull/5050)] fix global session is not change to Committed in saga mode
- [[#5052](https://github.com/seata/seata/pull/5052)] fix update join condition placeholder param error
- [[#5031](https://github.com/seata/seata/pull/5031)] fix mysql InsertOnDuplicateUpdate should not use null index value as image sql query condition
- [[#5075](https://github.com/seata/seata/pull/5075)] fix InsertOnDuplicateUpdateExecutor could not intercept the sql which has no primary and unique key

- [[#5093](https://github.com/seata/seata/pull/5093)] fix access key loss after seata server restart
- [[#5092](https://github.com/seata/seata/pull/5092)] fix when seata and jpa are used together, their AutoConfiguration order is incorrect
- [[#5109](https://github.com/seata/seata/pull/5109)] fix NPE caused when there is no @GlobalTransactional annotation on the RM side
- [[#5131](https://github.com/seata/seata/pull/5131)] rollback active xa connection fail
- [[#5134](https://github.com/seata/seata/pull/5134)] hikari datasource auto proxy fail

### optimize:
- [[#4774](https://github.com/seata/seata/pull/4774)] optimize mysql8 dependencies for seataio/seata-server image
Expand All @@ -45,6 +51,7 @@ Add changes here for all PR submitted to the develop branch.
- [[#4750](https://github.com/seata/seata/pull/4750)] optimize unBranchLock romove xid
- [[#4797](https://github.com/seata/seata/pull/4797)] optimize the github actions
- [[#4800](https://github.com/seata/seata/pull/4800)] Add NOTICE as Apache License V2
- [[#4681](https://github.com/seata/seata/pull/4681)] optimize the check lock during global transaction
- [[#4761](https://github.com/seata/seata/pull/4761)] use hget replace hmget because only one field
- [[#4414](https://github.com/seata/seata/pull/4414)] exclude log4j dependencies
- [[#4836](https://github.com/seata/seata/pull/4836)] optimize BaseTransactionalExecutor#buildLockKey(TableRecords rowsIncludingPK) method more readable
Expand All @@ -67,10 +74,14 @@ Add changes here for all PR submitted to the develop branch.
- [[#5047](https://github.com/seata/seata/pull/5047)] remove useless code
- [[#5051](https://github.com/seata/seata/pull/5051)] undo log dirty throw BranchRollbackFailed_Unretriable
- [[#5075](https://github.com/seata/seata/pull/5075)] intercept the InsertOnDuplicateUpdate statement which has no primary key and unique index value
- [[#5104](https://github.com/seata/seata/pull/5104)] remove the druid dependency in ConnectionProxy
- [[#5124](https://github.com/seata/seata/pull/5124)] support oracle on delete tccfence logs


### test:
- [[#4411](https://github.com/seata/seata/pull/4411)] add UT for oracle in AT mode
- [[#4794](https://github.com/seata/seata/pull/4794)] try to fix the test `DataSourceProxyTest.getResourceIdTest()`

- [[#5101](https://github.com/seata/seata/pull/5101)] fix ClassNotFoundException during the zk unit test

Thanks to these contributors for their code commits. Please report an unintended omission.

Expand All @@ -97,5 +108,7 @@ Thanks to these contributors for their code commits. Please report an unintended
- [crazy-sheep](https://github.com/crazy-sheep)
- [zhangzq7](https://github.com/zhangzq7)
- [l81893521](https://github.com/l81893521)
- [zhuyoufeng](https://github.com/zhuyoufeng)
- [xingfudeshi](https://github.com/xingfudeshi)

Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
2 changes: 2 additions & 0 deletions changes/zh-cn/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
### bugfix:
- [[#1234](https://github.com/seata/seata/pull/1234)] 样例,后续请删除
- [[#4626](https://github.com/seata/seata/pull/4626)] 使用 `easyj-maven-plugin` 插件代替 `flatten-maven-plugin` 插件,以修复 `shade` 插件与 `flatten` 插件不兼容的问题,导致`seata-all.pom` 中的 `${revision}` 并没有被替换,使应用端引用 `seata-all` 后无法打包。
- [[#5098](https://github.com/seata/seata/pull/5098)] Druid 禁用 oracle implicit cache

### optimize:
- [[#4567](https://github.com/seata/seata/pull/4567)] 支持where条件带函数find_in_set支持
Expand All @@ -36,6 +37,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [slievrly](https://github.com/slievrly)
- [doubleDimple](https://github.com/doubleDimple)
- [Bughue](https://github.com/Bughue)
- [miaoxueyu](https://github.com/miaoxueyu)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。

Expand Down
14 changes: 13 additions & 1 deletion changes/zh-cn/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- [[#4877](https://github.com/seata/seata/pull/4877)] seata client支持jdk17
- [[#4468](https://github.com/seata/seata/pull/4968)] 支持kryo 5.3.0
- [[#4914](https://github.com/seata/seata/pull/4914)] 支持mysql的update join联表更新语法

- [[#5111](https://github.com/seata/seata/pull/5111)] 支持传递contextPath参数给Nacos客户端


### bugfix:
Expand All @@ -36,10 +36,17 @@
- [[#5033](https://github.com/seata/seata/pull/5023)] 修复InsertOnDuplicateUpdate中插入值解析为String类型导致的类型识别错误
- [[#5038](https://github.com/seata/seata/pull/5038)] 修复SagaAsyncThreadPoolProperties冲突问题
- [[#5050](https://github.com/seata/seata/pull/5050)] 修复Saga模式下全局状态未正确更改成Committed
- [[#5052](https://github.com/seata/seata/pull/5052)] 修复update join条件中占位符参数问题
- [[#5031](https://github.com/seata/seata/pull/5031)] 修复InsertOnDuplicateUpdate中不应该使用null值索引作为查询条件
- [[#5075](https://github.com/seata/seata/pull/5075)] 修复InsertOnDuplicateUpdate无法拦截无主键和唯一索引的SQL
- [[#5093](https://github.com/seata/seata/pull/5093)] 修复seata server重启后access key丢失问题
- [[#5092](https://github.com/seata/seata/pull/5092)] 修复当seata and jpa共同使用时, AutoConfiguration的顺序不正确的问题
- [[#5109](https://github.com/seata/seata/pull/5109)] 修复当RM侧没有加@GlobalTransactional报NPE的问题
- [[#5131](https://github.com/seata/seata/pull/5131)] 修复xaconnection处于active状态时无法回滚的问题
- [[#5134](https://github.com/seata/seata/pull/5134)] 修复hikariDataSource 自动代理在某些情况下失效的问题

### optimize:
- [[#4681](https://github.com/seata/seata/pull/4681)] 优化竞争锁过程
- [[#4774](https://github.com/seata/seata/pull/4774)] 优化 seataio/seata-server 镜像中的 mysql8 依赖
- [[#4750](https://github.com/seata/seata/pull/4750)] 优化AT分支释放全局锁不使用xid
- [[#4790](https://github.com/seata/seata/pull/4790)] 添加一个 github action,用于自动发布Seata到OSSRH
Expand Down Expand Up @@ -67,10 +74,13 @@
- [[#5047](https://github.com/seata/seata/pull/5047)] 移除无用代码
- [[#5051](https://github.com/seata/seata/pull/5051)] 回滚时undolog产生脏写需要抛出不再重试(BranchRollbackFailed_Unretriable)的异常
- [[#5075](https://github.com/seata/seata/pull/5075)] 拦截没有主键及唯一索引值的insert on duplicate update语句
- [[#5104](https://github.com/seata/seata/pull/5104)] ConnectionProxy脱离对druid的依赖
- [[#5124](https://github.com/seata/seata/pull/5124)] 支持oracle删除tccfence记录表

### test:
- [[#4411](https://github.com/seata/seata/pull/4411)] 测试Oracle数据库AT模式下类型支持
- [[#4794](https://github.com/seata/seata/pull/4794)] 重构代码,尝试修复单元测试 `DataSourceProxyTest.getResourceIdTest()`
- [[#5101](https://github.com/seata/seata/pull/5101)] 修复zk注册和配置中心报ClassNotFoundException的问题 `DataSourceProxyTest.getResourceIdTest()`


非常感谢以下 contributors 的代码贡献。若有无意遗漏,请报告。
Expand Down Expand Up @@ -100,5 +110,7 @@
- [crazy-sheep](https://github.com/crazy-sheep)
- [zhangzq7](https://github.com/zhangzq7)
- [l81893521](https://github.com/l81893521)
- [zhuyoufeng](https://github.com/zhuyoufeng)
- [xingfudeshi](https://github.com/xingfudeshi)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
14 changes: 12 additions & 2 deletions common/src/main/java/io/seata/common/ConfigurationKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -740,15 +740,25 @@ public interface ConfigurationKeys {
*/
String TM_INTERCEPTOR_ORDER = CLIENT_TM_PREFIX + "interceptorOrder";

/**
* The constant ACCESS_KEY.
*/
String ACCESS_KEY = "accesskey";

/**
* The constant SECRET_KEY.
*/
String SECRET_KEY = "secretkey";

/**
* The constant SEATA_ACCESS_KEY.
*/
String SEATA_ACCESS_KEY = SEATA_PREFIX + "accesskey";
String SEATA_ACCESS_KEY = SEATA_PREFIX + ACCESS_KEY;

/**
* The constant SEATA_SECRET_KEY.
*/
String SEATA_SECRET_KEY = SEATA_PREFIX + "secretkey";
String SEATA_SECRET_KEY = SEATA_PREFIX + SECRET_KEY;

/**
* The constant EXTRA_DATA_SPLIT_CHAR.
Expand Down
30 changes: 30 additions & 0 deletions common/src/main/java/io/seata/common/LockStrategyMode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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;

/**
* @funkye
*/
public enum LockStrategyMode {
/**
* Optimistic lock mode is recommended when resources are not reused in the current global transaction.
*/
OPTIMISTIC,
/**
* Pessimistic lock mode is recommended when there may be repeated use of the same resource in a global transaction.
*/
PESSIMISTIC
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.listener.AbstractSharedListener;
import com.alibaba.nacos.api.exception.NacosException;

import io.seata.common.exception.NotSupportYetException;
import io.seata.common.util.CollectionUtils;
import io.seata.common.util.StringUtils;
Expand All @@ -46,6 +45,7 @@
* The type Nacos configuration.
*
* @author slievrly
* @author xingfudeshi@gmail.com
*/
public class NacosConfiguration extends AbstractConfiguration {
private static volatile NacosConfiguration instance;
Expand All @@ -64,6 +64,7 @@ public class NacosConfiguration extends AbstractConfiguration {
private static final String ACCESS_KEY = "accessKey";
private static final String SECRET_KEY = "secretKey";
private static final String USE_PARSE_RULE = "false";
private static final String CONTEXT_PATH = "contextPath";
private static final Configuration FILE_CONFIG = ConfigurationFactory.CURRENT_FILE_INSTANCE;
private static volatile ConfigService configService;
private static final int MAP_INITIAL_CAPACITY = 8;
Expand Down Expand Up @@ -244,6 +245,10 @@ private static Properties getConfigProperties() {
}
}
}
String contextPath = StringUtils.isNotBlank(System.getProperty(CONTEXT_PATH)) ? System.getProperty(CONTEXT_PATH) : FILE_CONFIG.getConfig(getNacosContextPathKey());
if (StringUtils.isNotBlank(contextPath)) {
properties.setProperty(CONTEXT_PATH, contextPath);
}
return properties;
}

Expand Down Expand Up @@ -306,6 +311,10 @@ private static String getSeataConfigStr() {
return sb.toString();
}

private static String getNacosContextPathKey() {
return String.join(ConfigurationKeys.FILE_CONFIG_SPLIT_CHAR, ConfigurationKeys.FILE_ROOT_CONFIG, CONFIG_TYPE, CONTEXT_PATH);
}

private static void initSeataConfig() {
try {
String nacosDataId = getNacosDataId();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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.config.nacos;

import java.lang.reflect.Method;
import java.util.Properties;

import io.seata.common.util.ReflectionUtil;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;


/**
* The type Nacos configuration test
*
* @author xingfudeshi@gmail.com
*/
public class NacosConfigurationTest {

@Test
public void testGetConfigProperties() throws Exception {
Method method = ReflectionUtil.getMethod(NacosConfiguration.class, "getConfigProperties");
Properties properties = (Properties) ReflectionUtil.invokeMethod(null, method);
Assertions.assertThat(properties.getProperty("contextPath")).isEqualTo("/bar");
System.setProperty("contextPath", "/foo");
properties = (Properties) ReflectionUtil.invokeMethod(null, method);
Assertions.assertThat(properties.getProperty("contextPath")).isEqualTo("/foo");
}


}
Loading

0 comments on commit 0c839b9

Please sign in to comment.