• Guilhem Bichot's avatar
    Fix for BUG#39210 "Maria deadlock in _ma_bitmap_wait_or_flush". It was a thread · ed567bd2
    Guilhem Bichot authored
    which nobody woke up (see comment of ma_bitmap.c). No testcase, this requires
    multiple threads and is automatically tested at push time by maria_stress.yy (pushbuild2).
    
    storage/maria/ma_bitmap.c:
      * _ma_bitmap_wait_or_flush() didn't publish that it was waiting for bitmap to not
      be over-allocated (i.e. didn't modify bitmap->flush_all_requested) so nobody
      (_ma_bitmap_flushable(), _ma_bitmap_release_unused()) knew it had to wake it up
      => it stalled (BUG#39210). In fact the wait in _ma_bitmap_wait_or_flush()
      is not needed, it's ok if this function sends the over-allocated bitmap to page
      cache and keeps pin on it (_ma_bitmap_unpin_all() will unpin it later, and
      the one who added _ma_bitmap_wait_or_flush() didn't know it). Function
      is thus deleted, as _ma_bitmap_flush() can do its job.
      * After fixing that, test runs longer and BUG 39665 happens, which looks like
      a separate page cache bug.
      * Smaller changes: _ma_bitmap_flush_all() called write_changed_bitmap() even
      though it might not be changed; added some DBUG calls in functions; split
      assertions.
      * In _ma_bitmap_release_unused(), it's more logical to test non_flushable_state
      than now_transactional to know if we have to decrement non_flushable
      (it's exactly per the definition of non_flushable_state).
    storage/maria/ma_blockrec.c:
      _ma_bitmap_wait_or_flush() is not needed.
      ******
      new prototype and splitting assertion in three (3rd one fires: BUG 39665)
    storage/maria/ma_blockrec.h:
      _ma_bitmap_wait_or_flush() is not needed.
    ed567bd2
ma_blockrec.c 231 KB