• Satya B's avatar
    Fix for Bug#33785 - myisamchk show warning message · 22ec06de
    Satya B authored
    myisamchk tool generates warnings when run on an myisam files (.MYI or .MYD)
    This is because of the conversion of max_value for certain options in myisamchk 
    from singed long to unsigned long
    
    The max value for the options key_buffer_size, read_buffer_size, write_buffer
    _size and sort_buffer_size is given as (long) ~0L which becomes -1  when casted
    from signed long to longlong and then casted to ulonglong. When (ulonglong) -1 
    is compared with maximal value for GET_ULONG data type, we adjust it to 
    (ulonglong) ULONG_MAX and throw the warning.
    
    Fixed by using the right max size.
    
    Max values for the variables (from mysqld.cc)
    ----------------------------
    1. key_buffer_size
       5.0: ULONG_MAX
       5.1: SIZE_T_MAX
       6.0: SIZE_T_MAX
    
    2. read_buffer_size and write_buffer_size
       5.0: INT_MAX32
       5.1: INT_MAX32
       6.0: INT_MAX32
    
    3. sort_buffer_size (aka myisam_sort_buffer_size)
       5.0: UINT_MAX32
       5.1: ULONG_MAX
       6.0: ULONG_MAX
    
    Note: testcase not attached
    
    myisam/myisamchk.c:
      Bug#33785 - myisamchk show warning message
          
      Fixed the Max value for key_buffer_size, read_buffer_size, write_buffer_size and
      sort_buffer_size options
    22ec06de
myisamchk.c 60.7 KB