diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 071c9214776..71b4194dc59 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -80,4 +80,4 @@ jobs:
# step 4
- name: "Test with Maven"
run: |
- ./mvnw -T 4C clean test -Dspring-boot.version=${{ matrix.springboot }} -Dspring-boot-for-server.version=2.5.14 -Dspring-framework-for-server.version=5.3.20 -Dkotlin-maven-plugin.version=1.7.22 -Dcheckstyle.skip=true -Dlicense.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
+ ./mvnw -T 4C clean test -Dspring-boot.version=${{ matrix.springboot }} -Dspring-boot-for-server.version=2.7.17 -Dspring-framework-for-server.version=5.3.30 -Dkotlin-maven-plugin.version=1.7.22 -Dcheckstyle.skip=true -Dlicense.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
diff --git a/all/pom.xml b/all/pom.xml
index 3d5d2696241..c2178c7183b 100644
--- a/all/pom.xml
+++ b/all/pom.xml
@@ -184,6 +184,16 @@
+
+ io.seata
+ seata-rm-datasource-mysql5
+ ${project.version}
+
+
+ io.seata
+ seata-rm-datasource-mysql8
+ ${project.version}
+
io.seata
seata-sqlparser-core
diff --git a/bom/pom.xml b/bom/pom.xml
index e71dc4c3988..7223960e2af 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -193,6 +193,16 @@
seata-rm-datasource
${project.version}
+
+ io.seata
+ seata-rm-datasource-mysql5
+ ${project.version}
+
+
+ io.seata
+ seata-rm-datasource-mysql8
+ ${project.version}
+
- 2.5.13
- 5.3.20
+ 2.7.17
+ 5.3.30
5.8.2
diff --git a/changes/en-us/develop.md b/changes/en-us/develop.md
index 1b2f57f1de7..5d189721f02 100644
--- a/changes/en-us/develop.md
+++ b/changes/en-us/develop.md
@@ -10,6 +10,7 @@ Add changes here for all PR submitted to the develop branch.
- [[#5991](https://github.com/seata/seata/pull/5991)] fix the issue that the Lua script is not synchronized when the redis sentinel master node is down
- [[#6025](https://github.com/seata/seata/pull/6025)] fix the white screen after click the "View Global Lock" button on the transaction info page in the console
- [[#6026](https://github.com/seata/seata/pull/6026)] fix incorrect metric report
+- [[#6068](https://github.com/seata/seata/pull/6068)] fix the column `TINYINT(1)` in MySql being resolved to `BIT` type
### optimize:
- [[#6044](https://github.com/seata/seata/pull/6044)] optimize derivative product check base on mysql
@@ -27,6 +28,6 @@ Thanks to these contributors for their code commits. Please report an unintended
- [jsbxyyx](https://github.com/jsbxyyx)
- [liuqiufeng](https://github.com/liuqiufeng)
- [ptyin](https://github.com/ptyin)
-
+- [wangliang181230](https://github.com/wangliang181230)
Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
diff --git a/changes/zh-cn/develop.md b/changes/zh-cn/develop.md
index 2eb0a37fbac..1a42b583aa7 100644
--- a/changes/zh-cn/develop.md
+++ b/changes/zh-cn/develop.md
@@ -10,6 +10,7 @@
- [[#5991](https://github.com/seata/seata/pull/5991)] 修复redis sentinel master node 宕机时,lua脚本未同步的问题
- [[#6025](https://github.com/seata/seata/pull/6025)] 修复控制台点击事务信息页面中的"查看全局锁"按钮之后白屏的问题
- [[#6026](https://github.com/seata/seata/pull/6026)] 修复异常的打点
+- [[#6068](https://github.com/seata/seata/pull/6068)] 修复 “MySql中的 `TINYINT(1)` 类型字段被解析为`BIT`,导致回滚后的值要么是0,要么是1。而不是原来的值。” 的问题。
### optimize:
- [[#6044](https://github.com/seata/seata/pull/6044)] 优化MySQL衍生数据库判断逻辑
@@ -27,5 +28,6 @@
- [jsbxyyx](https://github.com/jsbxyyx)
- [liuqiufeng](https://github.com/liuqiufeng)
- [ptyin](https://github.com/ptyin)
+- [wangliang181230](https://github.com/wangliang181230)
同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
diff --git a/common/src/main/java/io/seata/common/loader/DependsOnException.java b/common/src/main/java/io/seata/common/loader/DependsOnException.java
new file mode 100644
index 00000000000..68a5e1596f9
--- /dev/null
+++ b/common/src/main/java/io/seata/common/loader/DependsOnException.java
@@ -0,0 +1,36 @@
+/*
+ * 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.loader;
+
+/**
+ * The DependsOn Exception
+ *
+ * @author wang.liang
+ */
+class DependsOnException extends Exception {
+
+ public DependsOnException(String message) {
+ super(message);
+ }
+
+ public DependsOnException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public DependsOnException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/common/src/main/java/io/seata/common/loader/EnhancedServiceLoader.java b/common/src/main/java/io/seata/common/loader/EnhancedServiceLoader.java
index 69f7189a099..4031f1ed297 100644
--- a/common/src/main/java/io/seata/common/loader/EnhancedServiceLoader.java
+++ b/common/src/main/java/io/seata/common/loader/EnhancedServiceLoader.java
@@ -32,6 +32,7 @@
import io.seata.common.Constants;
import io.seata.common.executor.Initialize;
import io.seata.common.util.CollectionUtils;
+import io.seata.common.util.ReflectionUtil;
import io.seata.common.util.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.slf4j.Logger;
@@ -339,7 +340,7 @@ private S load(String activateName, Object[] args, ClassLoader loader)
* @param activateName the activate name
* @param argsType the args type
* @param args the args
- * @param loader the class loader
+ * @param loader the class loader
* @return the s
* @throws EnhancedServiceNotFoundException the enhanced service not found exception
*/
@@ -350,8 +351,8 @@ private S load(String activateName, Class>[] argsType, Object[] args, ClassLoa
/**
* get all implements
- * @param loader the class loader
*
+ * @param loader the class loader
* @return list list
*/
private List loadAll(ClassLoader loader) {
@@ -541,7 +542,7 @@ private void loadFile(String dir, ClassLoader loader, List getUnloadedExtensionDefinition(String className, ClassLoader loader)
- throws ClassNotFoundException, ClassCastException {
+ throws ClassNotFoundException, ClassCastException, DependsOnException {
//Check whether the definition has been loaded
if (!isDefinitionContainsClazz(className, loader)) {
Class> clazz = Class.forName(className, true, loader);
@@ -584,11 +585,17 @@ private ExtensionDefinition getUnloadedExtensionDefinition(String className,
String serviceName = null;
int priority = 0;
Scope scope = Scope.SINGLETON;
- LoadLevel loadLevel = clazz.getAnnotation(LoadLevel.class);
- if (loadLevel != null) {
- serviceName = loadLevel.name();
- priority = loadLevel.order();
- scope = loadLevel.scope();
+ try {
+ LoadLevel loadLevel = clazz.getAnnotation(LoadLevel.class);
+ if (loadLevel != null) {
+ serviceName = loadLevel.name();
+ priority = loadLevel.order();
+ scope = loadLevel.scope();
+
+ this.verifyDependsOn(loadLevel);
+ }
+ } catch (ArrayStoreException | TypeNotPresentException e) {
+ throw new DependsOnException("Verify depends on classes failed.", e);
}
ExtensionDefinition result = new ExtensionDefinition<>(serviceName, priority, scope, enhancedServiceClass);
classToDefinitionMap.put(clazz, result);
@@ -601,6 +608,20 @@ private ExtensionDefinition getUnloadedExtensionDefinition(String className,
return null;
}
+ private void verifyDependsOn(LoadLevel loadLevel) throws DependsOnException {
+ // In java11 and above, a TypeNotPresentException will throw only after obtaining it once,
+ // if any dependent class does not exist.
+ @SuppressWarnings("unused")
+ Class>[] dependsOnClasses = loadLevel.dependsOnClasses();
+
+ // verify depends on class names
+ for (String className : loadLevel.dependsOnClassNames()) {
+ if (!ReflectionUtil.existsClass(className)) {
+ throw new DependsOnException("The dependent class '" + className + "' does not exist");
+ }
+ }
+ }
+
private boolean isDefinitionContainsClazz(String className, ClassLoader loader) {
for (Map.Entry, ExtensionDefinition> entry : classToDefinitionMap.entrySet()) {
if (!entry.getKey().getName().equals(className)) {
@@ -654,6 +675,7 @@ private S initInstance(Class implClazz, Class>[] argTypes, Object[] args)
/**
* Helper Class for hold a value.
+ *
* @param
*/
private static class Holder {
diff --git a/common/src/main/java/io/seata/common/loader/LoadLevel.java b/common/src/main/java/io/seata/common/loader/LoadLevel.java
index 1c974a6a03f..605cd5e949f 100644
--- a/common/src/main/java/io/seata/common/loader/LoadLevel.java
+++ b/common/src/main/java/io/seata/common/loader/LoadLevel.java
@@ -48,4 +48,18 @@
* Scope enum.
*/
Scope scope() default Scope.SINGLETON;
+
+ /**
+ * Depends on classes.
+ *
+ * @return the classes
+ */
+ Class>[] dependsOnClasses() default {};
+
+ /**
+ * Depends on class names.
+ *
+ * @return the class names
+ */
+ String[] dependsOnClassNames() default {};
}
diff --git a/common/src/test/java/io/seata/common/loader/AfricaHello.java b/common/src/test/java/io/seata/common/loader/AfricaHello.java
new file mode 100644
index 00000000000..20cff71a39d
--- /dev/null
+++ b/common/src/test/java/io/seata/common/loader/AfricaHello.java
@@ -0,0 +1,25 @@
+/*
+ * 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.loader;
+
+/**
+ * The type Africa hello.
+ *
+ * @author wang.liang
+ */
+@LoadLevel(name = "AfricaHello", dependsOnClasses = String.class, dependsOnClassNames = "java.lang.Integer")
+public class AfricaHello implements Hello3 {
+}
diff --git a/common/src/test/java/io/seata/common/loader/AustraliaHello.java b/common/src/test/java/io/seata/common/loader/AustraliaHello.java
new file mode 100644
index 00000000000..4e71d12d839
--- /dev/null
+++ b/common/src/test/java/io/seata/common/loader/AustraliaHello.java
@@ -0,0 +1,25 @@
+/*
+ * 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.loader;
+
+/**
+ * The type Australia hello.
+ *
+ * @author wang.liang
+ */
+@LoadLevel(name = "AustraliaHello", dependsOnClassNames = "io.seata.Xxxxx")
+public class AustraliaHello implements Hello3 {
+}
diff --git a/common/src/test/java/io/seata/common/loader/EnhancedServiceLoaderTest.java b/common/src/test/java/io/seata/common/loader/EnhancedServiceLoaderTest.java
index dd1d6a69c00..8dabaa26fc7 100644
--- a/common/src/test/java/io/seata/common/loader/EnhancedServiceLoaderTest.java
+++ b/common/src/test/java/io/seata/common/loader/EnhancedServiceLoaderTest.java
@@ -133,4 +133,10 @@ public void classCastExceptionTest() {
});
}
+ @Test
+ public void testDependsOn() {
+ List hello3List = EnhancedServiceLoader.loadAll(Hello3.class);
+ assertThat(hello3List.size()).isEqualTo(1);
+ assertThat(hello3List.get(0).getClass()).isEqualTo(AfricaHello.class);
+ }
}
diff --git a/common/src/test/java/io/seata/common/loader/Hello3.java b/common/src/test/java/io/seata/common/loader/Hello3.java
new file mode 100644
index 00000000000..6d015bfffaf
--- /dev/null
+++ b/common/src/test/java/io/seata/common/loader/Hello3.java
@@ -0,0 +1,22 @@
+/*
+ * 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.loader;
+
+/**
+ * @author wang.liang
+ */
+interface Hello3 {
+}
diff --git a/common/src/test/resources/META-INF/seata/io.seata.common.loader.Hello3 b/common/src/test/resources/META-INF/seata/io.seata.common.loader.Hello3
new file mode 100644
index 00000000000..7898217a5e7
--- /dev/null
+++ b/common/src/test/resources/META-INF/seata/io.seata.common.loader.Hello3
@@ -0,0 +1,2 @@
+io.seata.common.loader.AfricaHello
+io.seata.common.loader.AustraliaHello
\ No newline at end of file
diff --git a/core/src/main/java/io/seata/core/context/FastThreadLocalContextCore.java b/core/src/main/java/io/seata/core/context/FastThreadLocalContextCore.java
index 7840f8fa804..343f30ad5c4 100644
--- a/core/src/main/java/io/seata/core/context/FastThreadLocalContextCore.java
+++ b/core/src/main/java/io/seata/core/context/FastThreadLocalContextCore.java
@@ -26,7 +26,7 @@
*
* @author ph3636
*/
-@LoadLevel(name = "FastThreadLocalContextCore", order = Integer.MIN_VALUE + 1)
+@LoadLevel(name = "FastThreadLocalContextCore", order = Integer.MIN_VALUE + 1, dependsOnClasses = FastThreadLocal.class)
public class FastThreadLocalContextCore implements ContextCore {
private FastThreadLocal