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

Some regions still in flashback state after flashback cluster done #44292

Closed
seiya-annie opened this issue May 31, 2023 · 3 comments · Fixed by tikv/tikv#14859
Closed

Some regions still in flashback state after flashback cluster done #44292

seiya-annie opened this issue May 31, 2023 · 3 comments · Fixed by tikv/tikv#14859
Assignees
Labels

Comments

@seiya-annie
Copy link

seiya-annie commented May 31, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

HA test for multi-valued index
loop inject pd-latency/tikv-latency/pd-timeoff failure during following steps:
1.add multi-valued index in table
2.flashback to the time before add index

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

add index successfully
flashback successfully

3. What did you see instead (Required)

report tidb status abnormal during tikv-latency case:
in log we found:

[2023/05/30 18:48:12.466 +00:00] [INFO] [ddl_worker.go:601] ["[ddl] finish DDL job"] [worker="worker 3, tp general"] [job="ID:297, Type:drop index, State:synced, SchemaState:none, SchemaID:91, TableID:242, RowCount:0, ArgLen:4, start time: 2023-05-30 18:48:12.147 +0000 UTC, Err:<nil>, ErrCount:0, SnapshotVersion:0"]
[2023/05/30 18:48:12.645 +00:00] [INFO] [handle.go:1411] ["[stats] incrementally update modifyCount"] [tableID=243] [curModifyCnt=0] [results.BaseModifyCnt=0] [modifyCount=0]
[2023/05/30 18:48:12.645 +00:00] [INFO] [handle.go:1433] ["[stats] directly update count"] [tableID=243] [results.Count=1000000] [count=1000000]
[2023/05/30 18:48:12.650 +00:00] [WARN] [session.go:2239] ["run statement failed"] [schemaVersion=233] [error="region 94 is in flashback progress, FlashbackStartTS is 441836495043821576"] [session="{\n  \"currDBName\": \"\",\n  \"id\": 0,\n  \"status\": 3,\n  \"strictMode\": true,\n  \"txn\": \"441836501099347969\",\n  \"user\": null\n}"]
[2023/05/30 18:48:12.650 +00:00] [ERROR] [analyze.go:322] ["save table stats to storage failed"] [error="region 94 is in flashback progress, FlashbackStartTS is 441836495043821576"] [tableID=243]
[2023/05/30 18:48:12.653 +00:00] [INFO] [analyze.go:590] ["analyze table `test`.`user_data1` has failed"] [partition=] ["job info"="auto analyze table all columns with 256 buckets, 500 topn, 0.11 samplerate"] ["start time"=2023/05/30 18:48:10.259 +00:00] ["end time"=2023/05/30 18:48:12.650 +00:00] [cost=2.391293318s]
[2023/05/30 18:48:12.653 +00:00] [INFO] [tidb.go:285] ["rollbackTxn called due to ddl/autocommit failure"]
[2023/05/30 18:48:12.653 +00:00] [WARN] [session.go:2239] ["run statement failed"] [schemaVersion=226] [error="region 94 is in flashback progress, FlashbackStartTS is 441836495043821576"] [session="{\n  \"currDBName\": \"\",\n  \"id\": 622910720530448387,\n  \"status\": 2,\n  \"strictMode\": true,\n  \"user\": null\n}"]
[2023/05/30 18:48:12.653 +00:00] [ERROR] [update.go:1307] ["[stats] auto analyze failed"] [sql="analyze table `test`.`user_data1` index `j2`"] [cost_time=2.415044361s] [error="region 94 is in flashback progress, FlashbackStartTS is 441836495043821576"]
[2023/05/30 18:48:12.655 +00:00] [INFO] [domain.go:2023] ["HistoricalStatsWorker exited."]
[2023/05/30 18:48:12.655 +00:00] [INFO] [wait_group_wrapper.go:137] ["background process exited"] [source=domain] [process=HistoricalStatsWorker]
[2023/05/30 18:48:14.546 +00:00] [INFO] [cpuprofile.go:113] ["parallel cpu profiler started"]
[2023/05/30 18:48:14.546 +00:00] [INFO] [sem.go:78] ["tidb-server is operating with security enhanced mode (SEM) enabled"]
[2023/05/30 18:48:14.546 +00:00] [INFO] [printer.go:48] ["Welcome to TiDB."] ["Release Version"=v7.1.0] [Edition=Community] ["Git Commit Hash"=635a4362235e8a3c0043542e629532e3c7bb2756] ["Git Branch"=heads/refs/tags/v7.1.0] ["UTC Build Time"="2023-05-30 10:58:57"] [GoVersion=go1.20.3] ["Race Enabled"=false] ["Check Table Before Drop"=false] ["TiKV Min Version"=6.2.0-alpha]

4. What is your TiDB version? (Required)

v7.1.0

@seiya-annie seiya-annie added the type/bug The issue is confirmed as a bug. label May 31, 2023
@seiya-annie
Copy link
Author

@seiya-annie seiya-annie changed the title tidb restarted after flashback tidb may restarted or has data inconsistency after flashback May 31, 2023
@Defined2014 Defined2014 changed the title tidb may restarted or has data inconsistency after flashback Some regions still in flashback state after flashback cluster done May 31, 2023
@Defined2014
Copy link
Contributor

Defined2014 commented May 31, 2023

After flashback cluster, some regions still in flashback state. Because TiKV receives a FlashbackCmd before FlashbackPrepare completes and returns a not prepare error to TiDB, TiDB will ignore it for some expected reasons.

tidb/ddl/cluster.go

Lines 555 to 557 in 3a489e4

if err.Error() != fmt.Sprintf("region %d is not prepared for the flashback", loc.Region.GetID()) {
return taskStat, err
}

TiKV should not return before FlashbackPrepare is actually executed.

@ti-chi-bot ti-chi-bot bot added may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels May 31, 2023
@Defined2014 Defined2014 removed may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels May 31, 2023
ti-chi-bot bot pushed a commit to tikv/tikv that referenced this issue Jun 1, 2023
…4859)

ref #13303, close pingcap/tidb#44292

During the Flashback process, we should prevent any read or write operations on the in-memory pessimistic lock table
and clear it like rolling back other locks to ensure that Flashback can proceed smoothly.

Signed-off-by: JmPotato <ghzpotato@gmail.com>
ti-chi-bot pushed a commit to ti-chi-bot/tikv that referenced this issue Jun 1, 2023
ref tikv#13303, close pingcap/tidb#44292

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/tikv that referenced this issue Jun 1, 2023
ref tikv#13303, close pingcap/tidb#44292

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

fixed by tikv/tikv#14859

ti-chi-bot bot pushed a commit to tikv/tikv that referenced this issue Jun 5, 2023
…4859) (#14861)

ref #13303, ref #14859, close pingcap/tidb#44292

During the Flashback process, we should prevent any read or write operations on the in-memory pessimistic lock table
and clear it like rolling back other locks to ensure that Flashback can proceed smoothly.

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

Co-authored-by: JmPotato <ghzpotato@gmail.com>
ti-chi-bot bot pushed a commit to tikv/tikv that referenced this issue Jun 16, 2023
…4859) (#14862)

ref #13303, ref #14859, close pingcap/tidb#44292

During the Flashback process, we should prevent any read or write operations on the in-memory pessimistic lock table
and clear it like rolling back other locks to ensure that Flashback can proceed smoothly.

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

Co-authored-by: JmPotato <ghzpotato@gmail.com>
tonyxuqqi pushed a commit to tonyxuqqi/tikv that referenced this issue Jun 22, 2023
…kv#14859)

ref tikv#13303, close pingcap/tidb#44292

During the Flashback process, we should prevent any read or write operations on the in-memory pessimistic lock table
and clear it like rolling back other locks to ensure that Flashback can proceed smoothly.

Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: tonyxuqqi <tonyxuqi@outlook.com>
ti-chi-bot bot pushed a commit to tikv/tikv that referenced this issue Jul 4, 2023
…14986)

ref #13303, ref pingcap/tidb#44292

Make `test_flashback_with_in_memory_pessimistic_locks` stable.

Signed-off-by: JmPotato <ghzpotato@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants