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

Defend against data inconsistency and improve its troubleshooting #26833

Open
5 of 8 tasks
lysu opened this issue Aug 3, 2021 · 2 comments
Open
5 of 8 tasks

Defend against data inconsistency and improve its troubleshooting #26833

lysu opened this issue Aug 3, 2021 · 2 comments
Assignees
Labels
sig/transaction SIG:Transaction type/enhancement The issue or PR belongs to an enhancement. type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@lysu
Copy link
Contributor

lysu commented Aug 3, 2021

Description

Currently, some new features may introduce data inconsistency bugs, and we only can find them after admin check or indexLookup, following DML maybe write more inconsistent data after reading old inconsistent records, it's better to have a mechanism to report the inconsistent bug before laid down data.

On the other hand, it's also hard for customers/supporters to troubleshoot data inconsistency problems. we often need multiple rounds of communication with customers to collect information, and even worse, sometimes we cannot identify the root cause due to lack of some useful information.

This issue tracks our progress in defending against data inconsistency and improve its troubleshooting.

Sub Tasks

Task 1: Defending against data inconsistency

Development

1) Assertion in Prewrite Mutation
2) Check Mutation for single row changes

Test

  • Ensure it can report the error when there is something wrong
    • Inject the old bug in the previous issue to see whether it can report errors like desired
  • Ensure it doesn't misreport where everything is ok
    • Write unit test to ensure code snippet, add test hook to support check mutation value in test
    • Retest exists write path test case
    • Add more multiple stmt in one txn test case + check mutation by hook
  • Ensure it doesn't have performance regression
    • Sysbench/TPCC to ensure small txn doesn't have regression
    • BigTxn test case to ensure memory cause doesn't increase a lot (+1 Byte per key)

Task 2: Improve data inconsistency troubleshooting

1) Improve consistent check fail error & log

Development
  • executor: enhance data inconsistency report #27388
    • Unify different check fail reporter, ensure error message contain necessary info like db/table/index (optional readable row identifier)
    • Request MVCC info for unmatched record and index and dump them in log
Test
  • Check can be added in Task1's test case to ensure error messages or logs have enough information

2) Improve MVCC fetch API

Task 3: Enhance data inconsistency recover

  • Support recover a region in tables
  • Speed up admin recover
@tisonkun
Copy link
Contributor

Hi @lysu , is there a design document for this effort or an issue to create a design?

Also it looks like a lot of work to do, would you like to take a look at developing in a feature branch?

@ekexium
Copy link
Contributor

ekexium commented Aug 28, 2021

There is a design doc but is internal and in Chinese.

We are trying to develop at a separate feature branch pingcap:ft-data-inconsistency.

MyonKeminta added a commit to MyonKeminta/tidb that referenced this issue Nov 18, 2021
MyonKeminta added a commit to MyonKeminta/tikv that referenced this issue Nov 30, 2021
ti-chi-bot added a commit to tikv/tikv that referenced this issue Dec 9, 2021
… lock requests (#11516)

* Support check existence without getting value during pessimistic lock requests

ref pingcap/tidb#26833

Signed-off-by: MyonKeminta <[email protected]>

* Address comments and add test

Signed-off-by: MyonKeminta <[email protected]>

* Add comments to PessimisticLockRes

Signed-off-by: MyonKeminta <[email protected]>

* update kvproto

Signed-off-by: MyonKeminta <[email protected]>

* ref #11542

Signed-off-by: MyonKeminta <[email protected]>

Co-authored-by: MyonKeminta <[email protected]>
Co-authored-by: Ti Chi Robot <[email protected]>
ekexium pushed a commit that referenced this issue Dec 9, 2021
* Pick unistore changes from #28313, ref #26833

* fix build

Co-authored-by: MyonKeminta <[email protected]>
5kbpers pushed a commit to 5kbpers/tikv that referenced this issue Dec 13, 2021
… lock requests (tikv#11516)

* Support check existence without getting value during pessimistic lock requests

ref pingcap/tidb#26833

Signed-off-by: MyonKeminta <[email protected]>

* Address comments and add test

Signed-off-by: MyonKeminta <[email protected]>

* Add comments to PessimisticLockRes

Signed-off-by: MyonKeminta <[email protected]>

* update kvproto

Signed-off-by: MyonKeminta <[email protected]>

* ref tikv#11542

Signed-off-by: MyonKeminta <[email protected]>

Co-authored-by: MyonKeminta <[email protected]>
Co-authored-by: Ti Chi Robot <[email protected]>
ti-chi-bot pushed a commit that referenced this issue Feb 11, 2022
YuJuncen pushed a commit to pingcap/br that referenced this issue Mar 1, 2022
@ekexium ekexium added the type/enhancement The issue or PR belongs to an enhancement. label Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/transaction SIG:Transaction type/enhancement The issue or PR belongs to an enhancement. type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

4 participants