'Mysql 8.0 "ERROR 1030 (HY000): Got error 100" when adding index to very large table

I'm attempting to add an index to a very large table (2B rows) and the command fails after a few hours with:

ERROR 1030 (HY000): Got error 100 - 'InnoDB error' from storage engine

I'm finding the InnoDB 100 error code to be ungoogleable. It seems to be running out of some kind of resource, but the server has 128 GB of RAM and tons of disk space. Mysql isn't crashing.

I think maybe I need some config tweaks to give it more juice, but I don't know where to start.

Server version: Server version: 8.0.28
Db engine: InnoDB



Solution 1:[1]

Ok, mystery solved. It turns out mysql by default writes temporary table data to /tmp (not your mysql data dir). Ordinarily you'd probably never notice this, but it can be a LOT of data if you're doing something absurd like creating indexes on 2 billion rows.

In my case the root partition filled to 100%, causing the index command to fail. After which it quietly freed up its temp storage just to make it harder for me to diagnose.

The solution: move the temp directory to a location with more space:

sudo nano /[config path]/my.cnf

Add:

tmpdir=/[new tempdir path]/mytempdir

Set perms:

sudo chown -R mysql:mysql /[new tempdir path]/mytempdir

Restart mysql:

sudo systemctl restart mysql

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Minsc