Skip to content

Commit

Permalink
bugfix: fix some problem of the sql parser (apache#4352)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 authored Jan 28, 2022
1 parent 54b394e commit 09fa60c
Show file tree
Hide file tree
Showing 25 changed files with 54 additions and 24 deletions.
2 changes: 1 addition & 1 deletion config/seata-config-custom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-config-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion config/seata-config-etcd3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-config-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.etcd</groupId>
Expand Down
2 changes: 1 addition & 1 deletion config/seata-config-nacos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-config-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
Expand Down
2 changes: 1 addition & 1 deletion config/seata-config-spring-cloud/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-config-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand Down
2 changes: 1 addition & 1 deletion config/seata-config-zk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-config-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.101tec</groupId>
Expand Down
2 changes: 1 addition & 1 deletion discovery/seata-discovery-consul/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-discovery-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ecwid.consul</groupId>
Expand Down
2 changes: 1 addition & 1 deletion discovery/seata-discovery-custom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-discovery-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion discovery/seata-discovery-etcd3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-discovery-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.etcd</groupId>
Expand Down
2 changes: 1 addition & 1 deletion discovery/seata-discovery-eureka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-discovery-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.netflix.eureka</groupId>
Expand Down
2 changes: 1 addition & 1 deletion discovery/seata-discovery-nacos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-discovery-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
Expand Down
2 changes: 1 addition & 1 deletion discovery/seata-discovery-redis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-discovery-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
Expand Down
2 changes: 1 addition & 1 deletion discovery/seata-discovery-sofa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-discovery-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.alipay.sofa</groupId>
Expand Down
2 changes: 1 addition & 1 deletion discovery/seata-discovery-zk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-discovery-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.101tec</groupId>
Expand Down
1 change: 0 additions & 1 deletion integration/grpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<groupId>io.grpc</groupId>
<artifactId>grpc-testing</artifactId>
<scope>test</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
Expand Down
2 changes: 1 addition & 1 deletion metrics/seata-metrics-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-metrics-api</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
4 changes: 2 additions & 2 deletions metrics/seata-metrics-exporter-prometheus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-metrics-api</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-core</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>

<dependency>
Expand Down
4 changes: 2 additions & 2 deletions metrics/seata-metrics-registry-compact/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-metrics-api</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-common</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
package io.seata.rm.datasource.util;

import io.seata.common.loader.EnhancedServiceLoader;
import io.seata.config.ConfigurationFactory;
import io.seata.core.constants.ConfigurationKeys;
import io.seata.rm.BaseDataSourceResource;
import io.seata.rm.DefaultResourceManager;
import io.seata.sqlparser.SqlParserType;
Expand All @@ -42,8 +40,7 @@ static DbTypeParser getDbTypeParser() {
if (dbTypeParser == null) {
synchronized (JdbcUtils.class) {
if (dbTypeParser == null) {
String sqlparserType = ConfigurationFactory.getInstance().getConfig(ConfigurationKeys.SQL_PARSER_TYPE, SqlParserType.SQL_PARSER_TYPE_DRUID);
dbTypeParser = EnhancedServiceLoader.load(DbTypeParser.class, sqlparserType);
dbTypeParser = EnhancedServiceLoader.load(DbTypeParser.class, SqlParserType.SQL_PARSER_TYPE_DRUID);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion saga/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-common</artifactId>
<version>${project.parent.version}</version>
<version>${project.version}</version>
</dependency>

<dependency>
Expand Down
1 change: 1 addition & 0 deletions script/client/conf/file.conf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ client {
sagaRetryPersistModeUpdate = false
sagaCompensatePersistModeUpdate = false
tccActionInterceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000
sqlParserType = "druid"
}
tm {
commitRetryCount = 5
Expand Down
1 change: 1 addition & 0 deletions script/client/spring/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ seata.client.rm.saga-json-parser=fastjson
seata.client.rm.saga-retry-persist-mode-update=false
seata.client.rm.saga-compensate-persist-mode-update=false
seata.client.rm.tcc-action-interceptor-order=-2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000
seata.client.rm.sql-parser-type=druid
seata.client.rm.lock.retry-interval=10
seata.client.rm.lock.retry-times=30
seata.client.rm.lock.retry-policy-branch-rollback-on-conflict=true
Expand Down
1 change: 1 addition & 0 deletions script/client/spring/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ seata:
saga-retry-persist-mode-update: false
saga-compensate-persist-mode-update: false
tcc-action-interceptor-order: -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000
sql-parser-type: druid
lock:
retry-interval: 10
retry-times: 30
Expand Down
1 change: 1 addition & 0 deletions script/config-center/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ client.rm.reportSuccessEnable=false
client.rm.sagaBranchRegisterEnable=false
client.rm.sagaJsonParser=fastjson
client.rm.tccActionInterceptorOrder=-2147482648
client.rm.sqlParserType=druid
client.tm.commitRetryCount=5
client.tm.rollbackRetryCount=5
client.tm.defaultGlobalTransactionTimeout=60000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package io.seata.spring.boot.autoconfigure.properties.client;

import io.seata.sqlparser.SqlParserType;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

Expand Down Expand Up @@ -46,6 +47,7 @@ public class RmProperties {
private boolean sagaRetryPersistModeUpdate = DEFAULT_CLIENT_SAGA_RETRY_PERSIST_MODE_UPDATE;
private boolean sagaCompensatePersistModeUpdate = DEFAULT_CLIENT_SAGA_COMPENSATE_PERSIST_MODE_UPDATE;
private int tccActionInterceptorOrder = TCC_ACTION_INTERCEPTOR_ORDER;
private String sqlParserType = SqlParserType.SQL_PARSER_TYPE_DRUID;

public int getAsyncCommitBufferLimit() {
return asyncCommitBufferLimit;
Expand Down Expand Up @@ -132,4 +134,13 @@ public RmProperties setTccActionInterceptorOrder(int tccActionInterceptorOrder)
this.tccActionInterceptorOrder = tccActionInterceptorOrder;
return this;
}

public String getSqlParserType() {
return sqlParserType;
}

public RmProperties setSqlParserType(String sqlParserType) {
this.sqlParserType = sqlParserType;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.RmProperties",
"defaultValue": -2147482648
},
{
"name": "seata.client.rm.sql-parser-type",
"type": "java.lang.String",
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.RmProperties",
"defaultValue": "druid"
},
{
"name": "seata.client.rm.lock.retry-interval",
"type": "java.lang.Integer",
Expand Down Expand Up @@ -368,6 +374,19 @@
}
]
},
{
"name": "seata.client.rm.sql-parser-type",
"values": [
{
"value": "druid",
"description": "the default type."
},
{
"value": "antlr",
"description": "'io.seata:seata-sqlparser-antlr' dependency must be referenced manually."
}
]
},
{
"name": "seata.client.undo.log-serialization",
"values": [
Expand Down

0 comments on commit 09fa60c

Please sign in to comment.