• Satya B's avatar
    Fix for Bug#37408 - Compressed MyISAM files should not require/use mmap() · cf9966f8
    Satya B authored
                      
    When compressed myisam files are opened, they are always memory mapped
    sometimes causing memory swapping problems.
    
    When we mmap the myisam compressed tables of size greater than the memory 
    available, the kswapd0 process utilization is very high consuming 30-40% of 
    the cpu. This happens only with linux kernels older than 2.6.9
    
    With newer linux kernels, we don't have this problem of high cpu consumption
    and this option may not be required.
     
    The option 'myisam_mmap_size' is added to limit the amount of memory used for
    memory mapping of myisam files. This option is not dynamic.
    
    The default value on 32 bit system is 4294967295 bytes and on 64 bit system it
    is 18446744073709547520 bytes.
    
    Note: Testcase only tests the option variable. The actual bug has be to 
    tested manually.
    
    include/my_global.h:
      Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
      
      define SIZE_T_MAX
    include/myisam.h:
      Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
      
      declare 'myisam_mmap_size' and 'myisam_mmap_used' variables and the mutex
      THR_LOCK_myisam_mmap
    myisam/mi_packrec.c:
      Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
      
      add 'myisam_mmap_size' option which limits the memory available to mmap of 
      myisam files
    myisam/mi_static.c:
      Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
      
      declare 'myisam_mmap_size' and 'myisam_mmap_used' variables and the mutex
      THR_LOCK_myisam_mmap
    myisam/myisamdef.h:
      Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
      
      move MEMMAP_EXTRA_MARGIN to myisam.h so that it can be used in mysqld.cc
    mysql-test/r/variables.result:
      Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
      
      Testcase for BUG#37408 to test the myisam_mmap_size option
    mysql-test/t/variables.test:
      Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
      
      Testcase for BUG#37408 to test the myisam_mmap_size option
    mysys/my_thr_init.c:
      Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
      
      intialize the lock THR_LOCK_myisam_mmap
    sql/mysqld.cc:
      Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
      
      add the 'myisam_mmap_size' option
    sql/set_var.cc:
      Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
      
      add the 'myisam_mmap_size' to the SHOW VARIABLES list
    cf9966f8
my_global.h 44.5 KB