Skip to content

Delta data do not build the new added local indexes #9971

@Lloyd-Pottiger

Description

@Lloyd-Pottiger

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> create table t (a vector(3), b vector(4), vector index v_idx_a((VEC_COSINE_DISTANCE(a))) USING HNSW);
Query OK, 0 rows affected (0.03 sec)

mysql> insert into t values ("[1,1,1]", "[1,1,1,1]"), ("[2,2,2]", "[2,2,2,2]"), ("[3,3,3]", "[3,3,3,3]");
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> select * from information_schema.tiflash_indexes;
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| TIDB_DATABASE | TIDB_TABLE | TABLE_ID | COLUMN_NAME | INDEX_NAME | COLUMN_ID | INDEX_ID | INDEX_KIND | ROWS_STABLE_INDEXED | ROWS_STABLE_NOT_INDEXED | ROWS_DELTA_INDEXED | ROWS_DELTA_NOT_INDEXED | ERROR_MESSAGE | TIFLASH_INSTANCE |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| test          | t          |      112 | a           | v_idx_a    |         1 |        1 | Vector     |                   0 |                       0 |                  0 |                      3 |               | 127.0.0.1:3930   |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
1 row in set (0.01 sec)

mysql> select * from information_schema.tiflash_indexes;
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| TIDB_DATABASE | TIDB_TABLE | TABLE_ID | COLUMN_NAME | INDEX_NAME | COLUMN_ID | INDEX_ID | INDEX_KIND | ROWS_STABLE_INDEXED | ROWS_STABLE_NOT_INDEXED | ROWS_DELTA_INDEXED | ROWS_DELTA_NOT_INDEXED | ERROR_MESSAGE | TIFLASH_INSTANCE |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| test          | t          |      112 | a           | v_idx_a    |         1 |        1 | Vector     |                   0 |                       0 |                  0 |                      3 |               | 127.0.0.1:3930   |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
1 row in set (0.01 sec)

mysql> select * from information_schema.tiflash_indexes;
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| TIDB_DATABASE | TIDB_TABLE | TABLE_ID | COLUMN_NAME | INDEX_NAME | COLUMN_ID | INDEX_ID | INDEX_KIND | ROWS_STABLE_INDEXED | ROWS_STABLE_NOT_INDEXED | ROWS_DELTA_INDEXED | ROWS_DELTA_NOT_INDEXED | ERROR_MESSAGE | TIFLASH_INSTANCE |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| test          | t          |      112 | a           | v_idx_a    |         1 |        1 | Vector     |                   0 |                       0 |                  0 |                      3 |               | 127.0.0.1:3930   |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
1 row in set (0.01 sec)

mysql> insert into t select * from t;
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> insert into t select * from t;
Query OK, 6 rows affected (0.01 sec)
Records: 6  Duplicates: 0  Warnings: 0

mysql> insert into t select * from t;
Query OK, 12 rows affected (0.00 sec)
Records: 12  Duplicates: 0  Warnings: 0

mysql> insert into t select * from t;
Query OK, 24 rows affected (0.01 sec)
Records: 24  Duplicates: 0  Warnings: 0

mysql> insert into t select * from t;
Query OK, 48 rows affected (0.01 sec)
Records: 48  Duplicates: 0  Warnings: 0

mysql> insert into t select * from t;
Query OK, 96 rows affected (0.00 sec)
Records: 96  Duplicates: 0  Warnings: 0

mysql> select * from information_schema.tiflash_indexes;
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| TIDB_DATABASE | TIDB_TABLE | TABLE_ID | COLUMN_NAME | INDEX_NAME | COLUMN_ID | INDEX_ID | INDEX_KIND | ROWS_STABLE_INDEXED | ROWS_STABLE_NOT_INDEXED | ROWS_DELTA_INDEXED | ROWS_DELTA_NOT_INDEXED | ERROR_MESSAGE | TIFLASH_INSTANCE |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| test          | t          |      112 | a           | v_idx_a    |         1 |        1 | Vector     |                   0 |                       0 |                  0 |                    192 |               | 127.0.0.1:3930   |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
1 row in set (0.00 sec)

mysql> select * from information_schema.tiflash_indexes;
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| TIDB_DATABASE | TIDB_TABLE | TABLE_ID | COLUMN_NAME | INDEX_NAME | COLUMN_ID | INDEX_ID | INDEX_KIND | ROWS_STABLE_INDEXED | ROWS_STABLE_NOT_INDEXED | ROWS_DELTA_INDEXED | ROWS_DELTA_NOT_INDEXED | ERROR_MESSAGE | TIFLASH_INSTANCE |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| test          | t          |      112 | a           | v_idx_a    |         1 |        1 | Vector     |                   0 |                       0 |                  0 |                    192 |               | 127.0.0.1:3930   |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
1 row in set (0.01 sec)

mysql> insert into t select * from t;
Query OK, 192 rows affected (0.01 sec)
Records: 192  Duplicates: 0  Warnings: 0

mysql> insert into t select * from t;
Query OK, 384 rows affected (0.01 sec)
Records: 384  Duplicates: 0  Warnings: 0

mysql> select * from information_schema.tiflash_indexes;
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| TIDB_DATABASE | TIDB_TABLE | TABLE_ID | COLUMN_NAME | INDEX_NAME | COLUMN_ID | INDEX_ID | INDEX_KIND | ROWS_STABLE_INDEXED | ROWS_STABLE_NOT_INDEXED | ROWS_DELTA_INDEXED | ROWS_DELTA_NOT_INDEXED | ERROR_MESSAGE | TIFLASH_INSTANCE |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| test          | t          |      112 | a           | v_idx_a    |         1 |        1 | Vector     |                   0 |                       0 |                  0 |                    768 |               | 127.0.0.1:3930   |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
1 row in set (0.00 sec)

mysql> alter table t add vector index v_idx_b((VEC_COSINE_DISTANCE(b))) USING HNSW;
Query OK, 0 rows affected (0.09 sec)

mysql> select * from information_schema.tiflash_indexes;

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

+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| TIDB_DATABASE | TIDB_TABLE | TABLE_ID | COLUMN_NAME | INDEX_NAME | COLUMN_ID | INDEX_ID | INDEX_KIND | ROWS_STABLE_INDEXED | ROWS_STABLE_NOT_INDEXED | ROWS_DELTA_INDEXED | ROWS_DELTA_NOT_INDEXED | ERROR_MESSAGE | TIFLASH_INSTANCE |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| test          | t          |      112 | a           | v_idx_a    |         1 |        1 | Vector     |                   0 |                       0 |                768 |                      0 |               | 127.0.0.1:3930   |
| test          | t          |      112 | b           | v_idx_b    |         2 |        2 | Vector     |                   0 |                       0 |                768 |                     0 |               | 127.0.0.1:3930   |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
2 rows in set (0.00 sec)

3. What did you see instead (Required)

+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| TIDB_DATABASE | TIDB_TABLE | TABLE_ID | COLUMN_NAME | INDEX_NAME | COLUMN_ID | INDEX_ID | INDEX_KIND | ROWS_STABLE_INDEXED | ROWS_STABLE_NOT_INDEXED | ROWS_DELTA_INDEXED | ROWS_DELTA_NOT_INDEXED | ERROR_MESSAGE | TIFLASH_INSTANCE |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+
| test          | t          |      112 | a           | v_idx_a    |         1 |        1 | Vector     |                   0 |                       0 |                768 |                      0 |               | 127.0.0.1:3930   |
| test          | t          |      112 | b           | v_idx_b    |         2 |        2 | Vector     |                   0 |                       0 |                  0 |                    768 |               | 127.0.0.1:3930   |
+---------------+------------+----------+-------------+------------+-----------+----------+------------+---------------------+-------------------------+--------------------+------------------------+---------------+------------------+

4. What is your TiFlash version? (Required)

master

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions