List:Commits« Previous MessageNext Message »
From:Vladimir Shebordaev Date:November 16 2006 1:11am
Subject:bk commit into 5.0 tree (ted:1.2311) BUG#4291
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ted. When ted does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-11-16 04:11:16+03:00, ted@stripped +6 -0
  BUG #4291 fix: new configuration option "disk-tmp-table-size"
    introduced to set maximum expected on-disk temporary table size 
    and avoid mix-up of tmp_table_size and max_heap_table_size 

  mysql-test/r/disk_tmp_table.result@stripped, 2006-11-16 04:11:12+03:00, ted@stripped +42 -0
    Results recorded out of disk_tmp_table test

  mysql-test/r/disk_tmp_table.result@stripped, 2006-11-16 04:11:12+03:00, ted@stripped +0 -0

  mysql-test/t/disk_tmp_table.test@stripped, 2006-11-16 04:11:12+03:00, ted@stripped +31 -0
    Test to check on-disk temporary table creation

  mysql-test/t/disk_tmp_table.test@stripped, 2006-11-16 04:11:12+03:00, ted@stripped +0 -0

  sql/mysqld.cc@stripped, 2006-11-16 04:11:12+03:00, ted@stripped +6 -1
    "disk-tmp-table-size" option introduced

  sql/set_var.cc@stripped, 2006-11-16 04:11:12+03:00, ted@stripped +4 -0
    "disk-tmp-table-size" option introduced

  sql/sql_class.h@stripped, 2006-11-16 04:11:12+03:00, ted@stripped +1 -0
    "disk-tmp-table-size" option introduced

  sql/sql_select.cc@stripped, 2006-11-16 04:11:12+03:00, ted@stripped +3 -3
    now tmp_table_size is used just like the manual says; made use of disk_tmp_table_size
    as the hint about ISAM temporary table size 

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	ted
# Host:	ted.mysql.internal
# Root:	/home/ted/src/mysql/mysql-5.0-maint

--- 1.579/sql/mysqld.cc	2006-11-16 04:11:23 +03:00
+++ 1.580/sql/mysqld.cc	2006-11-16 04:11:23 +03:00
@@ -4620,7 +4620,7 @@
   OPT_SLAVE_TRANS_RETRIES, OPT_READONLY, OPT_DEBUGGING,
   OPT_SORT_BUFFER, OPT_TABLE_CACHE,
   OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
-  OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
+  OPT_TMP_TABLE_SIZE, OPT_DISK_TMP_TABLE_SIZE, OPT_THREAD_STACK,
   OPT_WAIT_TIMEOUT, OPT_MYISAM_REPAIR_THREADS,
   OPT_INNODB_MIRRORED_LOG_GROUPS,
   OPT_INNODB_LOG_FILES_IN_GROUP,
@@ -6007,6 +6007,11 @@
    (gptr*) &global_system_variables.tmp_table_size,
    (gptr*) &max_system_variables.tmp_table_size, 0, GET_ULONG,
    REQUIRED_ARG, 32*1024*1024L, 1024, ~0L, 0, 1, 0},
+  {"disk_tmp_table_size", OPT_DISK_TMP_TABLE_SIZE,
+   "The temporary table cannot (much) exceed this size on disk.",
+   (gptr*) &global_system_variables.disk_tmp_table_size,
+   (gptr*) &max_system_variables.disk_tmp_table_size, 0, GET_ULONG,
+   REQUIRED_ARG, 64*1024*1024L, 2048, ~0L, 0, 1, 0},
   {"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
    "Allocation block size for transactions to be stored in binary log",
    (gptr*) &global_system_variables.trans_alloc_block_size,

--- 1.308/sql/sql_class.h	2006-11-16 04:11:23 +03:00
+++ 1.309/sql/sql_class.h	2006-11-16 04:11:23 +03:00
@@ -528,6 +528,7 @@
   ulong sortbuff_size;
   ulong table_type;
   ulong tmp_table_size;
+  ulong disk_tmp_table_size;
   ulong tx_isolation;
   ulong completion_type;
   /* Determines which non-standard SQL behaviour should be enabled */

--- 1.472/sql/sql_select.cc	2006-11-16 04:11:23 +03:00
+++ 1.473/sql/sql_select.cc	2006-11-16 04:11:23 +03:00
@@ -9255,9 +9255,9 @@
     table->s->max_rows= ~(ha_rows) 0;
   else
     table->s->max_rows= (((table->s->db_type == DB_TYPE_HEAP) ?
-                          min(thd->variables.tmp_table_size,
-                              thd->variables.max_heap_table_size) :
-                          thd->variables.tmp_table_size)/ table->s->reclength);
+                          min(thd->variables.disk_tmp_table_size,
+                              thd->variables.tmp_table_size) :
+                          thd->variables.disk_tmp_table_size)/ table->s->reclength);
   set_if_bigger(table->s->max_rows,1);		// For dummy start options
   /*
     Push the LIMIT clause to the temporary table creation, so that we

--- 1.171/sql/set_var.cc	2006-11-16 04:11:23 +03:00
+++ 1.172/sql/set_var.cc	2006-11-16 04:11:23 +03:00
@@ -417,6 +417,8 @@
 					 fix_tx_isolation);
 sys_var_thd_ulong	sys_tmp_table_size("tmp_table_size",
 					   &SV::tmp_table_size);
+sys_var_thd_ulong       sys_disk_tmp_table_size("disk_tmp_table_size",
+                                           &SV::disk_tmp_table_size);
 sys_var_bool_ptr  sys_timed_mutexes("timed_mutexes",
                                     &timed_mutexes);
 sys_var_const_str	sys_version("version", server_version);
@@ -762,6 +764,7 @@
   &sys_time_zone,
   &sys_tmpdir,
   &sys_tmp_table_size,
+  &sys_disk_tmp_table_size,
   &sys_trans_alloc_block_size,
   &sys_trans_prealloc_size,
   &sys_tx_isolation,
@@ -1083,6 +1086,7 @@
   {"time_zone",               (char*) &sys_time_zone,               SHOW_SYS},
   {sys_timed_mutexes.name,    (char*) &sys_timed_mutexes,       SHOW_SYS},
   {sys_tmp_table_size.name,   (char*) &sys_tmp_table_size,	    SHOW_SYS},
+  {sys_disk_tmp_table_size.name, (char*) &sys_disk_tmp_table_size,  SHOW_SYS},
   {sys_tmpdir.name,           (char*) &sys_tmpdir,	            SHOW_SYS},
   {sys_trans_alloc_block_size.name, (char*) &sys_trans_alloc_block_size,
    SHOW_SYS},
--- New file ---
+++ mysql-test/r/disk_tmp_table.result	06/11/16 04:11:12
DROP TABLE IF EXISTS t1;
Warnings:
Note	1051	Unknown table 't1'
CREATE TABLE t1 ( a VARCHAR(250) );
INSERT INTO t1 SELECT RAND() FROM (SELECT 0 a UNION SELECT 1 UNION SELECT 2
UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION
SELECT 8 UNION SELECT 9) a, (SELECT 0 a UNION SELECT 10 UNION SELECT 20 UNION
SELECT 30 UNION SELECT 40 UNION SELECT 50 UNION SELECT 60 UNION SELECT 70 UNION
SELECT 80 UNION SELECT 90) b, (SELECT 0 a UNION SELECT 100 UNION SELECT 200
UNION SELECT 300 UNION SELECT 400 UNION SELECT 500 UNION SELECT 600 UNION SELECT
700 UNION SELECT 800 UNION SELECT 900) c;
SET tmp_table_size=0;
SET disk_tmp_table_size=0;
FLUSH STATUS;
SELECT SQL_NO_CACHE a, COUNT(*) FROM t1 GROUP BY a ORDER BY NULL LIMIT 1;
SHOW VARIABLES LIKE '%tmp_table_size';
Variable_name	Value
tmp_table_size	1024
disk_tmp_table_size	2048
SHOW STATUS LIKE 'created_tmp_disk_tables';
Variable_name	Value
Created_tmp_disk_tables	1
FLUSH STATUS;
SET tmp_table_size=32*1024*1024;
SELECT SQL_NO_CACHE a, COUNT(*) FROM t1 GROUP BY a ORDER BY NULL LIMIT 1;
SHOW VARIABLES LIKE '%tmp_table_size';
Variable_name	Value
tmp_table_size	33554432
disk_tmp_table_size	2048
SHOW STATUS LIKE 'created_tmp_disk_tables';
Variable_name	Value
Created_tmp_disk_tables	1
FLUSH STATUS;
SET disk_tmp_table_size=64*1024*1024;
SELECT SQL_NO_CACHE a, COUNT(*) FROM t1 GROUP BY a ORDER BY NULL LIMIT 1;
SHOW VARIABLES LIKE '%tmp_table_size';
Variable_name	Value
tmp_table_size	33554432
disk_tmp_table_size	67108864
SHOW STATUS LIKE 'created_tmp_disk_tables';
Variable_name	Value
Created_tmp_disk_tables	0

--- New file ---
+++ mysql-test/t/disk_tmp_table.test	06/11/16 04:11:12
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( a VARCHAR(250) );
INSERT INTO t1 SELECT RAND() FROM (SELECT 0 a UNION SELECT 1 UNION SELECT 2
UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION
SELECT 8 UNION SELECT 9) a, (SELECT 0 a UNION SELECT 10 UNION SELECT 20 UNION
SELECT 30 UNION SELECT 40 UNION SELECT 50 UNION SELECT 60 UNION SELECT 70 UNION
SELECT 80 UNION SELECT 90) b, (SELECT 0 a UNION SELECT 100 UNION SELECT 200
UNION SELECT 300 UNION SELECT 400 UNION SELECT 500 UNION SELECT 600 UNION SELECT
700 UNION SELECT 800 UNION SELECT 900) c;
SET tmp_table_size=0;
SET disk_tmp_table_size=0;
FLUSH STATUS;
--disable_result_log
SELECT SQL_NO_CACHE a, COUNT(*) FROM t1 GROUP BY a ORDER BY NULL LIMIT 1;
--enable_result_log
SHOW VARIABLES LIKE '%tmp_table_size';
SHOW STATUS LIKE 'created_tmp_disk_tables';
FLUSH STATUS;
SET tmp_table_size=32*1024*1024;
--disable_result_log
SELECT SQL_NO_CACHE a, COUNT(*) FROM t1 GROUP BY a ORDER BY NULL LIMIT 1;
--enable_result_log
SHOW VARIABLES LIKE '%tmp_table_size';
SHOW STATUS LIKE 'created_tmp_disk_tables';
FLUSH STATUS;
SET disk_tmp_table_size=64*1024*1024;
--disable_result_log
SELECT SQL_NO_CACHE a, COUNT(*) FROM t1 GROUP BY a ORDER BY NULL LIMIT 1;
--enable_result_log
SHOW VARIABLES LIKE '%tmp_table_size';
SHOW STATUS LIKE 'created_tmp_disk_tables';

Thread
bk commit into 5.0 tree (ted:1.2311) BUG#4291Vladimir Shebordaev16 Nov