Skip to content

Commit

Permalink
Merge branch '2.x' into CSReg
Browse files Browse the repository at this point in the history
  • Loading branch information
xingfudeshi authored Oct 12, 2024
2 parents d78b659 + 66bd3a4 commit 79a99bc
Show file tree
Hide file tree
Showing 64 changed files with 5,678 additions and 46 deletions.
10 changes: 8 additions & 2 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Add changes here for all PR submitted to the 2.x branch.

### feature:

- [[#6876](https://github.com/apache/incubator-seata/pull/6876)]support kingbase
- [[#6881](https://github.com/apache/incubator-seata/pull/6881)]support grpc
- [[#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
Expand All @@ -22,6 +23,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
- [[#6911](https://github.com/apache/incubator-seata/pull/6911)] fix some typos in project


### refactor:
Expand All @@ -43,6 +47,8 @@ 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)
- [psxjoy](https://github.com/psxjoy)



Expand Down
12 changes: 9 additions & 3 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
<!-- 请根据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
- [[#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打包后的读取
Expand All @@ -23,6 +25,9 @@
- [[#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
- [[#6911](https://github.com/apache/incubator-seata/pull/6911)] 修正项目中的部分拼写错误


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

- [dsomehan](https://github.com/dsomehan)
- [psxjoy](https://github.com/psxjoy)

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

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 @@ -82,7 +82,7 @@ public interface GlobalTransaction extends BaseTransaction {
/**
* Suspend the global transaction.
*
* @param clean the clean if true, clean the transaction context. otherwise,supend only
* @param clean the clean if true, clean the transaction context. otherwise,suspend only
* @return the SuspendedResourcesHolder which holds the suspend resources
* @throws TransactionException Any exception that fails this will be wrapped with TransactionException and thrown
* @see SuspendedResourcesHolder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public final class ConfigurationFactory {
public static volatile FileConfiguration ORIGIN_FILE_INSTANCE = null;

static {
initOriginConfiguraction();
initOriginConfiguration();
load();
maybeNeedOriginFileInstance();
}
Expand All @@ -83,7 +83,7 @@ private static void load() {
CURRENT_FILE_INSTANCE = extConfiguration == null ? configuration : extConfiguration;
}

private static void initOriginConfiguraction() {
private static void initOriginConfiguration() {
String seataConfigName = System.getProperty(SYSTEM_PROPERTY_SEATA_CONFIG_NAME);
if (seataConfigName == null) {
seataConfigName = System.getenv(ENV_SEATA_CONFIG_NAME);
Expand Down Expand Up @@ -225,7 +225,7 @@ private static Configuration getNonSpringConfiguration(String configTypeName) {

public static void reload() {
ConfigurationCache.clear();
initOriginConfiguraction();
initOriginConfiguration();
load();
maybeNeedOriginFileInstance();
instance = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.springframework.security.core.userdetails.UserDetails;

/**
* custem user
* custom user
*
*/
public class CustomUserDetails implements UserDetails {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.springframework.stereotype.Service;

/**
* Custem user service
* Custom user service
*
*/
@Service
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 @@ -105,7 +105,7 @@ public enum TransactionExceptionCode {
/**
* Failed to lock global transaction exception code.
*/
FailedLockGlobalTranscation,
FailedLockGlobalTransaction,

/**
* FailedWriteSession
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public enum Protocol {
/**
* grpc
*/
GPRC("grpc"),
GRPC("grpc"),

/**
* seata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void start() {
@Override
public void initChannel(SocketChannel ch) {
ChannelPipeline pipeline = ch.pipeline();
if (nettyClientConfig.getProtocol().equals(Protocol.GPRC.value)) {
if (nettyClientConfig.getProtocol().equals(Protocol.GRPC.value)) {
pipeline.addLast(Http2FrameCodecBuilder.forClient().build())
.addLast(new Http2MultiplexHandler(new ChannelDuplexHandler()));
} else {
Expand Down Expand Up @@ -191,7 +191,7 @@ public Channel getNewChannel(InetSocketAddress address) {
channel = f.channel();
}

if (nettyClientConfig.getProtocol().equals(Protocol.GPRC.value)) {
if (nettyClientConfig.getProtocol().equals(Protocol.GRPC.value)) {
Http2StreamChannelBootstrap bootstrap = new Http2StreamChannelBootstrap(channel);
bootstrap.handler(new ChannelInboundHandlerAdapter() {
@Override
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);
}
}
Loading

0 comments on commit 79a99bc

Please sign in to comment.