List:Commits« Previous MessageNext Message »
From:Martin Skold Date:November 10 2006 11:39am
Subject:bk commit into 5.1 tree (mskold:1.2319)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of marty. When marty 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-10 11:38:54+01:00, mskold@stripped +5 -0
  Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.1
  into  mysql.com:/windows/Linux_space/MySQL/mysql-5.1-new-ndb
  MERGE: 1.2303.36.15

  client/mysqldump.c@stripped, 2006-11-10 11:29:00+01:00, mskold@stripped +0 -0
    Auto merged
    MERGE: 1.252.1.7

  sql/ha_ndbcluster.cc@stripped, 2006-11-10 11:29:00+01:00, mskold@stripped +0 -0
    Auto merged
    MERGE: 1.357.1.13

  sql/sql_class.h@stripped, 2006-11-10 11:38:50+01:00, mskold@stripped +0 -3
    Fixed indentation
    MERGE: 1.320.4.1

  sql/sql_show.cc@stripped, 2006-11-10 11:29:01+01:00, mskold@stripped +0 -0
    Auto merged
    MERGE: 1.366.1.4

  storage/ndb/src/ndbapi/NdbTransaction.cpp@stripped, 2006-11-10 11:29:01+01:00,
mskold@stripped +0 -0
    Auto merged
    MERGE: 1.64.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:	mskold
# Host:	linux.site
# Root:	/windows/Linux_space/MySQL/mysql-5.1-new-ndb/RESYNC

--- 1.257/client/mysqldump.c	2006-11-10 11:39:03 +01:00
+++ 1.258/client/mysqldump.c	2006-11-10 11:39:03 +01:00
@@ -45,6 +45,7 @@
 #include <m_string.h>
 #include <m_ctype.h>
 #include <hash.h>
+#include <stdarg.h>
 
 #include "client_priv.h"
 #include "mysql.h"
@@ -544,6 +545,8 @@ static void write_header(FILE *sql_file,
   if (opt_xml)
   {
     fputs("<?xml version=\"1.0\"?>\n", sql_file);
+    /* Schema reference.  Allows use of xsi:nil for NULL values and 
+       xsi:type to define an element's data type. */
     fputs("<mysqldump ", sql_file);
     fputs("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"",
           sql_file);
@@ -1144,7 +1147,7 @@ static char *quote_for_like(const char *
 
   SYNOPSIS
     print_quoted_xml()
-    output      - output file
+    xml_file    - output file
     str         - string to print
     len         - its length
 
@@ -1181,34 +1184,63 @@ static void print_quoted_xml(FILE *xml_f
 
 
 /*
-  Print xml tag with one attribute.
+  Print xml tag. Optionally add attribute(s).
 
   SYNOPSIS
-    print_xml_tag1()
-    xml_file    - output file
-    sbeg        - line beginning
-    stag_atr    - tag and attribute
-    sval        - value of attribute
-    send        - line ending
+    print_xml_tag(xml_file, sbeg, send, tag_name, first_attribute_name, 
+                    ..., attribute_name_n, attribute_value_n, NullS)
+    xml_file              - output file
+    sbeg                  - line beginning
+    send                  - line ending
+    tag_name              - XML tag name.
+    first_attribute_name  - tag and first attribute
+    first_attribute_value - (Implied) value of first attribute
+    attribute_name_n      - attribute n
+    attribute_value_n     - value of attribute n
 
   DESCRIPTION
-    Print tag with one attribute to the xml_file. Format is:
-      sbeg<stag_atr="sval">send
+    Print XML tag with any number of attribute="value" pairs to the xml_file.
+
+    Format is:
+      sbeg<tag_name first_attribute_name="first_attribute_value" ... 
+      attribute_name_n="attribute_value_n">send
   NOTE
-    sval MUST be a NULL terminated string.
-    sval string will be qouted before output.
+    Additional arguments must be present in attribute/value pairs.
+    The last argument should be the null character pointer.
+    All attribute_value arguments MUST be NULL terminated strings.
+    All attribute_value arguments will be quoted before output.
 */
 
-static void print_xml_tag1(FILE * xml_file, const char* sbeg,
-                           const char* stag_atr, const char* sval,
-                           const char* send)
+static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send, 
+                          const char* tag_name, 
+                          const char* first_attribute_name, ...)
 {
+  va_list arg_list;
+  const char *attribute_name, *attribute_value;
+
   fputs(sbeg, xml_file);
-  fputs("<", xml_file);
-  fputs(stag_atr, xml_file);
-  fputs("\"", xml_file);
-  print_quoted_xml(xml_file, sval, strlen(sval));
-  fputs("\">", xml_file);
+  fputc('<', xml_file);
+  fputs(tag_name, xml_file);  
+
+  va_start(arg_list, first_attribute_name);
+  attribute_name= first_attribute_name;
+  while (attribute_name != NullS)
+  {
+    attribute_value= va_arg(arg_list, char *);
+    DBUG_ASSERT(attribute_value != NullS);
+
+    fputc(' ', xml_file);
+    fputs(attribute_name, xml_file);    
+    fputc('\"', xml_file);
+    
+    print_quoted_xml(xml_file, attribute_value, strlen(attribute_value));
+    fputc('\"', xml_file);
+
+    attribute_name= va_arg(arg_list, char *);
+  }
+  va_end(arg_list);
+
+  fputc('>', xml_file);
   fputs(send, xml_file);
   check_io(xml_file);
 }
@@ -1419,6 +1451,28 @@ static uint dump_events_for_db(char *db)
 
 
 /*
+  Print hex value for blob data.
+
+  SYNOPSIS
+    print_blob_as_hex()
+    output_file         - output file
+    str                 - string to print
+    len                 - its length
+
+  DESCRIPTION
+    Print hex value for blob data.
+*/
+
+static void print_blob_as_hex(FILE *output_file, const char *str, ulong len)
+{
+    /* sakaik got the idea to to provide blob's in hex notation. */
+    const char *ptr= str, *end= ptr + len;
+    for (; ptr < end ; ptr++)
+      fprintf(output_file, "%02X", *((uchar *)ptr));
+    check_io(output_file);
+}
+
+/*
   dump_routines_for_db
   -- retrieves list of routines for a given db, and prints out
   the CREATE PROCEDURE definition into the output (the dump).
@@ -1865,7 +1919,8 @@ static uint get_table_structure(char *ta
       if (!opt_xml)
         fprintf(sql_file, "CREATE TABLE %s (\n", result_table);
       else
-        print_xml_tag1(sql_file, "\t", "table_structure name=", table, "\n");
+        print_xml_tag(sql_file, "\t", "\n", "table_structure", "name=", table, 
+                NullS);
       check_io(sql_file);
     }
 
@@ -2437,8 +2492,8 @@ static void dump_table(char *table, char
     rownr=0;
     init_length=(uint) insert_pat.length+4;
     if (opt_xml)
-      print_xml_tag1(md_result_file, "\t", "table_data name=", table, "\n");
-
+      print_xml_tag(md_result_file, "\t", "\n", "table_data", "name=", table,
+              NullS);
     if (opt_autocommit)
     {
       fprintf(md_result_file, "set autocommit=0;\n");
@@ -2492,7 +2547,7 @@ static void dump_table(char *table, char
                    field->type == MYSQL_TYPE_LONG_BLOB ||
                    field->type == MYSQL_TYPE_MEDIUM_BLOB ||
                    field->type == MYSQL_TYPE_TINY_BLOB)) ? 1 : 0;
-        if (extended_insert)
+        if (extended_insert && !opt_xml)
         {
           if (i == 0)
             dynstr_set(&extended_row,"(");
@@ -2581,18 +2636,25 @@ static void dump_table(char *table, char
             {
               if (opt_xml)
               {
-                print_xml_tag1(md_result_file, "\t\t", "field name=",
-                              field->name, "");
-                print_quoted_xml(md_result_file, row[i], length);
+                if (opt_hex_blob && is_blob && length)
+                {
+                    /* Define xsi:type="xs:hexBinary" for hex encoded data */
+                    print_xml_tag(md_result_file, "\t\t", "", "field", "name=",
+                            field->name, "xsi:type=", "xs:hexBinary", NullS);
+                    print_blob_as_hex(md_result_file, row[i], length);
+                }
+                else
+                {
+                    print_xml_tag(md_result_file, "\t\t", "", "field", "name=", 
+                            field->name, NullS);
+                    print_quoted_xml(md_result_file, row[i], length);
+                }
                 fputs("</field>\n", md_result_file);
               }
               else if (opt_hex_blob && is_blob && length)
               {
-                /* sakaik got the idea to to provide blob's in hex notation. */
-                char *ptr= row[i], *end= ptr + length;
                 fputs("0x", md_result_file);
-                for (; ptr < end ; ptr++)
-                  fprintf(md_result_file, "%02X", *((uchar *)ptr));
+                print_blob_as_hex(md_result_file, row[i], length);
               }
               else
                 unescape(md_result_file, row[i], length);
@@ -2603,8 +2665,8 @@ static void dump_table(char *table, char
               char *ptr= row[i];
               if (opt_xml)
               {
-                print_xml_tag1(md_result_file, "\t\t", "field name=",
-                               field->name, "");
+                print_xml_tag(md_result_file, "\t\t", "", "field", "name=",
+                        field->name, NullS);
                 fputs(!my_isalpha(charset_info, *ptr) ? ptr: "NULL",
                       md_result_file);
                 fputs("</field>\n", md_result_file);
@@ -3187,7 +3249,7 @@ static int dump_all_tables_in_db(char *d
   if (init_dumping(database, init_dumping_tables))
     return 1;
   if (opt_xml)
-    print_xml_tag1(md_result_file, "", "database name=", database, "\n");
+    print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
   if (lock_tables)
   {
     DYNAMIC_STRING query;
@@ -3270,7 +3332,7 @@ static my_bool dump_all_views_in_db(char
   if (init_dumping(database, init_dumping_views))
     return 1;
   if (opt_xml)
-    print_xml_tag1(md_result_file, "", "database name=", database, "\n");
+    print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
   if (lock_tables)
   {
     DYNAMIC_STRING query;
@@ -3409,7 +3471,7 @@ static int dump_selected_tables(char *db
      /* We shall countinue here, if --force was given */
   }
   if (opt_xml)
-    print_xml_tag1(md_result_file, "", "database name=", db, "\n");
+    print_xml_tag(md_result_file, "", "\n", "database", "name=", db, NullS);
 
   /* Dump each selected table */
   for (pos= dump_tables; pos < end; pos++)
@@ -3522,7 +3584,7 @@ static int do_reset_master(MYSQL *mysql_
 }
 
 
-static int start_transaction(MYSQL *mysql_con, my_bool consistent_read_now)
+static int start_transaction(MYSQL *mysql_con)
 {
   /*
     We use BEGIN for old servers. --single-transaction --master-data will fail
@@ -3537,10 +3599,8 @@ static int start_transaction(MYSQL *mysq
                                         "SET SESSION TRANSACTION ISOLATION "
                                         "LEVEL REPEATABLE READ") ||
           mysql_query_with_error_report(mysql_con, 0,
-                                        consistent_read_now ?
                                         "START TRANSACTION "
-                                        "WITH CONSISTENT SNAPSHOT" :
-                                        "BEGIN"));
+                                        "/*!40100 WITH CONSISTENT SNAPSHOT */"));
 }
 
 
@@ -4030,7 +4090,7 @@ int main(int argc, char **argv)
   if ((opt_lock_all_tables || opt_master_data) &&
       do_flush_tables_read_lock(mysql))
     goto err;
-  if (opt_single_transaction && start_transaction(mysql, test(opt_master_data)))
+  if (opt_single_transaction && start_transaction(mysql))
       goto err;
   if (opt_delete_master_logs && do_reset_master(mysql))
     goto err;

--- 1.373/sql/sql_show.cc	2006-11-10 11:39:03 +01:00
+++ 1.374/sql/sql_show.cc	2006-11-10 11:39:03 +01:00
@@ -3916,10 +3916,12 @@ static void collect_partition_expr(List<
 }
 
 
-static void store_schema_partitions_record(THD *thd, TABLE *table,
+static void store_schema_partitions_record(THD *thd, TABLE *schema_table,
+                                           TABLE *showing_table,
                                            partition_element *part_elem,
                                            handler *file, uint part_id)
 {
+  TABLE* table= schema_table;
   CHARSET_INFO *cs= system_charset_info;
   PARTITION_INFO stat_info;
   TIME time;
@@ -3970,11 +3972,22 @@ static void store_schema_partitions_reco
       table->field[23]->store((longlong) part_elem->nodegroup_id, TRUE);
     else
       table->field[23]->store(STRING_WITH_LEN("default"), cs);
+
+    table->field[24]->set_notnull();
     if (part_elem->tablespace_name)
       table->field[24]->store(part_elem->tablespace_name,
                               strlen(part_elem->tablespace_name), cs);
     else
-      table->field[24]->store(STRING_WITH_LEN("default"), cs);
+    {
+      char *ts= showing_table->file->get_tablespace_name(thd);
+      if(ts)
+      {
+        table->field[24]->store(ts, strlen(ts), cs);
+        my_free(ts, MYF(0));
+      }
+      else
+        table->field[24]->set_null();
+    }
   }
   return;
 }
@@ -4157,7 +4170,7 @@ static int get_schema_partitions_record(
           table->field[6]->store((longlong) ++subpart_pos, TRUE);
           table->field[6]->set_notnull();
           
-          store_schema_partitions_record(thd, table, subpart_elem,
+          store_schema_partitions_record(thd, table, show_table, subpart_elem,
                                          file, part_id);
           part_id++;
           if(schema_table_store_record(thd, table))
@@ -4166,7 +4179,7 @@ static int get_schema_partitions_record(
       }
       else
       {
-        store_schema_partitions_record(thd, table, part_elem,
+        store_schema_partitions_record(thd, table, show_table, part_elem,
                                        file, part_id);
         part_id++;
         if(schema_table_store_record(thd, table))
@@ -4178,7 +4191,7 @@ static int get_schema_partitions_record(
   else
 #endif
   {
-    store_schema_partitions_record(thd, table, 0, file, 0);
+    store_schema_partitions_record(thd, table, show_table, 0, file, 0);
     if(schema_table_store_record(thd, table))
       DBUG_RETURN(1);
   }
@@ -5543,7 +5556,7 @@ ST_FIELD_INFO partitions_fields_info[]=
   {"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
   {"PARTITION_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, 0},
   {"NODEGROUP", 12 , MYSQL_TYPE_STRING, 0, 0, 0},
-  {"TABLESPACE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
+  {"TABLESPACE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
   {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
 };
 

--- 1.360/sql/ha_ndbcluster.cc	2006-11-10 11:39:03 +01:00
+++ 1.361/sql/ha_ndbcluster.cc	2006-11-10 11:39:03 +01:00
@@ -6510,7 +6510,7 @@ static int ndbcluster_init(void *p)
   }
   {
     char buf[128];
-    my_snprintf(buf, sizeof(buf), "mysqld --server-id=%d", server_id);
+    my_snprintf(buf, sizeof(buf), "mysqld --server-id=%lu", server_id);
     g_ndb_cluster_connection->set_name(buf);
   }
   g_ndb_cluster_connection->set_optimized_node_selection
@@ -7267,7 +7267,7 @@ int handle_trailing_share(NDB_SHARE *sha
       share->key_length= min_key_length;
     }
     share->key_length=
-      my_snprintf(share->key, min_key_length + 1, "#leak%d",
+      my_snprintf(share->key, min_key_length + 1, "#leak%lu",
                   trailing_share_id++);
   }
   /* Keep it for possible the future trailing free */
@@ -9804,12 +9804,12 @@ ndbcluster_show_status(handlerton *hton,
   update_status_variables(g_ndb_cluster_connection);
   buflen=
     my_snprintf(buf, sizeof(buf),
-                "cluster_node_id=%u, "
+                "cluster_node_id=%ld, "
                 "connected_host=%s, "
-                "connected_port=%u, "
-                "number_of_data_nodes=%u, "
-                "number_of_ready_data_nodes=%u, "
-                "connect_count=%u",
+                "connected_port=%ld, "
+                "number_of_data_nodes=%ld, "
+                "number_of_ready_data_nodes=%ld, "
+                "connect_count=%ld",
                 ndb_cluster_node_id,
                 ndb_connected_host,
                 ndb_connected_port,
@@ -10695,7 +10695,8 @@ static int ndbcluster_fill_files_table(h
       table->field[IS_FILES_VERSION]->store(uf.getObjectVersion());
 
       char extra[100];
-      int len=
my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u;UNDO_BUFFER_SIZE=%lu",id,lfg.getUndoBufferSize());
+      int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u;UNDO_BUFFER_SIZE=%lu",
+                           id, (ulong) lfg.getUndoBufferSize());
       table->field[IS_FILES_EXTRA]->set_notnull();
       table->field[IS_FILES_EXTRA]->store(extra, len, system_charset_info);
       schema_table_store_record(thd, table);
@@ -10712,7 +10713,6 @@ static int ndbcluster_fill_files_table(h
   for (i= 0; i < lfglist.count; i++)
   {
     NdbDictionary::Dictionary::List::Element& elt= lfglist.elements[i];
-    unsigned id;
 
     NdbDictionary::LogfileGroup lfg= dict->getLogfileGroup(elt.name);
     ndberr= dict->getNdbError();
@@ -10750,7 +10750,7 @@ static int ndbcluster_fill_files_table(h
     char extra[100];
     int len= my_snprintf(extra,sizeof(extra),
                          "UNDO_BUFFER_SIZE=%lu",
-                         lfg.getUndoBufferSize());
+                         (ulong) lfg.getUndoBufferSize());
     table->field[IS_FILES_EXTRA]->set_notnull();
     table->field[IS_FILES_EXTRA]->store(extra, len, system_charset_info);
     schema_table_store_record(thd, table);
Thread
bk commit into 5.1 tree (mskold:1.2319)Martin Skold10 Nov