List:Internals« Previous MessageNext Message »
From:sanja Date:May 17 2005 8:46pm
Subject:bk commit into 5.0 tree (bell:1.1843)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of bell. When bell 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
  1.1843 05/05/17 23:46:02 bell@stripped +7 -0
  merge

  mysql-test/t/subselect.test
    1.98 05/05/17 23:45:52 bell@stripped +3 -3
    merge

  mysql-test/t/myisam.test
    1.44 05/05/17 23:45:52 bell@stripped +0 -0
    merge

  mysql-test/r/subselect.result
    1.112 05/05/17 23:45:52 bell@stripped +2 -3
    merge

  mysql-test/r/myisam.result
    1.62 05/05/17 23:45:52 bell@stripped +0 -0
    merga

  sql/item.cc
    1.118 05/05/17 23:39:08 bell@stripped +0 -0
    Auto merged

  myisam/mi_check.c
    1.131 05/05/17 23:39:05 bell@stripped +0 -0
    Auto merged

  BitKeeper/etc/logging_ok
    1.314 05/05/17 23:38:18 bell@stripped +0 -1
    auto-union

# 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:	bell
# Host:	book.sanja.is.com.ua
# Root:	/Users/bell/mysql/bk/work-bug2-5.0/RESYNC

--- 1.130/myisam/mi_check.c	2005-04-13 17:06:28 +03:00
+++ 1.131/myisam/mi_check.c	2005-05-17 23:39:05 +03:00
@@ -3244,6 +3244,9 @@
     cmp=ha_key_cmp(sort_param->seg,sort_info->key_block->lastkey,
 		   (uchar*) a, USE_WHOLE_KEY,SEARCH_FIND | SEARCH_UPDATE,
 		   &diff_pos);
+    ha_key_cmp(sort_param->seg,sort_info->key_block->lastkey,
+               (uchar*) a, USE_WHOLE_KEY,SEARCH_FIND | SEARCH_NULL_ARE_NOT_EQUAL,
+               &diff_pos);
     sort_param->unique[diff_pos-1]++;
   }
   else
@@ -3956,7 +3959,38 @@
   return;
 }
 
-    /* calculate unique keys for each part key */
+
+/*
+  Update statistics for each part of an index
+  
+  SYNOPSIS
+    update_key_parts()
+      keyinfo               Index information (only key->keysegs used)
+      rec_per_key_part  OUT Store statistics here
+      unique            IN  Array of #distinct values collected over index
+                            run.
+      records               Number of records in the table
+      
+  NOTES
+    Unique is an array:
+    unique[0]= (#different values of {keypart1}) - 1
+    unique[1]= (#different values of {keypart2,keypart1} tuple) - unique[0] - 1
+    ...
+    Here we assume that NULL != NULL (see SEARCH_NULL_ARE_NOT_EQUAL). The
+    'unique' array is collected in one sequential scan through the entire
+    index. This is done in two places: in chk_index() and in sort_key_write().
+
+    Output is an array:
+    rec_per_key_part[k] = 
+     = E(#records in the table such that keypart_1=c_1 AND ... AND 
+         keypart_k=c_k for arbitrary constants c_1 ... c_k) 
+     
+     = {assuming that values have uniform distribution and index contains all
+        tuples from the domain (or that {c_1, ..., c_k} tuple is choosen from
+        index tuples}
+     
+     = #tuples-in-the-index / #distinct-tuples-in-the-index.
+*/
 
 void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
 			     ulonglong *unique, ulonglong records)

--- 1.117/sql/item.cc	2005-05-16 09:12:31 +03:00
+++ 1.118/sql/item.cc	2005-05-17 23:39:08 +03:00
@@ -3543,7 +3543,7 @@
 
 Item *Item_int_with_ref::new_item()
 {
-  DBUG_ASSERT(ref->basic_const_item());
+  DBUG_ASSERT(ref->const_item());
   /*
     We need to evaluate the constant to make sure it works with
     parameter markers.

--- 1.111/mysql-test/r/subselect.result	2005-04-16 08:08:08 +03:00
+++ 1.112/mysql-test/r/subselect.result	2005-05-17 23:45:52 +03:00
@@ -1160,7 +1160,7 @@
 PRIMARY KEY  (Code)
 ) ENGINE=MyISAM;
 INSERT INTO t2 VALUES ('AUS','Australia','Oceania','Australia and New Zealand',7741220.00,1901,18886000,79.8,351182.00,392911.00,'Australia','Constitutional Monarchy, Federation','Elisabeth II',135,'AU');
+INSERT INTO t2 VALUES ('AZE','Azerbaijan','Asia','Middle East',86600.00,1991,7734000,62.9,4127.00,4100.00,'Azärbaycan','Federal Republic','Heydär Äliyev',144,'AZ');
 select t2.Continent, t1.Name, t1.Population from t2 LEFT JOIN t1 ON t2.Code = t1.t2  where t1.Population IN (select max(t1.Population) AS Population from t1, t2 where t1.t2 = t2.Code group by Continent);
 Continent	Name	Population
 Oceania	Sydney	3276207
@@ -2504,7 +2504,7 @@
 ) ENGINE=MyISAM;
 INSERT INTO t1 VALUES ('XXX','Xxxxx','Oceania','Xxxxxx',26.00,0,0,0,0,0,'Xxxxx','Xxxxx','Xxxxx',NULL,'XX');
 INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,68000,75.1,334.00,NULL,'Amerika Samoa','US Territory','George W. Bush',54,'AS');
+INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
 INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
 /*!40000 ALTER TABLE t1 ENABLE KEYS */;
 SELECT DISTINCT Continent AS c FROM t1 WHERE Code <> SOME ( SELECT Code FROM t1 WHERE Continent = c AND Population < 200);
@@ -2709,7 +2709,30 @@
 ERROR 21000: Operand should contain 3 column(s)
 select (select * from t1) = (1,2,3);
 ERROR 21000: Operand should contain 2 column(s)
-drop table t1;
+drop table t1
+#;
+CREATE TABLE `t1` (
+`itemid` bigint(20) unsigned NOT NULL auto_increment,
+`sessionid` bigint(20) unsigned default NULL,
+`time` int(10) unsigned NOT NULL default '0',
+`type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
+NULL default '',
+`data` text collate latin1_general_ci NOT NULL,
+PRIMARY KEY  (`itemid`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
+CREATE TABLE `t2` (
+`sessionid` bigint(20) unsigned NOT NULL auto_increment,
+`pid` int(10) unsigned NOT NULL default '0',
+`date` int(10) unsigned NOT NULL default '0',
+`ip` varchar(15) collate latin1_general_ci NOT NULL default '',
+PRIMARY KEY  (`sessionid`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
+SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
+ip	count( e.itemid )
+10.10.10.1	1
+drop tables t1,t2;
 create table t1 (df decimal(5,1));
 insert into t1 values(1.1);
 insert into t1 values(2.2);

--- 1.97/mysql-test/t/subselect.test	2005-04-16 08:07:39 +03:00
+++ 1.98/mysql-test/t/subselect.test	2005-05-17 23:45:52 +03:00
@@ -665,7 +665,7 @@
 ) ENGINE=MyISAM;
 
 INSERT INTO t2 VALUES ('AUS','Australia','Oceania','Australia and New Zealand',7741220.00,1901,18886000,79.8,351182.00,392911.00,'Australia','Constitutional Monarchy, Federation','Elisabeth II',135,'AU');
+INSERT INTO t2 VALUES ('AZE','Azerbaijan','Asia','Middle East',86600.00,1991,7734000,62.9,4127.00,4100.00,'Azärbaycan','Federal Republic','Heydär Äliyev',144,'AZ');
 
 select t2.Continent, t1.Name, t1.Population from t2 LEFT JOIN t1 ON t2.Code = t1.t2  where t1.Population IN (select max(t1.Population) AS Population from t1, t2 where t1.t2 = t2.Code group by Continent); 
 
@@ -1524,7 +1524,7 @@
 ) ENGINE=MyISAM;
 INSERT INTO t1 VALUES ('XXX','Xxxxx','Oceania','Xxxxxx',26.00,0,0,0,0,0,'Xxxxx','Xxxxx','Xxxxx',NULL,'XX');
 INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,68000,75.1,334.00,NULL,'Amerika Samoa','US Territory','George W. Bush',54,'AS');
+INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
 INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
 /*!40000 ALTER TABLE t1 ENABLE KEYS */;
 SELECT DISTINCT Continent AS c FROM t1 WHERE Code <> SOME ( SELECT Code FROM t1 WHERE Continent = c AND Population < 200);
@@ -1727,6 +1727,30 @@
 -- error 1241
 select (select * from t1) = (1,2,3);
 drop table t1;
+
+#
+# Item_int_with_ref check (BUG#10020)
+#
+CREATE TABLE `t1` (
+  `itemid` bigint(20) unsigned NOT NULL auto_increment,
+  `sessionid` bigint(20) unsigned default NULL,
+  `time` int(10) unsigned NOT NULL default '0',
+  `type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
+NULL default '',
+  `data` text collate latin1_general_ci NOT NULL,
+  PRIMARY KEY  (`itemid`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
+CREATE TABLE `t2` (
+  `sessionid` bigint(20) unsigned NOT NULL auto_increment,
+  `pid` int(10) unsigned NOT NULL default '0',
+  `date` int(10) unsigned NOT NULL default '0',
+  `ip` varchar(15) collate latin1_general_ci NOT NULL default '',
+  PRIMARY KEY  (`sessionid`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
+SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
+drop tables t1,t2;
 
 #
 #decimal-related tests

--- 1.61/mysql-test/r/myisam.result	2005-05-13 12:08:03 +03:00
+++ 1.62/mysql-test/r/myisam.result	2005-05-17 23:45:52 +03:00
@@ -594,6 +594,20 @@
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 drop table t1;
+create table t1 (a int, key(a));
+insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
+analyze table t1;
+Table	Op	Msg_type	Msg_text
+test.t1	analyze	status	OK
+show keys from t1;
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
+t1	1	a	1	a	A	8	NULL	NULL	YES	BTREE	
+alter table t1 disable keys;
+alter table t1 enable keys;
+show keys from t1;
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
+t1	1	a	1	a	A	8	NULL	NULL	YES	BTREE	
+drop table t1;
 set storage_engine=MyISAM;
 drop table if exists t1,t2,t3;
 --- Testing varchar ---

--- 1.43/mysql-test/t/myisam.test	2005-05-13 12:08:03 +03:00
+++ 1.44/mysql-test/t/myisam.test	2005-05-17 23:45:52 +03:00
@@ -563,6 +563,21 @@
 check table t1;
 drop table t1;
 
+
+# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
+# different statistics on the same table with NULL values.
+create table t1 (a int, key(a));
+
+insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
+analyze table t1;
+show keys from t1;
+
+alter table t1 disable keys;
+alter table t1 enable keys;
+show keys from t1;
+
+drop table t1;
+
 #
 # Test varchar
 #
Thread
bk commit into 5.0 tree (bell:1.1843)sanja17 May