List:Commits« Previous MessageNext Message »
From:Satya B Date:April 22 2009 1:02pm
Subject:bzr commit into mysql-5.1-bugteam branch (satya.bn:2864) Bug#37408
View as plain text  
#At file:///home/satya/WORK/37408/mysql-5.1-bugteam-37408/ based on revid:alfranio.correia@stripped

 2864 Satya B	2009-04-22
      Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
      
      When compressed myisam files are opened, they are always memory mapped
      causing memory swapping problems.
      
      Fixed my adding an option to disable memory mapping for compressed myisam
      tables.
      
      The option is "myisam_compressed_use_mmap" . The behaviour of this variable
      is modeled after "myisam_use_mmap" but doesn't have any dependency on it.
      
      It can be given command line , option file, through set command(i.e. dynamic)
      and it is a "GLOBAL" variable.
      
      Note that default value for the "myisam_compressed_use_mmap" is "ON" so that it 
      doesn't break the existing behaviour.
      
      Note:
      Testcase for the fix is not possible and has to be tested manually.
      modified:
        sql/mysql_priv.h
        sql/mysqld.cc
        sql/set_var.cc
        storage/myisam/mi_extra.c
        storage/myisam/mi_static.c
        storage/myisam/myisamdef.h

per-file messages:
  sql/mysql_priv.h
    added extern variable "myisam_compressed_use_mmap"
  sql/mysqld.cc
    Added OPT_MYISAM_COMPRESSED_USE_MMAP to the enum options_mysqld and also
    to my_long_options[]
  sql/set_var.cc
    add mysiam_compressed_use_mmap variable to set variables
  storage/myisam/mi_extra.c
    fixed mi_extra() to use Memory mapping based on the flag
    myisam_compressed_use_mmap
  storage/myisam/mi_static.c
    myisam_compressed_use_mmap is defined here
  storage/myisam/myisamdef.h
    extern declaration for the mysiam_compressed_use_mmap.
=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2009-04-08 23:58:57 +0000
+++ b/sql/mysql_priv.h	2009-04-22 13:02:33 +0000
@@ -1979,6 +1979,7 @@ extern uint volatile thread_count, threa
 extern uint connection_count;
 extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types;
 extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
+extern my_bool myisam_compressed_use_mmap;
 extern my_bool opt_slave_compressed_protocol, use_temp_pool;
 extern ulong slave_exec_mode_options;
 extern my_bool opt_readonly, lower_case_file_system;

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2009-03-24 13:58:52 +0000
+++ b/sql/mysqld.cc	2009-04-22 13:02:33 +0000
@@ -5555,6 +5555,7 @@ enum options_mysqld
   OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
   OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE,
   OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS,
+  OPT_MYISAM_COMPRESSED_USE_MMAP,
   OPT_MYISAM_STATS_METHOD,
   OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT,
   OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT,
@@ -6709,6 +6710,11 @@ The minimum value for this variable is 4
    (uchar**) &opt_myisam_use_mmap,
    (uchar**) &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG, 0, 
     0, 0, 0, 0, 0},
+  {"myisam_compressed_use_mmap", OPT_MYISAM_COMPRESSED_USE_MMAP,
+   "Use memory mapping for reading compressed MyISAM tables.",
+   (uchar**) &myisam_compressed_use_mmap,
+   (uchar**) &myisam_compressed_use_mmap, 0, GET_BOOL, NO_ARG, 1, 
+    0, 0, 0, 0, 0},
   {"myisam_stats_method", OPT_MYISAM_STATS_METHOD,
    "Specifies how MyISAM index statistics collection code should threat NULLs. "
    "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2009-03-19 14:43:01 +0000
+++ b/sql/set_var.cc	2009-04-22 13:02:33 +0000
@@ -428,6 +428,8 @@ static sys_var_thd_ulong       sys_myisa
 static sys_var_thd_ulong	sys_myisam_sort_buffer_size(&vars, "myisam_sort_buffer_size", &SV::myisam_sort_buff_size);
 static sys_var_bool_ptr	sys_myisam_use_mmap(&vars, "myisam_use_mmap",
                                             &opt_myisam_use_mmap);
+static sys_var_bool_ptr	sys_myisam_compressed_use_mmap(&vars, "myisam_compressed_use_mmap",
+                                                       &myisam_compressed_use_mmap);
 
 static sys_var_thd_enum         sys_myisam_stats_method(&vars, "myisam_stats_method",
                                                 &SV::myisam_stats_method,

=== modified file 'storage/myisam/mi_extra.c'
--- a/storage/myisam/mi_extra.c	2007-10-11 15:07:40 +0000
+++ b/storage/myisam/mi_extra.c	2009-04-22 13:02:33 +0000
@@ -72,7 +72,8 @@ int mi_extra(MI_INFO *info, enum ha_extr
     if (info->s->file_map) /* Don't use cache if mmap */
       break;
 #if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
-    if ((share->options & HA_OPTION_COMPRESS_RECORD))
+    if ((share->options & HA_OPTION_COMPRESS_RECORD) &&
+        myisam_compressed_use_mmap)
     {
       pthread_mutex_lock(&share->intern_lock);
       if (_mi_memmap_file(info))

=== modified file 'storage/myisam/mi_static.c'
--- a/storage/myisam/mi_static.c	2009-01-15 18:11:25 +0000
+++ b/storage/myisam/mi_static.c	2009-04-22 13:02:33 +0000
@@ -40,6 +40,7 @@ ulong myisam_concurrent_insert= 0;
 my_off_t myisam_max_temp_length= MAX_FILE_SIZE;
 ulong    myisam_bulk_insert_tree_size=8192*1024;
 ulong    myisam_data_pointer_size=4;
+my_bool  myisam_compressed_use_mmap= 1;
 
 
 static int always_valid(const char *filename __attribute__((unused)))

=== modified file 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h	2009-02-19 21:09:35 +0000
+++ b/storage/myisam/myisamdef.h	2009-04-22 13:02:33 +0000
@@ -476,6 +476,7 @@ extern uint NEAR myisam_read_vec[],NEAR 
 extern uint myisam_quick_table_bits;
 extern File myisam_log_file;
 extern ulong myisam_pid;
+extern my_bool myisam_compressed_use_mmap;
 
 	/* This is used by _mi_calc_xxx_key_length och _mi_store_key */
 

Thread
bzr commit into mysql-5.1-bugteam branch (satya.bn:2864) Bug#37408Satya B22 Apr