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

perf: optimize the performance of XA transactions #554

Merged
merged 3 commits into from May 14, 2023

Conversation

iSuperCoder
Copy link
Contributor

What this PR does:

取消了每次执行XA事务时查询数据库版本的操作,把版本查询放在了getOpenConnectorProxy过程中,只需要查一次即可。

Which issue(s) this PR fixes:
Fixes #553

There is no need to query the database version every time an xa transaction is executed.
Just query it once in getOpenConnectorProxy of seataDriver.
@codecov-commenter
Copy link

codecov-commenter commented May 11, 2023

Codecov Report

Merging #554 (37e97d8) into master (d62b776) will increase coverage by 0.35%.
The diff coverage is 69.23%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master     #554      +/-   ##
==========================================
+ Coverage   36.64%   36.99%   +0.35%     
==========================================
  Files         160      160              
  Lines       11138    11154      +16     
==========================================
+ Hits         4081     4126      +45     
+ Misses       6710     6681      -29     
  Partials      347      347              
Impacted Files Coverage Δ
pkg/datasource/sql/connector.go 85.71% <ø> (+21.00%) ⬆️
pkg/rm/tcc/fence/fence_driver_tx.go 0.00% <ø> (ø)
pkg/datasource/sql/driver.go 69.71% <61.90%> (+3.38%) ⬆️
pkg/datasource/sql/db.go 52.03% <100.00%> (+7.78%) ⬆️

... and 1 file with indirect coverage changes

@iSuperCoder
Copy link
Contributor Author

11

使用QueryContext在sample中测试select for update,加上def rows.Close()就没有busy buffer,去掉defer rows.Close就必现busy buffer异常。使用ExecContext测试没有这个问题。
我目前还没有定位到根本原因,可以继续看看,如果确实存在未解决的bug,可以考虑在新的PR中解决。当前PR仅优化数据库版本查询导致的XA事务耗时增加。

…Resource

Compatible with two types of driver.Conn that implement either the Queryer or QueryerContext interface.
@luky116 luky116 merged commit 8e89c54 into apache:master May 14, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

每次执行XA事务都查询数据库版本会增加事务执行的延迟
4 participants