-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
*: fix lost index bug of insert on duplicate key update #16672
Conversation
Signed-off-by: crazycs <crazycs520@gmail.com>
Signed-off-by: crazycs <crazycs520@gmail.com>
Signed-off-by: crazycs <crazycs520@gmail.com>
table/tables/index.go
Outdated
@@ -293,7 +293,11 @@ func (c *index) Create(sctx sessionctx.Context, rm kv.RetrieverMutator, indexedV | |||
// If the index kv was untouched(unchanged), and the key/value already exists in mem-buffer, | |||
// should not overwrite the key with un-commit flag. | |||
// So if the key exists, just do nothing and return. | |||
_, err = txn.GetMemBuffer().Get(ctx, key) | |||
if memTxn, ok := txn.(kv.MemBufferRetriever); ok { | |||
_, err = memTxn.GetFromMemBuffer(ctx, key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to change TxnState.GetMembuffer implementation, so we will not misuse it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buffer level is too complex to get things right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great
/rebuild |
Signed-off-by: crazycs <crazycs520@gmail.com>
/run-all-test |
Signed-off-by: crazycs <crazycs520@gmail.com>
/run-all-tests |
Codecov Report
@@ Coverage Diff @@
## master #16672 +/- ##
===========================================
Coverage 80.4305% 80.4305%
===========================================
Files 506 506
Lines 136958 136958
===========================================
Hits 110156 110156
Misses 18219 18219
Partials 8583 8583 |
/rebuild |
LGTM |
/run-unit-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PTAL @tiancaiamao |
LGTM |
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
@crazycs520 merge failed. |
Data Race case in test:
|
/run-unit-test |
2 similar comments
/run-unit-test |
/run-unit-test |
cherry-pick #16672 for this hotfix
Signed-off-by: sre-bot <sre-bot@pingcap.com>
cherry pick to release-3.0 in PR #16687 |
Signed-off-by: sre-bot <sre-bot@pingcap.com>
cherry pick to release-3.1 in PR #16688 |
Fix issue pingcap#16669 When check the untouched index, we should also check the memory-buffer in the session too.
cherry pick to release-4.0 in PR #16689 |
Fix issue pingcap#16669 When check the untouched index, we should also check the memory-buffer in the session too.
Fix issue pingcap#16669 When check the untouched index, we should also check the memory-buffer in the session too.
Fix issue pingcap#16669 When check the untouched index, we should also check the memory-buffer in the session too.
Signed-off-by: crazycs crazycs520@gmail.com
What problem does this PR solve?
Fix issue #16669
What is changed and how it works?
When check the untouched index, should also check the
memory-buffer
in the session too.Related changes
Check List
Tests
Side effects
Release note