v.19.14Improvement

When Enable Dumping Temporary Data to the Disk to Restrict Memory Usage During GROUP By, ORDER By, It Didn't Check the Free Disk Space

When enable dumping temporary data to the disk to restrict memory usage during GROUP BY, ORDER BY, it didn't check the free disk space. The fix add a new setting min_free_disk_space, when the free disk space it smaller then the threshold, the query will stop and throw ErrorCodes::NOT_ENOUGH_SPACE. #6678 (Weiqing Xu) #6691 (alexey-milovidov)
Add min_free_disk_space setting to prevent disk space exhaustion during temporary data dumping for GROUP BY and ORDER BY.

Why it matters

When disk dumping is enabled to limit memory usage during GROUP BY and ORDER BY operations, there was no check for available free disk space. This could lead to disk space exhaustion and system instability. The new setting min_free_disk_space prevents this by enforcing a minimum free disk space threshold; if free space drops below this threshold, the query is stopped with an ErrorCodes::NOT_ENOUGH_SPACE error. This protects the system from running out of disk space during query execution.

How to use it

Users can enable this feature by setting the configuration parameter min_free_disk_space to the desired minimum free disk space in bytes. When enabled, if the available free disk space falls below this limit during dumping of temporary data for GROUP BY or ORDER BY operations, the query execution will be stopped with an error indicating insufficient disk space.