summaryrefslogtreecommitdiff
path: root/sql/sql_list.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.10' into 10.11Oleksandr Byelkin2023-01-311-1/+1
|\
| * Merge branch '10.4' into 10.5Oleksandr Byelkin2023-01-271-1/+1
| |\
| | * Merge branch '10.3' into 10.4Oleksandr Byelkin2023-01-261-1/+1
| | |\
| | | * MDEV-30052 Crash with a query containing nested WINDOW clausesIgor Babaev2023-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use SELECT_LEX to save lists for ORDER BY and GROUP BY before parsing WINDOW clauses / specifications. This is needed for proper parsing of a nested WINDOW clause when a WINDOW clause is used in a subquery contained in another WINDOW clause. Fix assignment of empty SQL_I_List to another one (in case of empty list next shoud point on first).
* | | | MDEV-15530: Variable replicate_rewrite_db cannot be found in "show global ↵Anel Husakovic2022-10-211-1/+0
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | variables" - Add `replicate_rewrite_db` status variable, that may accept comma separated key-value pairs. - Note that option `OPT_REPLICATE_REWRITE_DB` already existed in `mysqld.h` from this commit 23d8586dbfdf Reviewer:Brandon Nesterenko <brandon.nesterenko@mariadb.com>
* | | Merge 10.4 into 10.5Aleksey Midenkov2022-10-071-6/+6
|\ \ \ | |/ /
| * | Merge 10.3 into 10.4Aleksey Midenkov2022-10-061-6/+6
| |\ \ | | |/
| | * MDEV-28576 Ability to manipulate List<const char *>Aleksey Midenkov2022-10-051-6/+6
| | | | | | | | | | | | | | | | | | | | | For "const char *" replace() and after() accepted const as "T *" and passed forward "void *". This cannot be cast implicitly, so we better use "const void *" instead of "void *" in the input interface. This way we avoid problems with using List for any const type.
* | | perfschema memory related instrumentation changesSergei Golubchik2020-03-101-1/+2
|/ /
* | cleanup: replace List_iterator(_fast) in handler0alter.ccEugene Kosov2019-11-131-0/+6
| | | | | | | | | | Basically, use more List<T>::iterator. This patch required adding two more overloads to new iterator for convenience.
* | MDEV-20297 Support C++11 range-based for loop for List<T>Eugene Kosov2019-11-121-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | New iterator has the fastest possible implementation: just moves one pointer. It's faster that List_iterator and List_iterator_fast: both do more on increment. Overall patch brings: 1) work compile times 2) possibly(!) worse debug build performance 3) definitely better optimized build performance 4) ability to write less code 5) ability to write less bug-prone code
* | Merge 10.3 into 10.4Marko Mäkelä2019-08-161-1/+9
|\ \ | |/
| * Merge 10.2 into 10.3Marko Mäkelä2019-08-151-1/+9
| |\
| | * MDEV-19740: Fix C++11 violations caught by GCC 9.2.1Marko Mäkelä2019-08-151-5/+18
| | |
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-1/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
| |\ \ | | |/
| | * Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| | |\
| | | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | | |\
| | | | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | * Update wrong zip-code
| | * | | Merge 10.1 into 10.2Marko Mäkelä2018-08-211-1/+4
| | |\ \ \ | | | |/ /
| | | * | Merge branch '10.0' into 10.1Oleksandr Byelkin2018-08-211-1/+4
| | | |\ \ | | | | |/
| | | | * MDEV-16904 inline void swap(base_list &rhs) should swap list only when list ↵Sachin2018-08-071-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is... not empty We should swap the list only when list is not empty.
* | | | | MDEV-18796 Synchronize PS grammar between sql_yacc.yy and sql_yacc_ora.yyAlexander Barkov2019-03-031-0/+6
| | | | |
* | | | | Merge 10.3 into 10.4Marko Mäkelä2018-08-161-1/+4
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-15127 AddressSanitizer: stack-buffer-overflow in base_list::push_back ..Sachin2018-08-071-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem:- If we try to run this query with -WITH_ASAN=ON compiled server CREATE TABLE t1 (i INT); SET debug_dbug="+d,test_completely_invisible,test_invisible_index"; CREATE TABLE t2 LIKE t1; This will generate a stack buffer overflow error. ==8922==ERROR: AddressSanitizer: stack-buffer-overflow on address #ADDR Analyze:- Error is generated on this line if (((*last)=new list_node(info, &end_of_list))) So info is our Key*, &end_of_list is global variable and last == #ADDR So last is suspicious variable. And last is the variable present in alter_info ->key_list. Now the question is how this key_list->last gets wrong/ different stack variable. In the backtrace, we can see that key_list is generated in mysql_create_table_like_table by calling mysql_preapre_alter_table_function and dummy key_list is created by mysql_create_like_table. In the end on mysql_prepare_alter_table we call alter_info->key_list.swap(new_key_list); So there is two options either key_list is empty or not empty , IF it is not empty then there is no issues last ptr is replaced by thd->mem_root (allocated ptr) So problem arises when key_list is empty. It swaps the dummy last ptr by mysql_prepare_alter_table declared ptr. which is wrong. Solution:- We wont swap variable if list does not have any element.
* | | | | mysys: rename ME_xxx flags to match plugin apiSergei Golubchik2018-06-041-1/+1
|/ / / /
* | | | bugfix: correct list assignment operatorSergei Golubchik2018-05-171-3/+8
| | | |
* | | | Fix many -Wunused-parameterMarko Mäkelä2018-05-011-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused InnoDB function parameters and functions. i_s_sys_virtual_fill_table(): Do not allocate heap memory. mtr_is_block_fix(): Replace with mtr_memo_contains(). mtr_is_page_fix(): Replace with mtr_memo_contains_page().
* | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2018-02-151-1/+4
|\ \ \ \
| * \ \ \ Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2018-02-121-1/+4
| |\ \ \ \ | | |/ / /
| | * | | MDEV-13508 ALTER TABLE that renames columns and CHECK constraintsMonty2018-02-101-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed by adding Item::rename_fields_processor Signed-off-by: Monty <monty@mariadb.org>
| * | | | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2018-02-081-2/+2
| |\ \ \ \ | | |/ / /
| | * | | Merge branch 'github/10.1' into 10.2Sergei Golubchik2018-02-061-2/+2
| | |\ \ \ | | | |/ /
| | | * | Merge branch 'github/10.0' into 10.1Sergei Golubchik2018-02-021-2/+2
| | | |\ \ | | | | |/
| | | | * Correct TRASH() macro usageSergei Golubchik2018-01-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TRASH was mapped to TRASH_FREE and was supposed to be used for memory that should not be accessed anymore, while TRASH_ALLOC() is to be used for uninitialized but to-be-used memory. But sometimes TRASH() was used in the latter sense. Remove TRASH() macro, always use explicit TRASH_ALLOC() or TRASH_FREE().
| * | | | Fixing a few -Wconversion warningsAlexander Barkov2017-09-231-2/+4
| | | | |
* | | | | CleanupsMonty2017-12-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove not used thd_rpl_is_parallel() - Remove not used mysql_notify_thread_having_shared_lock() - Remove not needed LOCK_thread_count from MYSQL_BIN_LOG::reset_logs() - LOCK_thread_count is not protecting against rollback, so this code and comment is not needed - Remove mutex_locks in slave.cc that are not needed. Added THD::assert_not_linked() to ensure that it was safe to remove - Fixed not repeatable test load_data_stmt_view - Updated binlog_killed to test removal of mutex (thanks to Andrei Elkin for test) - More code comments
* | | | | Added sql_alloc.hMichael Widenius2017-08-241-40/+2
| | | | | | | | | | | | | | | | | | | | | | | | | - Moved declaration of Sql_alloc from Sql_list.h as they are independent structures.
* | | | | Enusure that my_global.h is included firstMichael Widenius2017-08-241-1/+1
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added sql/mariadb.h file that should be included first by files in sql directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables that must be done before my_global.h is included) - Removed a lot of include my_global.h from include files - Removed include's of some files that my_global.h automatically includes - Removed duplicated include's of my_sys.h - Replaced include my_config.h with my_global.h
* | | | Changing field::field_name and Item::name to LEX_CSTRINGMonty2017-04-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benefits of this patch: - Removed a lot of calls to strlen(), especially for field_string - Strings generated by parser are now const strings, less chance of accidently changing a string - Removed a lot of calls with LEX_STRING as parameter (changed to pointer) - More uniform code - Item::name_length was not kept up to date. Now fixed - Several bugs found and fixed (Access to null pointers, access of freed memory, wrong arguments to printf like functions) - Removed a lot of casts from (const char*) to (char*) Changes: - This caused some ABI changes - lex_string_set now uses LEX_CSTRING - Some fucntions are now taking const char* instead of char* - Create_field::change and after changed to LEX_CSTRING - handler::connect_string, comment and engine_name() changed to LEX_CSTRING - Checked printf() related calls to find bugs. Found and fixed several errors in old code. - A lot of changes from LEX_STRING to LEX_CSTRING, especially related to parsing and events. - Some changes from LEX_STRING and LEX_STRING & to LEX_CSTRING* - Some changes for char* to const char* - Added printf argument checking for my_snprintf() - Introduced null_clex_str, star_clex_string, temp_lex_str to simplify code - Added item_empty_name and item_used_name to be able to distingush between items that was given an empty name and items that was not given a name This is used in sql_yacc.yy to know when to give an item a name. - select table_name."*' is not anymore same as table_name.* - removed not used function Item::rename() - Added comparision of item->name_length before some calls to my_strcasecmp() to speed up comparison - Moved Item_sp_variable::make_field() from item.h to item.cc - Some minimal code changes to avoid copying to const char * - Fixed wrong error message in wsrep_mysql_parse() - Fixed wrong code in find_field_in_natural_join() where real_item() was set when it shouldn't - ER_ERROR_ON_RENAME was used with extra arguments. - Removed some (wrong) ER_OUTOFMEMORY, as alloc_root will already give the error. TODO: - Check possible unsafe casts in plugin/auth_examples/qa_auth_interface.c - Change code to not modify LEX_CSTRING for database name (as part of lower_case_table_names)
* | | | MDEV-10914 ROW data type for stored routine variablesAlexander Barkov2017-04-051-8/+4
|/ / /
* | | fix the method nameSergei Golubchik2016-06-041-1/+1
| | | | | | | | | | | | | | | it's always assert_<statement>, not <do something>_if_<condition>
* | | MDEV-9848: Window functions: reuse sorting and/or scanningSergei Petrunia2016-04-051-0/+10
| | | | | | | | | | | | | | | | | | | | | - Rename Window_funcs_computation to Window_funcs_computation_step - Introduce Window_func_sort which invokes filesort and then invokes computation of all window functions that use this ordering. - Expose Window functions' sort operations in EXPLAIN|ANALYZE FORMAT=JSON
* | | The implementation of the template bubble_sort assumedIgor Babaev2016-04-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that the call-back comparison function returns a positive number when arg1 < arg2, and a negative number when arg1 > arg2. This is not in line with other implementation of sorting algorithm. Changed bubble_sort: now a negative result from the comparison function means that arg1 < arg2, and positive result means that arg1 > arg2. Changed accordingly all call-back functions that are used as parameters in the call of bubble_sort. Added a test case to check the proper sorting of window functions.
* | | MDEV-6150 Speed up connection speed by moving creation of THD to new threadMonty2016-02-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Creating a CONNECT object on client connect and pass this to the working thread which creates the THD. Split LOCK_thread_count to different mutexes Added LOCK_thread_start to syncronize threads Moved most usage of LOCK_thread_count to dedicated functions Use next_thread_id() instead of thread_id++ Other things: - Thread id now starts from 1 instead of 2 - Added cast for thread_id as thread id is now of type my_thread_id - Made THD->host const (To ensure it's not changed) - Removed some DBUG_PRINT() about entering/exiting mutex as these was already logged by mutex code - Fixed that aborted_connects and connection_errors_internal are counted in all cases - Don't take locks for current_linfo when we set it (not needed as it was 0 before)
* | | MDEV-8715 - Obsolete sql_alloc() in favor of THD::alloc() and thd_alloc()Sergey Vojtovich2015-11-261-3/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | The following left in semi-improved state to keep patch size reasonable: - Field operator new: left thd_alloc(current_thd) - Sql_alloc operator new: left thd_alloc(thd_get_current_thd()) - Item_args constructors: left thd_alloc(thd) - Item_func_interval::fix_length_and_dec(): no THD arg, have to call current_thd - Item_func_dyncol_exists::val_int(): same - Item_dyncol_get::val_str(): same - Item_dyncol_get::val_int(): same - Item_dyncol_get::val_real(): same - Item_dyncol_get::val_decimal(): same - Item_singlerow_subselect::fix_length_and_dec(): same
* | - Renaming variables so that they don't shadow others (After this patch one ↵Monty2015-07-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | MDEV-7951 - sql_alloc() takes 0.25% in OLTP ROSergey Vojtovich2015-05-131-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | cleanup: rename List<> methodsSergei Golubchik2014-10-101-4/+4
|/ | | | | prepand() -> prepend() concat() -> append()
* Debugging aid: Add T* List<T>::elem(int n) which returns N-th element in the ↵Sergey Petrunya2014-03-111-2/+7
| | | | | | | list. - There was List<N>::nth_element() but it didn't work because linker removed it. - Now, removal by linker is prevented for important values of T, and function is renamed.