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

TiFlash result is not correct in consistency test #8845

Closed
lilinghai opened this issue Mar 14, 2024 · 5 comments · Fixed by #9000
Closed

TiFlash result is not correct in consistency test #8845

lilinghai opened this issue Mar 14, 2024 · 5 comments · Fixed by #9000

Comments

@lilinghai
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

insert with currency 5 and diff result tikv with tiflash

[2024/03/11 12:08:54.808 +08:00] [INFO] [verify.go:163] ["verify successfully"] [tikv="[35771550]"] [tiflash="[35771550]"] [tag=]
[2024/03/11 12:08:54.854 +08:00] [ERROR] [consistency_test.go:666] ["check consistence error"] ["db name"=db12] [sql="select count(*) from other_handle7"] [realSql="select /*+ ignore_index(other_handle7,PRIMARY) */  count(*) from other_handle7"] [
"prev succ"=3143] [error="result inconsistent tso 448300353380155718, difference: row number: 1, row1: 35068980, row2: 35068960, tikv: [35068980], tiflash [35068960]"] [stack="github.com/pingcap/endless/testcase/tiflash/consistency_test.checkConsi
stency.func1\n\t/home/jenkins/agent/workspace/endless-master-build/testcase/tiflash/consistency/consistency_test.go:666\ngithub.com/pingcap/endless/pkg/util.WithGinkgoRecover.func1\n\t/go/pkg/mod/github.com/pingcap/endless@v0.0.0-20240306021835-65
047c8b63a1/pkg/util/fastfail.go:18\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/go/pkg/mod/golang.org/x/sync@v0.2.0/errgroup/errgroup.go:75"]

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. What is your TiFlash version? (Required)

master

@CalvinNeo
Copy link
Member

CalvinNeo commented Apr 22, 2024

Maybe due to #3971 of reusing history read index results of the same region.
This is because if two txns are not visible to each other, the order of there commit record may not correspond to their start_ts. That means the following may happen, given start_ts1 < start_ts2 < commit_ts1 < commit_ts2

index 10: Put Write CF commit_ts2
index 11: Put Write CF commit_ts1

The TiFlash's SOTA strategy is when handled a read index of tso commit_ts2, the following read index of commit_ts1 will reuse the result of 10 rather than 11, which is wrong.
If so, it affects releases starting from 6.0.

@JaySon-Huang
Copy link
Contributor

JaySon-Huang commented Apr 29, 2024

All versions before v8.1 are affected.

Abstracted reproduce steps:

  • Thread A write some rows, naming batch_1. Then acquire a segment snapshot snap_a
  • Thread C write some rows, naming batch_2, with exactly the same row_ids and version with the batch_1
  • Thread B acquires a segment snapshot snap_b
  • Thread B get executed before thread A and update the shared-delta-index of the segment
    • However, when thread B update the shared-delta-index, the rows in batch_1 get deleted
  • Thread A continue the read and reuse the shared-delta-index, but it can not read the rows in batch_1 because the rows are deleted from shared-delta-index

This issue can automatically disappear in the following reads. Because following read will use a more advance delta-index with the delta covering the duplicated rows.

ti-chi-bot bot pushed a commit that referenced this issue Apr 30, 2024
ti-chi-bot bot pushed a commit that referenced this issue May 29, 2024
…9000) (#9016)

close #8845

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

Co-authored-by: jinhelin <linjinhe33@gmail.com>
ti-chi-bot bot added a commit that referenced this issue May 29, 2024
…9000) (#9017)

close #8845

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

Co-authored-by: jinhelin <linjinhe33@gmail.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment