ddl: Fix adding vector index on empty table may blocked forever#9470
Conversation
| || (managed_storage->engineType() != ::TiDB::StorageEngine::DT | ||
| && managed_storage->engineType() != ::TiDB::StorageEngine::TMT)) | ||
| { | ||
| LOG_DEBUG(log, "{}.{} is not ManageableStorage", database_name, table_name); |
There was a problem hiding this comment.
Running queries on the system table will trigger this logging, which is verbose but not provide any information. Remove it.
|
Why not just insert a row even when store is not init? |
|
Not sure whether this idea is ok, we may also regard progress=1 and missing table in tiflash_indexes as index build is finished, because progress=1 already means TiFlash is aware of this table, and then no entry in tiflash_indexes means exactly this case? |
@breezewish No, we can not tell the difference between these two cases
|
|
@Lloyd-Pottiger tiflash/dbms/src/Storages/System/StorageSystemDTLocalIndexes.cpp Lines 91 to 98 in 1a781c7 |
The index info can get from table info, and the rows indexed is 0. |
2337578 to
2b98e1f
Compare
b60ba2a to
62b868d
Compare
6f3a586 to
aa597a9
Compare
aa597a9 to
56546e4
Compare
|
/retest |
56546e4 to
679765d
Compare
|
@Lloyd-Pottiger @JinheLin PTAL |
|
Need to update description. |
Updated |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JinheLin, Lloyd-Pottiger The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
Issue Number: ref #9032
Problem Summary:
When creating vector index on empty table, the DDL may be blocked forever.
This is because when an empty table is synced to TiFlash, the
StorageDeltaMergeis created without initializing theDeltaMergeStoreinstance. This is to avoid generating too many fragmented, small files that exhaust the filesystem inode.However, if the
DeltaMergeStoreinstance is not created, thensystem.dt_local_indexwill not get the local index stats. Which make tidb consider the vector index is still under building and the ddl does not end.tiflash/dbms/src/Storages/System/StorageSystemDTLocalIndexes.cpp
Lines 88 to 94 in 1a781c7
What is changed and how it works?
StorageDeltaMergeis created butDeltaMergeStoreis not inited, then generate the local index info by the TiDB::TableInfoSmall refactor:
Check List
Tests
Side effects
Documentation
Release note