• Anirudh Mangipudi's avatar
    Bug #12546953 "SHOW VARIABLES LIKE 'DATADIR';" RETURN EMPTY. · 4061d719
    Anirudh Mangipudi authored
    Problem:
    ===========================================================
    If mysqld daemon is started without a --datadir option
    option, and we issue the SHOW VARIABLES LIKE 'DATADIR';SQL command
    at the client it returns an empty path. This is because
    mysql_real_data_home_ptr is being reset to NULL by Sys_var_charptr
    constructor call when the datadir is not given either through
    configuration file (no-defaults) or through mysqld parameters.
    
    Solution:
    ===========================================================
    mysql_real_data_home is an array which stores the path of the datadir
    and mysql_real_data_home_ptr is the pointer to it. The pointer is
    being set to NULL at the Sys_datadir, which is of type Sys_var_charptr,
    constructor call. This is because at Sys_datadir call the def_val 
    parameter was being passed with DEFAULT(0) which is now replaced with
    DEFAULT(mysql_real_data_home). The patch has been tested manually as it
    is not possible to start mtr without a default config file.
    4061d719
sys_vars.cc 128 KB