From: magnus.blaudd Date: June 21 2011 3:02pm Subject: bzr push into mysql-5.5-cluster branch (magnus.blaudd:3361 to 3362) List-Archive: http://lists.mysql.com/commits/139573 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3362 magnus.blaudd@stripped 2011-06-21 ndb - add MCP patch for bug 51828 to 5.5-cluster 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 3361 Frazer Clement 2011-06-21 Testcase fix modified: mysql-test/suite/ndb_rpl/r/ndb_rpl_rep_error.result === modified file 'client/mysql_upgrade.c' --- a/client/mysql_upgrade.c 2011-04-14 14:31:38 +0000 +++ b/client/mysql_upgrade.c 2011-06-21 14:58:05 +0000 @@ -779,10 +779,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 2010-10-27 11:32:32 +0000 +++ b/scripts/comp_sql.c 2011-06-21 14:58:05 +0000 @@ -71,7 +71,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)) { @@ -112,9 +121,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).