-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[Fix](merge-on-write) Should update pending delete bitmap KVs in MS when no need to calc delete bitmaps in publish phase #46039
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](merge-on-write) Should update pending delete bitmap KVs in MS when no need to calc delete bitmaps in publish phase #46039
Conversation
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
run buildall |
we need to add an additional filed to identify the owner of the pending delete bitmap |
TPC-H: Total hot run time: 32447 ms
|
TeamCity be ut coverage result: |
TPC-DS: Total hot run time: 190524 ms
|
ClickBench: Total hot run time: 31.56 s
|
2bb6847
to
c55511c
Compare
run buildall |
TeamCity be ut coverage result: |
TPC-H: Total hot run time: 32709 ms
|
TPC-DS: Total hot run time: 190186 ms
|
ClickBench: Total hot run time: 31.58 s
|
run buildall |
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
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
TPC-H: Total hot run time: 32722 ms
|
TPC-DS: Total hot run time: 190734 ms
|
ClickBench: Total hot run time: 31.31 s
|
TeamCity be ut coverage result: |
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
…hen no need to calc delete bitmaps in publish phase (apache#46039) consider the following situation: 1. Txn A acquires the lock, obtains version X to publish, calculates the delete bitmap, writes the pending delete bitmap KVs to the MS, but fails for some reason before committing the transaction in the MS. 2. Txn B acquires the lock, obtains version X to publish, **cleans up the pending delete bitmap KV written by Txn A**, calculates the delete bitmap, **writes its pending delete bitmap KV to the MS**, but also fails for some reason before committing the transaction in the MS. 3. Txn A then reacquires the lock, obtains version X to publish, and notices that neither the version nor the compaction counts have changed. It will skip the process of calculating the delete bitmap and writing the pending delete bitmap KV to the MS apache#39018 and eventually succeeds in committing the transaction in the MS. In this case, Txn A will save the wrong delete bitmaps(generated by Txn B) in MS and causing correctness problem. To solve the problem, we should still update delete bitmap KVs in MS when we skip the calculation of delete bitmap on BE in publish phase. Also add a defensive check: record `lock_id` when writing pending delete bitmap keys and check if the `lock_id` is correct when commit txn in MS.
…hen no need to calc delete bitmaps in publish phase (apache#46039) consider the following situation: 1. Txn A acquires the lock, obtains version X to publish, calculates the delete bitmap, writes the pending delete bitmap KVs to the MS, but fails for some reason before committing the transaction in the MS. 2. Txn B acquires the lock, obtains version X to publish, **cleans up the pending delete bitmap KV written by Txn A**, calculates the delete bitmap, **writes its pending delete bitmap KV to the MS**, but also fails for some reason before committing the transaction in the MS. 3. Txn A then reacquires the lock, obtains version X to publish, and notices that neither the version nor the compaction counts have changed. It will skip the process of calculating the delete bitmap and writing the pending delete bitmap KV to the MS apache#39018 and eventually succeeds in committing the transaction in the MS. In this case, Txn A will save the wrong delete bitmaps(generated by Txn B) in MS and causing correctness problem. To solve the problem, we should still update delete bitmap KVs in MS when we skip the calculation of delete bitmap on BE in publish phase. Also add a defensive check: record `lock_id` when writing pending delete bitmap keys and check if the `lock_id` is correct when commit txn in MS.
…it txn in MS (#46841) ### What problem does this PR solve? Related PR: #46039 Problem Summary: #46039 add a defensive check when commit_txn in MS to check whether the `lock_id` of pending delete bitmaps on tablets involved in the txn is the current txn's `lock_id`. But this may report a false negative in the following circumstance: 1. heavy schema change begins and add shadow index to table. 2. txn A load data to base index and shadow index. 3. txn A write its pending delete bitmaps on MS. This includes tablets of base index and shadow index. 4. txn A failed to remove its pending delete bitmaps for some reson(e.g. `commit_txn()` failed due to too large value) 5. txn B load data to base index and shadow index. 6. schema change failed for some reason and **remove shadow index on table.** 7. txn B send delete bitmap calculation task to BE. **Note that this will not involved tablets under shadow index because these tablets have been dropped.** **So these tablets' pending delete bitmaps will still be txn A's**. 8. txn B commit txn on MS and find that pending delete bitmaps' `lock_id` on tablets under shadow index not match. And txn B will failed. We can see that the checks on these dropped tablets are useless so we remove the mandatory check to avoid this false negative and print a warning log instead to help locate problems.
…it txn in MS (apache#46841) Related PR: apache#46039 Problem Summary: apache#46039 add a defensive check when commit_txn in MS to check whether the `lock_id` of pending delete bitmaps on tablets involved in the txn is the current txn's `lock_id`. But this may report a false negative in the following circumstance: 1. heavy schema change begins and add shadow index to table. 2. txn A load data to base index and shadow index. 3. txn A write its pending delete bitmaps on MS. This includes tablets of base index and shadow index. 4. txn A failed to remove its pending delete bitmaps for some reson(e.g. `commit_txn()` failed due to too large value) 5. txn B load data to base index and shadow index. 6. schema change failed for some reason and **remove shadow index on table.** 7. txn B send delete bitmap calculation task to BE. **Note that this will not involved tablets under shadow index because these tablets have been dropped.** **So these tablets' pending delete bitmaps will still be txn A's**. 8. txn B commit txn on MS and find that pending delete bitmaps' `lock_id` on tablets under shadow index not match. And txn B will failed. We can see that the checks on these dropped tablets are useless so we remove the mandatory check to avoid this false negative and print a warning log instead to help locate problems.
…_txn()` (apache#47136) Related PR: apache#46039 Problem Summary: apache#46039 introduce an defensive check when `commit_txn()`, but this may influence the commit process. This PR remove this check totally to eliminate this overhead.
…_txn()` (apache#47136) Related PR: apache#46039 Problem Summary: apache#46039 introduce an defensive check when `commit_txn()`, but this may influence the commit process. This PR remove this check totally to eliminate this overhead.
…hen no need to calc delete bitmaps in publish phase apache#46039 (apache#3722)
…_txn()` (apache#47136) ### What problem does this PR solve? Related PR: apache#46039 Problem Summary: apache#46039 introduce an defensive check when `commit_txn()`, but this may influence the commit process. This PR remove this check totally to eliminate this overhead.
What problem does this PR solve?
consider the following situation:
In this case, Txn A will save the wrong delete bitmaps(generated by Txn B) in MS and causing correctness problem.
To solve the problem, we should still update delete bitmap KVs in MS when we skip the calculation of delete bitmap on BE in publish phase.
Also add a defensive check: record
lock_id
when writing pending delete bitmap keys and check if thelock_id
is correct when commit txn in MS.Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)