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

rollback(savepoint) in AbstractConnectionProxy work unexpected #3223

Closed
1 task
caohdgege opened this issue Oct 26, 2020 · 8 comments · Fixed by #3413
Closed
1 task

rollback(savepoint) in AbstractConnectionProxy work unexpected #3223

caohdgege opened this issue Oct 26, 2020 · 8 comments · Fixed by #3413
Assignees
Labels
task: help-wanted Extra attention is needed

Comments

@caohdgege
Copy link
Contributor

caohdgege commented Oct 26, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

rollback(savepoint) in AbstractConnectionProxy should not only call targetConnection.rollback(savepoint), but also need to delete the lockKeysBuffer and sqlUndoItemsBuffer of this savepoint life cycle.
If you want to fix it, please comment "Please assign it to me" in this issue.

rollback(savepoint) 除了要执行targetConnection.rollback(savepoint),还要删除这个savepoint期间对应的lockKeysBuffer和sqlUndoItemsBuffer。
如果有靓仔靓女想要帮忙修复这个的话,请留言 "Please assign it to me"

Ⅱ. Describe what happened

image

Ⅲ. Describe what you expected to happen

能够正常删除这个savepoint期间对应的lockKeysBuffer和sqlUndoItemsBuffer
或者明确抛出异常说明不支持 savepoint

@l81893521 l81893521 added the task: help-wanted Extra attention is needed label Oct 26, 2020
@caohdgege caohdgege changed the title AbstractConnectionProxy的rollback(savepoint)处理不正常 rollback(savepoint) in AbstractConnectionProxy work unexpected Oct 26, 2020
@neighbor-uncleWang
Copy link

My plan:Get the connection context of the dataSourceProxy and clear the cache directly from the context as shown in the figure.I'm not sure if I'm doing it right, please give me an idea of implementation.
我的计划:获得dataSourceProxy的ConnectionContext,然后直接清空ConnectionContext中的缓存,做法如图。我不敢确定我的做法是否正确,请给我一个实现思想。
SZBOIR$JTY@HL3KW {8(BD4

@neighbor-uncleWang
Copy link

Please assign it to me

@caohdgege
Copy link
Contributor Author

图裂了,能不能直接贴一下文字版?(最近github上面的图片都看不了。。。。)

@neighbor-uncleWang
Copy link

这个写法
@OverRide
public void rollback(Savepoint savepoint) throws SQLException {
targetConnection.rollback(savepoint);
try {
ConnectionContext connectionContext = dataSourceProxy.getConnection().getContext();
//Clear the cache
connectionContext.getUndoItems().clear();
connectionContext.getLockKeysBuffer().clear();
}catch (Exception e){
throw new UnsupportedOperationException("failed to empty sqlUndoItemsBuffer and lockKeysBuffer,does not support Savepoint."+e.getMessage());
}
}

@caohdgege
Copy link
Contributor Author

不能这样删,你这样就相当于删除了整个分支事务的undo_item和lock_key_buffer了。
我的思路是要记录undo_item和lock_key_buffer对应的是哪个分支事务,然后rollback(savepoint)的时候把这些clear,如果是releaseSavepoint(savepoint)的时候,把后面的savepoint对应的undo_item和lock_key_buffer挪到上一个savepoint上。

@neighbor-uncleWang
Copy link

好的,了解

@neighbor-uncleWang
Copy link

抱歉,到年底了,开发工作繁重,没有时间完成这个issues。

@caohdgege
Copy link
Contributor Author

抱歉,到年底了,开发工作繁重,没有时间完成这个issues。

OK,那我处理一下这个。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task: help-wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants