An error occurred fetching the project authors.
  1. 24 Aug, 2007 1 commit
    • unknown's avatar
      · 8f145dae
      unknown authored
      Whitespace cleanup
      
      
      sql/sql_yacc.yy:
        
        Whitespace cleaup
      8f145dae
  2. 22 Aug, 2007 3 commits
    • unknown's avatar
      Bug#30333 (Performance, expressions lists in the parser) · 5dc3e889
      unknown authored
      Before this patch, the parser would execute:
      - Select->expr_list.push_front()
      - Select->expr_list.pop()
      when parsing expressions lists, in the following rules:
      - udf_expr_list
      - expr_list
      - ident_list
      
      This is unnecessary, and introduces overhead due to the memory allocations
      performed with Select->expr_list
      
      With this patch, this code has been removed.
      The list being parsed is maintained in the parser stack instead.
      
      Also, 'udf_expr_list' has been renamed 'opt_udf_expr_list', since this
      production can be empty.
      
      
      sql/sql_lex.cc:
        Removed unused attribute expr_list
      sql/sql_lex.h:
        Removed unused attribute expr_list
      sql/sql_yacc.yy:
        Improved performances when parsing expression lists
      5dc3e889
    • unknown's avatar
      Manual merge · 49fea65f
      unknown authored
      49fea65f
    • unknown's avatar
      Bug#30237 (Performance regression in boolean expressions) · fb1be0f1
      unknown authored
      This is a performance bug, related to the parsing or 'OR' and 'AND' boolean
      expressions.
      
      Let N be the number of expressions involved in a OR (respectively AND).
      
      When N=1
      
      For example, "select 1" involve only 1 term: there is no OR operator.
      
      In 4.0 and 4.1, parsing expressions not involving OR had no overhead.
      In 5.0, parsing adds some overhead, with Select->expr_list.
      
      With this patch, the overhead introduced in 5.0 has been removed,
      so that performances for N=1 should be identical to the 4.0 performances,
      which are optimal (there is no code executed at all)
      
      The overhead in 5.0 was in fact affecting significantly some operations.
      For example, loading 1 Million rows into a table with INSERTs,
      for a table that has 100 columns, leads to parsing 100 Millions of
      expressions, which means that the overhead related to Select->expr_list
      is executed 100 Million times ...
      
      Considering that N=1 is by far the most probable expression,
      this case should be optimal.
      
      When N=2
      
      For example, "select a OR b" involves 2 terms in the OR operator.
      
      In 4.0 and 4.1, parsing expressions involving 2 terms created 1 Item_cond_or
      node, which is the expected result.
      In 5.0, parsing these expression also produced 1 node, but with some extra
      overhead related to Select->expr_list : creating 1 list in Select->expr_list
      and another in Item_cond::list is inefficient.
      
      With this patch, the overhead introduced in 5.0 has been removed
      so that performances for N=2 should be identical to the 4.0 performances.
      Note that the memory allocation uses the new (thd->mem_root) syntax
      directly.
      The cost of "is_cond_or" is estimated to be neglectable: the real problem
      of the performance degradation comes from unneeded memory allocations.
      
      When N>=3
      
      For example, "select a OR b OR c ...", which involves 3 or more terms.
      
      In 4.0 and 4.1, the parser had no significant cost overhead, but produced
      an Item tree which is difficult to evaluate / optimize during runtime.
      In 5.0, the parser produces a better Item tree, using the Item_cond
      constructor that accepts a list of children directly, but at an extra cost
      related to Select->expr_list.
      
      With this patch, the code is implemented to take the best of the two
      implementations:
      - there is no overhead with Select->expr_list
      - the Item tree generated is optimized and flattened.
      
      This is achieved by adding children nodes into the Item tree directly,
      with Item_cond::add(), which avoids the need for temporary lists and memory
      allocation
      
      Note that this patch also provide an extra optimization, that the previous
      code in 5.0 did not provide: expressions are flattened in the Item tree,
      based on what the expression already parsed is, and not based on the order
      in which rules are reduced.
      
      For example : "(a OR b) OR c", "a OR (b OR c)" would both be represented
      with 2 Item_cond_or nodes before this patch, and with 1 node only with this
      patch. The logic used is based on the mathematical properties of the OR
      operator (it's associative), and produces a simpler tree.
      
      
      sql/item_cmpfunc.h:
        Improved performances for parsing boolean expressions
      sql/sql_yacc.yy:
        Improved performances for parsing boolean expressions
      mysql-test/r/parser_precedence.result:
        Added test cases to cover boolean operator precedence
      mysql-test/t/parser_precedence.test:
        Added test cases to cover boolean operator precedence
      fb1be0f1
  3. 15 Aug, 2007 2 commits
    • unknown's avatar
      Provide initial module structure to Doxygen. · 7691bbbf
      unknown authored
      sql/event_data_objects.cc:
        Add module comments.
      sql/event_data_objects.h:
        Add module comments.
      sql/event_db_repository.cc:
        Add module comments.
      sql/event_db_repository.h:
        Add module comments.
      sql/event_queue.cc:
        Add module comments.
      sql/event_queue.h:
        Add module comments.
      sql/event_scheduler.cc:
        Add module comments.
      sql/event_scheduler.h:
        Add module comments.
      sql/events.cc:
        Add module comments.
      sql/events.h:
        Add module comments.
      sql/lock.cc:
        Add module comments.
      sql/sp_head.h:
        Add module comments.
      sql/sql_base.cc:
        Add module comments.
      sql/sql_lex.h:
        Add module comments.
      sql/sql_parse.cc:
        Add module comments.
      sql/sql_select.cc:
        Add module comments.
      sql/sql_yacc.yy:
        Add module comments.
      7691bbbf
    • unknown's avatar
      2c4c5581
  4. 03 Aug, 2007 1 commit
    • unknown's avatar
      Bug#28875 Conversion between ASCII and LATIN1 charsets does not function · 53df09a9
      unknown authored
      (Regression, caused by a patch for the bug 22646).
      Problem: when result type of date_format() was changed from
      binary string to character string, mixing date_format()
      with a ascii column in CONCAT() stopped to work.
      Fix:
      - adding "repertoire" flag into DTCollation class,
      to mark items which can return only pure ASCII strings.
      - allow character set conversion from pure ASCII to other character sets.
      
      
      include/m_ctype.h:
        Defining new flags.
        Adding new function prototypes.
      mysql-test/r/ctype_ucs.result:
        Adding tests.
      mysql-test/r/ctype_utf8.result:
        Adding tests.
      mysql-test/r/func_time.result:
        Adding tests.
      mysql-test/t/ctype_ucs.test:
        Adding tests.
      mysql-test/t/ctype_utf8.test:
        Adding tests.
      mysql-test/t/func_time.test:
        Adding test.
      mysys/charset.c:
        Adding pure ASCII detection when loading a dynamic character set.
      sql/item.cc:
        - Moving detection of a Unicode superset into function.
        - Adding detection of a ASCII subset.
        - Adding creation of to-ASCII character set convertor when
          safe_charset_converter() failed and when the argument.
          repertoire is know to be pure ASCII.
      sql/item.h:
        - Adding "repertoire" member into DTCollation class.
        - Adding "repertoire" argument to constructors.
        - Adding new methods:
          set_repertoire_from_charset()
          set_repertoire_from_value()
      sql/item_func.cc:
        Adding "repertoire" argument.
      sql/item_strfunc.cc:
        Adding "repertoire" argument.
      sql/item_timefunc.cc:
        Initializing the result repertoire taking into account the "is_ascii"
        flag of the current locale.
      sql/sql_lex.cc:
        Detect 7bit strings, return in Lex->text_string_is_7bit.
      sql/sql_lex.h:
        Adding new member into LEX structure.
        Adding new member into Lex_input_stream
      sql/sql_string.cc:
        Allow simple copy from pure ASCII to a ASCII-based character set.
      sql/sql_yacc.yy:
        Depening on Lex->text_string_is_7bit and character set features,
        create Item_string with MY_REPERTOIRE_ASCII when it is possible.
      strings/conf_to_src.c:
        - Adding printing of the "MY_CS_PUREASCII" flag
        - Adding printing of copyright
      strings/ctype-extra.c:
        Recreating ctype-extra.c: ascii_general_ci and ascii_bin
        are now marked with MY_CS_PUREASCII flag.
      strings/ctype.c:
        Adding new functions.
      53df09a9
  5. 31 Jul, 2007 1 commit
    • unknown's avatar
      sql_yacc.yy, sp.result, disabled.def: · 124ad9c6
      unknown authored
        Post-merge fix.
      
      
      mysql-test/t/disabled.def:
        Post-merge fix.
      mysql-test/r/sp.result:
        Post-merge fix.
      sql/sql_yacc.yy:
        Post-merge fix.
      124ad9c6
  6. 29 Jul, 2007 1 commit
    • unknown's avatar
      Fixed bug #30120. · 33fc4ad4
      unknown authored
      SP with local variables with non-ASCII names crashed the server.
      
      The server replaces SP local variable names with NAME_CONST calls
      when putting statements into the binary log. It used UTF8-encoded
      item names as variable names for the replacement inside NAME_CONST
      calls. However, statement string may be encoded by any
      known character set by the SET NAMES statement.
      The server used byte length of UTF8-encoded names to increment
      the position in the query string that led to array index overrun.
      
      
      sql/item.cc:
        Fixed bug #30120.
        The Item_splocal class constructor has been modified to
        accept new parameter `len_in_q': the byte length of
        variable name in the query string.
      sql/item.h:
        Fixed bug #30120.
        The Item_splocal class has been modified to keep new
        field `len_in_query': the byte length of variable name in
        the query string.
      sql/sp_head.cc:
        Fixed bug #30120.
        The subst_spvars function has been modified to increment
        position in the query string by the lengths of not
        encoded variable names instead of byte length of names
        encoded to UTF-8.
      sql/sql_yacc.yy:
        Fixed bug #30120.
        The simple_ident rule action has been modified to
        pass the byte length of the local variable name token
        to the Item_splocal object constructor.
      mysql-test/t/sp.test:
        Updated test case for bug #30120.
      mysql-test/r/sp.result:
        Updated test case for bug #30120.
      33fc4ad4
  7. 26 Jul, 2007 1 commit
    • unknown's avatar
      Bug #30036: SHOW TABLE TYPES causes the debug client to crash · c7150fd8
      unknown authored
      SHOW TABLE TYPES is a (to be deprecated) synonym for 
      SHOW STORAGE ENGINES.
      Fixed to use the right schema table in addition to 
      issuing a warning.
      
      
      mysql-test/r/show_check.result:
        Bug #30036: test case
      mysql-test/t/show_check.test:
        Bug #30036: test case
      sql/sql_yacc.yy:
        Bug #30036: use the right schema table
      c7150fd8
  8. 23 Jul, 2007 1 commit
  9. 16 Jul, 2007 1 commit
    • unknown's avatar
      Post-merge fixes (merge from the main). · bc642e11
      unknown authored
      mysql-test/r/innodb_mysql.result:
        Update test results (merge from the main tree).
      mysql-test/r/query_cache.result:
        Update test results (merge from the main tree).
      mysql-test/r/sp.result:
        Update test results (merge from the main tree).
      mysql-test/t/query_cache.test:
        Use --echo End of to simplify future merges.
      sql/handler.h:
        st_table_list -> TABLE_LIST
      sql/item_create.cc:
        A post-merge fix (this code is in sql_yacc.yy in 5.0)
      sql/rpl_utility.h:
        st_table_list -> TABLE_LIST
      sql/sp.cc:
        A post-merge fix.
      sql/sp_head.cc:
        In 5.1 memdup_root returns void*.
      sql/sql_show.cc:
        st_table_list -> TABLE_LIST
      sql/sql_show.h:
        st_table_list -> TABLE_LIST
      sql/sql_yacc.yy:
        A post-merge fix.
      sql/table.cc:
        st_table_list -> TABLE_LIST
      sql/table.h:
        st_table_list -> TABLE_LIST
      bc642e11
  10. 12 Jul, 2007 1 commit
    • unknown's avatar
      A fix and a test case for Bug#26141 mixing table types in trigger · 9dc3088f
      unknown authored
      causes full table lock on innodb table.
      Also fixes Bug#28502 Triggers that update another innodb table 
      will block on X lock unnecessarily (duplciate).
      Code review fixes.
      
      Both bugs' synopses are misleading: InnoDB table is
      not X locked. The statements, however, cannot proceed concurrently, 
      but this happens due to lock conflicts for tables used in triggers,
      not for the InnoDB table. 
      
      If a user had an InnoDB table, and two triggers, AFTER UPDATE and 
      AFTER INSERT, competing for different resources (e.g. two distinct
      MyISAM tables), then these two triggers would not be able to execute
      concurrently. Moreover, INSERTS/UPDATES of the InnoDB table would
      not be able to run concurrently. 
      The problem had other side-effects (see respective bug reports).
      
      This behavior was a consequence of a shortcoming of the pre-locking
      algorithm, which would not distinguish between different DML operations
      (e.g. INSERT and DELETE) and pre-lock all the tables
      that are used by any trigger defined on the subject table.
      
      The idea of the fix is to extend the pre-locking algorithm to keep track,
      for each table, what DML operation it is used for and not
      load triggers that are known to never be fired.
      
      
      mysql-test/r/trigger-trans.result:
        Update results (Bug#26141)
      mysql-test/r/trigger.result:
        Update results (Bug#28502)
      mysql-test/t/trigger-trans.test:
        Add a test case for Bug#26141 mixing table types in trigger causes 
        full table lock on innodb table.
      mysql-test/t/trigger.test:
        Add a test case for Bug#28502 Triggers that update another innodb 
        table will block echo on X lock unnecessarily. Add more test 
        coverage for triggers.
      sql/item.h:
        enum trg_event_type is needed in table.h
      sql/sp.cc:
        Take into account table_list->trg_event_map when determining
        what tables to pre-lock. 
        
        After this change, if we attempt to fire a 
        trigger for which we had not pre-locked any tables, error
        'Table was not locked with LOCK TABLES' will be printed.
        This, however, should never happen, provided the pre-locking
        algorithm has no programming bugs.
        
        Previously a trigger key in the sroutines hash was based on the name 
        of the table the trigger belongs to. This was possible because we would
        always add to the pre-locking list all the triggers defined for a table when
        handling this table.
        Now the key is based on the name of the trigger, owing
        to the fact that a trigger name must be unique in the database it
        belongs to.
      sql/sp_head.cc:
        Generate sroutines hash key in init_spname(). This is a convenient
        place since there we have all the necessary information and can
        avoid an extra alloc.
        
        Maintain and merge trg_event_map when adding and merging elements
        of the pre-locking list.
      sql/sp_head.h:
        Add ,m_sroutines_key member, used when inserting the sphead for a
        trigger into the cache of routines used by a statement.
        Previously the key was based on the table name the trigger belonged
        to, since for a given table we would add to the sroutines list
        all the triggers defined on it.
      sql/sql_lex.cc:
        Introduce a new lex step: set_trg_event_type_for_tables().
        It is called when we have finished parsing but before opening
        and locking tables. Now this step is used to evaluate for each
        TABLE_LIST instance which INSERT/UPDATE/DELETE operation, if any,
        it is used in.
        In future this method could be extended to aggregate other information
        that is hard to aggregate during parsing.
      sql/sql_lex.h:
        Add declaration for set_trg_event_type_for_tables().
      sql/sql_parse.cc:
        Call set_trg_event_type_for_tables() after MYSQLparse(). Remove tabs.
      sql/sql_prepare.cc:
        Call set_trg_event_type_for_tables() after  MYSQLparse().
      sql/sql_trigger.cc:
        Call set_trg_event_type_for_tables() after MYSQLparse().
      sql/sql_trigger.h:
        Remove an obsolete member.
      sql/sql_view.cc:
        Call set_trg_event_type_for_tables() after MYSQLparse().
      sql/sql_yacc.yy:
        Move assignment of sp_head::m_type before calling sp_head::init_spname(), 
        one is now used inside another.
      sql/table.cc:
        Implement TABLE_LIST::set_trg_event_map() - a method that calculates
        wh triggers may be fired on this table when executing a statement.
      sql/table.h:
        Add missing declarations.
        Move declaration of trg_event_type from item.h (it will be needed for 
        trg_event_map bitmap when we start using Bitmap template instead
        of uint8).
      9dc3088f
  11. 11 Jul, 2007 1 commit
    • unknown's avatar
      A fix and a test case for Bug#25859 ALTER DATABASE works w/o parameters. · 0bc3e69f
      unknown authored
      Fix the parser to make the database options not optional.
      
      
      mysql-test/r/information_schema.result:
        Update results (Bug#25859)
      mysql-test/t/information_schema.test:
        Add a test case for Bug#25859 "ALTER DATABASE works w/o parameters"
      sql/sql_yacc.yy:
        Fix Bug#25859 ALTER DATABASE works w/o parameters - require
        parameters in the parser.
      0bc3e69f
  12. 05 Jul, 2007 1 commit
    • unknown's avatar
      A fix and a test case for Bug#29050 Creation of a legal stored procedure · e8966dee
      unknown authored
      fails if a database is not selected prior.
      
      The problem manifested itself when a user tried to
      create a routine that had non-fully-qualified identifiers in its bodies
      and there was no current database selected.
      
      This is a regression introduced by the fix for Bug 19022:
      
      The patch for Bug 19022 changes the code to always produce a warning
      if we can't resolve the current database in the parser. 
      In this case this was not necessary, since even though the produced
      parsed tree was incorrect, we never re-use sphead
      that was obtained at first parsing of CREATE PROCEDURE.
      The sphead that is anyhow used is always obtained through db_load_routine,
      and there we change the current database to sphead->m_db before
      calling yyparse.
      
      The idea of the fix is to resolve the current database directly using 
      lex->sphead->m_db member when parsing a stored routine body, when
      such is present.
      
      This patch removes the need to reset the current database
      when loading a trigger or routine definition into SP cache.
      The redundant code will be removed in 5.1.
      
      
      mysql-test/r/sp.result:
        Update test results (Bug#29050)
      mysql-test/r/trigger.result:
        Update results.
      mysql-test/t/sp.test:
        Add a test case for Bug#29050
      mysql-test/t/trigger.test:
        Fix wrong behavior covered with tests.
      sql/sql_lex.cc:
        Implement st_lex::copy_db_to().
      sql/sql_lex.h:
        Declare st_lex::copy_db_to().
      sql/sql_parse.cc:
        Use st_lex::copy_db_to() in add_table_to_list, rather than
        THD::copy_db_to(). The former will use the database of the sphead,
        if we're parsing a stored routine, not the default database in
        THD. The default database is needed to initialize tables->db
        when the database part was not explicitly specified in the identifier.
      sql/sql_yacc.yy:
        Use st_lex::copy_db_to() in the parser, rather than
        THD::copy_db_to(). The former will use the database of the sphead,
        if we're parsing a stored routine, not the default database in
        THD.
      e8966dee
  13. 28 Jun, 2007 1 commit
    • unknown's avatar
      Patch for the following bugs: · 405f82d3
      unknown authored
        - BUG#11986: Stored routines and triggers can fail if the code
          has a non-ascii symbol
        - BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
        - BUG#19443: INFORMATION_SCHEMA does not support charsets properly
        - BUG#21249: Character set of SP-var can be ignored
        - BUG#25212: Character set of string constant is ignored (stored routines)
        - BUG#25221: Character set of string constant is ignored (triggers)
      
      There were a few general problems that caused these bugs:
      1. Character set information of the original (definition) query for views,
         triggers, stored routines and events was lost.
      2. mysqldump output query in client character set, which can be
         inappropriate to encode definition-query.
      3. INFORMATION_SCHEMA used strings with mixed encodings to display object
         definition;
      
      1. No query-definition-character set.
      
      In order to compile query into execution code, some extra data (such as
      environment variables or the database character set) is used. The problem
      here was that this context was not preserved. So, on the next load it can
      differ from the original one, thus the result will be different.
      
      The context contains the following data:
        - client character set;
        - connection collation (character set and collation);
        - collation of the owner database;
      
      The fix is to store this context and use it each time we parse (compile)
      and execute the object (stored routine, trigger, ...).
      
      2. Wrong mysqldump-output.
      
      The original query can contain several encodings (by means of character set
      introducers). The problem here was that we tried to convert original query
      to the mysqldump-client character set.
      
      Moreover, we stored queries in different character sets for different
      objects (views, for one, used UTF8, triggers used original character set).
      
      The solution is
        - to store definition queries in the original character set;
        - to change SHOW CREATE statement to output definition query in the
          binary character set (i.e. without any conversion);
        - introduce SHOW CREATE TRIGGER statement;
        - to dump special statements to switch the context to the original one
          before dumping and restore it afterwards.
      
      Note, in order to preserve the database collation at the creation time,
      additional ALTER DATABASE might be used (to temporary switch the database
      collation back to the original value). In this case, ALTER DATABASE
      privilege will be required. This is a backward-incompatible change.
      
      3. INFORMATION_SCHEMA showed non-UTF8 strings
      
      The fix is to generate UTF8-query during the parsing, store it in the object
      and show it in the INFORMATION_SCHEMA.
      
      Basically, the idea is to create a copy of the original query convert it to
      UTF8. Character set introducers are removed and all text literals are
      converted to UTF8.
      
      This UTF8 query is intended to provide user-readable output. It must not be
      used to recreate the object.  Specialized SHOW CREATE statements should be
      used for this.
      
      The reason for this limitation is the following: the original query can
      contain symbols from several character sets (by means of character set
      introducers).
      
      Example:
      
        - original query:
          CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;
      
        - UTF8 query (for INFORMATION_SCHEMA):
          CREATE VIEW v1 AS SELECT 'Hello' AS c1;
      
      
      client/mysqldump.c:
        Set original character set and collation before dumping definition query.
      include/my_sys.h:
        Move out-parameter to the end of list.
      mysql-test/lib/mtr_report.pl:
        Ignore server-warnings during the test case.
      mysql-test/r/create.result:
        Update result file.
      mysql-test/r/ctype_cp932_binlog_stm.result:
        Update result file.
      mysql-test/r/events.result:
        Update result file.
      mysql-test/r/events_bugs.result:
        Update result file.
      mysql-test/r/events_grant.result:
        Update result file.
      mysql-test/r/func_in.result:
        Update result file.
      mysql-test/r/gis.result:
        Update result file.
      mysql-test/r/grant.result:
        Update result file.
      mysql-test/r/information_schema.result:
        Update result file.
      mysql-test/r/information_schema_db.result:
        Update result file.
      mysql-test/r/lowercase_view.result:
        Update result file.
      mysql-test/r/mysqldump.result:
        Update result file.
      mysql-test/r/ndb_sp.result:
        Update result file.
      mysql-test/r/ps.result:
        Update result file.
      mysql-test/r/rpl_replicate_do.result:
        Update result file.
      mysql-test/r/rpl_sp.result:
        Update result file.
      mysql-test/r/rpl_trigger.result:
        Update result file.
      mysql-test/r/rpl_view.result:
        Update result file.
      mysql-test/r/show_check.result:
        Update result file.
      mysql-test/r/skip_grants.result:
        Update result file.
      mysql-test/r/sp-destruct.result:
        Update result file.
      mysql-test/r/sp-error.result:
        Update result file.
      mysql-test/r/sp-security.result:
        Update result file.
      mysql-test/r/sp.result:
        Update result file.
      mysql-test/r/sql_mode.result:
        Update result file.
      mysql-test/r/system_mysql_db.result:
        Update result file.
      mysql-test/r/temp_table.result:
        Update result file.
      mysql-test/r/trigger-compat.result:
        Update result file.
      mysql-test/r/trigger-grant.result:
        Update result file.
      mysql-test/r/trigger.result:
        Update result file.
      mysql-test/r/view.result:
        Update result file.
      mysql-test/r/view_grant.result:
        Update result file.
      mysql-test/t/events.test:
        Update test case (new columns added).
      mysql-test/t/information_schema.test:
        Update test case (new columns added).
      mysql-test/t/show_check.test:
        Test case for SHOW CREATE TRIGGER in prepared statements and
        stored routines.
      mysql-test/t/sp-destruct.test:
        Update test case (new columns added).
      mysql-test/t/sp.test:
        Update test case (new columns added).
      mysql-test/t/view.test:
        Update test.
      mysys/charset.c:
        Move out-parameter to the end of list.
      scripts/mysql_system_tables.sql:
        Add new columns to mysql.proc and mysql.event.
      scripts/mysql_system_tables_fix.sql:
        Add new columns to mysql.proc and mysql.event.
      sql/event_data_objects.cc:
        Support new attributes for events.
      sql/event_data_objects.h:
        Support new attributes for events.
      sql/event_db_repository.cc:
        Support new attributes for events.
      sql/event_db_repository.h:
        Support new attributes for events.
      sql/events.cc:
        Add new columns to SHOW CREATE event resultset.
      sql/mysql_priv.h:
        1. Introduce Object_creation_ctx;
        2. Introduce SHOW CREATE TRIGGER;
        3. Introduce auxilary functions.
      sql/sp.cc:
        Add support for new store routines attributes.
      sql/sp_head.cc:
        Add support for new store routines attributes.
      sql/sp_head.h:
        Add support for new store routines attributes.
      sql/sql_lex.cc:
        Generate UTF8-body on parsing/lexing.
      sql/sql_lex.h:
        1. Generate UTF8-body on parsing/lexing.
        2. Introduce SHOW CREATE TRIGGER.
      sql/sql_parse.cc:
        Introduce SHOW CREATE TRIGGER.
      sql/sql_partition.cc:
        Update parse_sql().
      sql/sql_prepare.cc:
        Update parse_sql().
      sql/sql_show.cc:
        Support new attributes for views
      sql/sql_trigger.cc:
        Support new attributes for views
      sql/sql_trigger.h:
        Support new attributes for views
      sql/sql_view.cc:
        Support new attributes for views
      sql/sql_yacc.yy:
        1. Add SHOW CREATE TRIGGER statement.
        2. Generate UTF8-body for views, stored routines, triggers and events.
      sql/table.cc:
        Introduce Object_creation_ctx.
      sql/table.h:
        Introduce Object_creation_ctx.
      sql/share/errmsg.txt:
        Add new errors.
      mysql-test/include/ddl_i18n.check_events.inc:
        Aux file for test suite.
      mysql-test/include/ddl_i18n.check_sp.inc:
        Aux file for test suite.
      mysql-test/include/ddl_i18n.check_triggers.inc:
        Aux file for test suite.
      mysql-test/include/ddl_i18n.check_views.inc:
        Aux file for test suite.
      mysql-test/include/have_cp1251.inc:
        Aux file for test suite.
      mysql-test/include/have_cp866.inc:
        Aux file for test suite.
      mysql-test/include/have_koi8r.inc:
        Aux file for test suite.
      mysql-test/include/have_utf8.inc:
        Aux file for test suite.
      mysql-test/r/ddl_i18n_koi8r.result:
        Result file.
      mysql-test/r/ddl_i18n_utf8.result:
        Result file.
      mysql-test/r/have_cp1251.require:
        Aux file for test suite.
      mysql-test/r/have_cp866.require:
        Aux file for test suite.
      mysql-test/r/have_koi8r.require:
        Aux file for test suite.
      mysql-test/r/have_utf8.require:
        Aux file for test suite.
      mysql-test/t/ddl_i18n_koi8r.test:
        Complete koi8r test case for the CS patch.
      mysql-test/t/ddl_i18n_utf8.test:
        Complete utf8 test case for the CS patch.
      405f82d3
  14. 22 Jun, 2007 3 commits
    • unknown's avatar
      Bug #28846 Use of undocumented Prepared Statements crashes server · 1eee6b13
      unknown authored
      - Manual merge patch.
      
      
      sql/sql_yacc.yy:
        Corrected merge error. ALTER VIEW rules has been split in two and both
        rules need to be checked for SP-context.
      1eee6b13
    • unknown's avatar
      Bug#28925 GROUP_CONCAT inserts wrong separators for a ucs2 column · 46c3d7b8
      unknown authored
      Problem: separator was not converted to the result character set,
      so the result was a mixture of two different character sets,
      which was especially bad for UCS2.
      Fix: convert separator to the result character set.
      
      
      mysql-test/r/ctype_ucs.result:
        Adding test case
      mysql-test/r/ctype_ucs2_def.result:
        Adding test case
      mysql-test/t/ctype_ucs.test:
        Adding test case
      mysql-test/t/ctype_ucs2_def.test:
        Adding test case
      sql/item_sum.cc:
        Adding conversion of separator to the result character set
      sql/sql_yacc.yy:
        Fixing GROUPC_CONCAT problems when "mysqld --default-character-set=ucs2".
      46c3d7b8
    • unknown's avatar
      Bug#28846 Use of undocumented Prepared Statements crashes server · 099be801
      unknown authored
      ALTER VIEW is currently not supported as a prepared statement
      and should be disabled as such as they otherwise could cause server crashes.
      
      ALTER VIEW is currently not supported when called from stored
      procedures or functions for related reasons and should also be disabled.
      
      This patch disables these DDL statements and adjusts the appropriate test
      cases accordingly.
      
      Additional tests has been added to reflect on the fact that we do support
      CREATE/ALTER/DROP TABLE for Prepared Statements (PS), Stored Procedures (SP)
      and PS within SP.
      
      
      mysql-test/r/ps_1general.result:
        - Updated test to reflect on the new policy to disallow ALTER VIEW within SP.
      mysql-test/r/sp-dynamic.result:
        - Added PS ALTER TABLE test from within SP-context to demonstrate that CREATE/ALTER/DROP
        TABLE statements is working.
        - Added PS CREATE/ALTER/DROP VIEW tests from within SP-context to show that
        ALTER VIEW is not supported, CREATE VIEW/DROP VIEW are supported.
      mysql-test/r/sp-error.result:
        - Updated test to reflect on the new policy to disallow VIEW DDL within SP.
      mysql-test/t/ps_1general.test:
        - Updated test to reflect on the new policy to disallow VIEW DDL within SP.
      mysql-test/t/sp-dynamic.test:
        - Add PS ALTER TABLE test from within SP to demonstrate that CREATE/ALTER/DROP
        TABLE statements are supported.
      mysql-test/t/sp-error.test:
        - Updated test to reflect on the new policy to disallow ALTER VIEW
        within SP-context.
        - Changed error code 1314 to the more abstract ER_SP_BADSTATEMENT.
      sql/sql_class.h:
        - Added comment for clarity
      sql/sql_parse.cc:
        - Added comment for clarity
      sql/sql_prepare.cc:
        - Disallow ALTER VIEW as prepared statements until they are
          properly supported. Note that SQLCOM_CREATE_VIEW also handles ALTER VIEW
          statements.
      sql/sql_view.cc:
        - converted to doxygen comments
        - Added comment for clarity
      sql/sql_yacc.yy:
        - Disallow ALTER VIEW statements within a SP.
        If the parser is operating within the SP context, this is shown
        on the sp->sphead pointer. If this flag is set for view DDL operations
        we stop parsing with the error 'ER_SP_BAD_STATEMENT'.
      099be801
  15. 18 Jun, 2007 2 commits
    • unknown's avatar
      Bug #28921 Queries containing UDF functions are cached · 5941479e
      unknown authored
      Fixed runtime to no longer allow the caching of queries with UDF calls.
      
      
      mysql-test/r/udf.result:
        Added a test that turns on caching and checks that querys calling UDFs don't get cached.
      mysql-test/t/udf.test:
        Added a test that turns on caching and checks that querys calling UDFs don't get cached.
      sql/sql_yacc.yy:
        Fixed code to set safe_to_cache_query=0 regardless if the function call is a UDF or SP. Where it was placed previously -- at the very end of the else testing for UDFs -- it only executed the statement if the function call was a stored procedure call.
      5941479e
    • unknown's avatar
      Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached · 2a9bb274
      unknown authored
      Changed code to enforce that SQL_CACHE only in the first SELECT is used to turn on caching(as documented), but any SQL_NO_CACHE will turn off caching (not documented, but a useful behaviour, especially for machine generated queries). Added test cases to explicitly test the documented caching behaviour and test cases for the reported bug. 
      
      
      mysql-test/r/query_cache.result:
        Added non-bug specific tests that ensure that only SQL_CACHE in the first SELECT is respected when encountered by the parser. These tests validate what is already documented, that only the outer most SELECTS can use the SQL_CACHE option to turn on caching. Because it would break existing SQL applications, we do not return an error if the SQL_CACHE expression is found in nested SELECTs. Also added test to validate nested SELECT can contain SQL_NO_CACHE and it will always turn off caching for the whole query. 
        
        Also added a bug specific test case to validate that the buggy behavior as reported has been fixed.
      mysql-test/t/query_cache.test:
        Added non-bug specific tests that ensure that only SQL_CACHE in the first SELECT is respected when encountered by the parser. These tests validate what is already documented, that only the outer most SELECTS can use the SQL_CACHE option to turn on caching. Because it would break existing SQL applications, we do not return an error if the SQL_CACHE expression is found in nested SELECTs. Also added test to validate nested SELECT can contain SQL_NO_CACHE and it will always turn off caching for the whole query. 
        
        Also added a bug specific test case to validate that the buggy behavior as reported has been fixed.
      sql/sql_yacc.yy:
        Added an explicit check to make sure "SELECT SQL_CACHE" only works on the first select in a query.
        
        The parser will always hit the outermost SELECT first, and if the SQL_CACHE option is found it sets the safe_to_query flag in the lex. Then, if there are subseqent "uncachable" subqueries or functions, as it parses those elements it sets the safe_to_query to 0. However, this cause problems if nested SELECTs also used the SQL_CACHE option, because then it would set back safe_to_query to 1, even though there are uncacheable expressions previously parsed.
        
        By adding the check to ensure only the first SELECT can turn caching on, it means a subsequent SQL_CACHE option can't turn caching back on after a uncacheable subsequery was already encountered.
      2a9bb274
  16. 14 Jun, 2007 2 commits
    • unknown's avatar
      Part of patch for BUG#11986: make sp_head::m_body_begin pointer · e57122a7
      unknown authored
      private and provide a setter for it. The setter will be used to
      construct UTF-query in the following patches.
      
      
      sql/sp_head.cc:
        Make sp_head::m_body_begin pointer private.
      sql/sp_head.h:
        Make sp_head::m_body_begin pointer private.
      sql/sql_yacc.yy:
        Make sp_head::m_body_begin pointer private.
      e57122a7
    • unknown's avatar
      This is the 3-rd part of patch for BUG#11986: · c7aeb8f3
      unknown authored
      remove redundant "body" from Event_parse_data (use sp_head::m_body).
      
      
      sql/event_data_objects.cc:
        Use sp_head::m_body to store SQL-statement.
        Polishing.
      sql/event_data_objects.h:
        Use sp_head::m_body to store SQL-statement.
        Polishing.
      sql/event_db_repository.cc:
        Use sp_head::m_body to store SQL-statement.
      sql/sql_yacc.yy:
        Use sp_head::m_body to store SQL-statement.
      c7aeb8f3
  17. 13 Jun, 2007 1 commit
  18. 12 Jun, 2007 1 commit
    • unknown's avatar
      Bug#25411 (trigger code truncated), PART II · f09496c8
      unknown authored
      Bug 28127 (Some valid identifiers names are not parsed correctly)
      Bug 26302 (MySQL server cuts off trailing "*/" from comments in SP/func)
      
      This patch is the second part of a major cleanup, required to fix
      Bug 25411 (trigger code truncated).
      
      The root cause of the issue stems from the function skip_rear_comments,
      which was a work around to remove "extra" "*/" characters from the query
      text, when parsing a query and reusing the text fragments to represent a
      view, trigger, function or stored procedure.
      The reason for this work around is that "special comments",
      like /*!50002 XXX */, were not parsed properly, so that a query like:
        AAA /*!50002 BBB */ CCC
      would be seen by the parser as "AAA BBB */ CCC" when the current version
      is greater or equal to 5.0.2
      
      The root cause of this stems from how special comments are parsed.
      Special comments are really out-of-bound text that appear inside a query,
      that affects how the parser behave.
      In nature, /*!50002 XXX */ in MySQL is similar to the C concept
      of preprocessing :
        #if VERSION >= 50002
        XXX
        #endif
      
      Depending on the current VERSION of the server, either the special comment
      should be expanded or it should be ignored, but in all cases the "text" of
      the query should be re-written to strip the "/*!50002" and "*/" markers,
      which does not belong to the SQL language itself.
      
      Prior to this fix, these markers would leak into :
      - the storage format for VIEW,
      - the storage format for FUNCTION,
      - the storage format for FUNCTION parameters, in mysql.proc (param_list),
      - the storage format for PROCEDURE,
      - the storage format for PROCEDURE parameters, in mysql.proc (param_list),
      - the storage format for TRIGGER,
      - the binary log used for replication.
      
      In all cases, not only this cause format corruption, but also provide a vector
      for dormant security issues, by allowing to tunnel code that will be activated
      after an upgrade.
      
      The proper solution is to deal with special comments strictly during parsing,
      when accepting a query from the outside world.
      Once a query is parsed and an object is created with a persistant
      representation, this object should not arbitrarily mutate after an upgrade.
      In short, special comments are a useful but limited feature for MYSQLdump,
      when used at an *interface* level to facilitate import/export,
      but bloating the server *internal* storage format is *not* the proper way
      to deal with configuration management of the user logic.
      
      With this fix:
      - the Lex_input_stream class now acts as a comment pre-processor,
      and either expands or ignore special comments on the fly.
      - MYSQLlex and sql_yacc.yy have been cleaned up to strictly use the
      public interface of Lex_input_stream. In particular, how the input stream
      accepts or rejects a character is private to Lex_input_stream, and the
      internal buffer pointers of that class are strictly private, and should not
      be tempered with during parsing.
      
      This caused many changes mostly in sql_lex.cc.
      
      During the code cleanup in case MY_LEX_NUMBER_IDENT,
      Bug 28127 (Some valid identifiers names are not parsed correctly)
      was found and fixed.
      
      By parsing special comments properly, and removing the function
      'skip_rear_comments' [sic],
      Bug 26302 (MySQL server cuts off trailing "*/" from comments in SP/func)
      has been fixed as well.
      
      
      sql/event_data_objects.cc:
        Cleanup of the code that extracts the query text
      sql/sp.cc:
        Cleanup of the code that extracts the query text
      sql/sp_head.cc:
        Cleanup of the code that extracts the query text
      sql/sql_trigger.cc:
        Cleanup of the code that extracts the query text
      sql/sql_view.cc:
        Cleanup of the code that extracts the query text
      mysql-test/r/comments.result:
        Bug#25411 (trigger code truncated)
      mysql-test/r/sp.result:
        Bug#25411 (trigger code truncated)
        Bug 26302 (MySQL server cuts off trailing "*/" from comments in SP/func)
      mysql-test/r/trigger.result:
        Bug#25411 (trigger code truncated)
      mysql-test/r/varbinary.result:
        Bug 28127 (Some valid identifiers names are not parsed correctly)
      mysql-test/t/comments.test:
        Bug#25411 (trigger code truncated)
      mysql-test/t/sp.test:
        Bug#25411 (trigger code truncated)
        Bug 26302 (MySQL server cuts off trailing "*/" from comments in SP/func)
      mysql-test/t/trigger.test:
        Bug#25411 (trigger code truncated)
      mysql-test/t/varbinary.test:
        Bug 28127 (Some valid identifiers names are not parsed correctly)
      sql/sql_lex.cc:
        Implemented comment pre-processing in Lex_input_stream,
        major cleanup of the lex/yacc code to not use Lex_input_stream private members.
      sql/sql_lex.h:
        Implemented comment pre-processing in Lex_input_stream,
        major cleanup of the lex/yacc code to not use Lex_input_stream private members.
      sql/sql_yacc.yy:
        post merge fix : view_check_options must be parsed before signaling the end of the query
      f09496c8
  19. 11 Jun, 2007 1 commit
  20. 10 Jun, 2007 1 commit
    • unknown's avatar
      Follow up after work on Bug 4968 · 97cf2694
      unknown authored
      Coding style: classes start with a capital letter.
      Rename some classes related to parsing:
      create_field -> Create_field
      foreign_key -> Foreign_key
      key_part_spec -> Key_part_spec
      
      
      sql/field.cc:
        create_field -> Create_field
      sql/field.h:
        create_field -> Create_field
      sql/item.h:
        create_field -> Create_field
      sql/item_sum.cc:
        create_field -> Create_field
      sql/mysql_priv.h:
        create_field -> Create_field
      sql/sp_head.cc:
        create_field -> Create_field
      sql/sp_head.h:
        create_field -> Create_field
      sql/sp_pcontext.cc:
        create_field -> Create_field
      sql/sp_pcontext.h:
        create_field -> Create_field
      sql/sp_rcontext.cc:
        create_field -> Create_field
      sql/sql_class.cc:
        create_field -> Create_field
        key_part_spec -> Key_part_spec
        foreign_key -> Foreign_key
      sql/sql_class.h:
        create_field -> Create_field
        key_part_spec -> Key_part_spec
        foreign_key -> Foreign_key
      sql/sql_insert.cc:
        create_field -> Create_field
      sql/sql_lex.cc:
        Coding style: classes start with a capital, create_field -> Create_field
      sql/sql_lex.h:
        create_field -> Create_field
        key_part_spec -> Key_part_spec
      sql/sql_parse.cc:
        create_field -> Create_field
        key_part_spec -> Key_part_spec
      sql/sql_select.cc:
        create_field -> Create_field
      sql/sql_table.cc:
        create_field -> Create_field
      sql/sql_yacc.yy:
        create_field -> Create_field
        key_part_spec -> Key_part_spec
        foreign_key -> Foreign_key
      sql/unireg.cc:
        create_field -> Create_field
      97cf2694
  21. 08 Jun, 2007 1 commit
    • unknown's avatar
      BUG#26976 - Missing table in merge not noted in related error msg + · 5f26429d
      unknown authored
                  SHOW CREATE TABLE fails
      
      After merge fixes.
      
      
      mysql-test/r/backup.result:
        Fixed test result.
      mysql-test/r/sp.result:
        Fixed test result.
      sql/sql_table.cc:
        Fixed wrongly merged line. Moved "deprecated" warnings from sql_yacc.yy
        to mysql_backup_tables/mysql_restore_table.
      sql/sql_yacc.yy:
        Moved "deprecated" warnings from sql_yacc.yy to
        mysql_backup_tables/mysql_restore_table.
      storage/myisam/ha_myisam.cc:
        Do not report the same error twice.
      storage/myisammrg/ha_myisammrg.cc:
        Removed wrongly merged line.
      5f26429d
  22. 06 Jun, 2007 1 commit
  23. 03 Jun, 2007 1 commit
    • unknown's avatar
      Bug #26162: Trigger DML ignores low_priority_updates setting · f9a41f9f
      unknown authored
        
      The value of "low-priority-updates" option and the LOW PRIORITY
      prefix was taken into account at parse time.
      This caused triggers (among others) to ignore this flag (if
      supplied for the DML statement).
      Moved reading of the LOW_PRIORITY flag at run time.
      Fixed an incosistency when handling
      SET GLOBAL LOW_PRIORITY_UPDATES : now it is in effect for
      delayed INSERTs.
      Tested by checking the effect of LOW_PRIORITY flag via a 
      trigger.
      
      
      include/thr_lock.h:
        Bug #26162: moved reading of the LOW PRIORITY flag at run time
      mysql-test/r/trigger.result:
        Bug #26162: test case
      mysql-test/t/trigger.test:
        Bug #26162: test case
      sql/set_var.cc:
        Bug #26162: fixed the handling of the "low-priority-updates" option
      sql/sql_base.cc:
        Bug #26162: moved reading of the LOW PRIORITY flag at run time
      sql/sql_yacc.yy:
        Bug #26162: moved reading of the LOW PRIORITY flag at run time
      f9a41f9f
  24. 28 May, 2007 2 commits
    • unknown's avatar
      Changed accidently added tabs back into spaces. · 64a82941
      unknown authored
      Fixed a bug that came in merge.
      
      
      client/mysqltest.c:
        Changed accidently added tabs back into spaces.
      mysys/array.c:
        Changed accidently added tabs back into spaces.
      sql/set_var.cc:
        Changed accidently added tabs back into spaces.
      sql/sql_insert.cc:
        Removed accidently included line in merge.
      sql/sql_yacc.yy:
        Changed accidently added tabs back into spaces.
      64a82941
    • unknown's avatar
      5.1 version of a fix and test cases for bugs: · b11f1d0c
      unknown authored
      Bug#4968 ""Stored procedure crash if cursor opened on altered table"
      Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing"
      Bug#19182 "CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work from 
      stored procedure."
      Bug#19733 "Repeated alter, or repeated create/drop, fails"
      Bug#22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"
      Bug#24879 "Prepared Statements: CREATE TABLE (UTF8 KEY) produces a 
      growing key length" (this bug is not fixed in 5.0)
      
      Re-execution of CREATE DATABASE, CREATE TABLE and ALTER TABLE 
      statements in stored routines or as prepared statements caused
      incorrect results (and crashes in versions prior to 5.0.25).
      
      In 5.1 the problem occured only for CREATE DATABASE, CREATE TABLE
      SELECT and CREATE TABLE with INDEX/DATA DIRECTOY options).
        
      The problem of bugs 4968, 19733, 19282 and 6895 was that functions
      mysql_prepare_table, mysql_create_table and mysql_alter_table are not
      re-execution friendly: during their operation they modify contents
      of LEX (members create_info, alter_info, key_list, create_list),
      thus making the LEX unusable for the next execution.
      In particular, these functions removed processed columns and keys from
      create_list, key_list and drop_list. Search the code in sql_table.cc 
      for drop_it.remove() and similar patterns to find evidence.
        
      The fix is to supply to these functions a usable copy of each of the
      above structures at every re-execution of an SQL statement. 
        
      To simplify memory management, LEX::key_list and LEX::create_list
      were added to LEX::alter_info, a fresh copy of which is created for
      every execution.
        
      The problem of crashing bug 22060 stemmed from the fact that the above 
      metnioned functions were not only modifying HA_CREATE_INFO structure 
      in LEX, but also were changing it to point to areas in volatile memory
      of the execution memory root.
         
      The patch solves this problem by creating and using an on-stack
      copy of HA_CREATE_INFO in mysql_execute_command.
      
      Additionally, this patch splits the part of mysql_alter_table
      that analizes and rewrites information from the parser into
      a separate function - mysql_prepare_alter_table, in analogy with
      mysql_prepare_table, which is renamed to mysql_prepare_create_table.
      
      
      mysql-test/r/ps.result:
        Update test results (Bug#19182, Bug#22060, Bug#4968, Bug#6895)
      mysql-test/r/sp.result:
        Update results (Bug#19733)
      mysql-test/t/ps.test:
        Add test cases for Bug#19182, Bug#22060, Bug#4968, Bug#6895
      mysql-test/t/sp.test:
        Add a test case for Bug#19733
      sql/field.h:
        Implement a deep copy constructor for create_field
      sql/mysql_priv.h:
        LEX::key_list and LEX::create_list were moved to LEX::alter_info.
        Update declarations to use LEX::alter_info instead of these two
        members.
        Remove declarations of mysql_add_index, mysql_drop_index.
      sql/sql_class.cc:
        Implement deep copy constructors.
      sql/sql_class.h:
        Implement (almost) deep copy constructors for key_part_spec, 
        Alter_drop, Alter_column, Key, foreign_key.
        Replace pair<columns, keys> with an instance of Alter_info in
        select_create constructor. We create a new copy of Alter_info
        each time we re-execute SELECT .. CREATE prepared statement.
      sql/sql_insert.cc:
        Adjust to a new signature of create_table_from_items.
      sql/sql_lex.cc:
        Implement Alter_info::Alter_info that would make a "deep" copy
        of all definition lists (keys, columns).
        Move is_partition_management() from sql_partition.cc (feature-based
        file division is evil).
      sql/sql_lex.h:
        Move key_list and create_list to class Alter_info. Implement
        Alter_info::Alter_info that can be used with PS and SP.
        Get rid of Alter_info::clear() which was an attempt to save on
        matches and always use Alter_info::reset().
        Implement an auxiliary Alter_info::init_for_create_from_alter()
        which is used in mysql_alter_table.
      sql/sql_list.cc:
          Implement a copy constructor of class List that makes a deep copy
          of all list nodes.
      sql/sql_list.h:
        Implement a way to make a deep copy of all list nodes.
      sql/sql_parse.cc:
        Adjust to new signatures of mysql_create_table, mysql_alter_table,
        select_create. Functions mysql_create_index and mysql_drop_index has
        become identical after initialization of alter_info was moved to the 
        parser, and were merged. Flag enable_slow_log was not updated for 
        SQLCOM_DROP_INDEX, which was a bug.
        Just like CREATE INDEX, DROP INDEX is currently done via complete 
        table rebuild and is rightfully a slow administrative statement.
      sql/sql_partition.cc:
        Move is_partition_management() to sql_lex.cc
        Adjust code to the new Alter_info.
      sql/sql_table.cc:
        Adjust mysql_alter_table, mysql_recreate_table, mysql_create_table,
        mysql_prepare_table to new signatures.
        Rename mysql_prepare_table to mysql_prepare_create_table. Make
        sure it follows the convention and returns FALSE for success and
        TRUE for error.
        Move parts of mysql_alter_table to mysql_prepare_alter_table.
        Move the first invokation of mysql_prepare_table from mysql_alter_table
        to compare_tables, as it was needed only for the purpose
        of correct comparison.
        Since now Alter_info itself is created in the runtime mem root,
        adjust mysql_prepare_table to always allocate memory in the
        runtime memory root.
        Remove dead code.
      sql/sql_yacc.yy:
        LEX::key_list and LEX::create_list moved to class Alter_info
      b11f1d0c
  25. 24 May, 2007 1 commit
  26. 23 May, 2007 2 commits
    • unknown's avatar
      5.1 version of fix for: · 206a6bb1
      unknown authored
        Bug #23667 "CREATE TABLE LIKE is not isolated from alteration
                    by other connections"
        Bug #18950 "CREATE TABLE LIKE does not obtain LOCK_open"
      As well as:
        Bug #25578 "CREATE TABLE LIKE does not require any privileges
                    on source table".
      
      The first and the second bugs resulted in various errors and wrong
      binary log order when one tried to execute concurrently CREATE TABLE LIKE
      statement and DDL statements on source table or DML/DDL statements on its
      target table.
      
      The problem was caused by incomplete protection/table-locking against
      concurrent statements implemented in mysql_create_like_table() routine.
      We solve it by simply implementing such protection in proper way.
      Most of actual work for 5.1 was already done by fix for bug 20662 and
      preliminary patch changing locking in ALTER TABLE.
      
      The third bug allowed user who didn't have any privileges on table create
      its copy and therefore circumvent privilege check for SHOW CREATE TABLE.
      
      This patch solves this problem by adding privilege check, which was missing.
      
      Finally it also removes some duplicated code from mysql_create_like_table()
      and thus fixes bug #26869 "TABLE_LIST::table_name_length inconsistent with
      TABLE_LIST::table_name".
      
      
      mysql-test/r/create-big.result:
        Added test coverage for concurrency-related issues with CREATE TABLE LIKE.
      mysql-test/r/create.result:
        Adjusted error-code in the test case after refactoring code that
        implements CREATE TABLE ... LIKE.
      mysql-test/r/grant2.result:
        Added test for bug#25578 "CREATE TABLE LIKE does not require any privileges
        on source table".
      mysql-test/t/create-big.test:
        Added test coverage for concurrency-related issues with CREATE TABLE LIKE.
      mysql-test/t/create.test:
        Adjusted error-code in the test case after refactoring code that
        implements CREATE TABLE ... LIKE.
      mysql-test/t/disabled.def:
        Recent code changes ensured that CREATE TABLE LIKE statement is properly
        isolated against other statements, so synchronization.test should no
        longer fail (see fix for bug 20662 and preliminary patch for bug 23667
        changing ALTER TABLE locking).
      mysql-test/t/grant2.test:
        Added test for bug#25578 "CREATE TABLE LIKE does not require any privileges
        on source table".
      sql/handler.h:
        Introduced new flag for HA_CREATE_INFO::options in order to be able to
        distinguish CREATE TABLE ... LIKE from other types of CREATE TABLE.
      sql/mysql_priv.h:
        mysql_create_like_table() now takes source table name not as a
        Table_ident object but as regular table list element.
      sql/sql_lex.h:
        Removed LEX::like_name member. Now we use special flag in
        LEX::create_info::options for distinguishing CREATE TABLE ... LIKE
        from other types of CREATE TABLE and store name of source table as
        regular element in statement's table list.
      sql/sql_parse.cc:
        CREATE TABLE ... LIKE implementation now uses statement's table list
        for storing information about the source table. We also use flag
        in LEX::create_info.options for distinguishing it from other types
        of CREATE TABLE.
        Finally CREATE TABLE ... LIKE now requires the same privileges on
        the source tables as SHOW CREATE TABLE. Moved this privilege check
        to check_show_create_table_access() function.
      sql/sql_partition.cc:
        Now we use special flag in LEX::create_info::options for distinguishing
        CREATE TABLE ... LIKE from other types of CREATE TABLE and store name
        of source table as regular element in statement's table list.
      sql/sql_table.cc:
        mysql_create_like_table():  
         - Commented and cleaned-up a bit code which is responsible for achieving
           isolation from concurrent statements. Most of actual work was done by
           fix for bug 20662 and preliminary patch changing locking locking in
           ALTER TABLE, so here we do minor things like relaxing locking on
           source table (we don't need lock on it, to have it open is enough) and
           adjusting code to make it more friendly against code implementing I_S.
         - Get rid of duplicated code related to source database/table name
           handling. All these operations are already done in
           st_select_lex::add_table_to_list(), so we achieve the same effect
           by including source table into the statement's table list.
      sql/sql_yacc.yy:
        Now we use special flag in LEX::create_info::options for distinguishing
        CREATE TABLE ... LIKE from other types of CREATE TABLE and store name
        of source table as regular element in statement's table list.
      206a6bb1
    • unknown's avatar
      5.0 version of fix for: · f9d7642e
      unknown authored
       Bug #23667 "CREATE TABLE LIKE is not isolated from alteration
                   by other connections"
       Bug #18950 "CREATE TABLE LIKE does not obtain LOCK_open"
      As well as:
       Bug #25578 "CREATE TABLE LIKE does not require any privileges
                   on source table".
      
      The first and the second bugs resulted in various errors and wrong
      binary log order when one tried to execute concurrently CREATE TABLE LIKE
      statement and DDL statements on source table or DML/DDL statements on its
      target table.
      
      The problem was caused by incomplete protection/table-locking against
      concurrent statements implemented in mysql_create_like_table() routine.
      We solve it by simply implementing such protection in proper way (see
      comment for sql_table.cc for details).
      
      The third bug allowed user who didn't have any privileges on table create
      its copy and therefore circumvent privilege check for SHOW CREATE TABLE.
      
      This patch solves this problem by adding privilege check, which was missing.
      
      Finally it also removes some duplicated code from mysql_create_like_table().
      
      Note that, altough tests covering concurrency-related aspects of CREATE TABLE
      LIKE behaviour will only be introduced in 5.1, they were run manually for
      this patch as well.
      
      
      mysql-test/r/grant2.result:
        Added test for bug#25578 "CREATE TABLE LIKE does not require any privileges
        on source table".
      mysql-test/t/grant2.test:
        Added test for bug#25578 "CREATE TABLE LIKE does not require any privileges
        on source table".
      sql/handler.h:
        Introduced new flag for HA_CREATE_INFO::options in order to be able to
        distinguish CREATE TABLE ... LIKE from other types of CREATE TABLE.
      sql/mysql_priv.h:
        mysql_create_like_table() now takes source table name not as a
        Table_ident object but as regular table list element.
      sql/sql_parse.cc:
        CREATE TABLE ... LIKE implementation now uses statement's table list
        for storing information about the source table. We also use flag
        in LEX::create_info.options for distinguishing it from other types
        of CREATE TABLE.
        Finally CREATE TABLE ... LIKE now requires the same privileges on
        the source tables as SHOW CREATE TABLE. Moved this privilege check
        to check_show_create_table_access() function.
      sql/sql_table.cc:
        mysql_create_like_table():
         - Provided proper protection from concurrent statements.
           This is achieved by keeping name-lock on the source table and holding
           LOCK_open mutex during whole operation. This gives protection against
           concurrent DDL on source table. Also holding this mutex makes copying
           of .frm file, call to ha_create_table() and binlogging atomic against
           concurrent DML and DDL operations on target table.
         - Get rid of duplicated code related to source database/table name
           handling. All these operations are already done in
           st_select_lex::add_table_to_list(), so we achieve the same effect
           by including source table into the statement's table list.
      sql/sql_yacc.yy:
        Now we use special flag in LEX::create_info::options for distinguishing
        CREATE TABLE ... LIKE from other types of CREATE TABLE and store name
        of source table as regular element in statement's table list.
      f9d7642e
  27. 18 May, 2007 1 commit
    • unknown's avatar
      Fix for bug #28464: a string argument to 'limit ?' PS - replication fails · 5b3b80b4
      unknown authored
      Problem: we may get syntactically incorrect queries in the binary log 
      if we use a string value user variable executing a PS which 
      contains '... limit ?' clause, e.g.
      prepare s from "select 1 limit ?"; 
      set @A='qwe'; execute s using @A;
        
      Fix: raise an error in such cases.
      
      
      mysql-test/r/limit.result:
        Fix for bug #28464: a string argument to 'limit ?' PS - replication fails
          - test result
      mysql-test/t/limit.test:
        Fix for bug #28464: a string argument to 'limit ?' PS - replication fails
          - test case
      sql/item.cc:
        Fix for bug #28464: a string argument to 'limit ?' PS - replication fails
          - if Item_param::strict_type is set, check given and required types,
            return an error if not equal.
      sql/item.h:
        Fix for bug #28464: a string argument to 'limit ?' PS - replication fails
          - bool strict_type introduced, which indicates that a parameter value must be of 
            the required_result_type type.
          - set_strict_type() function introduced to set required type.
      sql/sql_yacc.yy:
        Fix for bug #28464: a string argument to 'limit ?' PS - replication fails
          - as we accept only INTs in the 'limit' clause set parameter's required type.
      5b3b80b4
  28. 11 May, 2007 3 commits
    • unknown's avatar
      Fix for: · d46c8ce6
      unknown authored
        Bug #20662 "Infinite loop in CREATE TABLE IF NOT EXISTS ... SELECT
                    with locked tables"
        Bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers"
        Bug #24738 "CREATE TABLE ... SELECT is not isolated properly"
        Bug #24508 "Inconsistent results of CREATE TABLE ... SELECT when
                    temporary table exists"
      
      Deadlock occured when one tried to execute CREATE TABLE IF NOT
      EXISTS ... SELECT statement under LOCK TABLES which held
      read lock on target table.
      Attempt to execute the same statement for already existing
      target table with triggers caused server crashes.
      Also concurrent execution of CREATE TABLE ... SELECT statement
      and other statements involving target table suffered from
      various races (some of which might've led to deadlocks).
      Finally, attempt to execute CREATE TABLE ... SELECT in case
      when a temporary table with same name was already present
      led to the insertion of data into this temporary table and
      creation of empty non-temporary table.
       
      All above problems stemmed from the old implementation of CREATE
      TABLE ... SELECT in which we created, opened and locked target
      table without any special protection in a separate step and not
      with the rest of tables used by this statement.
      This underminded deadlock-avoidance approach used in server
      and created window for races. It also excluded target table
      from prelocking causing problems with trigger execution.
      
      The patch solves these problems by implementing new approach to
      handling of CREATE TABLE ... SELECT for base tables.
      We try to open and lock table to be created at the same time as
      the rest of tables used by this statement. If such table does not
      exist at this moment we create and place in the table cache special
      placeholder for it which prevents its creation or any other usage
      by other threads.
      We still use old approach for creation of temporary tables.
      
      Note that we have separate fix for 5.0 since there we use slightly
      different less intrusive approach.
      
      
      mysql-test/r/create.result:
        Extended test coverage for CREATE TABLE ... SELECT. In particular added
        tests for bug #24508 "Inconsistent results of CREATE TABLE ... SELECT
        when temporary table exists" and bug #20662 "Infinite loop in CREATE
        TABLE IF NOT EXISTS ... SELECT with locked tables".
      mysql-test/r/trigger.result:
        Added test case for bug #20903 "Crash when using CREATE TABLE .. SELECT
        and triggers"
      mysql-test/t/create.test:
        Extended test coverage for CREATE TABLE ... SELECT. In particular added
        tests for bug #24508 "Inconsistent results of CREATE TABLE ... SELECT
        when temporary table exists" and bug #20662 "Infinite loop in CREATE
        TABLE IF NOT EXISTS ... SELECT with locked tables".
      mysql-test/t/trigger.test:
        Added test case for bug #20903 "Crash when using CREATE TABLE .. SELECT
        and triggers"
      sql/lock.cc:
        Now for creation of name-lock placeholder lock_table_name() uses
        auxiliary function table_cache_insert_placeholder().
      sql/mysql_priv.h:
        Removed declaration of non-existing build_table_path() routine.
        The former mysql_create_table_internal() was renamed to
        mysql_create_table_no_lock() and now exposed to other modules to
        give them opportunity of creation of tables in cases when name-lock
        is already obtained.
        reopen_name_locked_table() now has 3rd argument which controls linking
        in of table being opened into THD::open_tables (this is useful in
        cases when placeholder used for name-locking is already linked into
        this list).
        Added declaration of auxiliary function table_cache_insert_placeholder()
        which is used for creation of table placeholders for name-locking.
        Added declaration of lock_table_name_if_not_cached() which can be
        used to take an exclusive name-lock on table if there are no records
        for it in table cache.
        Changed signature of unlink_open_table() function to simplify its use
        and make it useful for table placeholders and tables that are only open.
        Added auxiliary drop_open_table() routine.
        Moved declaration of refresh_version to table.h header to make it
        accessible from inline methods of TABLE class.
        MYSQL_OPEN_IGNORE_LOCKED_TABLES flag is no longer used. Instead
        MYSQL_OPEN_TEMPORARY_ONLY option was added.
      sql/sql_base.cc:
        Added support for the new approach to the handling of CREATE TABLE
        ... SELECT for base tables.
        
        Now we try to open and lock table to be created at the same time as
        the rest of tables used by this statement. If such table does not
        exist at this moment we create and place in the table cache special
        placeholder for it which prevents its creation or any other usage
        by other threads.
        
        Note significant distinctions of this placeholder from the placeholder
        used for normal name-lock: 1) It is treated like open table by other
        name-locks so it does not allow name-lock taking operations like DROP
        TABLE or RENAME TABLE to proceed. 2) it is linked into THD::open_tables
        list and automatically removed during close_thread_tables() call
          
        open_tables():
          Implemented logic described above. To do this added
          auxiliary check_if_table_exists() function.
          Removed support for MYSQL_OPEN_IGNORE_LOCKED_TABLES option
          which is no longer used.
          Added MYSQL_OPEN_TEMPORARY_ONLY which is used to restrict
          search for temporary tables only.
        close_cached_tables()/close_thread_table()/reopen_tables()/
        close_old_data_files()/table_is_used()/remove_table_from_cache():
          Added support for open placeholders (note that we also use them
          when we need to re-open tables during flush).
        unlink_open_table():
          Changed function signature to simplify its use and to make
          useful for open placeholders and tables which are only
          open and not locked.
        Added auxiliary drop_open_table() routine.
        reopen_name_locked_table():
          Now has 3rd argument which controls linking in of table being
          opened into THD::open_tables (this is useful in cases when
          placeholder used for name-locking is already linked into
          this list).
        Added auxiliary table_cache_insert_placeholder() routine which
        simplifies creation of placeholders used for name-locking.
        Added lock_table_name_if_not_cached() which can be used to take
        an exclusive name-lock on table if there are no records for it
        in table cache.
      sql/sql_handler.cc:
        Adjusted mysql_ha_mark_tables_for_reopen() routine to properly
        handle placeholders which now can be linked into open tables
        list.
      sql/sql_insert.cc:
        Introduced new approach to handling of base tables in CREATE TABLE
        ... SELECT statement.
        
        Now we try to open and lock table to be created at the same time as
        the rest of tables used by this statement. If such table does not
        exist at this moment we create and place in the table cache special
        placeholder for it which prevents its creation or any other usage
        by other threads. By doing this we avoid races which existed with
        previous approach in which we created, opened and locked target in
        separate step without any special protection.
        This also allows properly calculate prelocking set in cases when
        target table already exists and has some on insert triggers.
        
        Note that we don't employ the same approach for temporary tables
        (this is okay as such tables are unaffected by other threads).
        
        Changed create_table_from_items() and methods of select_create
        class to implement this approach.
      sql/sql_parse.cc:
        The new approach to handling of CREATE TABLE ... SELECT for
        base tables assumes that all tables (including table to be
        created) are opened and (or) locked at the same time.
        So in cases when we create base table we have to pass to
        open_and_lock_tables() table list which includes target table.
      sql/sql_prepare.cc:
        The new approach to handling of CREATE TABLE ... SELECT for
        base tables assumes that all tables (including table to be
        created) are opened and (or) locked at the same time.
        So in cases when we create base table we have to pass to
        open_and_lock_tables() table list which includes target table.
      sql/sql_table.cc:
        Changed mysql_create_table(), mysql_create_like_table() and
        mysql_alter_table() (in rename case) to obtain exclusive name-lock
        on the non-temporary table which is going to be created (to which
        we going to rename). This ensures that not only destination table
        doesn't exist on disk but also that there are no placeholder in 
        table cache for it (i.e. there is no CREATE TABLE ... SELECT operation
        in progress for it). Note that to avoid deadlocks while taking these
        name-locks this code assumes that existence of any record for table in
        table cache (even name-lock) means that table exists. Altough such
        check can lead to false positives these should occur only in case of
        highly concurrent DDL operations on the table and should not break
        binary logging.
        
        Renamed mysql_create_table_internal() to mysql_create_table_no_lock()
        and made it accessible from other files to give them ability to create
        table in situation when name-lock is already obtained or not relevant.
        
        Adjusted calls to reopen_name_locked_table(), which now takes
        extra argument, which controls linking of open table into
        THD::open_tables list.
        
        Removed redundant setting of table's 'version' field before calls
        to close_cached_table(). This function will set it to 0 itself
        anyway.
      sql/sql_trigger.cc:
        reopen_name_locked_tables() now has one more argument which controls
        linking of opened table into the THD::open_tables list.
      sql/sql_yacc.yy:
        The new approach to handling of CREATE TABLE ... SELECT statement
        for base tables assumes that all tables including table to be
        created are open and (or) locked at the same time. Therefore
        we need to set correct lock for target table.
      sql/table.h:
        Moved declaration of refresh_version variable from mysql_priv.h
        to make it accessible from inline methods of TABLE class.
        Renamed TABLE::locked_by_flush member to open_placeholder since
        now it is also used for taking exclusive name-lock and not only
        by flush. 
        Introduced TABLE::is_name_opened() helper method which can be used
        to distinguish TABLE instances corresponding to open tables or
        placeholders for them from closed instances (e.g. due to their old
        version). Also introduced TABLE::needs_reopen_or_name_lock() helper
        which allows to check if TABLE instance corresponds to outdated
        version of table or to name-lock placeholder.
        Introduced TABLE_LIST::create member which marks elements of
        table list corresponds to the table to be created.
        Adjusted TABLE_LIST::placeholder() method to take into account 
        name-lock placeholders for tables to be created (this, for example,
        allows to properly handle such placeholders in lock_tables()).
        Finally, moved currently unused TABLE::open_next/open_prev
        members under ifdef NOT_YET.
      mysql-test/r/create_select-big.result:
        New BitKeeper file ``mysql-test/r/create_select-big.result''
      mysql-test/t/create_select-big.test:
        New BitKeeper file ``mysql-test/t/create_select-big.test''
      d46c8ce6
    • unknown's avatar
      Fix for: · c5a82455
      unknown authored
        Bug #20662 "Infinite loop in CREATE TABLE IF NOT EXISTS ... SELECT
                    with locked tables"
        Bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers"
        Bug #24738 "CREATE TABLE ... SELECT is not isolated properly"
        Bug #24508 "Inconsistent results of CREATE TABLE ... SELECT when
                    temporary table exists"
       
      Deadlock occured when one tried to execute CREATE TABLE IF NOT
      EXISTS ... SELECT statement under LOCK TABLES which held
      read lock on target table.
      Attempt to execute the same statement for already existing
      target table with triggers caused server crashes.
      Also concurrent execution of CREATE TABLE ... SELECT statement
      and other statements involving target table suffered from
      various races (some of which might've led to deadlocks).
      Finally, attempt to execute CREATE TABLE ... SELECT in case
      when a temporary table with same name was already present
      led to the insertion of data into this temporary table and
      creation of empty non-temporary table.
       
      All above problems stemmed from the old implementation of CREATE
      TABLE ... SELECT in which we created, opened and locked target
      table without any special protection in a separate step and not
      with the rest of tables used by this statement.
      This underminded deadlock-avoidance approach used in server
      and created window for races. It also excluded target table
      from prelocking causing problems with trigger execution.
        
      The patch solves these problems by implementing new approach to
      handling of CREATE TABLE ... SELECT for base tables.
      We try to open and lock table to be created at the same time as
      the rest of tables used by this statement. If such table does not
      exist at this moment we create and place in the table cache special
      placeholder for it which prevents its creation or any other usage
      by other threads.
      
      We still use old approach for creation of temporary tables.
      
      Also note that we decided to postpone introduction of some tests
      for concurrent behaviour of CREATE TABLE ... SELECT till 5.1.
      The main reason for this is absence in 5.0 ability to set @@debug
      variable at runtime, which can be circumvented only by using several
      test files with individual .opt files. Since the latter is likely
      to slowdown test-suite unnecessary we chose not to push this tests
      into 5.0, but run them manually for this version and later push
      their optimized version into 5.1
      
      
      mysql-test/r/create.result:
        Extended test coverage for CREATE TABLE ... SELECT. In particular added
        tests for bug #24508 "Inconsistent results of CREATE TABLE ... SELECT
        when temporary table exists" and bug #20662 "Infinite loop in CREATE
        TABLE IF NOT EXISTS ... SELECT with locked tables".
      mysql-test/r/trigger.result:
        Added test case for bug #20903 "Crash when using CREATE TABLE .. SELECT
        and triggers"
      mysql-test/t/create.test:
        Extended test coverage for CREATE TABLE ... SELECT. In particular added
        tests for bug #24508 "Inconsistent results of CREATE TABLE ... SELECT
        when temporary table exists" and bug #20662 "Infinite loop in CREATE
        TABLE IF NOT EXISTS ... SELECT with locked tables".
      mysql-test/t/trigger.test:
        Added test case for bug #20903 "Crash when using CREATE TABLE .. SELECT
        and triggers"
      sql/lock.cc:
        Now for creation of name-lock placeholder in lock_table_name() we use
        auxiliary function table_cache_insert_placeholder().
      sql/mysql_priv.h:
        Made build_table_path() function available outside of sql_table.cc file.
        reopen_name_locked_table() now has 3rd argument which controls linking
        in of table being opened into THD::open_tables (this is useful in
        cases when placeholder used for name-locking is already linked into
        this list).
        Added declaration of auxiliary function table_cache_insert_placeholder()
        which is used for creation of table placeholders for name-locking.
        Added declaration of table_cache_has_open_placeholder() function which
        can be used for checking if table cache contains an open placeholder for
        the table and if this placeholder was created by another thread.
        (This function is needed only in 5.0 where we use it in various versions
         of CREATE TABLE in order to protect it from concurrent CREATE TABLE
         ... SELECT operations for the table. Starting from 5.1 we use different
         approach so it is going to be removed there).
        Made close_old_data_files() static within sql_base.cc file. 
        Added auxiliary drop_open_table() routine.
        Moved declaration of refresh_version to table.h header to make it
        accessible from inline methods of TABLE class.
        MYSQL_OPEN_IGNORE_LOCKED_TABLES flag is no longer used. Instead
        MYSQL_OPEN_TEMPORARY_ONLY option was added.
      sql/sql_base.cc:
        Added support for the new approach to the handling of CREATE TABLE
        ... SELECT for base tables.
        
        Now we try to open and lock table to be created at the same time as
        the rest of tables used by this statement. If such table does not
        exist at this moment we create and place in the table cache special
        placeholder for it which prevents its creation or any other usage
        by other threads.
        
        Note significant distinctions of this placeholder from the placeholder
        used for normal name-lock: 1) It is treated like open table by other
        name-locks so it does not allow name-lock taking operations like DROP
        TABLE or RENAME TABLE to proceed. 2) it is linked into THD::open_tables
        list and automatically removed during close_thread_tables() call.
        
        open_tables():
          Implemented logic described above. To do this added
          auxiliary check_if_table_exists() function.
          Removed support for MYSQL_OPEN_IGNORE_LOCKED_TABLES option
          which is no longer used.
          Added MYSQL_OPEN_TEMPORARY_ONLY which is used to restrict
          search for temporary tables only.
        close_cached_tables()/close_thread_table()/reopen_tables()/
        close_old_data_files()/table_is_used()/remove_table_from_cache():
          Added support for open placeholders (note that we also use them
          when we need to re-open tables during flush).
        Added auxiliary drop_open_table() routine.
        reopen_name_locked_table():
          Now has 3rd argument which controls linking in of table being
          opened into THD::open_tables (this is useful in cases when
          placeholder used for name-locking is already linked into
          this list).
        Added auxiliary table_cache_insert_placeholder() routine which
        simplifies creation of placeholders used for name-locking.
        Added table_cache_has_open_placeholder() function which can be
        used for checking if table cache contains an open placeholder for
        the table and if this placeholder was created by another thread.
        (This function is needed only in 5.0 where we use it in various versions
         of CREATE TABLE in order to protect it from concurrent CREATE TABLE
         ... SELECT operations for the table. Starting from 5.1 we use different
         approach so it is going to be removed there).
      sql/sql_handler.cc:
        Adjusted mysql_ha_mark_tables_for_reopen() routine to properly
        handle placeholders which now can be linked into open tables
        list.
      sql/sql_insert.cc:
        Introduced new approach to handling of base tables in CREATE TABLE
        ... SELECT statement.
        
        Now we try to open and lock table to be created at the same time as
        the rest of tables used by this statement. If such table does not
        exist at this moment we create and place in the table cache special
        placeholder for it which prevents its creation or any other usage
        by other threads. By doing this we avoid races which existed with
        previous approach in which we created, opened and locked target in
        separate step without any special protection.
        This also allows properly calculate prelocking set in cases when
        target table already exists and has some on insert triggers.
          
        Note that we don't employ the same approach for temporary tables
        (this is okay as such tables are unaffected by other threads).
        
        Changed create_table_from_items() and select_create methods to
        implement this approach.
      sql/sql_parse.cc:
        The new approach to handling of CREATE TABLE ... SELECT for
        base tables assumes that all tables (including table to be
        created) are opened and (or) locked at the same time.
        So in cases when we create base table we have to pass to
        open_and_lock_tables() table list which includes target table.
      sql/sql_prepare.cc:
        The new approach to handling of CREATE TABLE ... SELECT for
        base tables assumes that all tables (including table to be
        created) are opened and (or) locked at the same time.
        So in cases when we create base table we have to pass to
        open_and_lock_tables() table list which includes target table.
      sql/sql_table.cc:
        Now mysql_create_table_internal(), mysql_create_like_table() and
        mysql_alter_table() not only check that destination table doesn't
        exist on disk but also check that there is no create placeholder
        in table cache for it (i.e. there is no CREATE TABLE ... SELECT
        operation in progress for it). Note that starting from 5.1 we
        use different approach in order to to protect CREATE TABLE ... SELECT
        from concurrent CREATE TABLE (ALTER TABLE ... RENAME) operations,
        the latter simply take name-locks on table before its creation
        (on target table name before renaming).
        
        Also made build_table_path() available from other files and
        asjusted calls to reopen_name_locked_table(), which now takes
        extra argument, which controls linking of open table into
        THD::open_tables list.
      sql/sql_trigger.cc:
        reopen_name_locked_tables() now has one more argument which controls
        linking of opened table into the THD::open_tables list.
      sql/sql_yacc.yy:
        The new approach to handling of CREATE TABLE ... SELECT statement
        for base tables assumes that all tables including table to be
        created are open and (or) locked at the same time. Therefore
        we need to set correct lock for target table.
      sql/table.h:
        Moved declaration of refresh_version variable from mysql_priv.h
        to make it accessible from inline methods of TABLE class. 
        Renamed TABLE::locked_by_flush member to open_placeholder since
        now it is also used for taking exclusive name-lock and not only
        by flush. 
        Introduced TABLE::is_name_opened() helper method which can be used
        to distinguish TABLE instances corresponding to open tables or
        placeholders for them from closed instances (e.g. due to their old
        version). Also introduced TABLE::needs_reopen_or_name_lock() helper
        which allows to check if TABLE instance corresponds to outdated
        version of table or to name-lock placeholder.
        Introduced TABLE_LIST::create member which marks elements of
        table list corresponds to the table to be created.
        Adjusted TABLE_LIST::placeholder() method to take into account 
        name-lock placeholders for tables to be created (this, for example,
        allows to properly handle such placeholders in lock_tables()).
      c5a82455
    • unknown's avatar
      Cleanup: now that we have Lex_input_stream, finish the transition · a0567199
      unknown authored
      by moving yet another relevant flag to it from struct LEX.
      
      
      mysql-test/r/ps.result:
        Update result.
      mysql-test/r/ps_1general.result:
        Update result.
      mysql-test/t/ps.test:
        New error code.
      mysql-test/t/ps_1general.test:
        New error code.
      sql/sql_lex.cc:
        Move stmt_prepare_mode to Lex_input_stream.
      sql/sql_lex.h:
        Move stmt_prepare_mode to class Lex_input_stream
      sql/sql_prepare.cc:
        Move stmt_prepare_mode to Lex_input_stream
      sql/sql_yacc.yy:
        Remove dead code.
      a0567199
  29. 10 May, 2007 1 commit
    • unknown's avatar
      WL#3817: Simplify string / memory area types and make things more consistent (first part) · f252f924
      unknown authored
      The following type conversions was done:
      
      - Changed byte to uchar
      - Changed gptr to uchar*
      - Change my_string to char *
      - Change my_size_t to size_t
      - Change size_s to size_t
      
      Removed declaration of byte, gptr, my_string, my_size_t and size_s. 
      
      Following function parameter changes was done:
      - All string functions in mysys/strings was changed to use size_t
        instead of uint for string lengths.
      - All read()/write() functions changed to use size_t (including vio).
      - All protocoll functions changed to use size_t instead of uint
      - Functions that used a pointer to a string length was changed to use size_t*
      - Changed malloc(), free() and related functions from using gptr to use void *
        as this requires fewer casts in the code and is more in line with how the
        standard functions work.
      - Added extra length argument to dirname_part() to return the length of the
        created string.
      - Changed (at least) following functions to take uchar* as argument:
        - db_dump()
        - my_net_write()
        - net_write_command()
        - net_store_data()
        - DBUG_DUMP()
        - decimal2bin() & bin2decimal()
      - Changed my_compress() and my_uncompress() to use size_t. Changed one
        argument to my_uncompress() from a pointer to a value as we only return
        one value (makes function easier to use).
      - Changed type of 'pack_data' argument to packfrm() to avoid casts.
      - Changed in readfrm() and writefrom(), ha_discover and handler::discover()
        the type for argument 'frmdata' to uchar** to avoid casts.
      - Changed most Field functions to use uchar* instead of char* (reduced a lot of
        casts).
      - Changed field->val_xxx(xxx, new_ptr) to take const pointers.
      
      Other changes:
      - Removed a lot of not needed casts
      - Added a few new cast required by other changes
      - Added some cast to my_multi_malloc() arguments for safety (as string lengths
        needs to be uint, not size_t).
      - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
        explicitely as this conflict was often hided by casting the function to
        hash_get_key).
      - Changed some buffers to memory regions to uchar* to avoid casts.
      - Changed some string lengths from uint to size_t.
      - Changed field->ptr to be uchar* instead of char*. This allowed us to
        get rid of a lot of casts.
      - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
      - Include zlib.h in some files as we needed declaration of crc32()
      - Changed MY_FILE_ERROR to be (size_t) -1.
      - Changed many variables to hold the result of my_read() / my_write() to be
        size_t. This was needed to properly detect errors (which are
        returned as (size_t) -1).
      - Removed some very old VMS code
      - Changed packfrm()/unpackfrm() to not be depending on uint size
        (portability fix)
      - Removed windows specific code to restore cursor position as this
        causes slowdown on windows and we should not mix read() and pread()
        calls anyway as this is not thread safe. Updated function comment to
        reflect this. Changed function that depended on original behavior of
        my_pwrite() to itself restore the cursor position (one such case).
      - Added some missing checking of return value of malloc().
      - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
      - Changed type of table_def::m_size from my_size_t to ulong to reflect that
        m_size is the number of elements in the array, not a string/memory
        length.
      - Moved THD::max_row_length() to table.cc (as it's not depending on THD).
        Inlined max_row_length_blob() into this function.
      - More function comments
      - Fixed some compiler warnings when compiled without partitions.
      - Removed setting of LEX_STRING() arguments in declaration (portability fix).
      - Some trivial indentation/variable name changes.
      - Some trivial code simplifications:
        - Replaced some calls to alloc_root + memcpy to use
          strmake_root()/strdup_root().
        - Changed some calls from memdup() to strmake() (Safety fix)
        - Simpler loops in client-simple.c
      
      
      BitKeeper/etc/ignore:
        added libmysqld/ha_ndbcluster_cond.cc
        ---
        added debian/defs.mk debian/control
      client/completion_hash.cc:
        Remove not needed casts
      client/my_readline.h:
        Remove some old types
      client/mysql.cc:
        Simplify types
      client/mysql_upgrade.c:
        Remove some old types
        Update call to dirname_part
      client/mysqladmin.cc:
        Remove some old types
      client/mysqlbinlog.cc:
        Remove some old types
        Change some buffers to be uchar to avoid casts
      client/mysqlcheck.c:
        Remove some old types
      client/mysqldump.c:
        Remove some old types
        Remove some not needed casts
        Change some string lengths to size_t
      client/mysqlimport.c:
        Remove some old types
      client/mysqlshow.c:
        Remove some old types
      client/mysqlslap.c:
        Remove some old types
        Remove some not needed casts
      client/mysqltest.c:
        Removed some old types
        Removed some not needed casts
        Updated hash-get-key function arguments
        Updated parameters to dirname_part()
      client/readline.cc:
        Removed some old types
        Removed some not needed casts
        Changed some string lengths to use size_t
      client/sql_string.cc:
        Removed some old types
      dbug/dbug.c:
        Removed some old types
        Changed some string lengths to use size_t
        Changed some prototypes to avoid casts
      extra/comp_err.c:
        Removed some old types
      extra/innochecksum.c:
        Removed some old types
      extra/my_print_defaults.c:
        Removed some old types
      extra/mysql_waitpid.c:
        Removed some old types
      extra/perror.c:
        Removed some old types
      extra/replace.c:
        Removed some old types
        Updated parameters to dirname_part()
      extra/resolve_stack_dump.c:
        Removed some old types
      extra/resolveip.c:
        Removed some old types
      include/config-win.h:
        Removed some old types
      include/decimal.h:
        Changed binary strings to be uchar* instead of char*
      include/ft_global.h:
        Removed some old types
      include/hash.h:
        Removed some old types
      include/heap.h:
        Removed some old types
        Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
      include/keycache.h:
        Removed some old types
      include/m_ctype.h:
        Removed some old types
        Changed some string lengths to use size_t
        Changed character length functions to return uint
        unsigned char -> uchar
      include/m_string.h:
        Removed some old types
        Changed some string lengths to use size_t
      include/my_alloc.h:
        Changed some string lengths to use size_t
      include/my_base.h:
        Removed some old types
      include/my_dbug.h:
        Removed some old types
        Changed some string lengths to use size_t
        Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
      include/my_getopt.h:
        Removed some old types
      include/my_global.h:
        Removed old types:
        my_size_t -> size_t
        byte -> uchar
        gptr -> uchar *
      include/my_list.h:
        Removed some old types
      include/my_nosys.h:
        Removed some old types
      include/my_pthread.h:
        Removed some old types
      include/my_sys.h:
        Removed some old types
        Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
        Changed some string lengths to use size_t
        my_malloc() / my_free() now uses void *
        Updated parameters to dirname_part() & my_uncompress()
      include/my_tree.h:
        Removed some old types
      include/my_trie.h:
        Removed some old types
      include/my_user.h:
        Changed some string lengths to use size_t
      include/my_vle.h:
        Removed some old types
      include/my_xml.h:
        Removed some old types
        Changed some string lengths to use size_t
      include/myisam.h:
        Removed some old types
      include/myisammrg.h:
        Removed some old types
      include/mysql.h:
        Removed some old types
        Changed byte streams to use uchar* instead of char*
      include/mysql_com.h:
        Removed some old types
        Changed some string lengths to use size_t
        Changed some buffers to be uchar* to avoid casts
      include/queues.h:
        Removed some old types
      include/sql_common.h:
        Removed some old types
      include/sslopt-longopts.h:
        Removed some old types
      include/violite.h:
        Removed some old types
        Changed some string lengths to use size_t
      libmysql/client_settings.h:
        Removed some old types
      libmysql/libmysql.c:
        Removed some old types
      libmysql/manager.c:
        Removed some old types
      libmysqld/emb_qcache.cc:
        Removed some old types
      libmysqld/emb_qcache.h:
        Removed some old types
      libmysqld/lib_sql.cc:
        Removed some old types
        Removed some not needed casts
        Changed some buffers to be uchar* to avoid casts
        true -> TRUE, false -> FALSE
      mysys/array.c:
        Removed some old types
      mysys/charset.c:
        Changed some string lengths to use size_t
      mysys/checksum.c:
        Include zlib to get definition for crc32
        Removed some old types
      mysys/default.c:
        Removed some old types
        Changed some string lengths to use size_t
      mysys/default_modify.c:
        Changed some string lengths to use size_t
        Removed some not needed casts
      mysys/hash.c:
        Removed some old types
        Changed some string lengths to use size_t
        Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
        hash_element now takes 'ulong' as the index type (cleanup)
      mysys/list.c:
        Removed some old types
      mysys/mf_cache.c:
        Changed some string lengths to use size_t
      mysys/mf_dirname.c:
        Removed some old types
        Changed some string lengths to use size_t
        Added argument to dirname_part() to avoid calculation of length for 'to'
      mysys/mf_fn_ext.c:
        Removed some old types
        Updated parameters to dirname_part()
      mysys/mf_format.c:
        Removed some old types
        Changed some string lengths to use size_t
      mysys/mf_getdate.c:
        Removed some old types
      mysys/mf_iocache.c:
        Removed some old types
        Changed some string lengths to use size_t
        Changed calculation of 'max_length' to be done the same way in all functions
      mysys/mf_iocache2.c:
        Removed some old types
        Changed some string lengths to use size_t
        Clean up comments
        Removed not needed indentation
      mysys/mf_keycache.c:
        Removed some old types
      mysys/mf_keycaches.c:
        Removed some old types
      mysys/mf_loadpath.c:
        Removed some old types
      mysys/mf_pack.c:
        Removed some old types
        Changed some string lengths to use size_t
        Removed some not needed casts
        Removed very old VMS code
        Updated parameters to dirname_part()
        Use result of dirnam_part() to remove call to strcat()
      mysys/mf_path.c:
        Removed some old types
      mysys/mf_radix.c:
        Removed some old types
      mysys/mf_same.c:
        Removed some old types
      mysys/mf_sort.c:
        Removed some old types
      mysys/mf_soundex.c:
        Removed some old types
      mysys/mf_strip.c:
        Removed some old types
      mysys/mf_tempdir.c:
        Removed some old types
      mysys/mf_unixpath.c:
        Removed some old types
      mysys/mf_wfile.c:
        Removed some old types
      mysys/mulalloc.c:
        Removed some old types
      mysys/my_alloc.c:
        Removed some old types
        Changed some string lengths to use size_t
        Use void* as type for allocated memory area
        Removed some not needed casts
        Changed argument 'Size' to 'length' according coding guidelines
      mysys/my_chsize.c:
        Changed some buffers to be uchar* to avoid casts
      mysys/my_compress.c:
        More comments
        Removed some old types
        Changed string lengths to use size_t
        Changed arguments to my_uncompress() to make them easier to understand
        Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
        Changed type of 'pack_data' argument to packfrm() to avoid casts.
      mysys/my_conio.c:
        Changed some string lengths to use size_t
      mysys/my_create.c:
        Removed some old types
      mysys/my_div.c:
        Removed some old types
      mysys/my_error.c:
        Removed some old types
      mysys/my_fopen.c:
        Removed some old types
      mysys/my_fstream.c:
        Removed some old types
        Changed some string lengths to use size_t
        writen -> written
      mysys/my_getopt.c:
        Removed some old types
      mysys/my_getwd.c:
        Removed some old types
        More comments
      mysys/my_init.c:
        Removed some old types
      mysys/my_largepage.c:
        Removed some old types
        Changed some string lengths to use size_t
      mysys/my_lib.c:
        Removed some old types
      mysys/my_lockmem.c:
        Removed some old types
      mysys/my_malloc.c:
        Removed some old types
        Changed malloc(), free() and related functions to use void *
        Changed all functions to use size_t
      mysys/my_memmem.c:
        Indentation cleanup
      mysys/my_once.c:
        Removed some old types
        Changed malloc(), free() and related functions to use void *
      mysys/my_open.c:
        Removed some old types
      mysys/my_pread.c:
        Removed some old types
        Changed all functions to use size_t
        Added comment for how my_pread() / my_pwrite() are supposed to work.
        Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe.
        (If we ever would really need this, it should be enabled only with a flag argument)
      mysys/my_quick.c:
        Removed some old types
        Changed all functions to use size_t
      mysys/my_read.c:
        Removed some old types
        Changed all functions to use size_t
      mysys/my_realloc.c:
        Removed some old types
        Use void* as type for allocated memory area
        Changed all functions to use size_t
      mysys/my_static.c:
        Removed some old types
      mysys/my_static.h:
        Removed some old types
      mysys/my_vle.c:
        Removed some old types
      mysys/my_wincond.c:
        Removed some old types
      mysys/my_windac.c:
        Removed some old types
      mysys/my_write.c:
        Removed some old types
        Changed all functions to use size_t
      mysys/ptr_cmp.c:
        Removed some old types
        Changed all functions to use size_t
      mysys/queues.c:
        Removed some old types
      mysys/safemalloc.c:
        Removed some old types
        Changed malloc(), free() and related functions to use void *
        Changed all functions to use size_t
      mysys/string.c:
        Removed some old types
        Changed all functions to use size_t
      mysys/testhash.c:
        Removed some old types
      mysys/thr_alarm.c:
        Removed some old types
      mysys/thr_lock.c:
        Removed some old types
      mysys/tree.c:
        Removed some old types
      mysys/trie.c:
        Removed some old types
      mysys/typelib.c:
        Removed some old types
      plugin/daemon_example/daemon_example.cc:
        Removed some old types
      regex/reginit.c:
        Removed some old types
      server-tools/instance-manager/buffer.cc:
        Changed some string lengths to use size_t
        Changed buffer to be of type uchar*
      server-tools/instance-manager/buffer.h:
        Changed some string lengths to use size_t
        Changed buffer to be of type uchar*
      server-tools/instance-manager/commands.cc:
        Removed some old types
        Changed some string lengths to use size_t
        Changed buffer to be of type uchar*
      server-tools/instance-manager/instance_map.cc:
        Removed some old types
        Changed some string lengths to use size_t
        Changed buffer to be of type uchar*
      server-tools/instance-manager/instance_options.cc:
        Changed buffer to be of type uchar*
        Replaced alloc_root + strcpy() with strdup_root()
      server-tools/instance-manager/mysql_connection.cc:
        Changed buffer to be of type uchar*
      server-tools/instance-manager/options.cc:
        Removed some old types
      server-tools/instance-manager/parse.cc:
        Changed some string lengths to use size_t
      server-tools/instance-manager/parse.h:
        Removed some old types
        Changed some string lengths to use size_t
      server-tools/instance-manager/protocol.cc:
        Changed some buffers to be uchar* to avoid casts
        Changed some string lengths to use size_t
      server-tools/instance-manager/protocol.h:
        Changed some string lengths to use size_t
      server-tools/instance-manager/user_map.cc:
        Removed some old types
        Changed some string lengths to use size_t
      sql/derror.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Changed some string lengths to use size_t
      sql/discover.cc:
        Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
        Changed some string lengths to use size_t
        Changed some buffers to be uchar* to avoid casts
      sql/event_data_objects.cc:
        Removed some old types
        Added missing casts for alloc() and sprintf()
      sql/event_db_repository.cc:
        Changed some buffers to be uchar* to avoid casts
        Added missing casts for sprintf()
      sql/event_queue.cc:
        Removed some old types
      sql/field.cc:
        Removed some old types
        Changed memory buffers to be uchar*
        Changed some string lengths to use size_t
        Removed a lot of casts
        Safety fix in Field_blob::val_decimal() to not access zero pointer
      sql/field.h:
        Removed some old types
        Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes). 
        Changed some string lengths to use size_t
        Removed some not needed casts
        Changed val_xxx(xxx, new_ptr) to take const pointers
      sql/field_conv.cc:
        Removed some old types
        Added casts required because memory area pointers are now uchar*
      sql/filesort.cc:
        Initalize variable that was used unitialized in error conditions
      sql/gen_lex_hash.cc:
        Removed some old types
        Changed memory buffers to be uchar*
        Changed some string lengths to use size_t
        Removed a lot of casts
        Safety fix in Field_blob::val_decimal() to not access zero pointer
      sql/gstream.h:
        Added required cast
      sql/ha_ndbcluster.cc:
        Removed some old types
        Updated hash-get-key function arguments
        Changed some buffers to be uchar* to avoid casts
        Added required casts
        Removed some not needed casts
      sql/ha_ndbcluster.h:
        Removed some old types
      sql/ha_ndbcluster_binlog.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
        Changed some string lengths to use size_t
        Added missing casts for alloc() and sprintf()
      sql/ha_ndbcluster_binlog.h:
        Removed some old types
      sql/ha_ndbcluster_cond.cc:
        Removed some old types
        Removed some not needed casts
      sql/ha_ndbcluster_cond.h:
        Removed some old types
      sql/ha_partition.cc:
        Removed some old types
        Changed prototype for change_partition() to avoid casts
      sql/ha_partition.h:
        Removed some old types
      sql/handler.cc:
        Removed some old types
        Changed some string lengths to use size_t
      sql/handler.h:
        Removed some old types
        Changed some string lengths to use size_t
        Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
      sql/hash_filo.h:
        Removed some old types
        Changed all functions to use size_t
      sql/hostname.cc:
        Removed some old types
      sql/item.cc:
        Removed some old types
        Changed some string lengths to use size_t
        Use strmake() instead of memdup() to create a null terminated string.
        Updated calls to new Field()
      sql/item.h:
        Removed some old types
        Changed malloc(), free() and related functions to use void *
        Changed some buffers to be uchar* to avoid casts
      sql/item_cmpfunc.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
      sql/item_cmpfunc.h:
        Removed some old types
      sql/item_create.cc:
        Removed some old types
      sql/item_func.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Removed some not needed casts
        Added test for failing alloc() in init_result_field()
        Remove old confusing comment
        Fixed compiler warning
      sql/item_func.h:
        Removed some old types
      sql/item_row.cc:
        Removed some old types
      sql/item_row.h:
        Removed some old types
      sql/item_strfunc.cc:
        Include zlib (needed becasue we call crc32)
        Removed some old types
      sql/item_strfunc.h:
        Removed some old types
        Changed some types to match new function prototypes
      sql/item_subselect.cc:
        Removed some old types
      sql/item_subselect.h:
        Removed some old types
      sql/item_sum.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Removed some not needed casts
      sql/item_sum.h:
        Removed some old types
      sql/item_timefunc.cc:
        Removed some old types
        Changed some string lengths to use size_t
      sql/item_timefunc.h:
        Removed some old types
      sql/item_xmlfunc.cc:
        Changed some string lengths to use size_t
      sql/item_xmlfunc.h:
        Removed some old types
      sql/key.cc:
        Removed some old types
        Removed some not needed casts
      sql/lock.cc:
        Removed some old types
        Added some cast to my_multi_malloc() arguments for safety
      sql/log.cc:
        Removed some old types
        Changed some string lengths to use size_t
        Changed some buffers to be uchar* to avoid casts
        Changed usage of pwrite() to not assume it holds the cursor position for the file
        Made usage of my_read() safer
      sql/log_event.cc:
        Removed some old types
        Added checking of return value of malloc() in pack_info()
        Changed some buffers to be uchar* to avoid casts
        Removed some 'const' to avoid casts
        Added missing casts for alloc() and sprintf()
        Added required casts
        Removed some not needed casts
        Added some cast to my_multi_malloc() arguments for safety
      sql/log_event.h:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
      sql/log_event_old.cc:
        Changed some buffers to be uchar* to avoid casts
        Removed some not needed casts
      sql/log_event_old.h:
        Changed some buffers to be uchar* to avoid casts
      sql/mf_iocache.cc:
        Removed some old types
      sql/my_decimal.cc:
        Changed memory area to use uchar*
      sql/my_decimal.h:
        Changed memory area to use uchar*
      sql/mysql_priv.h:
        Removed some old types
        Changed malloc(), free() and related functions to use void *
        Changed some string lengths to use size_t
        Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
        Changed some buffers to be uchar* to avoid casts
      sql/mysqld.cc:
        Removed some old types
      sql/net_serv.cc:
        Removed some old types
        Changed some string lengths to use size_t
        Changed some buffers to be uchar* to avoid casts
        Ensure that vio_read()/vio_write() return values are stored in a size_t variable
        Removed some not needed casts
      sql/opt_range.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Removed some not needed casts
      sql/opt_range.h:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
      sql/opt_sum.cc:
        Removed some old types
        Removed some not needed casts
      sql/parse_file.cc:
        Removed some old types
        Changed some string lengths to use size_t
        Changed alloc_root + memcpy + set end 0 -> strmake_root()
      sql/parse_file.h:
        Removed some old types
      sql/partition_info.cc:
        Removed some old types
        Added missing casts for alloc()
        Changed some buffers to be uchar* to avoid casts
      sql/partition_info.h:
        Changed some buffers to be uchar* to avoid casts
      sql/protocol.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Removed some not needed casts
      sql/protocol.h:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Changed some string lengths to use size_t
      sql/records.cc:
        Removed some old types
      sql/repl_failsafe.cc:
        Removed some old types
        Changed some string lengths to use size_t
        Added required casts
      sql/rpl_filter.cc:
        Removed some old types
        Updated hash-get-key function arguments
        Changed some string lengths to use size_t
      sql/rpl_filter.h:
        Changed some string lengths to use size_t
      sql/rpl_injector.h:
        Removed some old types
      sql/rpl_record.cc:
        Removed some old types
        Removed some not needed casts
        Changed some buffers to be uchar* to avoid casts
      sql/rpl_record.h:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
      sql/rpl_record_old.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Removed some not needed casts
      sql/rpl_record_old.h:
        Removed some old types
        Changed some buffers to be uchar* to avoid cast
      sql/rpl_rli.cc:
        Removed some old types
      sql/rpl_tblmap.cc:
        Removed some old types
      sql/rpl_tblmap.h:
        Removed some old types
      sql/rpl_utility.cc:
        Removed some old types
      sql/rpl_utility.h:
        Removed some old types
        Changed type of m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length
      sql/set_var.cc:
        Removed some old types
        Updated parameters to dirname_part()
      sql/set_var.h:
        Removed some old types
      sql/slave.cc:
        Removed some old types
        Changed some string lengths to use size_t
      sql/slave.h:
        Removed some old types
      sql/sp.cc:
        Removed some old types
        Added missing casts for printf()
      sql/sp.h:
        Removed some old types
        Updated hash-get-key function arguments
      sql/sp_cache.cc:
        Removed some old types
        Added missing casts for printf()
        Updated hash-get-key function arguments
      sql/sp_head.cc:
        Removed some old types
        Added missing casts for alloc() and printf()
        Added required casts
        Updated hash-get-key function arguments
      sql/sp_head.h:
        Removed some old types
      sql/sp_pcontext.cc:
        Removed some old types
      sql/sp_pcontext.h:
        Removed some old types
      sql/sql_acl.cc:
        Removed some old types
        Changed some string lengths to use size_t
        Changed some buffers to be uchar* to avoid casts
        Removed some not needed casts
        Added required casts
      sql/sql_analyse.cc:
        Changed some buffers to be uchar* to avoid casts
      sql/sql_analyse.h:
        Changed some buffers to be uchar* to avoid casts
      sql/sql_array.h:
        Removed some old types
      sql/sql_base.cc:
        Removed some old types
        Updated hash-get-key function arguments
      sql/sql_binlog.cc:
        Removed some old types
        Added missing casts for printf()
      sql/sql_cache.cc:
        Removed some old types
        Updated hash-get-key function arguments
        Removed some not needed casts
        Changed some string lengths to use size_t
      sql/sql_cache.h:
        Removed some old types
        Removed reference to not existing function cache_key()
        Updated hash-get-key function arguments
      sql/sql_class.cc:
        Removed some old types
        Updated hash-get-key function arguments
        Added missing casts for alloc()
        Updated hash-get-key function arguments
        Moved THD::max_row_length() to table.cc (as it's not depending on THD)
        Removed some not needed casts
      sql/sql_class.h:
        Removed some old types
        Changed malloc(), free() and related functions to use void *
        Removed some not needed casts
        Changed some string lengths to use size_t
        Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
      sql/sql_connect.cc:
        Removed some old types
        Added required casts
      sql/sql_db.cc:
        Removed some old types
        Removed some not needed casts
        Added some cast to my_multi_malloc() arguments for safety
        Added missing casts for alloc()
      sql/sql_delete.cc:
        Removed some old types
      sql/sql_handler.cc:
        Removed some old types
        Updated hash-get-key function arguments
        Added some cast to my_multi_malloc() arguments for safety
      sql/sql_help.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Removed some not needed casts
      sql/sql_insert.cc:
        Removed some old types
        Added missing casts for alloc() and printf()
      sql/sql_lex.cc:
        Removed some old types
      sql/sql_lex.h:
        Removed some old types
        Removed some not needed casts
      sql/sql_list.h:
        Removed some old types
        Removed some not needed casts
      sql/sql_load.cc:
        Removed some old types
        Removed compiler warning
      sql/sql_manager.cc:
        Removed some old types
      sql/sql_map.cc:
        Removed some old types
      sql/sql_map.h:
        Removed some old types
      sql/sql_olap.cc:
        Removed some old types
      sql/sql_parse.cc:
        Removed some old types
        Trivial move of code lines to make things more readable
        Changed some string lengths to use size_t
        Added missing casts for alloc()
      sql/sql_partition.cc:
        Removed some old types
        Removed compiler warnings about not used functions
        Changed some buffers to be uchar* to avoid casts
        Removed some not needed casts
      sql/sql_partition.h:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
      sql/sql_plugin.cc:
        Removed some old types
        Added missing casts for alloc()
        Updated hash-get-key function arguments
      sql/sql_prepare.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Added missing casts for alloc() and printf()
      sql-common/client.c:
        Removed some old types
        Changed some memory areas to use uchar*
      sql-common/my_user.c:
        Changed some string lengths to use size_t
      sql-common/pack.c:
        Changed some buffers to be uchar* to avoid casts
      sql/sql_repl.cc:
        Added required casts
        Changed some buffers to be uchar* to avoid casts
        Changed some string lengths to use size_t
      sql/sql_select.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Removed some old types
      sql/sql_select.h:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
      sql/sql_servers.cc:
        Removed some old types
        Updated hash-get-key function arguments
      sql/sql_show.cc:
        Removed some old types
        Added missing casts for alloc()
        Removed some not needed casts
      sql/sql_string.cc:
        Removed some old types
        Added required casts
      sql/sql_table.cc:
        Removed some old types
        Removed compiler warning about not used variable
        Changed some buffers to be uchar* to avoid casts
        Removed some not needed casts
      sql/sql_test.cc:
        Removed some old types
      sql/sql_trigger.cc:
        Removed some old types
        Added missing casts for alloc()
      sql/sql_udf.cc:
        Removed some old types
        Updated hash-get-key function arguments
      sql/sql_union.cc:
        Removed some old types
      sql/sql_update.cc:
        Removed some old types
        Removed some not needed casts
      sql/sql_view.cc:
        Removed some old types
      sql/sql_yacc.yy:
        Removed some old types
        Changed some string lengths to use size_t
        Added missing casts for alloc()
      sql/stacktrace.c:
        Removed some old types
      sql/stacktrace.h:
        Removed some old types
      sql/structs.h:
        Removed some old types
      sql/table.cc:
        Removed some old types
        Updated hash-get-key function arguments
        Changed some buffers to be uchar* to avoid casts
        Removed setting of LEX_STRING() arguments in declaration
        Added required casts
        More function comments
        Moved max_row_length() here from sql_class.cc/sql_class.h
      sql/table.h:
        Removed some old types
        Changed some string lengths to use size_t
      sql/thr_malloc.cc:
        Use void* as type for allocated memory area
        Changed all functions to use size_t
      sql/tzfile.h:
        Changed some buffers to be uchar* to avoid casts
      sql/tztime.cc:
        Changed some buffers to be uchar* to avoid casts
        Updated hash-get-key function arguments
        Added missing casts for alloc()
        Removed some not needed casts
      sql/uniques.cc:
        Removed some old types
        Removed some not needed casts
      sql/unireg.cc:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
        Removed some not needed casts
        Added missing casts for alloc()
      storage/archive/archive_reader.c:
        Removed some old types
      storage/archive/azio.c:
        Removed some old types
        Removed some not needed casts
      storage/archive/ha_archive.cc:
        Removed some old types
        Changed type for 'frmblob' in archive_discover() to match handler
        Updated hash-get-key function arguments
        Removed some not needed casts
      storage/archive/ha_archive.h:
        Removed some old types
      storage/blackhole/ha_blackhole.cc:
        Removed some old types
      storage/blackhole/ha_blackhole.h:
        Removed some old types
      storage/csv/ha_tina.cc:
        Removed some old types
        Updated hash-get-key function arguments
        Changed some buffers to be uchar* to avoid casts
      storage/csv/ha_tina.h:
        Removed some old types
        Removed some not needed casts
      storage/csv/transparent_file.cc:
        Removed some old types
        Changed type of 'bytes_read' to be able to detect read errors
        Fixed indentation
      storage/csv/transparent_file.h:
        Removed some old types
      storage/example/ha_example.cc:
        Removed some old types
        Updated hash-get-key function arguments
      storage/example/ha_example.h:
        Removed some old types
      storage/federated/ha_federated.cc:
        Removed some old types
        Updated hash-get-key function arguments
        Removed some not needed casts
      storage/federated/ha_federated.h:
        Removed some old types
      storage/heap/_check.c:
        Changed some buffers to be uchar* to avoid casts
      storage/heap/_rectest.c:
        Removed some old types
      storage/heap/ha_heap.cc:
        Removed some old types
      storage/heap/ha_heap.h:
        Removed some old types
      storage/heap/heapdef.h:
        Removed some old types
      storage/heap/hp_block.c:
        Removed some old types
        Changed some string lengths to use size_t
      storage/heap/hp_clear.c:
        Removed some old types
      storage/heap/hp_close.c:
        Removed some old types
      storage/heap/hp_create.c:
        Removed some old types
      storage/heap/hp_delete.c:
        Removed some old types
      storage/heap/hp_hash.c:
        Removed some old types
      storage/heap/hp_info.c:
        Removed some old types
      storage/heap/hp_open.c:
        Removed some old types
      storage/heap/hp_rfirst.c:
        Removed some old types
      storage/heap/hp_rkey.c:
        Removed some old types
      storage/heap/hp_rlast.c:
        Removed some old types
      storage/heap/hp_rnext.c:
        Removed some old types
      storage/heap/hp_rprev.c:
        Removed some old types
      storage/heap/hp_rrnd.c:
        Removed some old types
      storage/heap/hp_rsame.c:
        Removed some old types
      storage/heap/hp_scan.c:
        Removed some old types
      storage/heap/hp_test1.c:
        Removed some old types
      storage/heap/hp_test2.c:
        Removed some old types
      storage/heap/hp_update.c:
        Removed some old types
      storage/heap/hp_write.c:
        Removed some old types
        Changed some string lengths to use size_t
      storage/innobase/handler/ha_innodb.cc:
        Removed some old types
        Updated hash-get-key function arguments
        Added missing casts for alloc() and printf()
        Removed some not needed casts
      storage/innobase/handler/ha_innodb.h:
        Removed some old types
      storage/myisam/ft_boolean_search.c:
        Removed some old types
      storage/myisam/ft_nlq_search.c:
        Removed some old types
      storage/myisam/ft_parser.c:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
      storage/myisam/ft_static.c:
        Removed some old types
      storage/myisam/ft_stopwords.c:
        Removed some old types
      storage/myisam/ft_update.c:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
      storage/myisam/ftdefs.h:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
      storage/myisam/fulltext.h:
        Removed some old types
      storage/myisam/ha_myisam.cc:
        Removed some old types
      storage/myisam/ha_myisam.h:
        Removed some old types
      storage/myisam/mi_cache.c:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
      storage/myisam/mi_check.c:
        Removed some old types
      storage/myisam/mi_checksum.c:
        Removed some old types
      storage/myisam/mi_close.c:
        Removed some old types
      storage/myisam/mi_create.c:
        Removed some old types
      storage/myisam/mi_delete.c:
        Removed some old types
      storage/myisam/mi_delete_all.c:
        Removed some old types
      storage/myisam/mi_dynrec.c:
        Removed some old types
      storage/myisam/mi_extra.c:
        Removed some old types
      storage/myisam/mi_key.c:
        Removed some old types
      storage/myisam/mi_locking.c:
        Removed some old types
      storage/myisam/mi_log.c:
        Removed some old types
      storage/myisam/mi_open.c:
        Removed some old types
        Removed some not needed casts
        Check argument of my_write()/my_pwrite() in functions returning int
        Added casting of string lengths to size_t
      storage/myisam/mi_packrec.c:
        Removed some old types
        Changed some buffers to be uchar* to avoid casts
      storage/myisam/mi_page.c:
        Removed some old types
      storage/myisam/mi_preload.c:
        Removed some old types
      storage/myisam/mi_range.c:
        Removed some old types
      storage/myisam/mi_rfirst.c:
        Removed some old types
      storage/myisam/mi_rkey.c:
        Removed some old types
      storage/myisam/mi_rlast.c:
        Removed some old types
      storage/myisam/mi_rnext.c:
        Removed some old types
      storage/myisam/mi_rnext_same.c:
        Removed some old types
      storage/myisam/mi_rprev.c:
        Removed some old types
      storage/myisam/mi_rrnd.c:
        Removed some old types
      storage/myisam/mi_rsame.c:
        Removed some old types
      storage/myisam/mi_rsamepos.c:
        Removed some old types
      storage/myisam/mi_scan.c:
        Removed some old types
      storage/myisam/mi_search.c:
        Removed some old types
      storage/myisam/mi_static.c:
        Removed some old types
      storage/myisam/mi_statrec.c:
        Removed some old types
      storage/myisam/mi_test1.c:
        Removed some old types
      storage/myisam/mi_test2.c:
        Removed some old types
      storage/myisam/mi_test3.c:
        Removed some old types
      storage/myisam/mi_unique.c:
        Removed some old types
      storage/myisam/mi_update.c:
        Removed some old types
      storage/myisam/mi_write.c:
        Removed some old types
      storage/myisam/myisam_ftdump.c:
        Removed some old types
      storage/myisam/myisamchk.c:
        Removed some old types
      storage/myisam/myisamdef.h:
        Removed some old types
      storage/myisam/myisamlog.c:
        Removed some old types
        Indentation fix
      storage/myisam/myisampack.c:
        Removed some old types
      storage/myisam/rt_index.c:
        Removed some old types
      storage/myisam/rt_split.c:
        Removed some old types
      storage/myisam/sort.c:
        Removed some old types
      storage/myisam/sp_defs.h:
        Removed some old types
      storage/myisam/sp_key.c:
        Removed some old types
      storage/myisammrg/ha_myisammrg.cc:
        Removed some old types
      storage/myisammrg/ha_myisammrg.h:
        Removed some old types
      storage/myisammrg/myrg_close.c:
        Removed some old types
      storage/myisammrg/myrg_def.h:
        Removed some old types
      storage/myisammrg/myrg_delete.c:
        Removed some old types
      storage/myisammrg/myrg_open.c:
        Removed some old types
        Updated parameters to dirname_part()
      storage/myisammrg/myrg_queue.c:
        Removed some old types
      storage/myisammrg/myrg_rfirst.c:
        Removed some old types
      storage/myisammrg/myrg_rkey.c:
        Removed some old types
      storage/myisammrg/myrg_rlast.c:
        Removed some old types
      storage/myisammrg/myrg_rnext.c:
        Removed some old types
      storage/myisammrg/myrg_rnext_same.c:
        Removed some old types
      storage/myisammrg/myrg_rprev.c:
        Removed some old types
      storage/myisammrg/myrg_rrnd.c:
        Removed some old types
      storage/myisammrg/myrg_rsame.c:
        Removed some old types
      storage/myisammrg/myrg_update.c:
        Removed some old types
      storage/myisammrg/myrg_write.c:
        Removed some old types
      storage/ndb/include/util/ndb_opts.h:
        Removed some old types
      storage/ndb/src/cw/cpcd/main.cpp:
        Removed some old types
      storage/ndb/src/kernel/vm/Configuration.cpp:
        Removed some old types
      storage/ndb/src/mgmclient/main.cpp:
        Removed some old types
      storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
        Removed some old types
        Removed old disabled code
      storage/ndb/src/mgmsrv/main.cpp:
        Removed some old types
      storage/ndb/src/ndbapi/NdbBlob.cpp:
        Removed some old types
      storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
        Removed not used variable
      storage/ndb/src/ndbapi/NdbOperationInt.cpp:
        Added required casts
      storage/ndb/src/ndbapi/NdbScanOperation.cpp:
        Added required casts
      storage/ndb/tools/delete_all.cpp:
        Removed some old types
      storage/ndb/tools/desc.cpp:
        Removed some old types
      storage/ndb/tools/drop_index.cpp:
        Removed some old types
      storage/ndb/tools/drop_tab.cpp:
        Removed some old types
      storage/ndb/tools/listTables.cpp:
        Removed some old types
      storage/ndb/tools/ndb_config.cpp:
        Removed some old types
      storage/ndb/tools/restore/consumer_restore.cpp:
        Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
      storage/ndb/tools/restore/restore_main.cpp:
        Removed some old types
      storage/ndb/tools/select_all.cpp:
        Removed some old types
      storage/ndb/tools/select_count.cpp:
        Removed some old types
      storage/ndb/tools/waiter.cpp:
        Removed some old types
      strings/bchange.c:
        Changed function to use uchar * and size_t
      strings/bcmp.c:
        Changed function to use uchar * and size_t
      strings/bmove512.c:
        Changed function to use uchar * and size_t
      strings/bmove_upp.c:
        Changed function to use uchar * and size_t
      strings/ctype-big5.c:
        Changed functions to use size_t
        Changed character length functions to return uint
      strings/ctype-bin.c:
        Changed functions to use size_t
      strings/ctype-cp932.c:
        Changed functions to use size_t
        Changed character length functions to return uint
      strings/ctype-czech.c:
        Fixed indentation
        Changed functions to use size_t
      strings/ctype-euc_kr.c:
        Changed functions to use size_t
        Changed character length functions to return uint
      strings/ctype-eucjpms.c:
        Changed functions to use size_t
        Changed character length functions to return uint
        unsigned char -> uchar
      strings/ctype-gb2312.c:
        Changed functions to use size_t
        Changed character length functions to return uint
      strings/ctype-gbk.c:
        Changed functions to use size_t
        Changed character length functions to return uint
      strings/ctype-latin1.c:
        Changed functions to use size_t
        Changed character length functions to return uint
        unsigned char -> uchar
      strings/ctype-mb.c:
        Changed functions to use size_t
        Changed character length functions to return uint
      strings/ctype-simple.c:
        Changed functions to use size_t
        Simpler loops for caseup/casedown
        unsigned int -> uint
        unsigned char -> uchar
      strings/ctype-sjis.c:
        Changed functions to use size_t
        Changed character length functions to return uint
      strings/ctype-tis620.c:
        Changed functions to use size_t
        Changed character length functions to return uint
        unsigned char -> uchar
      strings/ctype-uca.c:
        Changed functions to use size_t
        unsigned char -> uchar
      strings/ctype-ucs2.c:
        Moved inclusion of stdarg.h to other includes
        usigned char -> uchar
        Changed functions to use size_t
        Changed character length functions to return uint
      strings/ctype-ujis.c:
        Changed functions to use size_t
        Changed character length functions to return uint
        unsigned char -> uchar
      strings/ctype-utf8.c:
        Changed functions to use size_t
        unsigned char -> uchar
        Indentation fixes
      strings/ctype-win1250ch.c:
        Indentation fixes
        Changed functions to use size_t
      strings/ctype.c:
        Changed functions to use size_t
      strings/decimal.c:
        Changed type for memory argument to uchar *
      strings/do_ctype.c:
        Indentation fixes
      strings/my_strtoll10.c:
        unsigned char -> uchar
      strings/my_vsnprintf.c:
        Changed functions to use size_t
      strings/r_strinstr.c:
        Removed some old types
        Changed functions to use size_t
      strings/str_test.c:
        Removed some old types
      strings/strappend.c:
        Changed functions to use size_t
      strings/strcont.c:
        Removed some old types
      strings/strfill.c:
        Removed some old types
      strings/strinstr.c:
        Changed functions to use size_t
      strings/strlen.c:
        Changed functions to use size_t
      strings/strmake.c:
        Changed functions to use size_t
      strings/strnlen.c:
        Changed functions to use size_t
      strings/strnmov.c:
        Changed functions to use size_t
      strings/strto.c:
        unsigned char -> uchar
      strings/strtod.c:
        Changed functions to use size_t
      strings/strxnmov.c:
        Changed functions to use size_t
      strings/xml.c:
        Changed functions to use size_t
        Indentation fixes
      tests/mysql_client_test.c:
        Removed some old types
      tests/thread_test.c:
        Removed some old types
      vio/test-ssl.c:
        Removed some old types
      vio/test-sslclient.c:
        Removed some old types
      vio/test-sslserver.c:
        Removed some old types
      vio/vio.c:
        Removed some old types
      vio/vio_priv.h:
        Removed some old types
        Changed vio_read()/vio_write() to work with size_t
      vio/viosocket.c:
        Changed vio_read()/vio_write() to work with size_t
        Indentation fixes
      vio/viossl.c:
        Changed vio_read()/vio_write() to work with size_t
        Indentation fixes
      vio/viosslfactories.c:
        Removed some old types
      vio/viotest-ssl.c:
        Removed some old types
      win/README:
        More explanations
      f252f924