Skip to content

Commit

Permalink
optimize: add store mode,config type and registry type log info (apac…
Browse files Browse the repository at this point in the history
  • Loading branch information
renliangyu857 committed Feb 15, 2023
1 parent 357f8e8 commit b4f6fb7
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions changes/en-us/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Add changes here for all PR submitted to the develop branch.
- [[#5177](https://github.com/seata/seata/pull/5177)] If `server.session.enable-branch-async-remove` is true, delete the branch asynchronously and unlock it synchronously.
- [[#5273](https://github.com/seata/seata/pull/5273)] Optimize the compilation configuration of the `protobuf-maven-plugin` plug-in to solve the problem of too long command lines in higher versions.
- [[#5303](https://github.com/seata/seata/pull/5303)] remove startup script the -Xmn configuration
- [[#5325](https://github.com/seata/seata/pull/5325)] add store mode,config type and registry type log info
- [[#5315](https://github.com/seata/seata/pull/5315)] optimize the log of SPI
- [[#5323](https://github.com/seata/seata/pull/5323)] add time info for global transaction timeout log

Expand Down
1 change: 1 addition & 0 deletions changes/zh-cn/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- [[#5177](https://github.com/seata/seata/pull/5177)] 如果 `server.session.enable-branch-async-remove` 为真,异步删除分支,同步解锁。
- [[#5273](https://github.com/seata/seata/pull/5273)] 优化`protobuf-maven-plugin`插件的编译配置,解决高版本的命令行过长问题
- [[#5303](https://github.com/seata/seata/pull/5303)] 移除启动脚本的-Xmn参数
- [[#5325](https://github.com/seata/seata/pull/5325)] 添加配置中心、注册中心类型以及存储模式日志信息
- [[#5315](https://github.com/seata/seata/pull/5315)] 优化SPI加载日志
- [[#5323](https://github.com/seata/seata/pull/5323)] 为全局事务超时日志添加时间信息

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private static Configuration buildConfiguration() {
String configTypeName = CURRENT_FILE_INSTANCE.getConfig(
ConfigurationKeys.FILE_ROOT_CONFIG + ConfigurationKeys.FILE_CONFIG_SPLIT_CHAR
+ ConfigurationKeys.FILE_ROOT_TYPE);

LOGGER.info("use configuration center type: {}", configTypeName);
if (StringUtils.isBlank(configTypeName)) {
throw new NotSupportYetException("config type can not be null");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import io.seata.common.loader.EnhancedServiceLoader;
import io.seata.common.util.StringUtils;
import io.seata.config.ConfigurationFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The type multiple Registry factory.
Expand All @@ -33,6 +35,8 @@
*/
public class MultiRegistryFactory {

private static final Logger LOGGER = LoggerFactory.getLogger(MultiRegistryFactory.class);

/**
* Gets instances.
*
Expand All @@ -50,6 +54,7 @@ private static List<RegistryService> buildRegistryServices() {
if (StringUtils.isBlank(registryTypeNamesStr)) {
registryTypeNamesStr = RegistryType.File.name();
}
LOGGER.info("use multi registry center type: {}", registryTypeNamesStr);
String[] registryTypeNames = registryTypeNamesStr.split(Constants.REGISTRY_TYPE_SPLIT_CHAR);
for (String registryTypeName : registryTypeNames) {
RegistryType registryType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import io.seata.common.loader.EnhancedServiceLoader;
import io.seata.config.ConfigurationFactory;
import io.seata.config.ConfigurationKeys;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The type Registry factory.
Expand All @@ -29,6 +31,8 @@
*/
public class RegistryFactory {

private static final Logger LOGGER = LoggerFactory.getLogger(RegistryFactory.class);

/**
* Gets instance.
*
Expand All @@ -43,6 +47,7 @@ private static RegistryService buildRegistryService() {
String registryTypeName = ConfigurationFactory.CURRENT_FILE_INSTANCE.getConfig(
ConfigurationKeys.FILE_ROOT_REGISTRY + ConfigurationKeys.FILE_CONFIG_SPLIT_CHAR
+ ConfigurationKeys.FILE_ROOT_TYPE);
LOGGER.info("use registry center type: {}", registryTypeName);
try {
registryType = RegistryType.getType(registryTypeName);
} catch (Exception exx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import io.seata.server.session.SessionHelper;
import io.seata.server.session.SessionHolder;
import io.seata.server.store.StoreConfig;
import org.apache.commons.lang.time.DateFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
Expand Down Expand Up @@ -337,7 +338,8 @@ protected void timeoutCheck() {
return false;
}

LOGGER.warn("Global transaction[{}] is timeout and will be rollback,transaction begin time:{} and now:{}", globalSession.getXid(), globalSession.getBeginTime(), System.currentTimeMillis());
LOGGER.warn("Global transaction[{}] is timeout and will be rollback,transaction begin time:{} and now:{}", globalSession.getXid(),
DateFormatUtils.ISO_DATE_FORMAT.format(globalSession.getBeginTime()), DateFormatUtils.ISO_DATE_FORMAT.format(System.currentTimeMillis()));

globalSession.addSessionLifecycleListener(SessionHolder.getRootSessionManager());
globalSession.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import io.seata.config.ConfigurationFactory;
import io.seata.server.store.StoreConfig;
import io.seata.server.store.StoreConfig.LockMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The type Lock manager factory.
Expand All @@ -28,6 +30,7 @@
*/
public class LockerManagerFactory {

private static final Logger LOGGER = LoggerFactory.getLogger(LockerManagerFactory.class);
private static final Configuration CONFIG = ConfigurationFactory.getInstance();

/**
Expand Down Expand Up @@ -58,6 +61,7 @@ public static void init(LockMode lockMode) {
if (null == lockMode) {
lockMode = StoreConfig.getLockMode();
}
LOGGER.info("use lock store mode: {}", lockMode.getName());
//if not exist the lock mode, throw exception
if (null != StoreConfig.StoreMode.get(lockMode.name())) {
LOCK_MANAGER = EnhancedServiceLoader.load(LockManager.class, lockMode.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public static void init(SessionMode sessionMode) {
if (null == sessionMode) {
sessionMode = StoreConfig.getSessionMode();
}
LOGGER.info("use session store mode: {}", sessionMode.getName());
if (SessionMode.DB.equals(sessionMode)) {
ROOT_SESSION_MANAGER = EnhancedServiceLoader.load(SessionManager.class, SessionMode.DB.getName());
ASYNC_COMMITTING_SESSION_MANAGER = EnhancedServiceLoader.load(SessionManager.class, SessionMode.DB.getName(),
Expand Down

0 comments on commit b4f6fb7

Please sign in to comment.