pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.2k stars 5.84k forks source link

all tables has been finished flashback, but ddl command can't finished #38527

Closed seiya-annie closed 2 years ago

seiya-annie commented 2 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. 2tidb,3pd,4*tikv
  2. run update workload for 1hour, then execute flashback
  3. during flashback, run new transaction

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

in the finished flashback region, the transaction can executed successfully in the unfinished region, the transaction will fail flashback DDL can execute successfully

3. What did you see instead (Required)

ddl command hang

4. What is your TiDB version? (Required)

Release Version: v6.3.0-alpha-435-g5e9db0857-dirty Edition: Community Git Commit Hash: 5e9db08577ba04f54f0eed1e947244ab7a19d401 Git Branch: flashback-2-phase UTC Build Time: 2022-10-14 12:22:45 GoVersion: go1.19 Race Enabled: false TiKV Min Version: 6.2.0-alpha Check Table Before Drop: false Store: unistore [root@localhost ~]# /home/tidb/tidb-deploy/tikv-2360/bin/tikv-server -V TiKV Release Version: 6.4.0-alpha Edition: Community Git Commit Hash: 5f978e518901cb92affaa6d2a64b776e3943a27b Git Commit Branch: flashback_2pc UTC Build Time: 2022-10-12 11:50:41 Rust Version: rustc 1.64.0-nightly (0f4bcadb4 2022-07-30) Enable Features: pprof-fp jemalloc mem-profiling portable sse test-engine-kv-rocksdb test-engine-raft-raft-engine cloud-aws cloud-gcp cloud-azure Profile: release [root@localhost ~]#

base nightly version; v6.4.0-alpha-nightly-20221016

Defined2014 commented 2 years ago

The root reason is TiKV didn't check epoch before execute prepareFlashbackToVersion and flashbackToVersion. It's fixed by TiKV already, so close this.