Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop_#1829
Browse files Browse the repository at this point in the history
  • Loading branch information
long187 committed Oct 29, 2019
2 parents 99855ba + 9dab05d commit 23f00f2
Show file tree
Hide file tree
Showing 113 changed files with 3,021 additions and 667 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependency-reduced-pom.xml
/distribution/bin
/distribution/conf
/distribution/lib
/distribution/logs
/server/*root.*
/server/.root.*
/server/sessionStore/
Expand Down
7 changes: 5 additions & 2 deletions codec/seata-codec-seata/src/test/resources/file.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,22 @@ service {
default.grouplist = "127.0.0.1:8091"
#degrade current not support
enableDegrade = false
#disable
disable = false
#disable globaltransaction
disableGlobalTransaction = false
}

client {
async.commit.buffer.limit = 10000
lock {
retry.internal = 10
retry.times = 30
retry.policy.branch-rollback-on-conflict = true
}
report.retry.count = 5
tm.commit.retry.count = 1
tm.rollback.retry.count = 1
#schedule check table meta
table.meta.check.enable = true
}

transaction {
Expand Down
2 changes: 1 addition & 1 deletion codec/seata-codec-seata/src/test/resources/registry.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ registry {
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:1001/eureka"
serviceUrl = "http://localhost:8761/eureka"
application = "default"
weight = "1"
}
Expand Down
25 changes: 18 additions & 7 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
codecov:
require_ci_to_pass: yes
coverage:
status:
patch:
patch: no
project:
default:
threshold: 1%
if_not_found: success
changes: no
precision: 2
range: "50...100"
ignore:
- "codec/seata-codec-protobuf/src/main/java/io/seata/codec/protobuf/generated"
- "test/.*"
- ".github/.*"
- ".mvn/.*"
- ".style/.*"
- "*.md"
- "codec/seata-codec-protobuf/src/main/java/io/seata/codec/protobuf/generated"
- "test/.*"
- ".github/.*"
- ".mvn/.*"
- ".style/.*"
- "*.md"
comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: no
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public enum FrameworkErrorCode {
*/
RegisterRM("0304", "Register RM failed", "Register RM failed"),

/** 0400~0499 Saga相关错误 **/
/** 0400~0499 Saga related error **/

/**
* Process type not found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
import java.util.concurrent.atomic.AtomicInteger;

/**
* 计数器,从0开始,保证正数。
* positive atomic counter, begin with 0, ensure the number is positive.
*
* @author Geng Zhang
*/
public class PositiveAtomicCounter {
private static final int MASK = 0x7FFFFFFF;
private static final int MASK = 0x7FFFFFFF;
private final AtomicInteger atom;

public PositiveAtomicCounter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/io/seata/common/util/NetUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class NetUtil {
* @return the string
*/
public static String toStringAddress(SocketAddress address) {
if(null == address){
if (null == address) {
return StringUtils.EMPTY;
}
return toStringAddress((InetSocketAddress) address);
Expand Down Expand Up @@ -223,7 +223,7 @@ public static boolean isValidIp(String ip, boolean validLocalAndAny) {
if (validLocalAndAny) {
return ip != null && IP_PATTERN.matcher(ip).matches();
} else {
return (ip != null && !ANY_HOST.equals(ip) && !LOCALHOST.equals(ip) && IP_PATTERN.matcher(ip).matches());
return ip != null && !ANY_HOST.equals(ip) && !LOCALHOST.equals(ip) && IP_PATTERN.matcher(ip).matches();
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* 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.compressor.gzip;

import org.junit.jupiter.api.Assertions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ public final class ConfigurationFactory {
if (null == envValue) {
envValue = System.getenv(ENV_SYSTEM_KEY);
}
CURRENT_FILE_INSTANCE = (null == envValue) ? new FileConfiguration(seataConfigName + REGISTRY_CONF_SUFFIX)
Configuration configuration = (null == envValue) ? new FileConfiguration(seataConfigName + REGISTRY_CONF_SUFFIX)
: new FileConfiguration(seataConfigName + "-" + envValue + REGISTRY_CONF_SUFFIX);
Configuration extConfiguration = null;
try {
extConfiguration = EnhancedServiceLoader.load(ExtConfigurationProvider.class).provide(configuration);

} catch (Exception ignore) {

}
CURRENT_FILE_INSTANCE = null == extConfiguration ? configuration : extConfiguration;
}

private static final String NAME_KEY = "name";
Expand Down Expand Up @@ -91,7 +99,15 @@ private static Configuration buildConfiguration() {
+ FILE_TYPE + ConfigurationKeys.FILE_CONFIG_SPLIT_CHAR
+ NAME_KEY;
String name = CURRENT_FILE_INSTANCE.getConfig(pathDataId);
return new FileConfiguration(name);
Configuration configuration = new FileConfiguration(name);
Configuration extConfiguration = null;
try {
extConfiguration = EnhancedServiceLoader.load(ExtConfigurationProvider.class).provide(configuration);
} catch (Exception ignore) {

}

return null == extConfiguration ? configuration : extConfiguration;
} else {
return EnhancedServiceLoader.load(ConfigurationProvider.class, Objects.requireNonNull(configType).name())
.provide();
Expand Down
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.config;

/**
* the interface ext configuration provider
* @author [email protected]
* @date 2019/10/03
*/
public interface ExtConfigurationProvider {
/**
* provide a AbstractConfiguration implementation instance
* @param originalConfiguration
* @return configuration
*/
Configuration provide(Configuration originalConfiguration);
}
5 changes: 3 additions & 2 deletions config/seata-config-core/src/main/resources/file.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ service {
default.grouplist = "127.0.0.1:8091"
#degrade current not support
enableDegrade = false
#disable
disable = false
#disable globaltransaction
disableGlobalTransaction = false
}

client {
async.commit.buffer.limit = 10000
lock {
retry.internal = 10
retry.times = 30
retry.policy.branch-rollback-on-conflict = true
}
report.retry.count = 5
tm.commit.retry.count = 1
Expand Down
2 changes: 1 addition & 1 deletion config/seata-config-core/src/main/resources/registry.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ registry {
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:1001/eureka"
serviceUrl = "http://localhost:8761/eureka"
application = "default"
weight = "1"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static List<Exporter> getInstanceList() {
exporters.add(
EnhancedServiceLoader.load(Exporter.class, Objects.requireNonNull(exporterType).name()));
} catch (Exception exx) {
LOGGER.error("not support metrics exporter type: " + exporterTypeName, exx);
LOGGER.error("not support metrics exporter type: {}",exporterTypeName, exx);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<module>tm</module>
<module>metrics</module>
<module>codec</module>
<module>seata-spring-boot-starter</module>
<module>compressor</module>
<module>saga</module>
</modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ private TableMeta resultSetMetaToSchema(ResultSetMetaData rsmd, DatabaseMetaData
TableMeta tm = new TableMeta();
tm.setTableName(tableName);

/*
* when set the useInformationSchema true just like jdbc:mysql://127.0.0.1:3306/xxx?useInformationSchema=true
* mysql will use DatabaseMetaDataUsingInfoSchema instead of DatabaseMetaData
* so
* the type of get table meta will change from
* show full columns from xxx from xxx
* to
* select xxx from xxx where catalog_name like ? and table_name like ?
* in the second type we have to remove the "`"
*/
if(tableName.contains("`")){
tableName = tableName.replace("`", "");
}

ResultSet rsColumns = dbmd.getColumns(catalogName, schemaName, tableName, "%");
ResultSet rsIndex = dbmd.getIndexInfo(catalogName, schemaName, tableName, false, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static String getDbTypeFromDataSource(DataSource dataSource) throws SQLEx
try {
con.close();
} catch (SQLException e) {
LOGGER.error("Get dbType from failed: " + e.getMessage(), e);
LOGGER.error("Get dbType from failed: {}",e.getMessage(), e);
}
}
}
Expand Down Expand Up @@ -163,4 +163,4 @@ public int getTransOperationTimeout() {
public void setTransOperationTimeout(int transOperationTimeout) {
this.transOperationTimeout = transOperationTimeout;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static byte[] serializeByObjectOutput(Object o) {
oos.flush();
result = baos.toByteArray();
} catch (IOException e) {
LOGGER.error("serializer failed:" + o.getClass(), e);
LOGGER.error("serializer failed:{}",o.getClass(), e);
throw (new RuntimeException("IO Create Error", e));
} finally {
if (oos != null) {
Expand Down Expand Up @@ -111,4 +111,4 @@ public static Object deserializeByObjectInputStream(byte[] bytes) {
}
return result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,15 @@ else if((ExecutionStatus.FA.equals(stateInstance.getStatus()) || ExecutionStatus

sagaTransactionalTemplate.branchReport(globalTransaction.getXid(), Long.parseLong(stateInstance.getId()), branchStatus, null);
} catch (TransactionException e) {
LOGGER.error("Report branch status to server error: " + e.getCode() +
", StateMachine:" + stateInstance.getStateMachineInstance().getStateMachine().getName() +
", StateName:" + stateInstance.getName() +
", XID: "+stateInstance.getStateMachineInstance().getId() +
", branchId: " + stateInstance.getId() +
", branchStatus:" + branchStatus +
", Reason: " + e.getMessage(), e);
LOGGER.error("Report branch status to server error: {}, StateMachine:{}, StateName:{}, XID: {}, branchId: {}, branchStatus:{}, Reason:{} "
,e.getCode()
,stateInstance.getStateMachineInstance().getStateMachine().getName()
,stateInstance.getName()
,stateInstance.getStateMachineInstance().getId()
,stateInstance.getId()
,branchStatus
,e.getMessage()
,e);
}
}
}
Expand Down Expand Up @@ -630,4 +632,4 @@ public void setTablePrefix(String tablePrefix) {
super.setTablePrefix(tablePrefix);
this.stateLogStoreSqls = new StateLogStoreSqls(tablePrefix);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,22 @@

/**
* Async Callback
*
* @author lorne.cl
*/
public interface AsyncCallback {

/**
* on finished
*
* @param context
* @param stateMachineInstance
*/
void onFinished(ProcessContext context, StateMachineInstance stateMachineInstance);

/**
* on error
*
* @param context
* @param stateMachineInstance
* @param exp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import io.seata.saga.engine.store.StateLogStore;
import io.seata.saga.engine.repo.StateMachineRepository;
import io.seata.saga.engine.sequence.SeqGenerator;

import java.util.concurrent.ThreadPoolExecutor;

import org.springframework.context.ApplicationContext;

/**
Expand Down Expand Up @@ -133,6 +135,7 @@ public interface StateMachineConfig {

/**
* get ServiceInvokerManager
*
* @return
*/
ServiceInvokerManager getServiceInvokerManager();
Expand Down
Loading

0 comments on commit 23f00f2

Please sign in to comment.