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

txn: add newly inserted flag for memdb key node #369

Closed
wants to merge 1 commit into from

Conversation

cfzjywxk
Copy link
Contributor

@cfzjywxk cfzjywxk commented Nov 8, 2021

Signed-off-by: cfzjywxk lsswxrxr@163.com

Solution for pingcap/tidb#27564.

Add a new flag for key in memdb, when the key node is allocated by a PUT operation, add this flag to the key. This mark is used to identify the inserted keys generated from the transaction iteself, so that the delete operations on these keys could be skipped committing this transaction, see the comments for details in the issue. There are mainly two situations:

  • The key node is newly generated and it has value length greater than 0. This means the node is generated by a insert statement, the existency check mechanism will ensure the key dose not exist in storage.
  • The key node is set by a PUT opertion and it existing node in memdb is a node generated by LOCK. This means the insert is done followed a select for update.

This change could be risky, need to think it over.

Signed-off-by: cfzjywxk <lsswxrxr@163.com>
@cfzjywxk
Copy link
Contributor Author

cfzjywxk commented Nov 8, 2021

@MyonKeminta @you06 @longfangsong
PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant