• Marko Mäkelä's avatar
    MDEV-11520 Extending an InnoDB data file unnecessarily allocates · 978179a9
    Marko Mäkelä authored
    a large memory buffer on Windows
    
    fil_extend_space_to_desired_size(), os_file_set_size(): Use calloc()
    for memory allocation, and handle failures. Properly check the return
    status of posix_fallocate().
    
    On Windows, instead of extending the file by at most 1 megabyte at a time,
    write a zero-filled page at the end of the file.
    According to the Microsoft blog post
    https://blogs.msdn.microsoft.com/oldnewthing/20110922-00/?p=9573
    this will physically extend the file by writing zero bytes.
    (InnoDB never uses DeviceIoControl() to set the file sparse.)
    
    For innodb_plugin, port the XtraDB fix for MySQL Bug#56433
    (introducing fil_system->file_extend_mutex). The bug was
    fixed differently in MySQL 5.6 (and MariaDB Server 10.0).
    978179a9
fil0fil.c 136 KB