MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:jonas Date:October 10 2006 9:25am
Subject:bk commit into 5.1 tree (jonas:1.2305)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas 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-10-10 11:25:24+02:00, jonas@stripped +31 -0
  Merge perch.ndb.mysql.com:/home/jonas/src/mysql-5.1
  into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb
  MERGE: 1.2273.63.29

  client/mysqldump.c@stripped, 2006-10-10 11:25:17+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.250.1.1

  client/mysqltest.c@stripped, 2006-10-10 11:25:17+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.226.1.1

  mysql-test/r/csv.result@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.12.1.1

  mysql-test/r/ctype_utf8.result@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.98.1.9

  mysql-test/r/func_time.result@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.75.1.1

  mysql-test/t/csv.test@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.15.1.1

  mysql-test/t/ctype_utf8.test@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.89.1.9

  mysql-test/t/func_time.test@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.61.1.1

  sql/ha_ndbcluster.cc@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.348.4.22

  sql/item_timefunc.cc@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.134.1.1

  sql/sql_acl.cc@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.213.2.1

  sql/sql_base.cc@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.351.1.1

  sql/sql_lex.h@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.243.1.1

  sql/sql_view.cc@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.101.4.6

  sql/table.cc@stripped, 2006-10-10 11:25:18+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.239.1.10

  storage/csv/ha_tina.cc@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.60.3.1

  storage/innobase/btr/btr0btr.c@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.49.1.1

  storage/innobase/buf/buf0buf.c@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.58.1.1

  storage/innobase/dict/dict0dict.c@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.88.1.1

  storage/innobase/fil/fil0fil.c@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.70.1.1

  storage/innobase/fsp/fsp0fsp.c@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.33.1.1

  storage/innobase/handler/ha_innodb.cc@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.293.3.1

  storage/innobase/include/btr0cur.ic@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.11.1.1

  storage/innobase/log/log0log.c@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.52.1.1

  storage/innobase/log/log0recv.c@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.60.1.1

  storage/innobase/os/os0file.c@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.121.1.1

  storage/innobase/row/row0mysql.c@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.133.1.1

  storage/innobase/row/row0sel.c@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.111.1.1

  storage/innobase/srv/srv0start.c@stripped, 2006-10-10 11:25:19+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.98.1.1

  storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp@stripped, 2006-10-10 11:25:20+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.83.1.2

  tests/mysql_client_test.c@stripped, 2006-10-10 11:25:20+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.215.1.1

# 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:	jonas
# Host:	perch.ndb.mysql.com
# Root:	/home/jonas/src/mysql-5.1-new-ndb/RESYNC

--- 1.252/client/mysqldump.c	2006-10-10 11:25:30 +02:00
+++ 1.253/client/mysqldump.c	2006-10-10 11:25:30 +02:00
@@ -671,13 +671,13 @@
       tty_password=1;
     break;
   case 'r':
-    if (!(md_result_file = my_fopen(argument, O_WRONLY | FILE_BINARY,
+    if (!(md_result_file= my_fopen(argument, O_WRONLY | FILE_BINARY,
                                     MYF(MY_WME))))
       exit(1);
     break;
   case 'W':
 #ifdef __WIN__
-    opt_protocol = MYSQL_PROTOCOL_PIPE;
+    opt_protocol= MYSQL_PROTOCOL_PIPE;
 #endif
     break;
   case 'N':
@@ -692,7 +692,7 @@
 #include <sslopt-case.h>
   case 'V': print_version(); exit(0);
   case 'X':
-    opt_xml = 1;
+    opt_xml= 1;
     extended_insert= opt_drop= opt_lock=
       opt_disable_keys= opt_autocommit= opt_create_db= 0;
     break;
@@ -1582,7 +1582,7 @@
   const char *insert_option;
   char	     name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
   char       table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH];
-  FILE       *sql_file = md_result_file;
+  FILE       *sql_file= md_result_file;
   int        len;
   MYSQL_RES  *result;
   MYSQL_ROW  row;
@@ -1626,7 +1626,7 @@
   opt_quoted_table= quote_name(table, table_buff2, 0);
 
   if (opt_order_by_primary)
-    order_by = primary_key_fields(result_table);
+    order_by= primary_key_fields(result_table);
 
   if (!opt_xml && !mysql_query_with_error_report(mysql, 0, query_buff))
   {
@@ -1678,7 +1678,7 @@
       field= mysql_fetch_field_direct(result, 0);
       if (strcmp(field->name, "View") == 0)
       {
-        char *scv_buff = NULL;
+        char *scv_buff= NULL;
 
         verbose_msg("-- It's a view, create dummy table for view\n");
 
@@ -1715,7 +1715,7 @@
           my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
 
           safe_exit(EX_MYSQLERR);
-          DBUG_RETURN(0); 
+          DBUG_RETURN(0);
         }
         else
           my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
@@ -2085,7 +2085,7 @@
   char       name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3];
   char       query_buff[QUERY_LENGTH];
   uint old_opt_compatible_mode=opt_compatible_mode;
-  FILE       *sql_file = md_result_file;
+  FILE       *sql_file= md_result_file;
   MYSQL_RES  *result;
   MYSQL_ROW  row;
 
@@ -2329,15 +2329,15 @@
     end= strmov(end,buff);
     if (where || order_by)
     {
-      query = alloc_query_str((ulong) ((end - query) + 1 +
+      query= alloc_query_str((ulong) ((end - query) + 1 +
                              (where ? strlen(where) + 7 : 0) +
                              (order_by ? strlen(order_by) + 10 : 0)));
-      end = strmov(query, query_buf);
+      end= strmov(query, query_buf);
 
       if (where)
-        end = strxmov(end, " WHERE ", where, NullS);
+        end= strxmov(end, " WHERE ", where, NullS);
       if (order_by)
-        end = strxmov(end, " ORDER BY ", order_by, NullS);
+        end= strxmov(end, " ORDER BY ", order_by, NullS);
     }
     if (mysql_real_query(mysql, query, (uint) (end - query)))
     {
@@ -2358,10 +2358,10 @@
                 result_table);
     if (where || order_by)
     {
-      query = alloc_query_str((ulong) (strlen(query) + 1 +
+      query= alloc_query_str((ulong) (strlen(query) + 1 +
                              (where ? strlen(where) + 7 : 0) +
                              (order_by ? strlen(order_by) + 10 : 0)));
-      end = strmov(query, query_buf);
+      end= strmov(query, query_buf);
 
       if (where)
       {
@@ -2370,7 +2370,7 @@
           fprintf(md_result_file, "-- WHERE:  %s\n", where);
           check_io(md_result_file);
         }
-        end = strxmov(end, " WHERE ", where, NullS);
+        end= strxmov(end, " WHERE ", where, NullS);
       }
       if (order_by)
       {
@@ -2379,7 +2379,7 @@
           fprintf(md_result_file, "-- ORDER BY:  %s\n", order_by);
           check_io(md_result_file);
         }
-        end = strxmov(end, " ORDER BY ", order_by, NullS);
+        end= strxmov(end, " ORDER BY ", order_by, NullS);
       }
     }
     if (!opt_xml && !opt_compact)
@@ -2455,12 +2455,12 @@
         check_io(md_result_file);
       }
 
-      for (i = 0; i < mysql_num_fields(res); i++)
+      for (i= 0; i < mysql_num_fields(res); i++)
       {
         int is_blob;
         ulong length= lengths[i];
 
-        if (!(field = mysql_fetch_field(res)))
+        if (!(field= mysql_fetch_field(res)))
         {
           my_snprintf(query, QUERY_LENGTH,
                       "%s: Not enough fields from table %s! Aborting.\n",
@@ -2532,7 +2532,7 @@
               else
               {
                 /* change any strings ("inf", "-inf", "nan") into NULL */
-                char *ptr = row[i];
+                char *ptr= row[i];
                 if (my_isalpha(charset_info, *ptr) || (*ptr == '-' &&
                     my_isalpha(charset_info, ptr[1])))
                   dynstr_append(&extended_row, "NULL");
@@ -2592,7 +2592,7 @@
             else
             {
               /* change any strings ("inf", "-inf", "nan") into NULL */
-              char *ptr = row[i];
+              char *ptr= row[i];
               if (opt_xml)
               {
                 print_xml_tag1(md_result_file, "\t\t", "field name=",
@@ -2638,10 +2638,10 @@
       {
         ulong row_length;
         dynstr_append(&extended_row,")");
-        row_length = 2 + extended_row.length;
+        row_length= 2 + extended_row.length;
         if (total_length + row_length < opt_net_buffer_length)
         {
-          total_length += row_length;
+          total_length+= row_length;
           fputc(',',md_result_file);            /* Always row break */
           fputs(extended_row.str,md_result_file);
         }
@@ -2653,7 +2653,7 @@
 
           fputs(insert_pat.str,md_result_file);
           fputs(extended_row.str,md_result_file);
-          total_length = row_length+init_length;
+          total_length= row_length+init_length;
         }
         check_io(md_result_file);
       }
@@ -2718,15 +2718,15 @@
 
 static char *getTableName(int reset)
 {
-  static MYSQL_RES *res = NULL;
+  static MYSQL_RES *res= NULL;
   MYSQL_ROW    row;
 
   if (!res)
   {
-    if (!(res = mysql_list_tables(mysql,NullS)))
+    if (!(res= mysql_list_tables(mysql,NullS)))
       return(NULL);
   }
-  if ((row = mysql_fetch_row(res)))
+  if ((row= mysql_fetch_row(res)))
     return((char*) row[0]);
 
   if (reset)
@@ -2734,7 +2734,7 @@
   else
   {
     mysql_free_result(res);
-    res = NULL;
+    res= NULL;
   }
   return(NULL);
 } /* getTableName */
@@ -2889,7 +2889,7 @@
 
   if (mysql_query_with_error_report(mysql, &tableres, "SHOW DATABASES"))
     return 1;
-  while ((row = mysql_fetch_row(tableres)))
+  while ((row= mysql_fetch_row(tableres)))
   {
     if (dump_all_tables_in_db(row[0]))
       result=1;
@@ -2897,13 +2897,13 @@
   if (seen_views)
   {
     if (mysql_query(mysql, "SHOW DATABASES") ||
-        !(tableres = mysql_store_result(mysql)))
+        !(tableres= mysql_store_result(mysql)))
     {
       my_printf_error(0, "Error: Couldn't execute 'SHOW DATABASES': %s",
                       MYF(0), mysql_error(mysql));
       return 1;
     }
-    while ((row = mysql_fetch_row(tableres)))
+    while ((row= mysql_fetch_row(tableres)))
     {
       if (dump_all_views_in_db(row[0]))
         result=1;
@@ -3349,7 +3349,7 @@
   }
   else
   {
-    row = mysql_fetch_row(master);
+    row= mysql_fetch_row(master);
     if (row && row[0] && row[1])
     {
       /* SHOW MASTER STATUS reports file and position */
@@ -3476,7 +3476,7 @@
   MYSQL_FIELD   *field;
   mysql_field_seek(result, 0);
 
-  for ( ; (field = mysql_fetch_field(result)) ; row++)
+  for ( ; (field= mysql_fetch_field(result)) ; row++)
   {
     if (!strcmp(field->name,name))
     {
@@ -3604,17 +3604,19 @@
 
 static char *primary_key_fields(const char *table_name)
 {
-  MYSQL_RES  *res = NULL;
+  MYSQL_RES  *res= NULL;
   MYSQL_ROW  row;
   /* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */
   char show_keys_buff[15 + NAME_LEN * 2 + 3];
-  uint result_length = 0;
-  char *result = 0;
+  uint result_length= 0;
+  char *result= 0;
+  char buff[NAME_LEN * 2 + 3];
+  char *quoted_field;
 
   my_snprintf(show_keys_buff, sizeof(show_keys_buff),
               "SHOW KEYS FROM %s", table_name);
   if (mysql_query(mysql, show_keys_buff) ||
-      !(res = mysql_store_result(mysql)))
+      !(res= mysql_store_result(mysql)))
   {
     fprintf(stderr, "Warning: Couldn't read keys from table %s;"
             " records are NOT sorted (%s)\n",
@@ -3629,12 +3631,14 @@
    * row, and UNIQUE keys come before others.  So we only need to check
    * the first key, not all keys.
    */
-  if ((row = mysql_fetch_row(res)) && atoi(row[1]) == 0)
+  if ((row= mysql_fetch_row(res)) && atoi(row[1]) == 0)
   {
     /* Key is unique */
     do
-      result_length += strlen(row[4]) + 1;      /* + 1 for ',' or \0 */
-    while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1);
+    {
+      quoted_field= quote_name(row[4], buff, 0);
+      result_length+= strlen(quoted_field) + 1; /* + 1 for ',' or \0 */
+    } while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1);
   }
 
   /* Build the ORDER BY clause result */
@@ -3642,17 +3646,21 @@
   {
     char *end;
     /* result (terminating \0 is already in result_length) */
-    result = my_malloc(result_length + 10, MYF(MY_WME));
+    result= my_malloc(result_length + 10, MYF(MY_WME));
     if (!result)
     {
       fprintf(stderr, "Error: Not enough memory to store ORDER BY clause\n");
       goto cleanup;
     }
     mysql_data_seek(res, 0);
-    row = mysql_fetch_row(res);
-    end = strmov(result, row[4]);
-    while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1)
-      end = strxmov(end, ",", row[4], NullS);
+    row= mysql_fetch_row(res);
+    quoted_field= quote_name(row[4], buff, 0);
+    end= strmov(result, quoted_field);
+    while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1)
+    {
+      quoted_field= quote_name(row[4], buff, 0);
+      end= strxmov(end, ",", quoted_field, NullS);
+    }
   }
 
 cleanup:
@@ -3720,7 +3728,7 @@
   char       table_buff[NAME_LEN*2+3];
   char       table_buff2[NAME_LEN*2+3];
   char       query[QUERY_LENGTH];
-  FILE       *sql_file = md_result_file;
+  FILE       *sql_file= md_result_file;
   DBUG_ENTER("get_view_structure");
 
   if (opt_no_create_info) /* Don't write table creation info */

--- 1.242/sql/table.cc	2006-10-10 11:25:30 +02:00
+++ 1.243/sql/table.cc	2006-10-10 11:25:30 +02:00
@@ -632,7 +632,7 @@
         if (!strncmp(next_chunk + 2, "partition", str_db_type_length))
         {
           /* Use partition handler */
-          share->db_type= &partition_hton;
+          share->db_type= partition_hton;
           DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)",
                               str_db_type_length, next_chunk + 2,
                               ha_legacy_type(share->db_type)));
@@ -2257,7 +2257,7 @@
 
 bool check_db_name(char *name)
 {
-  uint name_length= 0;  // name length in symbols
+  char *start= name;
   /* Used to catch empty names and names with end space */
   bool last_char_is_space= TRUE;
 
@@ -2277,15 +2277,13 @@
         name += len;
         continue;
       }
-    name_length++;
     }
 #else
     last_char_is_space= *name==' ';
 #endif
-    name_length++;
     name++;
   }
-  return last_char_is_space || name_length > NAME_LEN;
+  return last_char_is_space || (uint) (name - start) > NAME_LEN;
 }
 
 

--- 1.103/mysql-test/r/ctype_utf8.result	2006-10-10 11:25:30 +02:00
+++ 1.104/mysql-test/r/ctype_utf8.result	2006-10-10 11:25:30 +02:00
@@ -1340,19 +1340,18 @@
 a
 e
 drop table t1;
-set names utf8;
-grant select on test.* to юзер_юзер@localhost;
-user()
-юзер_юзер@localhost
-revoke all on test.* from юзер_юзер@localhost;
-drop user юзер_юзер@localhost;
-create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
-use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
-select database();
-database()
-имя_базы_в_кодировке_утф8_длиной_больше_чем_45
-drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
-use test;
+create table t1(a char(10)) default charset utf8;
+insert into t1 values ('123'), ('456');
+explain
+select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	Y	ALL	NULL	NULL	NULL	NULL	2	Using temporary; Using filesort
+1	SIMPLE	Z	ALL	NULL	NULL	NULL	NULL	2	Using where
+select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
+substr(Z.a,-1)	a
+3	123
+6	456
+drop table t1;
 CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
 INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
 SELECT id FROM t1;
@@ -1462,3 +1461,21 @@
 execute my_stmt using @a;
 a	b
 drop table if exists t1;
+CREATE TABLE t1 (
+colA int(11) NOT NULL,
+colB varchar(255) character set utf8 NOT NULL,
+PRIMARY KEY  (colA)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar');
+CREATE TABLE t2 (
+colA int(11) NOT NULL,
+colB varchar(255) character set utf8 NOT NULL,
+KEY bad  (colA,colB(3))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar');
+SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB
+WHERE t1.colA < 3;
+colA	colB	colA	colB
+1	foo	1	foo
+2	foo bar	2	foo bar
+DROP TABLE t1, t2;

--- 1.92/mysql-test/t/ctype_utf8.test	2006-10-10 11:25:30 +02:00
+++ 1.93/mysql-test/t/ctype_utf8.test	2006-10-10 11:25:30 +02:00
@@ -1070,21 +1070,15 @@
 drop table t1;
 
 #
-# Bug#20393: User name truncation in mysql client
-# Bug#21432: Database/Table name limited to 64 bytes, not chars, problems with multi-byte
+# Bug #20204: "order by" changes the results returned
 #
-set names utf8;
-#create user юзер_юзер@localhost;
-grant select on test.* to юзер_юзер@localhost;
---exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
-revoke all on test.* from юзер_юзер@localhost;
-drop user юзер_юзер@localhost;
-
-create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
-use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
-select database();
-drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
-use test;
+
+create table t1(a char(10)) default charset utf8;
+insert into t1 values ('123'), ('456');
+explain
+  select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
+select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
+drop table t1;
 
 # End of 4.1 tests
 
@@ -1164,3 +1158,23 @@
 set @a:=null;
 execute my_stmt using @a;
 drop table if exists t1;
+
+#
+# Bug#19960: Inconsistent results when joining
+# InnoDB tables using partial UTF8 indexes
+#
+CREATE TABLE t1 (
+  colA int(11) NOT NULL,
+  colB varchar(255) character set utf8 NOT NULL,
+   PRIMARY KEY  (colA)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar');
+CREATE TABLE t2 (
+  colA int(11) NOT NULL,
+  colB varchar(255) character set utf8 NOT NULL,
+   KEY bad  (colA,colB(3))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar');
+SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB
+WHERE t1.colA < 3;
+DROP TABLE t1, t2;

--- 1.109/sql/sql_view.cc	2006-10-10 11:25:30 +02:00
+++ 1.110/sql/sql_view.cc	2006-10-10 11:25:30 +02:00
@@ -1603,7 +1603,7 @@
       list->push_back(fld);
     else
     {
-      my_error(ER_NON_UPDATABLE_TABLE, MYF(0), view->alias, "INSERT");
+      my_error(ER_NON_INSERTABLE_TABLE, MYF(0), view->alias, "INSERT");
       DBUG_RETURN(TRUE);
     }
   }

--- 1.84/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2006-10-10 11:25:30 +02:00
+++ 1.85/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2006-10-10 11:25:30 +02:00
@@ -1305,9 +1305,9 @@
       if (isMaster()) {
 	jam();
 	systemRestartTakeOverLab(signal);
-	if (anyActiveTakeOver() && false) {
+	if (anyActiveTakeOver())
+	{
 	  jam();
-	  ndbout_c("1 - anyActiveTakeOver == true");
 	  return;
 	}
       }
@@ -2347,6 +2347,8 @@
 	// NOT ACTIVE NODES THAT HAVE NOT YET BEEN TAKEN OVER NEEDS TAKE OVER
 	// IMMEDIATELY. IF WE ARE ALIVE WE TAKE OVER OUR OWN NODE.
 	/*-------------------------------------------------------------------*/
+	infoEvent("Take over of node %d started", 
+		  nodePtr.i);
 	startTakeOver(signal, RNIL, nodePtr.i, nodePtr.i);
       }//if
       break;
@@ -2459,6 +2461,12 @@
      *--------------------------------------------------------------------*/
     Uint32 takeOverNode = Sysfile::getTakeOverNode(startNodeId, 
 						   SYSFILE->takeOver);
+    if(takeOverNode == 0){
+      jam();
+      warningEvent("Bug in take-over code restarting");
+      takeOverNode = startNodeId;
+    }
+
     startTakeOver(signal, RNIL, startNodeId, takeOverNode);
     break;
   }
@@ -2612,7 +2620,14 @@
   Sysfile::setTakeOverNode(takeOverPtr.p->toFailedNode, SYSFILE->takeOver,
 			   startNode);
   takeOverPtr.p->toMasterStatus = TakeOverRecord::TO_START_COPY;
-  
+
+  if (getNodeState().getSystemRestartInProgress())
+  {
+    jam();
+    checkToCopy();
+    checkToCopyCompleted(signal);
+    return;
+  }
   cstartGcpNow = true;
 }//Dbdih::startTakeOver()
 
@@ -3264,7 +3279,10 @@
     copyFragReq->schemaVersion = tabPtr.p->schemaVersion;
     copyFragReq->distributionKey = fragPtr.p->distributionKey;
     copyFragReq->gci = gci;
-    sendSignal(ref, GSN_COPY_FRAGREQ, signal, CopyFragReq::SignalLength, JBB);
+    copyFragReq->nodeCount = extractNodeInfo(fragPtr.p, 
+					     copyFragReq->nodeList);
+    sendSignal(ref, GSN_COPY_FRAGREQ, signal, 
+	       CopyFragReq::SignalLength +  copyFragReq->nodeCount, JBB);
   } else {
     ndbrequire(takeOverPtr.p->toMasterStatus == TakeOverRecord::COMMIT_CREATE);
     jam();
@@ -3514,6 +3532,18 @@
   signal->theData[1] = takeOverPtr.p->toStartingNode;
   sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
 
+  if (getNodeState().getSystemRestartInProgress())
+  {
+    jam();
+    infoEvent("Take over of node %d complete", takeOverPtr.p->toStartingNode);
+    setNodeActiveStatus(takeOverPtr.p->toStartingNode, Sysfile::NS_Active);
+    takeOverPtr.p->toMasterStatus = TakeOverRecord::WAIT_LCP;
+    takeOverCompleted(takeOverPtr.p->toStartingNode);
+    checkToCopy();
+    checkToCopyCompleted(signal);
+    return;
+  }
+  
   c_lcpState.immediateLcpStart = true;
   takeOverPtr.p->toMasterStatus = TakeOverRecord::WAIT_LCP;
   
@@ -3620,16 +3650,12 @@
   }//if
   endTakeOver(takeOverPtr.i);
 
-  ndbout_c("2 - endTakeOver");
   if (cstartPhase == ZNDB_SPH4) {
     jam();
-    ndbrequire(false);
     if (anyActiveTakeOver()) {
       jam();
-      ndbout_c("4 - anyActiveTakeOver == true");
       return;
     }//if
-    ndbout_c("5 - anyActiveTakeOver == false -> ndbsttorry10Lab");
     ndbsttorry10Lab(signal, __LINE__);
     return;
   }//if
@@ -6699,7 +6725,13 @@
         }
       }
     }
-    ndbrequire(count == (2U + (1 + noOfReplicas) * noOfFragments)); 
+    if(count != (2U + (1 + noOfReplicas) * noOfFragments)){
+        char buf[255];
+        BaseString::snprintf(buf, sizeof(buf),
+                           "Illegal configuration change: NoOfReplicas."
+                           " Can't be applied online ");
+        progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
+    }
     
     CreateFragmentationConf * const conf = 
       (CreateFragmentationConf*)signal->getDataPtrSend();
@@ -10017,73 +10049,84 @@
       nodePtr.i = replicaPtr.p->procNode;
       ptrCheckGuard(nodePtr, MAX_NDB_NODES, nodeRecord);
       
-      if (replicaPtr.p->lcpOngoingFlag &&
-          replicaPtr.p->lcpIdStarted < lcpId) {
-        jam();
-	//-------------------------------------------------------------------
-	// We have found a replica on a node that performs local checkpoint
-	// that is alive and that have not yet been started.
-	//-------------------------------------------------------------------
-
-        if (nodePtr.p->noOfStartedChkpt < 2) {
-          jam();
-	  /**
-	   * Send LCP_FRAG_ORD to LQH
-	   */
-	  
-	  /**
-	   * Mark the replica so with lcpIdStarted == true
-	   */
-          replicaPtr.p->lcpIdStarted = lcpId;
-
-          Uint32 i = nodePtr.p->noOfStartedChkpt;
-          nodePtr.p->startedChkpt[i].tableId = tabPtr.i;
-          nodePtr.p->startedChkpt[i].fragId = curr.fragmentId;
-          nodePtr.p->startedChkpt[i].replicaPtr = replicaPtr.i;
-          nodePtr.p->noOfStartedChkpt = i + 1;
-
-	  sendLCP_FRAG_ORD(signal, nodePtr.p->startedChkpt[i]);
-        } else if (nodePtr.p->noOfQueuedChkpt < 2) {
-          jam();
-	  /**
-	   * Put LCP_FRAG_ORD "in queue"
-	   */
-	  
-	  /**
-	   * Mark the replica so with lcpIdStarted == true
-	   */
-          replicaPtr.p->lcpIdStarted = lcpId;
+      if (c_lcpState.m_participatingLQH.get(nodePtr.i))
+      {
+	if (replicaPtr.p->lcpOngoingFlag &&
+	    replicaPtr.p->lcpIdStarted < lcpId) 
+	{
+	  jam();
+	  //-------------------------------------------------------------------
+	  // We have found a replica on a node that performs local checkpoint
+	  // that is alive and that have not yet been started.
+	  //-------------------------------------------------------------------
 	  
-          Uint32 i = nodePtr.p->noOfQueuedChkpt;
-          nodePtr.p->queuedChkpt[i].tableId = tabPtr.i;
-          nodePtr.p->queuedChkpt[i].fragId = curr.fragmentId;
-          nodePtr.p->queuedChkpt[i].replicaPtr = replicaPtr.i;
-          nodePtr.p->noOfQueuedChkpt = i + 1;
-        } else {
-          jam();
+	  if (nodePtr.p->noOfStartedChkpt < 2) 
+	  {
+	    jam();
+	    /**
+	     * Send LCP_FRAG_ORD to LQH
+	     */
+	    
+	    /**
+	     * Mark the replica so with lcpIdStarted == true
+	     */
+	    replicaPtr.p->lcpIdStarted = lcpId;
 
-	  if(save){
+	    Uint32 i = nodePtr.p->noOfStartedChkpt;
+	    nodePtr.p->startedChkpt[i].tableId = tabPtr.i;
+	    nodePtr.p->startedChkpt[i].fragId = curr.fragmentId;
+	    nodePtr.p->startedChkpt[i].replicaPtr = replicaPtr.i;
+	    nodePtr.p->noOfStartedChkpt = i + 1;
+	    
+	    sendLCP_FRAG_ORD(signal, nodePtr.p->startedChkpt[i]);
+	  } 
+	  else if (nodePtr.p->noOfQueuedChkpt < 2) 
+	  {
+	    jam();
 	    /**
-	     * Stop increasing value on first that was "full"
+	     * Put LCP_FRAG_ORD "in queue"
 	     */
-	    c_lcpState.currentFragment = curr;
-	    save = false;
-	  }
-	  
-	  busyNodes.set(nodePtr.i);
-	  if(busyNodes.count() == lcpNodes){
+	    
 	    /**
-	     * There were no possibility to start the local checkpoint 
-	     * and it was not possible to queue it up. In this case we 
-	     * stop the start of local checkpoints until the nodes with a 
-	     * backlog have performed more checkpoints. We will return and 
-	     * will not continue the process of starting any more checkpoints.
+	     * Mark the replica so with lcpIdStarted == true
 	     */
-	    return;
+	    replicaPtr.p->lcpIdStarted = lcpId;
+	    
+	    Uint32 i = nodePtr.p->noOfQueuedChkpt;
+	    nodePtr.p->queuedChkpt[i].tableId = tabPtr.i;
+	    nodePtr.p->queuedChkpt[i].fragId = curr.fragmentId;
+	    nodePtr.p->queuedChkpt[i].replicaPtr = replicaPtr.i;
+	    nodePtr.p->noOfQueuedChkpt = i + 1;
+	  } 
+	  else 
+	  {
+	    jam();
+	    
+	    if(save)
+	    {
+	      /**
+	       * Stop increasing value on first that was "full"
+	       */
+	      c_lcpState.currentFragment = curr;
+	      save = false;
+	    }
+	    
+	    busyNodes.set(nodePtr.i);
+	    if(busyNodes.count() == lcpNodes)
+	    {
+	      /**
+	       * There were no possibility to start the local checkpoint 
+	       * and it was not possible to queue it up. In this case we 
+	       * stop the start of local checkpoints until the nodes with a 
+	       * backlog have performed more checkpoints. We will return and 
+	       * will not continue the process of starting any more checkpoints.
+	       */
+	      return;
+	    }//if
 	  }//if
-	}//if
-      }
-    }//while
+	}
+      }//while
+    }
     curr.fragmentId++;
     if (curr.fragmentId >= tabPtr.p->totalfragments) {
       jam();

--- 1.357/sql/ha_ndbcluster.cc	2006-10-10 11:25:30 +02:00
+++ 1.358/sql/ha_ndbcluster.cc	2006-10-10 11:25:30 +02:00
@@ -74,18 +74,26 @@
 
 static uint ndbcluster_partition_flags();
 static uint ndbcluster_alter_table_flags(uint flags);
-static int ndbcluster_init(void);
-static int ndbcluster_end(ha_panic_function flag);
-static bool ndbcluster_show_status(THD*,stat_print_fn *,enum ha_stat_type);
-static int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info);
-static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond);
+static int ndbcluster_init(void *);
+static int ndbcluster_end(handlerton *hton, ha_panic_function flag);
+static bool ndbcluster_show_status(handlerton *hton, THD*,
+                                   stat_print_fn *,
+                                   enum ha_stat_type);
+static int ndbcluster_alter_tablespace(handlerton *hton,
+                                       THD* thd, 
+                                       st_alter_tablespace *info);
+static int ndbcluster_fill_files_table(handlerton *hton,
+                                       THD *thd, 
+                                       TABLE_LIST *tables, 
+                                       COND *cond);
 
-handlerton ndbcluster_hton;
+handlerton *ndbcluster_hton;
 
-static handler *ndbcluster_create_handler(TABLE_SHARE *table,
+static handler *ndbcluster_create_handler(handlerton *hton,
+                                          TABLE_SHARE *table,
                                           MEM_ROOT *mem_root)
 {
-  return new (mem_root) ha_ndbcluster(table);
+  return new (mem_root) ha_ndbcluster(hton, table);
 }
 
 static uint ndbcluster_partition_flags()
@@ -2508,9 +2516,11 @@
     if (has_auto_increment) 
     {
       THD *thd= table->in_use;
+      int error;
 
       m_skip_auto_increment= FALSE;
-      update_auto_increment();
+      if ((error= update_auto_increment()))
+        DBUG_RETURN(error);
       m_skip_auto_increment= (insert_id_for_cur_row == 0);
     }
   }
@@ -4034,7 +4044,7 @@
         thd_ndb->init_open_tables();
         thd_ndb->stmt= trans;
 	thd_ndb->query_state&= NDB_QUERY_NORMAL;
-        trans_register_ha(thd, FALSE, &ndbcluster_hton);
+        trans_register_ha(thd, FALSE, ndbcluster_hton);
       } 
       else 
       { 
@@ -4050,7 +4060,7 @@
           thd_ndb->init_open_tables();
           thd_ndb->all= trans; 
 	  thd_ndb->query_state&= NDB_QUERY_NORMAL;
-          trans_register_ha(thd, TRUE, &ndbcluster_hton);
+          trans_register_ha(thd, TRUE, ndbcluster_hton);
 
           /*
             If this is the start of a LOCK TABLE, a table look 
@@ -4204,7 +4214,7 @@
       ERR_RETURN(ndb->getNdbError());
     no_uncommitted_rows_reset(thd);
     thd_ndb->stmt= trans;
-    trans_register_ha(thd, FALSE, &ndbcluster_hton);
+    trans_register_ha(thd, FALSE, ndbcluster_hton);
   }
   thd_ndb->query_state&= NDB_QUERY_NORMAL;
   m_active_trans= trans;
@@ -4221,7 +4231,7 @@
   Commit a transaction started in NDB
  */
 
-static int ndbcluster_commit(THD *thd, bool all)
+static int ndbcluster_commit(handlerton *hton, THD *thd, bool all)
 {
   int res= 0;
   Thd_ndb *thd_ndb= get_thd_ndb(thd);
@@ -4272,7 +4282,7 @@
   Rollback a transaction started in NDB
  */
 
-static int ndbcluster_rollback(THD *thd, bool all)
+static int ndbcluster_rollback(handlerton *hton, THD *thd, bool all)
 {
   int res= 0;
   Thd_ndb *thd_ndb= get_thd_ndb(thd);
@@ -5572,8 +5582,8 @@
                 HA_HAS_OWN_BINLOGGING | \
                 HA_HAS_RECORDS
 
-ha_ndbcluster::ha_ndbcluster(TABLE_SHARE *table_arg):
-  handler(&ndbcluster_hton, table_arg),
+ha_ndbcluster::ha_ndbcluster(handlerton *hton, TABLE_SHARE *table_arg):
+  handler(hton, table_arg),
   m_active_trans(NULL),
   m_active_cursor(NULL),
   m_table(NULL),
@@ -5836,7 +5846,7 @@
 }
 
 
-static int ndbcluster_close_connection(THD *thd)
+static int ndbcluster_close_connection(handlerton *hton, THD *thd)
 {
   Thd_ndb *thd_ndb= get_thd_ndb(thd);
   DBUG_ENTER("ndbcluster_close_connection");
@@ -5853,8 +5863,10 @@
   Try to discover one table from NDB
  */
 
-int ndbcluster_discover(THD* thd, const char *db, const char *name,
-                        const void** frmblob, uint* frmlen)
+int ndbcluster_discover(handlerton *hton, THD* thd, const char *db, 
+                        const char *name,
+                        const void** frmblob, 
+                        uint* frmlen)
 {
   int error= 0;
   NdbError ndb_error;
@@ -5934,7 +5946,8 @@
 
  */
 
-int ndbcluster_table_exists_in_engine(THD* thd, const char *db,
+int ndbcluster_table_exists_in_engine(handlerton *hton, THD* thd, 
+                                      const char *db,
                                       const char *name)
 {
   Ndb* ndb;
@@ -6034,7 +6047,7 @@
   DBUG_RETURN(ret);      
 }
 
-static void ndbcluster_drop_database(char *path)
+static void ndbcluster_drop_database(handlerton *hton, char *path)
 {
   THD *thd= current_thd;
   DBUG_ENTER("ndbcluster_drop_database");
@@ -6195,7 +6208,9 @@
   DBUG_RETURN(-(skipped + unhandled));
 }
 
-int ndbcluster_find_files(THD *thd,const char *db,const char *path,
+int ndbcluster_find_files(handlerton *hton, THD *thd,
+                          const char *db,
+                          const char *path,
                           const char *wild, bool dir, List<char> *files)
 {
   DBUG_ENTER("ndbcluster_find_files");
@@ -6305,7 +6320,7 @@
     DBUG_PRINT("info", ("%s existed on disk", name));     
     // The .ndb file exists on disk, but it's not in list of tables in ndb
     // Verify that handler agrees table is gone.
-    if (ndbcluster_table_exists_in_engine(thd, db, file_name) == 0)    
+    if (ndbcluster_table_exists_in_engine(hton, thd, db, file_name) == 0)    
     {
       DBUG_PRINT("info", ("NDB says %s does not exists", file_name));     
       it.remove();
@@ -6416,35 +6431,36 @@
 
 extern int ndb_dictionary_is_mysqld;
 
-static int ndbcluster_init()
+static int ndbcluster_init(void *p)
 {
   int res;
   DBUG_ENTER("ndbcluster_init");
 
   ndb_dictionary_is_mysqld= 1;
+  ndbcluster_hton= (handlerton *)p;
 
   {
-    handlerton &h= ndbcluster_hton;
-    h.state=            have_ndbcluster;
-    h.db_type=          DB_TYPE_NDBCLUSTER;
-    h.close_connection= ndbcluster_close_connection;
-    h.commit=           ndbcluster_commit;
-    h.rollback=         ndbcluster_rollback;
-    h.create=           ndbcluster_create_handler; /* Create a new handler */
-    h.drop_database=    ndbcluster_drop_database;  /* Drop a database */
-    h.panic=            ndbcluster_end;            /* Panic call */
-    h.show_status=      ndbcluster_show_status;    /* Show status */
-    h.alter_tablespace= ndbcluster_alter_tablespace;    /* Show status */
-    h.partition_flags=  ndbcluster_partition_flags; /* Partition flags */
-    h.alter_table_flags=ndbcluster_alter_table_flags; /* Alter table flags */
-    h.fill_files_table= ndbcluster_fill_files_table;
+    handlerton *h= ndbcluster_hton;
+    h->state=            have_ndbcluster;
+    h->db_type=          DB_TYPE_NDBCLUSTER;
+    h->close_connection= ndbcluster_close_connection;
+    h->commit=           ndbcluster_commit;
+    h->rollback=         ndbcluster_rollback;
+    h->create=           ndbcluster_create_handler; /* Create a new handler */
+    h->drop_database=    ndbcluster_drop_database;  /* Drop a database */
+    h->panic=            ndbcluster_end;            /* Panic call */
+    h->show_status=      ndbcluster_show_status;    /* Show status */
+    h->alter_tablespace= ndbcluster_alter_tablespace;    /* Show status */
+    h->partition_flags=  ndbcluster_partition_flags; /* Partition flags */
+    h->alter_table_flags=ndbcluster_alter_table_flags; /* Alter table flags */
+    h->fill_files_table= ndbcluster_fill_files_table;
 #ifdef HAVE_NDB_BINLOG
     ndbcluster_binlog_init_handlerton();
 #endif
-    h.flags=            HTON_CAN_RECREATE | HTON_TEMPORARY_NOT_SUPPORTED;
-    h.discover=         ndbcluster_discover;
-    h.find_files= ndbcluster_find_files;
-    h.table_exists_in_engine= ndbcluster_table_exists_in_engine;
+    h->flags=            HTON_CAN_RECREATE | HTON_TEMPORARY_NOT_SUPPORTED;
+    h->discover=         ndbcluster_discover;
+    h->find_files= ndbcluster_find_files;
+    h->table_exists_in_engine= ndbcluster_table_exists_in_engine;
   }
 
   if (have_ndbcluster != SHOW_OPTION_YES)
@@ -6553,10 +6569,12 @@
     delete g_ndb_cluster_connection;
   g_ndb_cluster_connection= NULL;
   have_ndbcluster= SHOW_OPTION_DISABLED;	// If we couldn't use handler
+  ndbcluster_hton->state= SHOW_OPTION_DISABLED;               // If we couldn't use handler
+
   DBUG_RETURN(TRUE);
 }
 
-static int ndbcluster_end(ha_panic_function type)
+static int ndbcluster_end(handlerton *hton, ha_panic_function type)
 {
   DBUG_ENTER("ndbcluster_end");
 
@@ -6640,7 +6658,7 @@
   share.db.length= 0;
   share.table_name.str= (char *) tab_name;
   share.table_name.length= strlen(tab_name);
-  ha_ndbcluster error_handler(&share);
+  ha_ndbcluster error_handler(ndbcluster_hton, &share);
   error_handler.print_error(error, MYF(0));
   DBUG_VOID_RETURN;
 }
@@ -8157,7 +8175,7 @@
     Wait for cluster to start
   */
   pthread_mutex_lock(&LOCK_ndb_util_thread);
-  while (!ndb_cluster_node_id && (ndbcluster_hton.slot != ~(uint)0))
+  while (!ndb_cluster_node_id && (ndbcluster_hton->slot != ~(uint)0))
   {
     /* ndb not connected yet */
     set_timespec(abstime, 1);
@@ -9720,7 +9738,7 @@
   Implements the SHOW NDB STATUS command.
 */
 bool
-ndbcluster_show_status(THD* thd, stat_print_fn *stat_print,
+ndbcluster_show_status(handlerton *hton, THD* thd, stat_print_fn *stat_print,
                        enum ha_stat_type stat_type)
 {
   char buf[IO_SIZE];
@@ -10184,7 +10202,7 @@
   return false;
 }
 
-int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
+int ndbcluster_alter_tablespace(handlerton *hton, THD* thd, st_alter_tablespace *info)
 {
   DBUG_ENTER("ha_ndbcluster::alter_tablespace");
 
@@ -10445,7 +10463,9 @@
   DBUG_RETURN(TRUE);
 }
 
-static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables,
+static int ndbcluster_fill_files_table(handlerton *hton, 
+                                       THD *thd, 
+                                       TABLE_LIST *tables,
                                        COND *cond)
 {
   TABLE* table= tables->table;
@@ -10766,7 +10786,7 @@
 };
 
 struct st_mysql_storage_engine ndbcluster_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION, &ndbcluster_hton };
+{ MYSQL_HANDLERTON_INTERFACE_VERSION };
 
 mysql_declare_plugin(ndbcluster)
 {
@@ -10775,6 +10795,7 @@
   ndbcluster_hton_name,
   "MySQL AB",
   "Clustered, fault-tolerant tables",
+  PLUGIN_LICENSE_GPL,
   ndbcluster_init, /* Plugin Init */
   NULL, /* Plugin Deinit */
   0x0100 /* 1.0 */,
Thread
bk commit into 5.1 tree (jonas:1.2305)jonas10 Oct