Created by Oleg Tsarev on 2011-12-17 and last modified on 2011-12-17
Get this branch:
bzr branch lp:~tsarev/percona-server/5.1_fix_bug_856404
Only Oleg Tsarev can upload to this branch. If you are Oleg Tsarev please log in for upload directions.

Branch merges

Related bugs

Related blueprints

Branch information

Recent revisions

413. By Oleg Tsarev on 2011-12-17

  Add tests:
    * select */* a comment \*/from t1;
    * select *# a comment \\\nfrom t1;
    * select *-- a comment \\\nfrom t1
    * select "\\\\"" /* not a comment */" from t1;
    * select "\\\\"" /*! not a comment */" from t1;

  Behavior was incorrect:
    * backslash-backslash-quote processed incorrectly (as backslash-quote)
    * backslash-star-slash processed incorrectly (as part of comment)
    * backslash inside comments and quotes` (this is also related to bugs #856404 and #705688 - go out arrays bound and memory corruption as result).

  Refactoring of query comments remover and cacheable query detector.
This changes simplify the query-cache-strip-comments option implementation and avoid future bugs.
  1) Rename class Query_Cache_Strip_Comments to Query_Without_Comments
  2) Fix bug inside "set" method: while I am allocating buffer for striped query I forgot about \0 in the end of query. After that memory is corrupted. This is related to bugs #856404 and #705688.
  3) Change logic of "set" inside Query_Without_Comments method - now thd->db_length used instead of sum "thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE"
  4) rename members of class Query_Cache_Strip_Comments: lenght => q_length, buffer_length => b_length
  5) Move class Query_Without_Comments (old Query_Cache_Strip_Comments) from file sql/query_cache_strip_comments.h to sql/sql_class.h. Move implementation of class's methods from sql_cache.cc to sql_class.cc
  6) Change interface of Query_Without_Comments - now this is just smart memory (re)allocation and memory free, without any logic of comment striping
  7) Remove file query_cache_strip_comments.h
  8) Remove class Query_Cache_Strip_Comments_Backup to Comments_Processor. Add logic of comments striping (from removed class Query_Cache_Strip_Comments).
  Add logic for check cacheability of query.
  9) Enum query_comments_parser::Kind. Describe part of query by following kinds:
   * Empty - end of query, empty query
   * Comment - single-line / multiline comments
   * WhiteSpace - space, tab, new line, carriage return
   * Special - part of query, which can be BEFORE the SELECT keyword in normal SELECT query (required for cacheable query detection) - WhiteSpace, Comment, or bracets ('(' and ')').
   * Another - any part of query except Special.
  10) Function query_comments_parser::analyze. Detect type of first part of query, return kind and pointer to begin/end
  11) Function query_comments_parser::remove_comments_from_query. Function remove all comments. Implemented using analyze. Function after remove some comment insert ' ' for avoid incorrect result. All sequences of whitespaces without another symbols replaced by single ' ' (including space which replaced the comment).
  12) Function query_comments_parses::skip_not_another - skip prefix before Another symbols (function hopes: first not another - SELECT. SELECT or not (cacheable or not) will checked immediately after funciton call).
  13) Function query_comments_parses::skip_defauls - default MySQL behavior - skip all open bracets ('('). Check for SELECT or not immediately after function call.
  Also fixed guard defines in it: from "_SQL_QUERY_STRIPC_COMMENTS_H_" to "_SQL_QUERY_CACHE_STRIP_COMMENTS_H_"
  14) Fixed header of query_cache_enhance.patch:
  from "query_cache_with_comments.patch" to "query_cache_enhance.patch"
  15) Little optimisation for '...''...' and "...""..."
  16) Change the memory allocation size - from 5.1.60 size is "(query_length + 1) + sizeof(size_t) + db_length + QUERY_CACHE_FLAGS_SIZE" instead of "(query_length + 1) + db_length + 1 + QUERY_CACHE_FLAGS_SIZE".
  Now query after \0 has also database length

410. By Stewart Smith on 2011-11-29

fix version number in Makefile

409. By Stewart Smith on 2011-11-24

merge makefile fix

408. By Stewart Smith on 2011-11-24

port Percona Server 5.1 to MySQL 5.1.60 base

407. By Stewart Smith on 2011-11-24

remove now unneeded patches as we're part of a happy bzr tree

406. By Stewart Smith on 2011-11-24

fix Makefile for building Percona Server as bzr brancH

405. By Stewart Smith on 2011-11-24

Import Percona Server patch: bug45702.patch

404. By Stewart Smith on 2011-11-24

Import Percona Server patch: bug860910.patch

# name : bug860910.patch
# maintainer : Alexey
# Fixes LP bug #860910 / MySQL bug #62557

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
Stacked on:
This branch contains Public information 
Everyone can see this information.