Commit graph

65349 commits

Author SHA1 Message Date
Vicențiu Ciorbaru
62df3119a5 Add a counter for the number of select statements using window functions
The counter is available via SHOW [GLOBAL] STATUS and will be reported
by the feedback plugin.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
5cb568786a MDEV-10669: Crash in SELECT with window function used
Make sure to call split_sum_func on all items that contain window
functions, so that all the column references are set up correctly.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
2857ff3c98 MDEV-10815: Window Function Expressions Wrong Results
Fix window function expressions such as win_func() <operator> expr.
The problem was found in 2 places.
First, when we have complex expressions containing window functions, we
can only compute their final value _after_ we have computed the window
function's values. These values must be stored within the temporary
table that we are using, before sending them off.
This is done by performing an extra copy_funcs call before the final
end_send() call.

Second, such expressions need to have their inner arguments,
changed such that the references within those arguments point to fields within
the temporary table.
Ex: sum(t.a) over (order by t.b) + sum(t.a) over (order by t.b)
Before this fix, t.a pointed to the original table's a field. In order
to compute the sum function's value correctly, it needs to point to the
copy of this field inside the temp table.
This is done by calling split_sum_func for each argument in the
expression in turn.

The win.test results have also been updated as they contained wrong
values for such a use case.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
1c72441364 Frame bounds using FOLLOWING or PRECEDING can have 0 as cardinal value
This makes them behave exactly like CURRENT ROW. Standard specifies
unsigned integer, which includes the value 0.

Expand the win_min_max test to include this kind of frame definitions.
2016-09-24 15:09:39 +02:00
Sergei Petrunia
a95e384d54 MDEV-10174: Make the fix for MDEV-8989 enabled by default in 10.2
- Change the default @@optimizer_switch value
- Adjust the testcases
2016-09-24 15:27:56 +03:00
Igor Babaev
4872ec6177 Fixed bug mdev-10874.
In some cases the method Window_funcs_sort::setup() did
not build the sequence of sorting keys correctly.
2016-09-23 14:23:17 -07:00
Vladislav Vaintroub
f7a7c0c2fe MDEV-10297 Add priorization to threadpool
Also MDEV-10385 Threadpool refactoring
2016-09-22 17:01:28 +00:00
Sergei Golubchik
f32a511558 Merge branch '10.2' into bb-10.2-connector-c-integ-subm 2016-09-22 17:50:37 +02:00
Igor Babaev
48b4e33596 Allowed to use WITH clauses before SELECT in CREATE ... SELECT
and INSERT ... SELECT.
Added test cases.
2016-09-22 01:45:05 -07:00
Sergei Golubchik
59d51f0c12 Merge branch '10.2' into bb-10.2-connector-c-integ-subm 2016-09-21 12:54:56 +02:00
Sergei Golubchik
4368efe870 valgrind failures
and a couple of collaterals:
* debugging assert in my_valgrind.h
* trivial cleanup in sql_union.cc
2016-09-21 10:03:16 +02:00
Igor Babaev
10aa3936a7 Fixed bug mdev-10842.
In some cases the function compare_order_elements() erroneously
returned CMP_EQ for not equal elements.
2016-09-20 19:56:05 -07:00
Igor Babaev
3da077a6ec Merge branch '10.2' of github.com:MariaDB/server into 10.2 2016-09-19 09:54:16 -07:00
Igor Babaev
697a9d0163 Fixed a failure with --valgrind for cte_recursive.test. 2016-09-19 09:53:36 -07:00
Sergei Golubchik
f9bdc7c01a Merge branch '10.2' into bb-10.2-jan 2016-09-19 09:47:08 +02:00
Sergey Vojtovich
cb575abf76 MDEV-10296 - Multi-instance table cache
Some compilers are unhappy about mixed struct/class declarations.
2016-09-16 21:46:33 +04:00
Sergey Vojtovich
0d88b97e1e MDEV-10296 - Multi-instance table cache
Fixed type cast.
2016-09-16 19:07:59 +04:00
Sergey Vojtovich
a2b1c58c19 MDEV-10296 - Multi-instance table cache
Fixed sysvars_server_[not]embedded failure: changed type of
table_open_cache_instances from ulong to uint.

Added casts foratomic operations around tc_active_instances and
tc_contention_warning_reported: needed on some platforms.
2016-09-16 18:41:21 +04:00
Sergey Vojtovich
8613633f26 MDEV-10296 - Multi-instance table cache
Table cache instances autosizing.
2016-09-16 15:46:15 +04:00
Sergey Vojtovich
7e9ac7b8ac MDEV-10296 - Multi-instance table cache
Improve scalability by implementing multi-instance table cache.
2016-09-16 15:46:15 +04:00
Sergei Golubchik
4572dca4bd increase I_S.FILES.FILE_NANE column length
because InnoDB 5.7 tdecided to store a full path there
2016-09-16 09:54:31 +02:00
Sergei Golubchik
c8b3244703 fix some quoting in error messages
add_identifier change comes from 5.7, everything else is a follow-up
2016-09-16 09:54:30 +02:00
Monty
6c1c27ea11 Don't increment 'Empty_queries' for queries with errors. 2016-09-15 22:02:32 +03:00
Monty
7ca60dd842 Test case for fix assertion/hang in read_init_file() 2016-09-15 21:56:01 +03:00
Sergei Golubchik
b1384143e2 fix many rpl test failures
* wait_until_connected_again.inc should expect ER_CONNECTION_KILLED now
* also fix MySQL BUG#36228
2016-09-15 15:31:28 +02:00
Igor Babaev
55eb6fa5da Another attempt to fix bug mdev-10785 + cleanup for the previous attempt. 2016-09-14 11:44:41 -07:00
Igor Babaev
c22d307afa Fixed bug mdev-10785.
The condition pushed into WHERE/HAVING of a materialized
view/derived table may differ for different executions of
the same prepared statement. That's why the should be
ANDed with the existing WHERE/HAVING conditions only after all
permanent transformations of these conditions has been
performed.
2016-09-14 01:06:45 -07:00
Igor Babaev
61d46e0423 Merge branch '10.2' of github.com:MariaDB/server into 10.2 2016-09-13 12:10:53 -07:00
Igor Babaev
08ba474174 Fixed bug mdev-10783.
Do not push conditions into materialized views/derived tables
marked with the flag 'fill_me'.
2016-09-13 11:58:35 -07:00
Alexander Barkov
a0db19bed9 MDEV-10779 Failing assertion lex->proc_list.elements == 0 or syntax error on PROCEDURE ANALYSE in UNION
Reverting a part of the patch for "MDEV-8909union parser cleanup",
as a parenthesized SELECT with PROCEDURE followed by UNION is not
disallowed by the grammar (only a non-parenthesized SELECT with PROCEDURE
followed by a UNION is disallowed grammatically).
2016-09-13 20:28:58 +04:00
Vicențiu Ciorbaru
54b81ac57f Window functions fail with --ps-protocol
When running with --ps protocol, window functions cleanup method may
be called twice. Enforce proper cleanup by setting pointers to NULL
after deletion. This prevents double deletion on second cleanup.
2016-09-12 18:50:47 +02:00
Sergei Golubchik
0aa6817e86 name clash with gnutls on on base64_encode 2016-09-12 17:51:52 +02:00
Sergei Golubchik
5ea5a7f7e7 auto-clone C/C, if possible 2016-09-12 17:51:52 +02:00
Sergei Golubchik
ece01ef3dc After-review changes
* remove redundant code
* fix tests
* move declarations and defines where they belong
2016-09-12 17:51:50 +02:00
Sergei Golubchik
ed0b84a027 remove libmysql/
also disable server's client plugins when C/C has the same
2016-09-12 17:51:49 +02:00
Sergei Golubchik
ec59220f2c post-merge fixes for ec47bea 2016-09-12 13:54:44 +02:00
Alexey Botchkov
76a0ed2e03 alter_table.test bug fixed.
Wrong argument for the my_error function fixed.
2016-09-12 13:11:35 +04:00
Igor Babaev
3630a00e25 Fixed bug mdev-10782.
This bug in the code of Item_ref::build_clone could
cause corruption of items in where conditions.
Also made sure that equality predicates extracted
from multiple equality items to be pushed into
materialized views were cloned.
2016-09-12 00:07:02 -07:00
Oleksandr Byelkin
9810d5ea13 Helper function for debugging. 2016-09-11 11:55:57 +02:00
Sergei Golubchik
dc900cc846 Remove a bunch of TODO's, fix perfschema.threads_innodb test 2016-09-11 10:57:05 +02:00
Sergei Golubchik
d019af402c misc after-merge changes:
* remove new InnoDB-specific ER_ and HA_ERR_ codes
* renamed few old ER_ and HA_ERR_ error messages to be less MyISAM-specific
* remove duplicate enum definitions (durability_properties, icp_result)
* move new mysql-test include files to their owner suite
* rename xtradb.rdiff files to *-disabled
* remove mistakenly committed helper perl module
* remove long obsolete handler::ha_statistic_increment() method
* restore the standard C xid_t structure to not have setters and getters
* remove xid_t::reset that was cleaning too much
* move MySQL-5.7 ER_ codes where they belong
* fir innodb to include service_wsrep.h not internal wsrep headers
* update tests and results
2016-09-10 16:04:44 +02:00
Igor Babaev
1168e2fa54 Merge branch '10.2' of github.com:MariaDB/server into 10.2 2016-09-09 13:25:45 -07:00
Igor Babaev
5c7d829346 Another attempt to fix bug mdev-10736. 2016-09-09 13:25:02 -07:00
Kristian Nielsen
49b25020ef Fix assertion/hang in read_init_file()
If there are other threads running (for example binlog background
thread), then the thread count may not drop to zero at the end of
do_handle_bootstrap(). This caused an assertion and missing wakeup of
the main thread. The missing wakeup is because THD::~THD() only
signals the COND_thread_count mutex when the number of threads drops
to zero.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-09-09 18:09:59 +02:00
Vicențiu Ciorbaru
be2b833c42 It is now possible to remove values multiple times from window functions
This can happen with degenerate frame definitions that are always empty.
2016-09-09 18:53:01 +03:00
Vicențiu Ciorbaru
14690c70c1 Enable almost all aggregate functions for window functions 2016-09-09 18:33:29 +03:00
Vicențiu Ciorbaru
dfd3be928d Make cursor implementation uniform
Cursors now report their current row number as the boundary of the
partition. This is used by Frame_scan_cursor to compute aggregate
functions that do not support removal.
2016-09-09 18:33:29 +03:00
Vicențiu Ciorbaru
ffed20c563 Extend Frame_cursor to report the current row it is pointing at
Added an extra virtual method to the Frame_cursor class to allow cursors
to report the row number to which they are pointing.
2016-09-09 18:32:35 +03:00
Vicențiu Ciorbaru
e174b13465 Add a method to disable the automatic adding of values from cursors
Currently cursors automatically add values to the sum functions they
manage. There are use cases when we just want to figure out the frame
boundaries, without actually adding/removing values from them.
2016-09-09 18:32:35 +03:00
Vicențiu Ciorbaru
3ba867be89 Convert Partition_read_cursor to inherit from Table_read_cursor
The 'IS A' relation is more appropriate for Partition_read_cursor. This
also helps with accessing methods available only to Table_read_cursor.
2016-09-09 18:32:35 +03:00