ERROR 1105 (HY000): [FLASH:Coprocessor:Internal] number of enum overflow enum boundary

We have configured TiFlash with one node 32 GB RAM on PoC environment.
Version is 5.7.25-TiDB-v7.1.1
We have around 3L data in the table tbl_merchant
There are around 5 columns having in this table along with other data. There is a column with MERCHANT_TYPE (‘AQ’,‘AC’) having data count AQ = 28999, AC = 266609

Mentioned error is thrown, whenever we are using above mentioed column in the SELECT statement. No issues for other enums. Also query works, if we execute this query with limit statement upto 9899

This issue appears for other tables with enum statement.

The error message you encountered, ERROR 1105 (HY000): [FLASH:Coprocessor:Internal] number of enum overflow enum boundary, indicates that there is an overflow in the enum boundary of the TiFlash coprocessor. This error usually occurs when the version of TiDB does not match with that of TiKV. To avoid version mismatch, it is recommended to upgrade all components when you upgrade the version .

In your case, you mentioned that you are using TiDB version 5.7.25-TiDB-v7.1.1. To resolve this issue, you can try upgrading your TiDB version to the latest stable version. Make sure to upgrade all components, including TiFlash, to the same version. This will help ensure compatibility and avoid any version mismatch issues that may cause the enum overflow error .

Additionally, it’s worth noting that the error occurs when you use the column with the MERCHANT_TYPE enum in your SELECT statement. You mentioned that the data count for AQ is 28999 and AC is 266609. It’s possible that the large number of enum values in this column is causing the overflow issue. You can try optimizing your schema design by reducing the number of enum values or using a different data type that can handle a larger number of values .

If the issue persists after upgrading your TiDB version and optimizing your schema design, I recommend reaching out to PingCAP support or the TiDB community for further assistance. They can provide more specific guidance and help troubleshoot the issue in your specific environment .

Please let me know if there’s anything else I can help with!

: Error Codes and Troubleshooting - TiDB Documentation

I found this issue based on the error message: TiFlash does not support modify Enum type even if the change is lossless · Issue #1328 · pingcap/tiflash · GitHub

In this issue, the error was caused by modifying the ENUM column.

Perhaps you can:

  1. try removing TiFlash replicas first:

    ALTER TABLE tbl_merchant SET TIFLASH REPLICA 0;
    
  2. Execute the following SQL to make sure related regions have been removed from tiflash store (Wait the REPLICA_COUNT column to 0):

    SELECT *
    FROM information_schema.tiflash_replica
    WHERE TABLE_NAME = 'tbl_merchant';
    
  3. Then recreate a TiFlash replicas:

    ALTER TABLE tbl_merchant SET TIFLASH REPLICA 1;
    

If the problem still cannot be solved, please let me know, I will help you solve further

@Mini256 Executed commands you suggested, Now it is giving error
ERROR 1105 (HY000): other error for mpp stream: From MPP<query:<query_ts:1698393710055100982, local_query_id:68, server_id:725668, start_ts:445223720716861465>,task_id:1>: Code: 0, e.displayText() = DB::TiFlashException: number of enum overflow enum boundary, e.what() = DB::TiFlashException

@Mini256 Kindly check comments, I posted 2-3 days back

There was problem with data. Some data was having blank value for the NOT NULL data, causing issue in SELECT statement.

There was problem with data. Some data was having blank value for the NOT NULL data, causing issue in SELECT statement.

Sorry for the late reply. Have you tried to solve this problem by fixing the data?

I think it’s worth submitting an issue to the TiFlash repository: Issues · pingcap/tiflash · GitHub

I am curious why TiDB stores blank values in the ENUM column of NOT NULL, and what tool do you use to import data into TiDB. (BR, Lightning, or other tools)

We have used DM tools.
if col_name enum (1,2) NOT NULL and we try to add value 3. Then in MySQL, it is inserted as Blank. (Note: it is NOT added as NULL)

In TiDB whenver any query tries to access that particular row, even in aggregate functions, it throws above error.

if col_name enum (1,2) NOT NULL and we try to add value 3. Then in MySQL, it is inserted as Blank. (Note: it is NOT added as NULL)

I checked the documentation for TiDB and MySQL, and I think this may be due to differences in SQL_MODE settings.

This may be related to whether or not the STRICT_TRANS_TABLES flag is included in the SQL_MODE.

Before MySQL version 5.7.5, the default SQL_MODE did not include the STRICT_TRANS_TABLES flag, which means that if you inserted an invalid value, MySQL would not throw an error, but would fill it with a blank value. This could be the cause of the original data not satisfying the Schema definition.

You can see the SQL_MODE configuration of MySQL and TiDB by using the following SQL:

mysql> SHOW VARIABLES LIKE 'sql_mode';
+---------------+--------------------------------------------------------------------------------+
| Variable_name | Value                                                                          |
+---------------+--------------------------------------------------------------------------------+
| sql_mode      | REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ANSI |
+---------------+--------------------------------------------------------------------------------+
1 row in set (0.00 sec)

In TiDB and MySQL 5.7.5 and later, the default SQL mode includes STRICT_TRANS_TABLES.

Reference:

I have reported this issue in the TiFlash repo, you can track progress by subscribing to issue:

In order to solve the problem, my suggestion is to repair the illegal value in the data.