List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:July 27 2005 3:08am
Subject:bk commit into 5.0 tree (jimw:1.1948) BUG#11602
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw 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
  1.1948 05/07/26 18:08:49 jimw@stripped +10 -0
  Increase allowed size of stored procedure bodies to 4GB, and 
  produce a sensible error when that limit is exceeded. (Bug #11602)

  mysql-test/t/sp-big.test
    1.1 05/07/26 18:08:45 jimw@stripped +33 -0
    New BitKeeper file ``mysql-test/t/sp-big.test''

  mysql-test/r/sp-big.result
    1.1 05/07/26 18:08:45 jimw@stripped +15 -0
    New BitKeeper file ``mysql-test/r/sp-big.result''

  sql/sql_parse.cc
    1.447 05/07/26 18:08:45 jimw@stripped +6 -0
    Handle SP_BODY_TOO_LONG error.

  sql/sp.h
    1.25 05/07/26 18:08:45 jimw@stripped +1 -0
    Add error for SP body being too long.

  sql/sp.cc
    1.83 05/07/26 18:08:45 jimw@stripped +5 -0
    Raise an error when the SP body is too long.

  sql/share/errmsg.txt
    1.40 05/07/26 18:08:45 jimw@stripped +2 -0
    Add error for SP routines that are too long

  mysql-test/t/sp-big.test
    1.0 05/07/26 18:08:45 jimw@stripped +0 -0
    BitKeeper file /home/jimw/my/mysql-5.0-11602/mysql-test/t/sp-big.test

  mysql-test/r/sp-big.result
    1.0 05/07/26 18:08:45 jimw@stripped +0 -0
    BitKeeper file /home/jimw/my/mysql-5.0-11602/mysql-test/r/sp-big.result

  scripts/mysql_fix_privilege_tables.sql
    1.29 05/07/26 18:08:44 jimw@stripped +2 -1
    Increase size of proc.body

  scripts/mysql_create_system_tables.sh
    1.26 05/07/26 18:08:44 jimw@stripped +1 -1
    Increase size of proc.body

  mysql-test/r/system_mysql_db.result
    1.27 05/07/26 18:08:44 jimw@stripped +1 -1
    Update results

  client/mysqltest.c
    1.151 05/07/26 18:08:44 jimw@stripped +2 -1
    Increase query buffer size, and explain why

# 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:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-11602

--- 1.446/sql/sql_parse.cc	2005-07-14 03:42:31 -07:00
+++ 1.447/sql/sql_parse.cc	2005-07-26 18:08:45 -07:00
@@ -4112,6 +4112,12 @@
       delete lex->sphead;
       lex->sphead= 0;
       goto error;
+    case SP_BODY_TOO_LONG:
+      my_error(ER_TOO_LONG_BODY, MYF(0), name);
+      lex->unit.cleanup();
+      delete lex->sphead;
+      lex->sphead= 0;
+      goto error;
     default:
       my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(lex), name);
       lex->unit.cleanup();

--- 1.39/sql/share/errmsg.txt	2005-07-13 03:20:38 -07:00
+++ 1.40/sql/share/errmsg.txt	2005-07-26 18:08:45 -07:00
@@ -5370,3 +5370,5 @@
         eng "Scale may not be larger than the precision (column '%-.64s')."
 ER_WRONG_LOCK_OF_SYSTEM_TABLE
         eng "You can't combine write-locking of system '%-.64s.%-.64s' table with other
tables"
+ER_TOO_LONG_BODY 42000 S1009
+	eng "Routine body for '%-.100s' is too long"
--- New file ---
+++ mysql-test/r/sp-big.result	05/07/26 18:08:45
drop procedure if exists test.longprocedure;
drop table if exists t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
length
107520
select length(routine_definition) from information_schema.routines where routine_schema =
'test' and routine_name = 'longprocedure';
length(routine_definition)
107530
call test.longprocedure(@value);
select @value;
@value
3
drop procedure test.longprocedure;
drop table t1;

--- New file ---
+++ mysql-test/t/sp-big.test	05/07/26 18:08:45
#
# Bug #11602: SP with very large body not handled well
#

--disable_warnings
drop procedure if exists test.longprocedure;
drop table if exists t1;
--enable_warnings

create table t1 (a int);
insert into t1 values (1),(2),(3);

let $body=`select repeat('select count(*) into out1 from t1;\n', 3072)`;

delimiter //;
--disable_query_log
eval select length('$body') as length//
eval create procedure test.longprocedure (out out1 int) deterministic
begin
  $body
end//
--enable_query_log

delimiter ;//

# this is larger than the length above, because it includes the 'begin' and
# 'end' bits and some whitespace
select length(routine_definition) from information_schema.routines where routine_schema =
'test' and routine_name = 'longprocedure';

call test.longprocedure(@value); select @value;

drop procedure test.longprocedure;
drop table t1;


--- 1.28/scripts/mysql_fix_privilege_tables.sql	2005-07-08 07:33:09 -07:00
+++ 1.29/scripts/mysql_fix_privilege_tables.sql	2005-07-26 18:08:44 -07:00
@@ -426,7 +426,7 @@
   security_type     enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL,
   param_list        blob DEFAULT '' NOT NULL,
   returns           char(64) DEFAULT '' NOT NULL,
-  body              blob DEFAULT '' NOT NULL,
+  body              longblob DEFAULT '' NOT NULL,
   definer           char(77) collate utf8_bin DEFAULT '' NOT NULL,
   created           timestamp,
   modified          timestamp,
@@ -477,6 +477,7 @@
                              'READS_SQL_DATA',
                              'MODIFIES_SQL_DATA'
                             ) DEFAULT 'CONTAINS_SQL' NOT NULL,
+                 MODIFY body longblob DEFAULT '' NOT NULL,
                  MODIFY sql_mode
                         set('REAL_AS_FLOAT',
                             'PIPES_AS_CONCAT',

--- 1.150/client/mysqltest.c	2005-07-03 04:17:45 -07:00
+++ 1.151/client/mysqltest.c	2005-07-26 18:08:44 -07:00
@@ -66,7 +66,8 @@
 #ifndef WEXITSTATUS
 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
 #endif
-#define MAX_QUERY     131072
+/* MAX_QUERY is 256K -- there is a test in sp-big that is >128K */
+#define MAX_QUERY     (256*1024)
 #define MAX_VAR_NAME	256
 #define MAX_COLUMNS	256
 #define PAD_SIZE	128

--- 1.82/sql/sp.cc	2005-07-13 03:20:38 -07:00
+++ 1.83/sql/sp.cc	2005-07-26 18:08:45 -07:00
@@ -503,6 +503,11 @@
       ret= SP_BAD_IDENTIFIER;
       goto done;
     }
+    if (sp->m_body.length >
table->field[MYSQL_PROC_FIELD_BODY]->field_length)
+    {
+      ret= SP_BODY_TOO_LONG;
+      goto done;
+    }
     table->field[MYSQL_PROC_FIELD_DB]->
       store(sp->m_db.str, sp->m_db.length, system_charset_info);
     table->field[MYSQL_PROC_FIELD_NAME]->

--- 1.24/sql/sp.h	2005-07-13 02:57:01 -07:00
+++ 1.25/sql/sp.h	2005-07-26 18:08:45 -07:00
@@ -29,6 +29,7 @@
 #define SP_INTERNAL_ERROR    -7
 #define SP_NO_DB_ERROR       -8
 #define SP_BAD_IDENTIFIER    -9
+#define SP_BODY_TOO_LONG    -10
 
 /* Drop all routines in database 'db' */
 int

--- 1.26/mysql-test/r/system_mysql_db.result	2005-07-11 06:57:39 -07:00
+++ 1.27/mysql-test/r/system_mysql_db.result	2005-07-26 18:08:44 -07:00
@@ -172,7 +172,7 @@
   `security_type` enum('INVOKER','DEFINER') NOT NULL default 'DEFINER',
   `param_list` blob NOT NULL,
   `returns` char(64) NOT NULL default '',
-  `body` blob NOT NULL,
+  `body` longblob NOT NULL,
   `definer` char(77) character set utf8 collate utf8_bin NOT NULL default '',
   `created` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
   `modified` timestamp NOT NULL default '0000-00-00 00:00:00',

--- 1.25/scripts/mysql_create_system_tables.sh	2005-07-08 07:33:09 -07:00
+++ 1.26/scripts/mysql_create_system_tables.sh	2005-07-26 18:08:44 -07:00
@@ -683,7 +683,7 @@
   c_p="$c_p   security_type     enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL,"
   c_p="$c_p   param_list        blob DEFAULT '' NOT NULL,"
   c_p="$c_p   returns           char(64) DEFAULT '' NOT NULL,"
-  c_p="$c_p   body              blob DEFAULT '' NOT NULL,"
+  c_p="$c_p   body              longblob DEFAULT '' NOT NULL,"
   c_p="$c_p   definer           char(77) collate utf8_bin DEFAULT '' NOT NULL,"
   c_p="$c_p   created           timestamp,"
   c_p="$c_p   modified          timestamp,"
Thread
bk commit into 5.0 tree (jimw:1.1948) BUG#11602Jim Winstead27 Jul