Commit graph

2198 commits

Author SHA1 Message Date
Sergey Vojtovich
5fc53b7cfe MDEV-8202 - st_select_lex::master_unit() takes 0.17% in OLTP RO
To make st_select_lex::master_unit() inlinable:
- moved it's definition to sql_lex.h
- removed base class virtual master_unit() declaration since this method is
  specific to st_select_lex

Overhead change:
st_select_lex::master_unit()      0.17% -> out of radar
execute_sqlcom_select()           0.13% -> 0.12%
JOIN::save_explain_data_intern()  0.27% -> 0.23%
JOIN::optimize_inner()            0.76% -> 0.72%
JOIN::exec_inner()                0.30% -> 0.24%
JOIN::prepare()                   0.30% -> 0.29%
JOIN::optimize()                  0.05% -> 0.05%
2015-06-02 18:02:32 +04:00
Sergei Golubchik
5091a4ba75 Merge tag 'mariadb-10.0.19' into 10.1 2015-06-01 15:51:25 +02: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
Sergey Vojtovich
c4d2c4e844 MDEV-7964 - delete_dynamic() takes 0.12% in OLTP RO
delete_dynamic() was called 9-11x per OLTP RO query + 3x per BEGIN/COMMIT.

3 calls were performed by LEX_MASTER_INFO. Added condition to call those only
for CHANGE MASTER.

1 call was performed by lock_table_names()/Hash_set/my_hash_free(). Hash_set was
supposed to be used for DDL and LOCK TABLES to gather database names, while it
was initialized/freed for DML too. In fact Hash_set didn't do any useful job
here. Hash_set was removed and MDL requests are now added directly to the list.

The rest 5-7 calls are done by optimizer, mostly by Explain_query and friends.
Since dynamic arrays are used in most cases, they can hardly be optimized.

my_hash_free() overhead dropped 0.02 -> out of radar.
delete_dynamic() overhead dropped 0.12 -> 0.04.
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
Sergei Golubchik
49c853fb94 Merge branch '5.5' into 10.0 2015-05-04 22:00:24 +02:00
Oleksandr Byelkin
8cbaafd22b MDEV-8018: main.multi_update fails with --ps-protocol
save_prep_leaf_tables() made recursive to work with underlying view

Arena restoiring fixed in case of EOM.
2015-04-22 13:59:18 +02:00
Sergei Petrunia
4938b82263 MDEV-7836: ANALYZE FORMAT=JSON should provide info about GROUP/ORDER BY
Provide basic info about sorting/grouping done by the queries.
2015-04-12 04:48:42 +03:00
Sergei Petrunia
2af935c8ec MDEV-7899: 10.1 is 3% slower than 10.0 in OLTP RO
- Remove ANALYZE's timing code off the the execution path of regular
  SELECTs.
- Improve the tracker that tracks counts/execution times of SELECTs or
  DML statements:
  = regular execution just increments counters
  = ANALYZE will also collect timings.
2015-04-07 01:29:17 +03:00
Alexander Barkov
7f613ebdb6 MDEV-7284 INDEX: CREATE OR REPLACE 2015-04-03 15:43:55 +04:00
Alexander Barkov
50eee60504 Preparatory refactoring for:
MDEV-6218 Wrong result of CHAR_LENGTH(non-BMP-character) with 3-byte utf8
- Moving get_text() as a method to Lex_input_stream.
- Moving the unescaping part into a separate function,
  this piece of code will later go to /strings most likely.
- Removing Lex_input_string::yytoklen, as it's not needed any more.
2015-03-26 20:44:12 +04: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
Oleksandr Byelkin
a71e2d23bd MDEV-7006 MDEV-7007: SET STATEMENT and slow log
fixed embedded server tests
MDEV-7009: SET STATEMENT min_examined_row_limit has no effect
MDEV-6948:SET STATEMENT gtid_domain_id = ... FOR has no effect (same for gtid_seq_no and server_id)

old values of SET STATENENT variables now saved in its own Query_arena and restored later
2015-03-12 10:19:32 +01:00
Oleksandr Byelkin
80f03abcca MDEV-7671: Cache VIEW definitions in the TDC
(changes of backported patch are very small: strlen removed, error processing fixed, view open statistics added)
2015-03-11 17:39:15 +01:00
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
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
c6d3f8058d MDEV-7112 Split HA_CREATE_INFO 2014-12-08 10:56:08 +04: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
Sergei Golubchik
97a913e31c cleanup: freshen up CREATE SERVER code
* pass LEX_STRING's from the parser, don't ignore the length only to strlen later
* init LEX::server_options only for SERVER commands, not for every statement
* don't put temporary values into a global persistent memroot

but really it's just scratching a surface
2014-12-04 10:41:51 +01:00
Nirbhay Choubey
a50ddebb5c MDEV-6593 : domain_id based replication filters
Implementation for domain ID based filtering of replication events.
2014-12-03 22:30:48 -05:00
Sergei Golubchik
ec4137c62b Merge branch '10.1' into bb-10.1-merge 2014-12-03 11:37:26 +01:00
Sergei Golubchik
853077ad7e Merge branch '10.0' into bb-10.1-merge
Conflicts:
	.bzrignore
	VERSION
	cmake/plugin.cmake
	debian/dist/Debian/control
	debian/dist/Ubuntu/control
	mysql-test/r/join_outer.result
	mysql-test/r/join_outer_jcl6.result
	mysql-test/r/null.result
	mysql-test/r/old-mode.result
	mysql-test/r/union.result
	mysql-test/t/join_outer.test
	mysql-test/t/null.test
	mysql-test/t/old-mode.test
	mysql-test/t/union.test
	packaging/rpm-oel/mysql.spec.in
	scripts/mysql_config.sh
	sql/ha_ndbcluster.cc
	sql/ha_ndbcluster_binlog.cc
	sql/ha_ndbcluster_cond.cc
	sql/item_cmpfunc.h
	sql/lock.cc
	sql/sql_select.cc
	sql/sql_show.cc
	sql/sql_update.cc
	sql/sql_yacc.yy
	storage/innobase/buf/buf0flu.cc
	storage/innobase/fil/fil0fil.cc
	storage/innobase/include/srv0srv.h
	storage/innobase/lock/lock0lock.cc
	storage/tokudb/CMakeLists.txt
	storage/xtradb/buf/buf0flu.cc
	storage/xtradb/fil/fil0fil.cc
	storage/xtradb/include/srv0srv.h
	storage/xtradb/lock/lock0lock.cc
	support-files/mysql.spec.sh
2014-12-02 22:25:16 +01:00
Sergei Petrunia
d5fbfb9a93 EXPLAIN FORMAT=JSON: Add support for single-table UPDATE/DELETE. 2014-11-28 02:36:31 +03:00
Sergei Petrunia
3d5f97fd70 Merge ../10.1-explain-json-r4 into 10.1 2014-11-27 00:51:54 +03:00
Sergei Golubchik
3495801e2e 5.5 merge 2014-11-19 17:23:39 +01:00
Oleksandr Byelkin
1827d9e6d1 MDEV-5231: Per query variables from Percona Server (rewritten) 2014-11-11 11:48:50 +01:00
Sergei Golubchik
360c49c1b9 MDEV-6179: dynamic columns functions/cast()/convert() doesn't play nice with CREATE/ALTER TABLE
When parsing a field declaration, grab type information from LEX before it's overwritten
by further rules. Pass type information through the parser stack to the rule that needs it.
2014-11-08 19:54:42 +01:00
Igor Babaev
d24919969a Correction for the fix of the bug mdev-6874. 2014-10-19 09:50:50 -07:00
Sergei Petrunia
47ced65566 MDEV-6388: ANALYZE $stmt output in the slow query log
Make log_slow_verbosity=explain actually print ANALYZE (that
is, EXPLAIN otuput with two extra columns).
2014-10-17 22:47:06 +04:00
Sergei Golubchik
1e79138459 Merge branch 'bb-10.1-merge' into 10.1 2014-10-16 00:30:29 +02:00
Sergei Petrunia
be1c17669c Merge ../10.1 into bb-10.1-explain-json 2014-10-15 17:21:59 +04:00
Sergei Golubchik
f62c12b405 Merge 10.0.14 into 10.1 2014-10-15 12:59:13 +02:00
Igor Babaev
3c4bb0e872 MDEV-334: Backport of UNION ALL optimization from mysql-5.7.
Although the original code of mysql-5.7 was adjusted
to the current MariaDB code the main ideas of the optimization
were preserved.
2014-10-14 09:36:50 -07:00
Sergei Golubchik
624888b4e6 cleanup: inherit from Sql_alloc
instead of copy-pasting its methods into a new class
2014-10-10 22:27:37 +02:00
Sergei Golubchik
e8fb24664e cleanup: use null_lex_str where appropriate 2014-10-10 22:27:37 +02:00
Sergei Golubchik
1c6ad62a26 mysql-5.5.39 merge
~40% bugfixed(*) applied
~40$ bugfixed reverted (incorrect or we're not buggy)
~20% bugfixed applied, despite us being not buggy
(*) only changes in the server code, e.g. not cmakefiles
2014-08-02 21:26:16 +02:00
Sergei Golubchik
6fb17a0601 5.5.39 merge 2014-08-07 18:06:56 +02:00
Gleb Shchepa
01fd5d0d0e Bug #18978946: BACKPORT TO 5.6: BUGFIX FOR 18017820 "BISON 3 BREAKS MYSQL BUILD"
Backport of the fix:

: Bug 18017820: BISON 3 BREAKS MYSQL BUILD
: ========================================    
: 
: The source of the reported problem is a removal of a few deprecated
: things from Bison 3.x: 
: * YYPARSE_PARAM macro (use the %parse-param bison directive instead),
: * YYLEX_PARAM macro (use %lex-param instead),
: 
: The fix removes obsolete macro calls and introduces use of
: %parse-param and %lex-param directives.
2014-06-23 19:59:15 +04:00
Gleb Shchepa
7141ae8561 Bug #18978946: BACKPORT TO 5.6: BUGFIX FOR 18017820 "BISON 3 BREAKS MYSQL BUILD"
Backport of the fix:

: Bug 18017820: BISON 3 BREAKS MYSQL BUILD
: ========================================    
: 
: The source of the reported problem is a removal of a few deprecated
: things from Bison 3.x: 
: * YYPARSE_PARAM macro (use the %parse-param bison directive instead),
: * YYLEX_PARAM macro (use %lex-param instead),
: 
: The fix removes obsolete macro calls and introduces use of
: %parse-param and %lex-param directives.
2014-06-23 19:59:15 +04:00
Sergei Petrunia
5cfd3270ec MDEV-6109: EXPLAIN JSON
- First code, "EXPLAIN FORMAT=JSON stmt" and "ANALYZE FORMAT=JSON stmt"
  work for basic queries.  Complex constructs (e.g subqueries, etc) not
  yet supported.
- No test infrastructure yet
2014-05-27 21:04:45 +04:00
Sergei Petrunia
eaba1ba4a5 Re-commit in git:
MDEV-406: ANALYZE $stmt
- Ported the old patch to new explain code
- New SQL syntax (ANALYZE $stmt)
- ANALYZE UPDATE/DELETE is now supported (because EXPLAIN UPDATE/DELETE is supported)
- Basic counters are calculated for basic kinds of queries
  (still need to see what happens with join buffer, ORDER BY...LIMIT queries, etc)
2014-05-27 20:13:17 +04:00
Sergei Golubchik
26618a54fa MDEV-5736 remove what remains from ONE_SHOT hack 2014-05-01 14:07:11 +02:00
Sergey Vojtovich
d12c7adf71 MDEV-5314 - Compiling fails on OSX using clang
This is port of fix for MySQL BUG#17647863.

revno: 5572
revision-id: jon.hauglid@oracle.com-20131030232243-b0pw98oy72uka2sj
committer: Jon Olav Hauglid <jon.hauglid@oracle.com>
timestamp: Thu 2013-10-31 00:22:43 +0100
message:
  Bug#17647863: MYSQL DOES NOT COMPILE ON OSX 10.9 GM

  Rename test() macro to MY_TEST() to avoid conflict with libc++.
2014-02-19 14:05:15 +04:00
Sergei Golubchik
72c20282db 10.0-base merge 2014-02-03 15:22:39 +01:00
Sergei Golubchik
59d9d08e2b 5.5 merge 2014-02-01 00:54:03 +01:00
unknown
b0aaf5c6f5 Merge 5.3->5.5 2014-01-15 16:07:50 +02:00
Murthy Narkedimilli
c92223e198 Updated/added copyright headers 2014-01-06 10:52:35 +05:30
Murthy Narkedimilli
496abd0814 Updated/added copyright headers 2014-01-06 10:52:35 +05:30
unknown
57400ee681 MDEV-5414: RAND() in a subselect : different behavior in MariaDB and MySQL
Materialization forced in case if rand() used in view or derived table to avoud several calls of rand for gting value of a field.

Fixed set variable uncachable flag from - it shouldbe a side effect not a random value.
2013-12-18 15:59:51 +02:00
Sergei Golubchik
d28d3ba40d 10.0-base merge 2013-12-16 13:02:21 +01:00
Sergei Golubchik
6bf10fac44 5.5 merge 2013-12-15 15:57:26 +01:00
Sergei Golubchik
e68bccc743 5.3 merge 2013-12-13 13:00:38 +01:00
Igor Babaev
3ec4296ec4 Fixed bug mdev-5410.
The fix for bug #27937 was incomplete: it did not handle correctly the queries
containing UNION with global ORDER BY in subselects.
2013-12-12 13:55:33 -08:00
Sergei Golubchik
0fdb3bcfdb 10.0-base merge (roles) 2013-10-29 15:08:44 +01:00
Sergei Golubchik
0c303b52a9 New syntax:
CREATE ROLE xxx WITH ADMIN yyy
  GRANT xxx TO yyy WITH ADMIN OPTION
  REVOKE ADMIN OPTION FOR xxx FROM yyy
2013-10-18 12:23:15 -07:00
Sergei Golubchik
72d8b533cc Fixes for mysql-test failures
mysql-test/r/acl_roles_show_grants.result:
  one can do SHOW GRANTS for himself
mysql-test/t/acl_roles_set_role-table-column-priv.test:
  correct error message
mysql-test/t/acl_roles_show_grants.test:
  one can SHOW GRANTS for himself
sql/sql_acl.cc:
  bugfixing:
  * don't assign with && - it can shortcut and the second assignment won't be executed
  * correct the test in check_grant_all_columns() - want_access should not be modified
  *
sql/sql_cmd.h.OTHER:
  add new commands at the end
sql/sql_db.cc:
  don't call acl_get() if all privileges are already satisfied
  (crashes when run with --skip-grants, because acl data stuctures aren't initialized)
sql/sql_parse.cc:
  * test for current_user in get_current_user()
  * map explicitly specified user@host to current_user
2013-10-18 08:10:51 -07:00
Vicențiu Ciorbaru
4a58599930 Implemented SHOW GRANTS functionality 2013-10-18 06:40:25 -07:00
Vicențiu Ciorbaru
f2ab661999 Added SHOW GRANTS recursive role print.
The output is not completely correct due to recursive role grants not
being completly implemented. However, this will help with testing the
implementation of set role with recursive grants.
2013-10-18 06:34:07 -07:00
Vicențiu Ciorbaru
dcc9fd4c8e Implemented syntax recognition for REVOKE ROLE 2013-10-18 04:41:06 -07:00
Vicențiu Ciorbaru
ec92a4e0ff Implemented syntax recognition for DROP ROLE 2013-10-18 04:36:25 -07:00
Vicențiu Ciorbaru
51c631c2ae Implemented syntax recognition for CREATE ROLE 2013-10-18 04:35:18 -07:00
Vicențiu Ciorbaru
d40d356606 Added syntax detection for the GRANT role TO {user | role } command.
Also added syntax for GRANT privilege TO { role } command
2013-10-18 04:29:01 -07:00
Sergey Petrunya
4bed7aa858 MDEV-3798: [SHOW] EXPLAIN UPDATE/DELETE, Memory leak in binlog.binlog_base64_flag:
- It turns out, there are statements that will call lex_start(thd->lex) 
  after parsing has been finished. lex_start() will set lex->explain=NULL,
  which will lose the pointer to already allocated Explain_plan object.
- To get rid of this, switch to lazy creation of lex->explain.  Now, it is 
  created only when we get a part ot query plan.
2013-10-16 12:13:51 +04:00
Sergey Petrunya
1e36cbfa39 MDEV-3798: [SHOW] EXPLAIN UPDATE/DELETE
- Merge with 10.0-base
2013-10-15 11:51:41 +04:00
Sergey Petrunya
105e3ae6c9 MDEV-3798: EXPLAIN UPDATE/DELETE
Update the SHOW EXPLAIN code to work with the 
new architecture (part#1):
Before, SHOW EXPLAIN operated on real query plan structures, 
which meant it had to check when SELECTs are created/deleted.
SELECTs would call apc_target->enable() when they got a query 
plan and disable() when their query plan was deleted.

Now, Explain data structure becomes available at once (and we
call apc_target->enable()) and then it stays until it is deleted
(when that happens, we call apc_target->disable()).
2013-10-14 20:09:33 +04:00
Sergey Petrunya
3c6ac6694d MDEV-3798: EXPLAIN UPDATE/DELETE
- Produce correct #rows for ORDER BY ... LIMIT N queries that take advantage of 
  ordered index read to read only N rows.
2013-10-09 13:07:46 +04:00
Sergey Petrunya
161d687594 MDEV-3798: EXPLAIN UPDATE/DELETE
- Generate correct contents of `Extra` column for UPDATEs/DELETEs that use quick selects
- UPDATEs with used_key_is_modified=true will show "Using buffer"
2013-10-09 09:40:33 +04:00
Sergey Petrunya
e5d13c1567 Merge 10.0-base -> 10.0 2013-10-16 13:38:42 +04:00
Sergey Petrunya
062b7bfa39 Better comments 2013-10-05 13:48:45 +04:00
Sergey Petrunya
abcf14e595 MDEV-3798: EXPLAIN UPDATE/DELETE
- Handle the case when EXPLAIN UPDATE/DELETE has pruned away all partitions.
2013-10-05 13:44:01 +04:00
Sergey Petrunya
72bc6d7364 MDEV-3798: EXPLAIN UPDATE/DELETE
- Address review feedback: more renames
2013-10-05 13:19:45 +04:00
Sergey Petrunya
fedf769f0b MDEV-3798: EXPLAIN UPDATE/DELETE
- Address review feedback: rename nearly any name used by the new EXPLAIN code.
2013-10-05 09:58:22 +04:00
Sergey Petrunya
d998a1635f MDEV-5045: Server crashes in QPF_query::print_explain with log_slow_verbosity='explain'
- Don't print a plan when the statement didn't produce it
- Also, add first testcase. We can't check the EXPLAIN from the slow log itself, though.
2013-09-20 17:45:24 +04:00
Sergei Golubchik
8b5938a127 remove unused LEX::contains_plaintext_password 2013-09-21 16:44:49 +02:00
Sergei Golubchik
9af177042e 10.0-base merge.
Partitioning/InnoDB changes are *not* merged (they'll come from 5.6)
TokuDB does not compile (not updated to 10.0 SE API)
2013-09-21 10:14:42 +02:00
Sergey Petrunya
2add402891 MDEV-407: Print EXPLAIN [ANALYZE] in the slow query log
- Initial implementation.
2013-09-19 08:33:58 +04:00
Sergei Golubchik
4ec2e9d7ed 5.5 merge and fixes for compiler/test errors 2013-09-18 13:07:31 +02:00
Sergey Petrunya
ae6e95c498 Code cleanup. 2013-09-17 16:03:40 +04:00
Sergey Vojtovich
6fc98018a4 MDEV-4902 - sql_yacc.yy incompatible with bison 3
- YYPARSE_PARAM and YYLEX_PARAM are removed in Bison 3.0. Deprecated
  since Bison 1.875 in favor of %lex-param, %parse-param.
- %parse-param adds an argument to yyerror() as well, updated
  MYSQLerror() accordingly.
- %parse-param allows to declare proper type for argument. That's
  what 99% of this patch is about.
2013-08-30 11:00:29 +04:00
Sergey Petrunya
662bfed027 [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Merge with current 10.0-base
2013-08-24 00:46:49 +04:00
Sergei Golubchik
b7b5f6f1ab 10.0-monty merge
includes:
* remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING"
* introduce LOCK_share, now LOCK_ha_data is strictly for engines
* rea_create_table() always creates .par file (even in "frm-only" mode)
* fix a 5.6 bug, temp file leak on dummy ALTER TABLE
2013-07-21 16:39:19 +02:00
Sergei Golubchik
5f6380adde 10.0-base merge 2013-07-18 16:46:57 +02:00
Sergei Golubchik
97e640b9ae 5.5 merge 2013-07-17 21:24:29 +02:00
Sergei Golubchik
005c7e5421 mysql-5.5.32 merge 2013-07-16 19:09:54 +02:00
unknown
69ca523810 MDEV-4547 [PATCH] Make REFRESH_* constants to be 64-bit in 32-bit compilation
REFRESH_FAST do not fit in 32 bit
2013-07-16 15:16:38 +03:00
Sergei Golubchik
0ce9391008 fix for alter_table_online test.
Map ALTER ONLINE TABLE to ALTER TABLE ... ALGORITHM=INPLACE.
Make MERGE engine to announce its support of inplace operations.
2013-07-10 12:48:56 +02:00
Sergey Petrunya
ef47cc1f09 [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Merge with 10.0-base
2013-06-27 18:28:14 +04:00
Sergey Petrunya
c0f7efb1ae Code cleanup 2013-06-27 16:28:57 +04:00
Sergey Petrunya
99a8bfe68c [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Update view.result (old EXPLAIN didn't match the execution)
- Put in a stub code to work around the 
  SELECT ... UNION SELECT ... ORDER BY (subuqery) problem
2013-06-27 01:00:22 +04:00
Sergei Golubchik
31a1934c9c MDEV-4660 SHUTDOWN command
Based on James Briggs contribution.
2013-06-24 20:56:49 +02:00
Sujatha Sivakumar
ce29ca8b76 Bug#16753869:INCORRECT TRUNCATION OF LONG SET EXPRESSION IN
LOAD DATA CAN CAUSE SQL INJECTION

Problem:
=======
A long SET expression in LOAD DATA is incorrectly truncated
when written to the binary log.

Analysis:
========
LOAD DATA statements are reconstructed once again before
they are written to the binary log. When SET clauses are
specified as part of LOAD DATA statement, these SET clause
user command strings need to be stored as it is inorder to
reconstruct the original user command.  At present these
strings are stored as part of SET clause item tree's
top most Item node's name itself which is incorrect. As an
Item::name can be of MAX_ALIAS_NAME (256) size. Hence the
name will get truncated to "255".

Because of this the rewritten LOAD DATA statement will be
terminated incorrectly.  When this statment is read back by
the mysqlbinlog tool it reads a starting single quote and
continuos to read till it finds an ending quote. Hence any
statement written post ending quote will be considered as
a new statement.

Fix:
===
As name field has length restriction the string value
should not be stored in Item::name.  A new String list is
maintained to store the SET expression values and this list
is read during reconstrution.

sql/sql_lex.cc:
  Clear the load data set string list during each query 
  execution.
sql/sql_lex.h:
  Added a new String list to store the load data operation's
  SET clause user command strings.
sql/sql_load.cc:
  Read the SET clause user command strings from load data
  set string list.
sql/sql_yacc.yy:
  Store the SET caluse user command string as part of load
  data set string list.
2013-06-24 11:11:55 +05:30
Sujatha Sivakumar
318077c4f9 Bug#16753869:INCORRECT TRUNCATION OF LONG SET EXPRESSION IN
LOAD DATA CAN CAUSE SQL INJECTION

Problem:
=======
A long SET expression in LOAD DATA is incorrectly truncated
when written to the binary log.

Analysis:
========
LOAD DATA statements are reconstructed once again before
they are written to the binary log. When SET clauses are
specified as part of LOAD DATA statement, these SET clause
user command strings need to be stored as it is inorder to
reconstruct the original user command.  At present these
strings are stored as part of SET clause item tree's
top most Item node's name itself which is incorrect. As an
Item::name can be of MAX_ALIAS_NAME (256) size. Hence the
name will get truncated to "255".

Because of this the rewritten LOAD DATA statement will be
terminated incorrectly.  When this statment is read back by
the mysqlbinlog tool it reads a starting single quote and
continuos to read till it finds an ending quote. Hence any
statement written post ending quote will be considered as
a new statement.

Fix:
===
As name field has length restriction the string value
should not be stored in Item::name.  A new String list is
maintained to store the SET expression values and this list
is read during reconstrution.
2013-06-24 11:11:55 +05:30
Sergey Petrunya
af5e128e50 [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Handle statements inside SPs:
  = regular statements
  = SET command, which does not have its own statement.

- Handle execution of subquery from range optimizer: 
  allocate subquery QPFs on the same MEM_ROOT as the whole 
  query plan was allocated.
2013-06-21 13:26:53 +04:00
Sergey Petrunya
52cfa54c1d [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
Single table UPDATE/DELETE
- Correctly print type=SIMPLE vs type=PRIMARY
- Handle UPDATE/DELETE of mergeable VIEWs: we get the 
  VIEW's select as the first subquery. 
  (MySQL 5.6 doesn't print it because it finds that the
   subquery is not attached to any select)
2013-06-20 20:58:26 +04:00
Sergey Petrunya
0a560289aa [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Introduce back QueryPlan/QueryPlanFootprint separation for 
  single-table UPDATEs/DELETEs
- Create an empty QueryPlanFootprint for all kinds of queries
2013-06-20 15:15:24 +04:00
Sergey Petrunya
1951d40a88 [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Make EXPLAIN UPDATE/DELETE use "Query Plan Footprints", too.
2013-06-18 21:08:34 +04:00
Michael Widenius
2534521f9a Fixed some merge issues:
- temporary tables now works
- mysql-system_tables updated to not use temporary tables
- PASSWORD() function fixed
- Support for STATS_AUTO_RECALC, STATS_PERSISTENT and STATS_SAMPLE_PAGES table options
2013-06-18 02:01:34 +03:00
Sergey Petrunya
03691a7771 SHOW EXPLAIN UPDATE/DELETE
- Introduce "Query Plan Footprints" (abbrev. QPFs)
  QPF is a part of query plan that is 
  1. sufficient to produce EXPLAIN output,
  2. can be used to produce EXPLAIN output even after its subquery/union
     was executed and deleted
  3. is cheap to save so that we can always save query plans

- This patch doesn't fully address #2, we make/save strings for 
  a number of EXPLAIN's columns.  This will be fixed.
2013-06-17 11:59:38 +04:00
Michael Widenius
5f1f2fc0e4 Applied all changes from Igor and Sanja 2013-06-15 18:32:08 +03:00