Skip to content

Commit

Permalink
Merge branch '2.x' into feature-fastjson2-serial
Browse files Browse the repository at this point in the history
  • Loading branch information
funky-eyes authored Oct 12, 2024
2 parents 3e25a5e + 87c1696 commit 7ff3df9
Show file tree
Hide file tree
Showing 45 changed files with 5,657 additions and 22 deletions.
3 changes: 3 additions & 0 deletions build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@
<maven.test.skip>false</maven.test.skip>
<maven.git-commit-id.skip>true</maven.git-commit-id.skip>

<maven.surefire.argLine></maven.surefire.argLine>
<maven.surefire.excludes></maven.surefire.excludes>

<!-- For docker image-->
<image.publish.skip>true</image.publish.skip>
<image.name>${IMAGE_NAME}</image.name>
Expand Down
12 changes: 9 additions & 3 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ Add changes here for all PR submitted to the 2.x branch.
<!-- Please add the `changes` to the following location(feature/bugfix/optimize/test) based on the type of PR -->

### feature:

- [[#6876](https://github.com/apache/incubator-seata/pull/6876)]support kingbase
- [[#6881](https://github.com/apache/incubator-seata/pull/6881)]support grpc
- [[#6904](https://github.com/apache/incubator-seata/pull/6904)] add fastjson2 serializer support
- [[#6876](https://github.com/apache/incubator-seata/pull/6876)] support kingbase
- [[#6881](https://github.com/apache/incubator-seata/pull/6881)] support grpc
- [[#6864](https://github.com/apache/incubator-seata/pull/6864)] support shentong database


### bugfix:
- [[#6899](https://github.com/apache/incubator-seata/pull/6899)] fix file.conf read failed after package
- [[#6890](https://github.com/apache/incubator-seata/pull/6890)] fix designerJson to standardJson: subStateMachine compensateState cannot be recognized
- [[#6907](https://github.com/apache/incubator-seata/pull/6907)] fix the issue of Codecov not generating reports

### optimize:
- [[#6826](https://github.com/apache/incubator-seata/pull/6826)] remove the branch registration operation of the XA read-only transaction
Expand All @@ -22,6 +24,9 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6898](https://github.com/apache/incubator-seata/pull/6898)] upgrade npmjs version in saga module
- [[#6879](https://github.com/apache/incubator-seata/pull/6879)] fix log argument mismatch issue
- [[#6902](https://github.com/apache/incubator-seata/pull/6900)] optimize readme docs
- [[#6905](https://github.com/apache/incubator-seata/pull/6905)] remove incompatible licenses at build time
- [[#6906](https://github.com/apache/incubator-seata/pull/6906)] h2 dependency adds test scope



### refactor:
Expand All @@ -43,6 +48,7 @@ Thanks to these contributors for their code commits. Please report an unintended
- [arrrnold17](https://github.com/arrrnold17)
- [xjlgod](https://github.com/xjlgod)
- [PleaseGiveMeTheCoke](https://github.com/PleaseGiveMeTheCoke)
- [dsomehan](https://github.com/dsomehan)



Expand Down
10 changes: 8 additions & 2 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
<!-- 请根据PR的类型添加 `变更记录` 到以下对应位置(feature/bugfix/optimize/test) 下 -->

### feature:
- [[#6876](https://github.com/apache/incubator-seata/pull/6876)]支持人大金仓数据库(kingbase)
- [[#6881](https://github.com/apache/incubator-seata/pull/6881)]全链路支持grpc
- [[#6904](https://github.com/apache/incubator-seata/pull/6904)] 增加Fastjson2序列化Rpc消息支持
- [[#6876](https://github.com/apache/incubator-seata/pull/6876)] 支持人大金仓数据库(kingbase)
- [[#6881](https://github.com/apache/incubator-seata/pull/6881)] client和server支持grpc协议
- [[#6864](https://github.com/apache/incubator-seata/pull/6864)] 支持神通数据库(oscar)


### bugfix:
- [[#6899](https://github.com/apache/incubator-seata/pull/6899)] 修复file.conf打包后的读取
- [[#6890](https://github.com/apache/incubator-seata/pull/6890)] 修复saga设计json转标准json过程中: 子状态机补偿节点无法被识别
- [[#6907](https://github.com/apache/incubator-seata/pull/6907)] 修复Codecov未生成报告的问题

### optimize:
- [[#6826](https://github.com/apache/incubator-seata/pull/6826)] 移除只读XA事务的分支注册操作
Expand All @@ -23,6 +26,8 @@
- [[#6879](https://github.com/apache/incubator-seata/pull/6879)] 修复日志参数不匹配问题
- [[#6898](https://github.com/apache/incubator-seata/pull/6898)] 升级 saga 模块 npmjs 版本
- [[#6902](https://github.com/apache/incubator-seata/pull/6900)] 优化 readme 文档
- [[#6905](https://github.com/apache/incubator-seata/pull/6905)] 移除构建期不兼容的 license
- [[#6906](https://github.com/apache/incubator-seata/pull/6906)] h2依赖添加test scope


### refactor:
Expand All @@ -45,6 +50,7 @@
- [arrrnold17](https://github.com/arrrnold17)
- [xjlgod](https://github.com/xjlgod)
- [PleaseGiveMeTheCoke](https://github.com/PleaseGiveMeTheCoke)
- [dsomehan](https://github.com/dsomehan)


同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public static String pageSql(String sourceSql, String dbType, int pageNum, int p
case "kingbase":
case "oceanbase":
case "dm":
case "oscar":
return LIMIT_TEMPLATE.replace(SOURCE_SQL_PLACE_HOLD, sourceSql)
.replace(LIMIT_PLACE_HOLD, String.valueOf(pageSize))
.replace(OFFSET_PLACE_HOLD, String.valueOf((pageNum - 1) * pageSize));
Expand Down Expand Up @@ -142,6 +143,7 @@ public static String countSql(String sourceSql, String dbType) {
case "oceanbase":
case "oracle":
case "dm":
case "oscar":
return sourceSql.replaceAll("(?i)(?<=select)(.*)(?=from)", " count(1) ");
case "postgresql":
case "kingbase":
Expand Down Expand Up @@ -185,6 +187,7 @@ public static String getTimeStartSql(String dbType, String timeColumnName) {
case "postgresql":
case "sqlserver":
case "dm":
case "oscar":
return " and FLOOR(" + timeColumnName + "/1000) >= ? ";
default:
throw new IllegalArgumentException("The DB type :" + dbType + " is not supported yet");
Expand All @@ -204,6 +207,7 @@ public static String getTimeEndSql(String dbType, String timeColumnName) {
case "postgresql":
case "sqlserver":
case "dm":
case "oscar":
return " and FLOOR(" + timeColumnName + "/1000) <= ? ";
default:
throw new IllegalArgumentException("The DB type :" + dbType + " is not supported yet");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public void testPageSql() {
assertEquals(PageUtil.pageSql(sourceSql, "postgresql", 1, 5), mysqlTargetSql);
assertEquals(PageUtil.pageSql(sourceSql, "oceanbase", 1, 5), mysqlTargetSql);
assertEquals(PageUtil.pageSql(sourceSql, "dm", 1, 5), mysqlTargetSql);
assertEquals(PageUtil.pageSql(sourceSql, "oscar", 1, 5), mysqlTargetSql);
assertEquals(PageUtil.pageSql(sourceSql, "oracle", 1, 5), oracleTargetSql);
assertEquals(PageUtil.pageSql(sourceSql, "sqlserver", 1, 5), sqlserverTargetSql);

Expand All @@ -61,6 +62,7 @@ void testCountSql() {
assertEquals(PageUtil.countSql(sourceSql, "postgresql"), targetSql);
assertEquals(PageUtil.countSql(sourceSql, "oceanbase"), targetSql);
assertEquals(PageUtil.countSql(sourceSql, "dm"), targetSql);
assertEquals(PageUtil.countSql(sourceSql, "oscar"), targetSql);
assertEquals(PageUtil.countSql(sourceSql, "oracle"), targetSql);
assertEquals(PageUtil.countSql(sourceSql, "sqlserver"), targetSql);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ public enum DBType {
/**
* PolarDB db type.
*/
POLARDB;
POLARDB,

/**
* oscar db type.
*/
OSCAR;

/**
* Valueof db type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class DistributedLockSqlFactory {
/**
* get the lock store sql
*
* @param dbType the dbType, support mysql/oracle/h2/postgre/oceanbase/dm/sqlserver ...
* @param dbType the dbType, support mysql/oracle/h2/postgre/oceanbase/dm/sqlserver/oscar ...
* @return lock store sql
*/
public static DistributedLockSql getDistributedLogStoreSql(String dbType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class LockStoreSqlFactory {
/**
* get the lock store sql
*
* @param dbType the dbType, support mysql/oracle/h2/postgre/oceanbase/dm
* @param dbType the dbType, support mysql/oracle/h2/postgre/oceanbase/dm/oscar
* @return lock store sql
*/
public static LockStoreSql getLogStoreSql(String dbType) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.
* The ASF licenses this file to You 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 org.apache.seata.core.store.db.sql.lock;


import org.apache.seata.common.loader.LoadLevel;

/**
* the database lock store shentong sql
*
*/
@LoadLevel(name = "oscar")
public class OscarLockStoreSql extends OracleLockStoreSql {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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.
* The ASF licenses this file to You 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 org.apache.seata.core.store.db.sql.log;


import org.apache.seata.common.loader.LoadLevel;

/**
* Database log store oscar sql
*/
@LoadLevel(name = "oscar")
public class OscarLogStoreSqls extends OracleLogStoreSqls {
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ org.apache.seata.core.store.db.sql.lock.SqlServerLockStoreSql
org.apache.seata.core.store.db.sql.lock.MariadbLockStoreSql
org.apache.seata.core.store.db.sql.lock.PolarDBXLockStoreSql
org.apache.seata.core.store.db.sql.lock.DmLockStoreSql
org.apache.seata.core.store.db.sql.lock.KingbaseLockStoreSql
org.apache.seata.core.store.db.sql.lock.OscarLockStoreSql
org.apache.seata.core.store.db.sql.lock.KingbaseLockStoreSql
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ org.apache.seata.core.store.db.sql.log.SqlServerLogStoreSqls
org.apache.seata.core.store.db.sql.log.MariadbLogStoreSqls
org.apache.seata.core.store.db.sql.log.PolarDBXLogStoreSqls
org.apache.seata.core.store.db.sql.log.DmLogStoreSqls
org.apache.seata.core.store.db.sql.log.KingbaseLogStoreSqls
org.apache.seata.core.store.db.sql.log.OscarLogStoreSqls
org.apache.seata.core.store.db.sql.log.KingbaseLogStoreSqls
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class LockStoreSqlFactoryTest {

private static LockStoreSql DM_LOCK_STORE = LockStoreSqlFactory.getLogStoreSql("dm");

private static LockStoreSql OSCAR_LOCK_STORE = LockStoreSqlFactory.getLogStoreSql("oscar");

private static String GLOBAL_TABLE = "global_table";

private static String BRANCH_TABLE = "branch_table";
Expand Down Expand Up @@ -379,4 +381,51 @@ public void dmLockTest() {
sql = DM_LOCK_STORE.getCheckLockableSql(BRANCH_TABLE, 3);
Assertions.assertEquals(EXPECT_CHECK_BRANCH_LOCKABLE_SQL,sql);
}


@Test
public void oscarLockTest() {
String sql;
// Get insert lock sql string.
sql = OSCAR_LOCK_STORE.getInsertLockSQL(GLOBAL_TABLE);
Assertions.assertNotNull(sql);
sql = OSCAR_LOCK_STORE.getInsertLockSQL(BRANCH_TABLE);
Assertions.assertNotNull(sql);

// Get delete lock sql string.
sql = OSCAR_LOCK_STORE.getDeleteLockSql(GLOBAL_TABLE);
Assertions.assertNotNull(sql);
sql = OSCAR_LOCK_STORE.getDeleteLockSql(BRANCH_TABLE);
Assertions.assertNotNull(sql);

// Get batch delete lock sql string.
sql = OSCAR_LOCK_STORE.getBatchDeleteLockSql(GLOBAL_TABLE, 3);
Assertions.assertEquals(EXPECT_BATCH_GLOBAL_DELETE_LOCK_SQL,sql);
sql = OSCAR_LOCK_STORE.getBatchDeleteLockSql(BRANCH_TABLE, 3);
Assertions.assertEquals(EXPECT_BATCH_BRANCH_DELETE_LOCK_SQL,sql);

// Get batch delete lock sql string.
sql = OSCAR_LOCK_STORE.getBatchDeleteLockSqlByBranchId(GLOBAL_TABLE);
Assertions.assertNotNull(sql);
sql = OSCAR_LOCK_STORE.getBatchDeleteLockSqlByBranchId(BRANCH_TABLE);
Assertions.assertNotNull(sql);

// Get batch delete lock sql string.
sql = OSCAR_LOCK_STORE.getBatchDeleteLockSqlByXid(GLOBAL_TABLE);
Assertions.assertEquals(EXPECT_BATCH_GLOBAL_DELETE_LOCK_BY_BRANCHS_SQL,sql);
sql = OSCAR_LOCK_STORE.getBatchDeleteLockSqlByXid(BRANCH_TABLE);
Assertions.assertEquals(EXPECT_BATCH_BRANCH_DELETE_LOCK_BY_BRANCHS_SQL,sql);

// Get query lock sql string.
sql = OSCAR_LOCK_STORE.getQueryLockSql(GLOBAL_TABLE);
Assertions.assertNotNull(sql);
sql = OSCAR_LOCK_STORE.getQueryLockSql(BRANCH_TABLE);
Assertions.assertNotNull(sql);

// Get check lock sql string.
sql = OSCAR_LOCK_STORE.getCheckLockableSql(GLOBAL_TABLE, 3);
Assertions.assertEquals(EXPECT_CHECK_GLOBAL_LOCKABLE_SQL,sql);
sql = OSCAR_LOCK_STORE.getCheckLockableSql(BRANCH_TABLE, 3);
Assertions.assertEquals(EXPECT_CHECK_BRANCH_LOCKABLE_SQL,sql);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class LogStoreSqlsFactoryTest {

private static LogStoreSqls dmLog = LogStoreSqlsFactory.getLogStoreSqls("dm");

private static LogStoreSqls oscarLog = LogStoreSqlsFactory.getLogStoreSqls("oscar");

private static String globalTable = "global_table";

private static String branchTable = "branch_table";
Expand Down Expand Up @@ -246,4 +248,38 @@ public void dmLogTest() {
sql = dmLog.getQueryBranchMax(branchTable);
Assertions.assertNotNull(sql);
}

@Test
public void oscarLogTest() {
String sql = oscarLog.getInsertGlobalTransactionSQL(globalTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getUpdateGlobalTransactionStatusSQL(globalTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getDeleteGlobalTransactionSQL(globalTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getQueryGlobalTransactionSQL(globalTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getQueryGlobalTransactionSQLByTransactionId(globalTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getQueryGlobalTransactionSQLByStatus(globalTable, "1");
Assertions.assertNotNull(sql);
sql = oscarLog.getQueryGlobalTransactionForRecoverySQL(globalTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getInsertBranchTransactionSQL(branchTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getUpdateBranchTransactionStatusSQL(branchTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getDeleteBranchTransactionByBranchIdSQL(branchTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getDeleteBranchTransactionByXId(branchTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getQueryBranchTransaction(branchTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getQueryBranchTransaction(branchTable, "1");
Assertions.assertNotNull(sql);
sql = oscarLog.getQueryGlobalMax(globalTable);
Assertions.assertNotNull(sql);
sql = oscarLog.getQueryBranchMax(branchTable);
Assertions.assertNotNull(sql);
}
}
6 changes: 0 additions & 6 deletions distribution/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,6 @@ BSD-3-Clause licenses
org.antlr:antlr4-runtime 4.8 BSD-3-Clause
org.abego.treelayout:org.abego.treelayout.core 1.0.3 BSD-3-Clause

========================================================================
CC-BY-4.0 licenses
========================================================================

caniuse-lite 1.0.30001589 CC-BY-4.0

========================================================================
CDDL-1.0 licenses
========================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ private void initResourceId() {
initSqlServerResourceId();
} else if (JdbcConstants.DM.equals(dbType)) {
initDMResourceId();
} else if (JdbcConstants.OSCAR.equals(dbType)) {
initOscarResourceId();
} else {
initDefaultResourceId();
}
Expand Down Expand Up @@ -321,6 +323,18 @@ private void initDMResourceId() {
}
}

/**
* init the oscar resource id
* jdbc:oscar://192.168.x.xx:2003/OSRDB
*/
private void initOscarResourceId() {
if (jdbcUrl.contains("?")) {
resourceId = jdbcUrl.substring(0, jdbcUrl.indexOf('?')) + "/" + userName;
} else {
resourceId = jdbcUrl + "/" + userName;
}
}

/**
* prevent pg sql url like
* jdbc:postgresql://127.0.0.1:5432/seata?currentSchema=public
Expand Down
Loading

0 comments on commit 7ff3df9

Please sign in to comment.