You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mysql [localhost] {msandbox} (sakila) > show create table actor\G
*************************** 1. row ***************************
Table: actor
Create Table: CREATE TABLE `actor` (
`actor_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`first_name` varchar(45) NOT NULL,
`last_name` varchar(45) NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`actor_id`),
KEY `idx_actor_last_name` (`last_name`)
) ENGINE=InnoDB AUTO_INCREMENT=65535 DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
SELECT COUNT(*) FROM actor;
+----------+
| COUNT(*) |
+----------+
| 0 |
+----------+
1 row in set (0.00 sec)
As we can see, the PK is a smallint, the table is empty, and the AUTO_INCREMENT value is at 65535 (this was a table that was full, then all rows were deleted).
If we try to use the tool, it will insert only one row, and will error out with duplicate key errors:
mysql_random_data_load_linux_amd64 sakila actor 5 --host=127.0.0.1 --port=12323 --user=msandbox --password=msandbox
2017/12/22 00:12:29 Starting
2017/12/22 00:12:29 cannot run insert: Error 1467: Failed to read auto-increment value from storage engine
2017/12/22 00:12:29 Adding extra 5 rows.
0s [============>-------------------------------------------------------] 20%
Error 1062: Duplicate entry '65535' for key 'PRIMARY'
Error 1062: Duplicate entry '65535' for key 'PRIMARY'
Error 1062: Duplicate entry '65535' for key 'PRIMARY'
...
Only one row is inserted:
SELECT * FROM actor;
+----------+-----------------------------------------------+-----------------------------------------------+---------------------+
| actor_id | first_name | last_name | last_update |
+----------+-----------------------------------------------+-----------------------------------------------+---------------------+
| 65535 | fugiat ratione tempora quia aliquam nulla dol | tempore aut harum debitis corporis sed repell | 2017-08-29 05:09:01 |
+----------+-----------------------------------------------+-----------------------------------------------+---------------------+
1 row in set (0.00 sec)
It may make sense to try to choose another PK value on error.
The text was updated successfully, but these errors were encountered:
As we can see, the PK is a smallint, the table is empty, and the AUTO_INCREMENT value is at 65535 (this was a table that was full, then all rows were deleted).
If we try to use the tool, it will insert only one row, and will error out with duplicate key errors:
Only one row is inserted:
It may make sense to try to choose another PK value on error.
The text was updated successfully, but these errors were encountered: