• Eugene Kosov's avatar
    MDEV-19231 make DB_SUCCESS equal to 0 · 6c5c1f0b
    Eugene Kosov authored
    It's a micro optimization. On most platforms CPUs has instructions to
    compare with 0 fast. DB_SUCCESS is the most popular outcome of functions
    and this patch optimized code like (err == DB_SUCCESS)
    
    BtrBulk::finish(): bogus assertion fixed
    
    fil_node_t::read_page0(): corrected usage of os_file_read()
    
    que_eval_sql(): bugus assertion removed. Apparently it checked that
    the field was assigned after having been zero-initialized at
    object creation.
    
    It turns out that the return type of os_file_read_func() was changed
    in mysql/mysql-server@98909cefbc37e54efc6452c7e95bccbf64ac9213 (MySQL 5.7)
    from ibool to dberr_t. The reviewer (if there was any) failed to
    point out that because of future merges, it could be a bad idea to
    change the return type of a function without changing the function name.
    
    This change was applied to MariaDB 10.2.2 in
    commit 2e814d47 but the
    MariaDB-specific code was not fully adjusted accordingly,
    e.g. in fil_node_open_file(). Essentially, code like
    !os_file_read(...) became dead code in MariaDB and later
    in Mariabackup 10.2, and we could be dealing with an uninitialized
    buffer after a failed page read.
    6c5c1f0b
fil_cur.cc 13.8 KB