tidb-dashboard icon indicating copy to clipboard operation
tidb-dashboard copied to clipboard

Keyviz: deleted table do not disappear

Open Fale opened this issue 3 years ago • 3 comments

Bug Report

What did you do?

  1. I created deleted 2 big tables in my DB (90~95% of DB size)
  2. Waited 1 day
  3. I went to Dashboard->Key visualizer

What did you expect to see? Only the existing table stats

What did you see instead? The existing table stats + stats for table_77 and table_177, which I assume are the two deleted tables, since in the same location/size there were the two deleted tables before I deleted them.

What version of TiDB Dashboard are you using (./tidb-dashboard --version)? I installed with tiup and I do not have tidb-dashboard. PD version: release-version=v5.2.0 edition=Community git-hash=8afd38d919ec727712a9518cc3ebdcab47b2fbcb git-branch=heads/refs/tags/v5.2.0 utc-build-time="2021-08-26 08:36:35"

Fale avatar Dec 26 '21 14:12 Fale

Is this by design, or is it undefined behavior? @breeswish

shhdgit avatar Dec 27 '21 03:12 shhdgit

Actually there was no table_77 or table_177 from the beginning. The root cause is that we are decoding the table name from StartKey. Since TiDB v5.x, the Region StartKey may not be a real table key.

This issue can be easily reproduced by importing TPC-H data with a TiFlash replica.

breezewish avatar Apr 01 '22 13:04 breezewish

I have found that there are three situations where this problem can occur:

  1. After the table is deleted and the dashboard is recovered, the table name map will be cleared. queries from the tidb schema will not contain the schema of the deleted table. middle_img_v2_20717eb2-d138-4765-89a0-cef5981e310g

  2. As @breeswish says, since TiDB v5.x, the Region StartKey may not be a real table key. So what is implied by StartKey now?

  3. The table name can't display within 1min of starting in keyviz.

shhdgit avatar Apr 12 '22 01:04 shhdgit