• Sergei Golubchik's avatar
    MDEV-32155 MariaDB Server crashes with ill-formed partitions · dea5746d
    Sergei Golubchik authored
    for ALTER_PARTITION_ADMIN (CHECK/REPAIR/LOAD INDEX/CACHE INDEX/etc)
    partitioning marks affected partitions with PART_ADMIN state.
    
    The assumption is that the server will call a corresponding
    method of ha_partition which will reset the state back to PART_NORMAL.
    
    This assumption is invalid, the server is not required to do so,
    indeed, in CHECK ... FOR UPGRADE the server might decide early that
    the table is fine and won't call ha_partition::check(), leaving
    partitions in the wrong state. It will thus leak into the next
    statement confusing the engine about what it is doing (see
    ha_partition::create_handler_file()), causing a crash later.
    
    Let's force all partitions into PART_NORMAL state after the admin
    operation succeeded, in case it did so without consulting the engine.
    dea5746d
sql_admin.cc 52.9 KB