Bug #55817 Server in bootstrap mode cannot execute long queries, installation breaks
Submitted: 7 Aug 2010 3:28 Modified: 2 Sep 2010 0:39
Reporter: Elena Stepanova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.6.0-m4 OS:Any
Assigned to: Marc ALFF CPU Architecture:Any
Tags: regression

[7 Aug 2010 3:28] Elena Stepanova
Description:
Server in bootstrap mode cannot execute queries longer than 10,000 symbols. fill_help_tables.sql currently contains a query with the length over 13,000 symbols; so all tools which use the script fail -- including mysql_install_db and MTR.

Also, the error message produced by server in this case is non-informative -- it's either just 

100807  4:47:42 [ERROR] Aborting

or 

ERROR: 1149  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
100807  5:21:22 [ERROR] Aborting

How to repeat:
1) run mysql_install_db and observe the error
or
2) run MTR with any test and observe the error
or
3) generate a query longer than 10,000 symbols, start server with --bootstrap option feeding the query to it.

Suggested fix:
Increase the constant (with some margin, as the length of help table queries might be hard to predict).
In case the limit is breached, produce a clear error message.
[11 Aug 2010 8:54] Marc ALFF
ANALYSIS
========

The fix is likely to increase:
#define MAX_BOOTSTRAP_QUERY_SIZE 10000
#define MAX_BOOTSTRAP_LINE_SIZE 10000
in file sql/sql_bootstrap.h

The problem however is to know what value to use,
which depends on the content of the scripts/fill_help_tables.sql file.

The file scripts/fill_help_tables.sql as checked in the configuration
management system (bazaar) in mysql-trunk reads:

"
-- fill_help_tables.sql - this file is a placeholder to satisfy build dependencies -
-- it will be replaced with the appropriate content by the Boostrap script that
-- creates the official source distribution.
"

and when building a server from the source checked in in the configuration management system :
- the code builds
- the server starts
- MTR does work

Changing the bug to "need feedback", since clarification is needed
to explain exactly what "fill_help_tables.sql" file was used and *where* is it coming from.

I would also like to know why this file -- a part of the product -- is not checked in with the source code with the rest of the source.
[11 Aug 2010 10:37] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/115479

3197 Marc Alff	2010-08-11
      Bug#55817 Server in bootstrap mode cannot execute long queries, installation breaks
      
      Increased the maximun query length in bootstrap mode,
      to accomodate the documentation generated content in file fill_help_tables.sql
[11 Aug 2010 12:07] Konstantin Osipov
Using static buffers for strings in 2010 is technically unsound. There may be bootstrap scripts out there which use an even longer SQL. Please use a dynamic buffer instead.
[18 Aug 2010 20:55] Christopher Powers
Patch approved as a short-term solution, given that this fix is needed ASAP.

I will open a lower priority bug to track the long-term solution, which, as Kostja points out, is to manage the query buffer size dynamically.
[18 Aug 2010 21:15] Christopher Powers
Bug for dynamic bootstrap queries: 

Bug #56098, "Server in bootstrap mode cannot execute arbitrarily long queries"
[23 Aug 2010 21:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/116551

3227 Marc Alff	2010-08-23
      Bug#55817 Server in bootstrap mode cannot execute long queries, installation breaks
            
      Increased the maximun query length in bootstrap mode,
      to accomodate the documentation generated content in file fill_help_tables.sql
[23 Aug 2010 21:39] Marc ALFF
patch queued into:
- mysql-trunk-bugfixing
- mysql-next-mr-bugfixing
[30 Aug 2010 8:30] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@sun.com-20100830082732-n2eyijnv86exc5ci) (version source revid:alik@sun.com-20100830082732-n2eyijnv86exc5ci) (merge vers: 5.6.1-m4) (pib:21)
[30 Aug 2010 8:33] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100830082745-n6sh01wlwh3itasv) (version source revid:alik@sun.com-20100830082745-n6sh01wlwh3itasv) (pib:21)
[2 Sep 2010 0:39] Paul DuBois
Noted in 5.6.1 changelog.

In bootstrap mode, the server could not execute statements longer
than 10,000 characters.