List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:October 28 2011 2:54pm
Subject:bzr push into mysql-5.1-telco-7.1 branch (magnus.blaudd:4319 to 4320)
View as plain text  
 4320 Magnus Blåudd	2011-10-28
      ndb
       - add MCP patch for bug 51828 also to 7.1 which we hit when
         adding SQL to create ndbinfo tables to mysql_system_tables.sql
       - choose only significants part of patch, i.e make comp_sql
         print the SQL as an array of strings and then make mysql_upgrade
         concat that string in dynamic memory before running the query

    modified:
      client/mysql_upgrade.c
      scripts/comp_sql.c
 4319 jonas oreland	2011-10-28
      ndb - update result file

    modified:
      mysql-test/suite/ndb/r/ndbinfo_dump.result
=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c	2011-06-30 15:55:35 +0000
+++ b/client/mysql_upgrade.c	2011-10-28 14:46:05 +0000
@@ -763,10 +763,42 @@ static int run_sql_fix_privilege_tables(
   if (init_dynamic_string(&ds_result, "", 512, 512))
     die("Out of memory");
 
+#ifndef MCP_BUG51828
+  /*
+    The SQL to run are kept in a big array of string in order
+    to avoid hitting compiler limits for max string length,
+    concatenate the strings into dynamic memory before
+    running the SQL. Significant parts of patch for bug#51828
+    backported from trunk
+  */
+  {
+    const char **query_ptr;
+    DYNAMIC_STRING ds_script;
+
+    if (init_dynamic_string(&ds_script, "", 65536, 1024))
+      die("Out of memory");
+
+    for ( query_ptr= &mysql_fix_privilege_tables[0];
+          *query_ptr != NULL;
+          query_ptr++
+          )
+    {
+      dynstr_append(&ds_script, *query_ptr);
+    }
+
+    verbose("Running 'mysql_fix_privilege_tables'...");
+    run_query(ds_script.str,
+              &ds_result, /* Collect result */
+              TRUE);
+
+    dynstr_free(&ds_script);
+  }
+#else
   verbose("Running 'mysql_fix_privilege_tables'...");
   run_query(mysql_fix_privilege_tables,
             &ds_result, /* Collect result */
             TRUE);
+#endif
 
   {
     /*

=== modified file 'scripts/comp_sql.c'
--- a/scripts/comp_sql.c	2009-05-26 18:53:34 +0000
+++ b/scripts/comp_sql.c	2011-10-28 14:46:05 +0000
@@ -74,7 +74,16 @@ int main(int argc, char *argv[])
   if (!(out= fopen(outfile_name, "w")))
     die("Failed to open output file '%s'", outfile_name);
 
+#ifndef MCP_BUG51828
+  /*
+    Print the SQL as an array of strings instead of one
+    large string in order to avoid compiler limit on max string length.
+    Significant parts of patch for bug#51828 backported from trunk.
+  */
+  fprintf(out, "const char* %s[]={\n\"", struct_name);
+#else
   fprintf(out, "const char* %s={\n\"", struct_name);
+#endif
 
   while (fgets(buff, sizeof(buff), in))
   {
@@ -115,9 +124,17 @@ int main(int argc, char *argv[])
       */
       fprintf(out, "\"\n\"");
     }
+#ifndef MCP_BUG51828
+    /* new line -> convert to new entry in array */
+    fprintf(out, "\",\n\"");
+#endif
   }
 
+#ifndef MCP_BUG51828
+  fprintf(out, "\",\nNULL\n};\n");
+#else
   fprintf(out, "\\\n\"};\n");
+#endif
 
   fclose(in);
   fclose(out);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.1 branch (magnus.blaudd:4319 to 4320) Magnus Blåudd1 Nov