Does innodb_online_alter_log_max_size took memory from ram or Hard Disk I got an Mysql (5.7) error while altering huge table (400 G) for adding an index:

ERROR 1799 (HY000): Creating index 'FTS_DOC_ID_INDEX' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again.


I guess that I had to increase innodb_online_alter_log_max_size but I'm afraid that it while took it from RAM cause it is already full enough.

N.B: I had enough space on tmpdir path.
As I read the manual:


  Specifies an upper limit on the size of the temporary log files used during online DDL operations for InnoDB tables. There is one such log file for each index being created or table being altered. This log file stores data inserted, updated, or deleted in the table during the DDL operation. The temporary log file is extended when needed by the value of innodb_sort_buffer_size, up to the maximum specified by innodb_online_alter_log_max_size. If a temporary log file exceeds the upper size limit, the ALTER TABLE operation fails and all uncommitted concurrent DML operations are rolled back. Thus, a large value for this option allows more DML to happen during an online DDL operation, but also extends the period of time at the end of the DDL operation when the table is locked to apply the data from the log.


That refers to disk space, not RAM.  And it will grow as needed, not start out at the setting.  innodb_online_alter_log_max_size should perhaps be set to something less than the disk space available, but otherwise not too small.

innodb_sort_buffer_size defaults to 1MB; there is probably no reason to change that.  In certain operations, this much space is allocated in RAM.  Probably one of those will be allocated (in RAM) for each index on the table.