• unknown's avatar
    BUG#27516 - divide by zero crash during optimize table · f4a5f3c6
    unknown authored
    When a table status is requested by statement like SHOW TABLE
    STATUS and there is another statement (e.g. DELETE) sets
    number of records to 0 concurrently, we may get division by
    zero error, which crashes a server.
    
    This is fixed by using thread local variable x->records instead
    of shared info->state->records when we check if it is zero and
    divide by it.
    
    
    myisam/mi_info.c:
      Information schema does not lock a table when it requests table
      state info. If another thread sets info->state->records to 0
      after we check if it is 0 and before we divide by it we may get
      division by zero error.
      
      Check and divide by local x->records variable instead of shared
      info->state->records.
    f4a5f3c6
bdb_notembedded.test 820 Bytes