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
Labels
affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-6.6 affects-7.0 affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.2 affects-7.3 affects-7.4 affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.0 affects-8.1 This bug affects the 8.1.x(LTS) versions. component/storage severity/critical type/bug The issue is confirmed as a bug.

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/[email protected]
047c8b63a1/pkg/util/fastfail.go:18\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/go/pkg/mod/golang.org/x/[email protected]/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

@lilinghai lilinghai added the type/bug The issue is confirmed as a bug. label Mar 14, 2024
@JaySon-Huang JaySon-Huang changed the title TiFlash result if not correct in consistency test TiFlash result is not correct in consistency test Mar 15, 2024
@ti-chi-bot ti-chi-bot added the affects-8.1 This bug affects the 8.1.x(LTS) versions. label Apr 9, 2024
@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.

@CalvinNeo CalvinNeo added affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. and removed may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 labels Apr 23, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 23, 2024
@JaySon-Huang JaySon-Huang added affects-7.0 affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.2 affects-7.3 affects-7.4 affects-7.5 This bug affects the 7.5.x(LTS) versions. labels Apr 29, 2024
@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
ti-chi-bot bot added a commit that referenced this issue May 29, 2024
…9000) (#9017)

close #8845

Signed-off-by: ti-chi-bot <[email protected]>

Co-authored-by: jinhelin <[email protected]>
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
Labels
affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-6.6 affects-7.0 affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.2 affects-7.3 affects-7.4 affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.0 affects-8.1 This bug affects the 8.1.x(LTS) versions. component/storage severity/critical type/bug The issue is confirmed as a bug.
Projects
None yet
5 participants