Skip to content

Stats loaded from json file have wrong status #42931

@xuyifangreeneyes

Description

@xuyifangreeneyes

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Start a v4.0.15 cluster

use test;
create table t(a int, b int);
-- insert some rows and wait for stats delta dump

Get stats json file test_t_stats.json through http api.

{
 "database_name": "test",
 "table_name": "t",
 "columns": {
  "a": {
   "histogram": {
    "ndv": 0
   },
   "cm_sketch": null,
   "null_count": 0,
   "tot_col_size": 256,
   "last_update_version": 440718415728738305,
   "correlation": 0
  },
  "b": {
   "histogram": {
    "ndv": 0
   },
   "cm_sketch": null,
   "null_count": 0,
   "tot_col_size": 256,
   "last_update_version": 440718415728738305,
   "correlation": 0
  }
 },
 "indices": {},
 "count": 256,
 "modify_count": 256,
 "partitions": null
}

Start a v6.5.1 cluster

mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> load stats 'test_t_stats.json';
Query OK, 0 rows affected (0.36 sec)

mysql> show stats_meta;
+---------+------------+----------------+---------------------+--------------+-----------+
| Db_name | Table_name | Partition_name | Update_time         | Modify_count | Row_count |
+---------+------------+----------------+---------------------+--------------+-----------+
| test    | t          |                | 2023-04-11 18:11:23 |          256 |       256 |
+---------+------------+----------------+---------------------+--------------+-----------+
1 row in set (0.10 sec)

mysql> show stats_histograms;
+---------+------------+----------------+-------------+----------+---------------------+----------------+------------+--------------+-------------+-------------+-----------------+----------------+----------------+---------------+
| Db_name | Table_name | Partition_name | Column_name | Is_index | Update_time         | Distinct_count | Null_count | Avg_col_size | Correlation | Load_status | Total_mem_usage | Hist_mem_usage | Topn_mem_usage | Cms_mem_usage |
+---------+------------+----------------+-------------+----------+---------------------+----------------+------------+--------------+-------------+-------------+-----------------+----------------+----------------+---------------+
| test    | t          |                | a           |        0 | 2023-04-11 18:11:22 |              0 |          0 |            1 |           0 | allEvicted  |               0 |              0 |              0 |             0 |
| test    | t          |                | b           |        0 | 2023-04-11 18:11:23 |              0 |          0 |            1 |           0 | allEvicted  |               0 |              0 |              0 |             0 |
+---------+------------+----------------+-------------+----------+---------------------+----------------+------------+--------------+-------------+-------------+-----------------+----------------+----------------+---------------+
2 rows in set (0.00 sec)

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

Since no stats are collected, columns a and b should not appear in show stats_histograms.

3. What did you see instead (Required)

Since no stats are collected, columns a and b appear in show stats_histograms and their status is allEvicted.

4. What is your TiDB version? (Required)

v6.5.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions