• Marko Mäkelä's avatar
    MDEV-26623 Possible race condition between statistics and bulk insert · 1e9c922f
    Marko Mäkelä authored
    When computing statistics, let us play it safe and check whether
    an insert into an empty table is in progress, once we have acquired
    the root page latch. If yes, let us pretend that the table is empty,
    just like MVCC reads would do.
    
    It is unlikely that this race condition could lead into any crashes
    before MDEV-24621, because the index tree structure should be protected
    by the page latches. But, at least we can avoid some busy work and
    return earlier.
    
    As part of this, some code that is only used for statistics calculation
    is being moved into static functions in that compilation unit.
    1e9c922f
btr0cur.h 37.2 KB