Commit graph

5166 commits

Author SHA1 Message Date
Monty
3bca8db4f9 MDEV-6152: Remove calls to current_thd while creating Item
- Part 4: Removing calls to sql_alloc() and sql_calloc()

Other things:
- Added current_thd in some places to make it clear that it's called (easier to remove later)
- Move memory allocation from Item_func_case::fix_length_and_dec() to Item_func_case::fix_fields()
- Added mem_root to some new calls
- Fixed some wrong UNINIT_VAR() calls
- Fixed a bug in generate_partition_syntax() in case of errors
- Added mem_root to argument to new thread_info
- Simplified my_parse_error() call in sql_yacc.yy
2015-08-27 22:29:11 +03:00
Monty
3cb578c001 MDEV-6152: Remove calls to current_thd while creating Item
- Part 3: Adding mem_root to push_back() and push_front()

Other things:
- Added THD as an argument to some partition functions.
- Added memory overflow checking for XML tag's in read_xml()
2015-08-27 22:21:08 +03:00
Monty
1bae0d9e56 Stage 2 of MDEV-6152:
- Added mem_root to all calls to new Item
- Added private method operator new(size_t size) to Item to ensure that
  we always use a mem_root when creating an item.

This saves use once call to current_thd per Item creation
2015-08-21 10:40:51 +04:00
Sergey Vojtovich
31e365efae MDEV-8010 - Avoid sql_alloc() in Items (Patch #1)
Added mandatory thd parameter to Item (and all derivative classes) constructor.
Added thd parameter to all routines that may create items.
Also removed "current_thd" from Item::Item. This reduced number of
pthread_getspecific() calls from 290 to 177 per OLTP RO transaction.
2015-08-21 10:40:39 +04:00
Monty
872a953b22 MDEV-8469 Add RESET MASTER TO x to allow specification of binlog file nr
Other things:
- Avoid calling init_and_set_log_file_name() when opening binary log.
- Remove newlines early when reading from index file.
- Ensure that reset_logs() will work even if thd is 0 (Can happen on startup)
- Added thd to sart_slave_threads() for better error handling.
2015-07-16 10:36:58 +03:00
Monty
7332af49e4 - Renaming variables so that they don't shadow others (After this patch one can compile with -Wshadow and get much fewer warnings)
- Changed ER(ER_...) to ER_THD(thd, ER_...) when thd was known or if there was many calls to current_thd in the same function.
- Changed ER(ER_..) to ER_THD_OR_DEFAULT(current_thd, ER...) in some places where current_thd is not necessary defined.
- Removing calls to current_thd when we have access to thd

Part of this is optimization (not calling current_thd when not needed),
but part is bug fixing for error condition when current_thd is not defined
(For example on startup and end of mysqld)

Notable renames done as otherwise a lot of functions would have to be changed:
- In JOIN structure renamed:
   examined_rows -> join_examined_rows
   record_count -> join_record_count
- In Field, renamed new_field() to make_new_field()

Other things:
- Added DBUG_ASSERT(thd == tmp_thd) in Item_singlerow_subselect() just to be safe.
- Removed old 'tab' prefix in JOIN_TAB::save_explain_data() and use members directly
- Added 'thd' as argument to a few functions to avoid calling current_thd.
2015-07-06 20:24:14 +03:00
Sergey Vojtovich
0865e3deab MDEV-7792 - SQL Parsing Error - UNION AND ORDER BY WITH JOIN
ORDER BY against union may confuse name resolution context, causing valid
SQL statements to fail.

The purpose of context change was presumably intended for the duration of
gathering field list for ORDER BY. However it isn't actually required (name
resolution context is never accessed by the latter).

See also alternative solution (in MySQL 5.7): 92145b95.
2015-06-29 11:04:55 +04:00
Sergei Golubchik
658992699b Merge tag 'mariadb-10.0.20' into 10.1 2015-06-27 20:35:26 +02:00
Sergei Golubchik
794a895c4c simplify CREATE TEMPORARY TABLE parser rule
as a bonus that makes CREATE TEMPORARY TEMPORARY TABLE illegal
2015-06-27 09:40:55 +02:00
Sergey Vojtovich
360176f397 MDEV-7943 - pthread_getspecific() takes 0.76% in OLTP RO
Pass THD to Item_field (and all derivatives) constructors.
This reduces number of pthread_getspecific() calls from 322 to 292.
2015-06-19 15:06:34 +04:00
Sergei Golubchik
810cf362ea Merge branch '5.5' into 10.0 2015-06-11 20:20:35 +02:00
Sergey Vojtovich
af2256ff72 MDEV-7207 - ALTER VIEW does not change ALGORITM
Fixed that ALTER VIEW ALGORITHM=UNDEFINED behaved as if algorithm was not
specified.
2015-06-05 10:44:10 +04:00
Sergei Golubchik
64569fa81d parser: better error messages for CHECK/REPAIR VIEW
remove the code that checks for correct options for
for CHECK/REPAIR VIEW. Rewrite the grammar for the parser
to check that. This changes error messages as

-ERROR 42000: You have an error ... near '' at line 1
+ERROR 42000: You have an error ... near 'quick' at line 1
2015-06-03 15:44:31 +02:00
Sergei Golubchik
5091a4ba75 Merge tag 'mariadb-10.0.19' into 10.1 2015-06-01 15:51:25 +02:00
Alexander Barkov
5bd25a9c53 A helper patch for "MDEV-8228 Move Item_func_like out of Item_bool_func2"
- Changing Comp_creator::create() and create_swap() to return
  Item_bool_rowready_func2 instead of Item_bool_func2, as they
  can never return neither Item_func_like nor Item_func_xor

- Changing the first argument of Comp_create::create() and create_swap()
  from THD to MEM_ROOT, so the method implementations can now reside in
  item_cmpfunc.h instead of item_cmpfunc.cc and thus make the code slightly
  easier to read.
2015-05-26 11:59:17 +04:00
Sergey Vojtovich
b22959903b MDEV-7943 - pthread_getspecific() takes 0.76% in OLTP RO
Added THD argument to select_result and all derivative classes.
This reduces number of pthread_getspecific calls from 796 to 776 per OLTP RO
transaction.
2015-05-13 15:56:56 +04:00
Sergey Vojtovich
4d1ccc4289 MDEV-7951 - sql_alloc() takes 0.25% in OLTP RO
sql_alloc() has additional costs compared to direct mem_root allocation:
- function call: it is defined in a separate translation unit and can't be
  inlined
- it needs to call pthread_getspecific() to get THD::mem_root

It is called dozens of times implicitely at least by:
- List<>::push_back()
- List<>::push_front()
- new (for Sql_alloc derived classes)
- sql_memdup()

Replaced lots of implicit sql_alloc() calls with direct mem_root allocation,
passing through THD pointer whenever it is needed.

Number of sql_alloc() calls reduced 345 -> 41 per OLTP RO transaction.
pthread_getspecific() overhead dropped 0.76 -> 0.59
sql_alloc() overhed dropped 0.25 -> 0.06
2015-05-13 10:43:14 +04:00
Sergei Golubchik
1d3ea9ecd8 perfschema 5.6.24
including the big commit
  commit 305130361bf72726de220f3d2b2787395e10be61
  Author: Marc Alff <marc.alff@oracle.com>
  Date:   Tue Feb 10 11:31:32 2015 +0100

      WL#8354 BACKPORT DIGEST IMPROVEMENTS TO MYSQL 5.6

(with the following commits) and related changes in sql/
2015-05-05 15:23:47 +02:00
Alexander Barkov
539b3ca87d - Moving Item_func_spatial_mbr_rel from Item_bool_func2 to Item_bool_func,
as Item_func_spatial_mbr_rel needs nothing from Item_bool_func2.
- Renaming Item_func_spacial_rel (the class that implements precise spacial
  relations) to Item_func_spatial_precise_rel
- Adding a new abstract class Item_func_spatial_rel as a common parent
  for Item_func_spatial_precise_rel and Item_func_spatial_mbr_rel.
2015-05-05 09:30:17 +04:00
Sergei Golubchik
49c853fb94 Merge branch '5.5' into 10.0 2015-05-04 22:00:24 +02:00
Sergei Golubchik
6f17e233bf post-merge fixes 2015-04-29 12:40:52 +02:00
Sergei Golubchik
f9c02d7c29 Merge branch 'openquery/MDEV-6916-maria-5.5-check_view-r4408' into 5.5 2015-04-28 21:11:49 +02:00
Sergei Golubchik
0f12ada6b6 Merge remote-tracking branch 'mysql/5.5' into 5.5 2015-04-27 21:04:06 +02:00
Alexander Barkov
46816996c8 Moving members' initialization from LEX::init_last_field
to constructor Create_field::Create_field().
2015-04-26 01:46:55 +04:00
Alexander Barkov
c6d08ecce3 Merge commit 'bc902a2bfc46add0708896c07621e3707f66d95f' into 10.1 2015-04-20 11:45:22 +04:00
Daniel Black
28b173134e Allow REPAIR NO_WRITE_TO_BINLOG as per serg's review
> +            if (lex->no_write_to_binlog && lex->only_view)
> +            {
> +              my_parse_error(ER(ER_SYNTAX_ERROR));
> +              MYSQL_YYABORT;

Why? REPAIR NO_WRITE_TO_BINLOG VIEW makes perfect sense to me, why did
you want to disallow it?
2015-04-13 21:12:23 +10:00
Oleksandr Byelkin
c8dbef22ad MDEV-6916 REPAIR VIEW / mysql migration
from: r4407
2015-04-12 20:41:28 +10:00
Alexander Barkov
7f613ebdb6 MDEV-7284 INDEX: CREATE OR REPLACE 2015-04-03 15:43:55 +04:00
Jan Lindström
86f46a3da4 MDEV-7301: Unknown column quoted with backticks in HAVING clause
when using function.

Merged upstream fix to Bug#16221433 MYSQL REJECTS QUERY DUE TO BAD
RESOLUTION OF NAMES IN HAVING; VIEW UNREADABLE
authored by Guilhem Bichot <guilhem.bichot@oracle.com>.
2015-03-23 09:49:32 +02:00
Alexander Barkov
0c26c0032c A preparatory patch for MDEV-7284 INDEX: CREATE OR REPLACE.
Removing "bool Key::create_if_not_exists" and deriving Key from
DDL_options instead.
2015-03-20 13:51:41 +04:00
Alexander Barkov
2a2cc16478 Refactoring in sql_yacc.yy. A pre-requirement patch for
MDEV-7801 Unexpected syntax error in ALTER TABLE t1 ADD INDEX TYPE BTREE
MDEV-7284 INDEX: CREATE OR REPLACE
2015-03-20 11:46:44 +04:00
Alexander Barkov
e6f67c64cd MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database 2015-03-16 21:55:10 +04:00
Alexander Barkov
bc902a2bfc MDEV-7387 [PATCH] Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
A contribution from Daniel Black, with minor additional enhancements.
2015-03-13 16:12:54 +04:00
Oleksandr Byelkin
dab12366b1 MDEV-6956:SET STATEMENT default_master_connection = ... has no effect
the problem was in assigning default value during parsing.
2015-03-12 09:47:36 +01:00
Oleksandr Byelkin
be73c7ee44 MDEV-6951: Erroneous SET STATEMENT produces two identical errors
Double error reporting removed.
2015-03-11 14:57:30 +01:00
Sergei Golubchik
5bff6c5d57 bison warning: clash on default action: <NONE> != <object_ddl_options> 2015-03-07 15:32:52 +01:00
Sergei Golubchik
2db62f686e Merge branch '10.0' into 10.1 2015-03-07 13:21:02 +01:00
Alexander Barkov
87b0cc9912 MDEV-7286 TRIGGER: CREATE OR REPLACE, CREATE IF NOT EXISTS
Based on the patch by Sriram Patil, made under terms of GSoC 2014.
2015-03-04 09:52:01 +04:00
Alexander Barkov
2d01907c1d MDEV-7281 EVENT: CREATE OR REPLACE 2015-02-27 13:34:18 +04:00
Alexander Barkov
f825b5a4ee MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14 2015-02-25 14:13:32 +04:00
Mithun C Y
c9f7948bc4 Bug #19892803: ASSERTION FAILED: N < M_SIZE WITH DISTINCT TIME
ISSUE:
------
We pre-allocate the ref_pointer_array before we resolve outer
references. This means that in some cases the
ref_pointer_array may not be large enough to hold all
references created. One such case is aggregate functions in
having clause of a subquery which may add items to select list
of outer query. So it is necessary to consider
select_n_having_items for subqueries while allocating
ref_pointer_array else we will get buffer overflow.

SOLUTION:
---------
Allocate a larger ref_pointer_array by aggregating
select_n_having_items for subqueries.
The fix in sql_yacc.yy is a backport from bug fix 18782905.
2015-01-30 16:36:23 +05:30
Alexander Barkov
1f0ad6c6b3 MDEV-7288 USER/ROLE: CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS 2015-01-13 11:50:33 +04:00
Alexander Barkov
2dbd26932d MDEV-7283 UDF: CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS
MDEV-7282 SP: CREATE OR REPLACE, CREATE IF NOT EXISTS
2014-12-15 17:41:15 +04:00
Alexander Barkov
822eb6ca3d MDEV-7285 SERVER: CREATE OR REPLACE and CREATE IF NOT EXISTS 2014-12-10 13:41:14 +04:00
Alexander Barkov
60277b8b3c MDEV-7287 VIEW: CREATE IF NOT EXISTS
Forgot to do "git add" for a number of files in the previous commit.
2014-12-10 11:32:52 +04:00
Alexander Barkov
dd270e43bf MDEV-7280 DATABASE: CREATE OR REPLACE 2014-12-10 08:13:08 +04:00
Alexander Barkov
c6d3f8058d MDEV-7112 Split HA_CREATE_INFO 2014-12-08 10:56:08 +04:00
Alexey Botchkov
c4cb15e87b MDEV-60 Support for Spatial Reference systems for the GIS data.
The GEOMETRY field metadata is stored in the FRM file.
        SRID for a spatial column now can be stored, it was added to the CREATE TABLE syntax,
        so the AddGeometryData() stored procedure is now possible. Script adding the required Add/DropGeometryColumn sp-s added.
2014-12-04 16:09:34 +01:00
Sergei Golubchik
65f0a8d487 cleanup: sort and reorder %union elements in sql_yacc.yy 2014-12-04 16:09:34 +01:00
Sergei Golubchik
227510e039 parser cleanup: don't store field properties in LEX, use Create_field directly
length/dec/charset are still in LEX, because they're also used
for CAST and dynamic columns.

also
1. fix "MDEV-7041 COLLATION(CAST('a' AS CHAR BINARY)) returns a wrong result"
2. allow BINARY modifier in stored function RETURN clause
3. allow "COLLATION without CHARSET" in SP/SF (parameters, RETURN, DECLARE)
4. print correct variable name in error messages for stored routine parameters
2014-12-04 16:09:34 +01:00