Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize: optimize lock release logic in AT transaction mode #6996

Merged
merged 4 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6991](https://github.com/apache/incubator-seata/pull/6991)] gRPC serialization default to Protobuf
- [[#6993](https://github.com/apache/incubator-seata/pull/6993)] optimize transaction metrics
- [[#6995](https://github.com/apache/incubator-seata/pull/6995)] upgrade outdate npmjs dependencies
- [[#6996](https://github.com/apache/incubator-seata/pull/6996)] optimize lock release logic in AT transaction mode


### refactor:
Expand Down
2 changes: 2 additions & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
- [[#6950](https://github.com/apache/incubator-seata/pull/6950)] 移除JVM参数app.id
- [[#6959](https://github.com/apache/incubator-seata/pull/6959)] 修正 `seata-http-jakarta`的模块命名和描述
- [[#6991](https://github.com/apache/incubator-seata/pull/6991)] gRPC协议序列化默认值为protobuf
- [[#6996](https://github.com/apache/incubator-seata/pull/6996)] 优化 AT 事务模式锁释放逻辑
- [[#6993](https://github.com/apache/incubator-seata/pull/6993)] 优化 metrics 指标


### refactor:


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,15 @@ public interface ConfigurationKeys {

/**
* The constant ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE.
* This configuration is deprecated, please use {@link #ROLLBACK_FAILED_UNLOCK_ENABLE} instead.
*/
@Deprecated
String ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE = SERVER_PREFIX + "rollbackRetryTimeoutUnlockEnable";

/**
* The constant ROLLBACK_FAILED_UNLOCK_ENABLE.
*/
String ROLLBACK_FAILED_UNLOCK_ENABLE = SERVER_PREFIX + "rollbackFailedUnlockEnable";
/**
* the constant RETRY_DEAD_THRESHOLD
*/
Expand Down
189 changes: 185 additions & 4 deletions common/src/main/java/org/apache/seata/common/DefaultValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,56 +18,160 @@

import java.time.Duration;

/**
* The interface Default values.
*/
public interface DefaultValues {
/**
* The constant DEFAULT_CLIENT_LOCK_RETRY_INTERVAL.
*/
int DEFAULT_CLIENT_LOCK_RETRY_INTERVAL = 10;
/**
* The constant DEFAULT_TM_DEGRADE_CHECK_ALLOW_TIMES.
*/
int DEFAULT_TM_DEGRADE_CHECK_ALLOW_TIMES = 10;
/**
* The constant DEFAULT_CLIENT_LOCK_RETRY_TIMES.
*/
int DEFAULT_CLIENT_LOCK_RETRY_TIMES = 30;
/**
* The constant DEFAULT_CLIENT_LOCK_RETRY_POLICY_BRANCH_ROLLBACK_ON_CONFLICT.
*/
boolean DEFAULT_CLIENT_LOCK_RETRY_POLICY_BRANCH_ROLLBACK_ON_CONFLICT = true;
/**
* The constant DEFAULT_LOG_EXCEPTION_RATE.
*/
int DEFAULT_LOG_EXCEPTION_RATE = 100;
/**
* The constant DEFAULT_CLIENT_ASYNC_COMMIT_BUFFER_LIMIT.
*/
int DEFAULT_CLIENT_ASYNC_COMMIT_BUFFER_LIMIT = 10000;
/**
* The constant DEFAULT_TM_DEGRADE_CHECK_PERIOD.
*/
int DEFAULT_TM_DEGRADE_CHECK_PERIOD = 2000;
/**
* The constant DEFAULT_CLIENT_REPORT_RETRY_COUNT.
*/
int DEFAULT_CLIENT_REPORT_RETRY_COUNT = 5;
/**
* The constant DEFAULT_CLIENT_REPORT_SUCCESS_ENABLE.
*/
boolean DEFAULT_CLIENT_REPORT_SUCCESS_ENABLE = false;
/**
* The constant DEFAULT_CLIENT_TABLE_META_CHECK_ENABLE.
*/
boolean DEFAULT_CLIENT_TABLE_META_CHECK_ENABLE = true;
/**
* The constant DEFAULT_TABLE_META_CHECKER_INTERVAL.
*/
long DEFAULT_TABLE_META_CHECKER_INTERVAL = 60000L;
/**
* The constant DEFAULT_TM_DEGRADE_CHECK.
*/
boolean DEFAULT_TM_DEGRADE_CHECK = false;
/**
* The constant DEFAULT_CLIENT_SAGA_BRANCH_REGISTER_ENABLE.
*/
boolean DEFAULT_CLIENT_SAGA_BRANCH_REGISTER_ENABLE = false;

/**
* The default session store dir
*/
String DEFAULT_SESSION_STORE_FILE_DIR = "sessionStore";
/**
* The constant DEFAULT_CLIENT_SAGA_RETRY_PERSIST_MODE_UPDATE.
*/
boolean DEFAULT_CLIENT_SAGA_RETRY_PERSIST_MODE_UPDATE = false;
/**
* The constant DEFAULT_CLIENT_SAGA_COMPENSATE_PERSIST_MODE_UPDATE.
*/
boolean DEFAULT_CLIENT_SAGA_COMPENSATE_PERSIST_MODE_UPDATE = false;
/**
* The constant DEFAULT_RAFT_SERIALIZATION.
*/
String DEFAULT_RAFT_SERIALIZATION = "jackson";
/**
* The constant DEFAULT_RAFT_COMPRESSOR.
*/
String DEFAULT_RAFT_COMPRESSOR = "none";

/**
* Shutdown timeout default 3s
*/
int DEFAULT_SHUTDOWN_TIMEOUT_SEC = 13;
/**
* The constant DEFAULT_SELECTOR_THREAD_SIZE.
*/
int DEFAULT_SELECTOR_THREAD_SIZE = 1;
/**
* The constant DEFAULT_BOSS_THREAD_SIZE.
*/
int DEFAULT_BOSS_THREAD_SIZE = 1;


/**
* The constant DEFAULT_SELECTOR_THREAD_PREFIX.
*/
String DEFAULT_SELECTOR_THREAD_PREFIX = "NettyClientSelector";
/**
* The constant DEFAULT_WORKER_THREAD_PREFIX.
*/
String DEFAULT_WORKER_THREAD_PREFIX = "NettyClientWorkerThread";
/**
* The constant DEFAULT_ENABLE_CLIENT_BATCH_SEND_REQUEST.
*/
@Deprecated
boolean DEFAULT_ENABLE_CLIENT_BATCH_SEND_REQUEST = true;
/**
* The constant DEFAULT_ENABLE_TM_CLIENT_BATCH_SEND_REQUEST.
*/
boolean DEFAULT_ENABLE_TM_CLIENT_BATCH_SEND_REQUEST = false;
/**
* The constant DEFAULT_ENABLE_RM_CLIENT_BATCH_SEND_REQUEST.
*/
boolean DEFAULT_ENABLE_RM_CLIENT_BATCH_SEND_REQUEST = true;
/**
* The constant DEFAULT_ENABLE_TC_SERVER_BATCH_SEND_RESPONSE.
*/
boolean DEFAULT_ENABLE_TC_SERVER_BATCH_SEND_RESPONSE = false;

/**
* The constant DEFAULT_CLIENT_CHANNEL_CHECK_FAIL_FAST.
*/
boolean DEFAULT_CLIENT_CHANNEL_CHECK_FAIL_FAST = true;

/**
* The constant DEFAULT_BOSS_THREAD_PREFIX.
*/
String DEFAULT_BOSS_THREAD_PREFIX = "NettyBoss";
/**
* The constant DEFAULT_NIO_WORKER_THREAD_PREFIX.
*/
String DEFAULT_NIO_WORKER_THREAD_PREFIX = "NettyServerNIOWorker";
/**
* The constant DEFAULT_EXECUTOR_THREAD_PREFIX.
*/
String DEFAULT_EXECUTOR_THREAD_PREFIX = "NettyServerBizHandler";
/**
* The constant DEFAULT_PROTOCOL.
*/
String DEFAULT_PROTOCOL = "seata";

/**
* The constant DEFAULT_TRANSPORT_HEARTBEAT.
*/
boolean DEFAULT_TRANSPORT_HEARTBEAT = true;
/**
* The constant DEFAULT_TRANSACTION_UNDO_DATA_VALIDATION.
*/
boolean DEFAULT_TRANSACTION_UNDO_DATA_VALIDATION = true;
/**
* The constant DEFAULT_TRANSACTION_UNDO_LOG_SERIALIZATION.
*/
String DEFAULT_TRANSACTION_UNDO_LOG_SERIALIZATION = "jackson";
/**
* The constant DEFAULT_ONLY_CARE_UPDATE_COLUMNS.
*/
boolean DEFAULT_ONLY_CARE_UPDATE_COLUMNS = true;
/**
* The constant DEFAULT_TRANSACTION_UNDO_LOG_TABLE.
Expand All @@ -93,40 +197,97 @@ public interface DefaultValues {
*/
String DEFAULT_DISTRIBUTED_LOCK_DB_TABLE = "distributed_lock";

/**
* The constant DEFAULT_TM_COMMIT_RETRY_COUNT.
*/
int DEFAULT_TM_COMMIT_RETRY_COUNT = 5;
/**
* The constant DEFAULT_TM_ROLLBACK_RETRY_COUNT.
*/
int DEFAULT_TM_ROLLBACK_RETRY_COUNT = 5;
/**
* The constant DEFAULT_GLOBAL_TRANSACTION_TIMEOUT.
*/
int DEFAULT_GLOBAL_TRANSACTION_TIMEOUT = 60000;

/**
* The constant DEFAULT_TX_GROUP.
*/
String DEFAULT_TX_GROUP = "default_tx_group";
/**
* The constant DEFAULT_TX_GROUP_OLD.
*/
@Deprecated
String DEFAULT_TX_GROUP_OLD = "my_test_tx_group";
/**
* The constant DEFAULT_TC_CLUSTER.
*/
String DEFAULT_TC_CLUSTER = "default";
/**
* The constant DEFAULT_GROUPLIST.
*/
String DEFAULT_GROUPLIST = "127.0.0.1:8091";

/**
* The constant DEFAULT_DATA_SOURCE_PROXY_MODE.
*/
String DEFAULT_DATA_SOURCE_PROXY_MODE = "AT";

/**
* The constant DEFAULT_DISABLE_GLOBAL_TRANSACTION.
*/
boolean DEFAULT_DISABLE_GLOBAL_TRANSACTION = false;

/**
* The constant SERVICE_DEFAULT_PORT.
*/
//currently not use and will be delete in the next version
@Deprecated
int SERVICE_DEFAULT_PORT = 8091;

/**
* The constant SERVICE_OFFSET_SPRING_BOOT.
*/
int SERVICE_OFFSET_SPRING_BOOT = 1000;

/**
* The constant SERVER_PORT.
*/
String SERVER_PORT = "seata.server.port";

/**
* The constant SERVER_DEFAULT_STORE_MODE.
*/
String SERVER_DEFAULT_STORE_MODE = "file";

/**
* The constant DEFAULT_SAGA_JSON_PARSER.
*/
String DEFAULT_SAGA_JSON_PARSER = "fastjson";

/**
* The constant DEFAULT_TCC_BUSINESS_ACTION_CONTEXT_JSON_PARSER.
*/
// default tcc business action context json parser
String DEFAULT_TCC_BUSINESS_ACTION_CONTEXT_JSON_PARSER = "fastjson";

/**
* The constant DEFAULT_SERVER_ENABLE_CHECK_AUTH.
*/
boolean DEFAULT_SERVER_ENABLE_CHECK_AUTH = true;

/**
* The constant DEFAULT_LOAD_BALANCE.
*/
String DEFAULT_LOAD_BALANCE = "XID";
/**
* The constant VIRTUAL_NODES_DEFAULT.
*/
int VIRTUAL_NODES_DEFAULT = 10;

/**
* The constant DEFAULT_SEATA_GROUP.
*/
String DEFAULT_SEATA_GROUP = "default";

/**
Expand All @@ -144,7 +305,6 @@ public interface DefaultValues {
*/
String DEFAULT_CLIENT_UNDO_COMPRESS_THRESHOLD = "64k";


/**
* the constant DEFAULT_RETRY_DEAD_THRESHOLD
*/
Expand Down Expand Up @@ -283,9 +443,9 @@ public interface DefaultValues {
long DEFAULT_MAX_ROLLBACK_RETRY_TIMEOUT = -1L;

/**
* the const DEFAULT_ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE
* The constant DEFAULT_ROLLBACK_FAILED_UNLOCK_ENABLE.
*/
boolean DEFAULT_ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE = false;
boolean DEFAULT_ROLLBACK_FAILED_UNLOCK_ENABLE = false;

/**
* DEFAULT_DISTRIBUTED_LOCK_EXPIRE_TIME
Expand All @@ -297,22 +457,43 @@ public interface DefaultValues {
*/
boolean DEFAULT_ENABLE_BRANCH_ASYNC_REMOVE = false;

/**
* The constant DEFAULT_DB_MAX_CONN.
*/
int DEFAULT_DB_MAX_CONN = 100;

/**
* The constant DEFAULT_DB_MIN_CONN.
*/
int DEFAULT_DB_MIN_CONN = 10;

/**
* The constant DEFAULT_REDIS_MAX_IDLE.
*/
int DEFAULT_REDIS_MAX_IDLE = 100;

/**
* The constant DEFAULT_REDIS_MAX_TOTAL.
*/
int DEFAULT_REDIS_MAX_TOTAL = 100;

/**
* The constant DEFAULT_REDIS_MIN_IDLE.
*/
int DEFAULT_REDIS_MIN_IDLE = 10;

/**
* The constant DEFAULT_QUERY_LIMIT.
*/
int DEFAULT_QUERY_LIMIT = 1000;

/**
* Default druid location in classpath
*/
String DRUID_LOCATION = "lib/sqlparser/druid.jar";

/**
* The constant DEFAULT_ROCKET_MQ_MSG_TIMEOUT.
*/
int DEFAULT_ROCKET_MQ_MSG_TIMEOUT = 60 * 1000;
}
2 changes: 1 addition & 1 deletion script/config-center/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ server.recovery.rollbackingRetryPeriod=1000
server.recovery.timeoutRetryPeriod=1000
server.maxCommitRetryTimeout=-1
server.maxRollbackRetryTimeout=-1
server.rollbackRetryTimeoutUnlockEnable=false
server.rollbackFailedUnlockEnable=false
server.distributedLockExpireTime=10000
server.session.branchAsyncQueueSize=5000
server.session.enableBranchAsyncRemove=false
Expand Down
Loading
Loading