Why does creating an index or adding a primary key report "no enough space in /tmp/tidb/tmp_ddl-4000"?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 创建索引或者增加主键报no enough space in /tmp/tidb/tmp_ddl-4000是怎么回事啊

| username: N1ckelth

[Test Environment for TiDB]
[TiDB Version] 8.0.0
[Reproduction Path] Operations performed that led to the issue
CREATE TABLE t0(c0 BOOL);
CREATE INDEX i0 ON t0(c0);
ALTER TABLE t0 ADD PRIMARY KEY(c0);
[Encountered Issue: Issue Phenomenon and Impact]
Both of the following statements result in an error:
ERROR 8256 (HY000): Check ingest environment failed: no enough space in /tmp/tidb/tmp_ddl-4000
[Resource Configuration] Using 1 PD and 3 TiKV

| username: N1ckelth | Original post link

TiDB is running in a Docker container. I checked the /tmp/tidb/tmp_ddl-4000 folder, and it is only 4.0KB.

| username: zhanggame1 | Original post link

The default parameters for building an index may use the disk.

| username: Jellybean | Original post link

This issue is caused by fast online DDL using disk temporarily to speed up the execution of some DDLs, and the default space is insufficient. You can set it to a directory with more space.

| username: yytest | Original post link

Try changing the directory.

| username: shigp_TIDBER | Original post link

Ensure there is enough space in the temporary directory.

| username: 友利奈绪 | Original post link

It may be due to insufficient permissions for non-root users.

| username: TiDBer_QYr0vohO | Original post link

The space in the directory /tmp/tidb/tmp_ddl-4000 is not enough.

| username: yytest | Original post link

Check if the disk space is insufficient.

| username: zhaokede | Original post link

Insufficient temporary folder capacity