summaryrefslogtreecommitdiff
path: root/sql/session_tracker.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.4' into 10.5Sergei Golubchik2020-05-091-1/+2
|\
| * Merge branch '10.3' into 10.4Sergei Golubchik2020-05-091-1/+2
| |\
| | * Merge branch '10.2' into 10.3mariadb-10.3.23Sergei Golubchik2020-05-091-1/+2
| | |\
| | | * MDEV-22504: Session tracking return incorrectly long traking dataOleksandr Byelkin2020-05-081-1/+2
| | | | | | | | | | | | | | | | When we move data we should fix buffer string length
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-05-051-1/+9
| |\ \ \ | | |/ /
| | * | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-05-041-1/+9
| | |\ \ | | | |/
| | | * MDEV-22337 Assertion `Alloced_length >= (str_length + length +...Alexey Botchkov2020-04-291-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | Fix pointer calculations in the Session_tracker::store. Most of the fix for this bug goes to the 10.5, but this part should be also fixed earlier.
* | | | MDEV-22337: Fix type mismatchMarko Mäkelä2020-04-291-3/+2
| | | |
* | | | MDEV-22337 Assertion `Alloced_length >= (str_length + length + net_le… ↵Alexey Botchkov2020-04-291-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | …ngth_size(length))' failed in Binary_string::q_net_store_data on long MULTIPOLYGON query with session_track_user_variables=1 (optimized builds). We have to reserve enough space in String to use q_something(). Also pointer calculations fixed.
* | | | perfschema memory related instrumentation changesSergei Golubchik2020-03-101-4/+6
| | | |
* | | | Merge 10.4 into 10.5Marko Mäkelä2019-12-161-2/+2
|\ \ \ \ | |/ / /
| * | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-12-091-2/+2
| |\ \ \ | | |/ /
| | * | Lintian complains on spelling errorFaustin Lammler2019-12-021-2/+2
| | | | | | | | | | | | | | | | | | | | The lintian check complains on spelling error: https://salsa.debian.org/mariadb-team/mariadb-10.3/-/jobs/95739
* | | | MDEV-16470 - Session user variables trackerSergey Vojtovich2019-09-241-1/+32
| | | | | | | | | | | | | | | | Based on contribution by Dapeng Huang.
* | | | Cleanup session trackerSergey Vojtovich2019-09-241-9/+10
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - call current_schema::mark_as_changed() directly - call state_change::mark_as_changed() directly - replaced SESSION_TRACKER_CHANGED with dummy tracker - replaced Session_tracker::mark_as_changed() with State_tracker::mark_as_changed() - hide and devirtualize original State_tracker::mark_as_changed(), rename it to set_changed() - all implementations of mark_as_changed() now check is_enabled() for consistency - no argument casts anymore
* | | Fixes based on warnings from gcc/clang and valgrindMonty2019-08-121-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Initialize variables that could be used uninitialized - Added extra end space to DbugStringItemTypeValue to get rid of warnings from c_ptr() - Session_sysvars_tracker::update() accessed unitialized memory if called with NULL value. - get_schema_stat_record() accessed unitialized memory if HA_KEY_LONG_HASH was used - parse_vcol_defs() accessed random memory for tables without keys.
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-0/+1
|\ \ \ | |/ /
| * | Added missing reset_changed()Sergey Vojtovich2019-05-081-0/+1
| | | | | | | | | | | | | | | | | | Causes valgrind warnings, harmless otherwise. Part of MDEV-14984 - regression in connect performance
* | | Merge 10.3 into 10.4Marko Mäkelä2019-05-051-619/+146
|\ \ \ | |/ /
| * | Revert THD::THD(skip_global_sys_var_lock) argumentbb-10.3-svoj-MDEV-14984Sergey Vojtovich2019-05-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally introduced by e972125f1 to avoid harmless wait for LOCK_global_system_variables in a newly created thread, which creation was initiated by system variable update. At the same time it opens dangerous hole, when system variable update thread already released LOCK_global_system_variables and ack_receiver thread haven't yet completed new THD construction. In this case THD constructor goes completely unprotected. Since ack_receiver.stop() waits for the thread to go down, we have to temporarily release LOCK_global_system_variables so that it doesn't deadlock with ack_receiver.run(). Unfortunately it breaks atomicity of rpl_semi_sync_master_enabled updates and makes them not serialized. LOCK_rpl_semi_sync_master_enabled was introduced to workaround the above. TODO: move ack_receiver start/stop into repl_semisync_master enable_master/disable_master under LOCK_binlog protection? Part of MDEV-14984 - regression in connect performance
| * | Adieu find_sys_var_ex()Sergey Vojtovich2019-05-031-34/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only take LOCK_plugin for plugin system variables. Reverted optimisation that was originally done for session tracker: it makes much less sense now. Specifically only if connections would want to track plugin session variables changes and these changes would actually happen frequently. If this ever becomes an issue, there're much better ways to optimise this workload. Part of MDEV-14984 - regression in connect performance
| * | Make connect speed great againSergey Vojtovich2019-05-031-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than parsing session_track_system_variables when thread starts, do it when first trackable event occurs. Benchmarked on a 2socket/20core/40threads Broadwell system using sysbench connect brencmark @40 threads (with select 1 disabled): 101379.77 -> 143016.68 CPS, whereas 10.2 is currently at 137766.31 CPS. Part of MDEV-14984 - regression in connect performance
| * | Safe session_track_system_variables snapshotSergey Vojtovich2019-05-031-43/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When enabling system variables tracker, make a copy of global_system_variables.session_track_system_variables under LOCK_global_system_variables. This protects from concurrent variable updates and potential freed memory access, as well as from variable reconstruction (which was previously protected by LOCK_plugin). We can also use this copy as a session variable pointer, so that we don't have to allocate memory and reconstruct it every time it is referenced. For this very reason we don't need buffer_length stuff anymore. As well as don't we need to take LOCK_plugin early in ::enable(). Unified ::parse_var_list() to acquire LOCK_plugin unconditionally. For no apparent reason it wasn't previously acquired for global variable update. Part of MDEV-14984 - regression in connect performance
| * | Allocate Session_sysvars_tracker staticallySergey Vojtovich2019-05-031-185/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One less new/delete per connection. Removed m_mem_flag since most allocs are thread specific. The only exception are allocs performed during initialization. Removed State_tracker and Session_tracker constructors as they don't make sense anymore. No reason to access session_sysvars_tracker via get_tracker(), so access it directly instead. Part of MDEV-14984 - regression in connect performance
| * | Allocate Transaction_state_tracker staticallySergey Vojtovich2019-05-031-3/+1
| | | | | | | | | | | | | | | | | | One less new/delete per connection. Part of MDEV-14984 - regression in connect performance
| * | Static current schema and state change trackersSergey Vojtovich2019-05-031-43/+4
| | | | | | | | | | | | | | | | | | Saves 2 new/delete per connection. Part of MDEV-14984 - regression in connect performance
| * | Allocate orig_list staticallySergey Vojtovich2019-05-031-40/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tool_list is a temporary list needed only for SET SESSION session_track_system_variables, so allocate it on stack instead. Sane reinit() calls. Saves 2 new/delete per connection. Part of MDEV-14984 - regression in connect performance
| * | Get rid of not implemented SESSION_GTIDS_TRACKERSergey Vojtovich2019-05-031-16/+0
| | | | | | | | | | | | | | | | | | One less new/delete per connection. Part of MDEV-14984 - regression in connect performance
| * | Cleanup session tracker APISergey Vojtovich2019-05-031-90/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Session_sysvars_tracker::server_init_check() -> sysvartrack_validate_value() - Session_sysvars_tracker::check_var_list() -> sysvartrack_validate_value() - Session_sysvars_tracker::server_init_process() -> sysvartrack_global_update() - sysvartrack_reprint_value() -> sysvartrack_global_update() - sysvartrack_value_len() -> sysvartrack_session_value_ptr() - sysvartrack_value_construct() -> sysvartrack_session_value_ptr() - sysvartrack_update() -> Session_sysvars_tracker::update() - Session_tracker::server_boot_verify() -> session_tracker_init() - sysvar_tracker() -> /dev/null Part of MDEV-14984 - regression in connect performance
| * | Cleanup session tracker redundancySergey Vojtovich2019-05-031-51/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - m_enabled is initialised by the base class constructor - removed unused schema_track_inited - moved Transaction_state_tracker constructor to declaration - common enable() - removed unused Session_sysvars_tracker::check_str() - classes are "private" by default - don't even try to compile for embedded Part of MDEV-14984 - regression in connect performance
| * | Session_sysvars_tracker::vars_list cleanupsSergey Vojtovich2019-05-031-92/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - return proper type - removed useless node argument - removed useless mem_flag - classes are "private" by default - simplified iterators Part of MDEV-14984 - regression in connect performance
| * | A proper State_tracker::m_changed enacpsulationSergey Vojtovich2019-05-031-79/+12
| | | | | | | | | | | | | | | | | | | | | | | | Note: preserved original behaviour, where remaining trackers are not reset on error from store(). This effectively means subsequent statements will start tracking from unclean state. Part of MDEV-14984 - regression in connect performance
* | | Moved normal transaction xid to implicit_xidSergey Vojtovich2019-04-251-1/+1
| | | | | | | | | | | | Part of MDEV-7974 - backport fix for mysql bug#12161 (XA and binlog)
* | | Move XID_state::xa_state handing inside xa.ccSergey Vojtovich2019-04-251-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let xid_cache_insert()/xid_cache_delete() handle xa_state. Let session tracker use is_explicit_XA() rather than xa_state != XA_NOTR. Fixed open_tables() to refuse data access in XA_ROLLBACK_ONLY state. Removed dead code from THD::cleanup(). It was supposed to be a reminder, but it got messed up over time. spider_internal_start_trx() is called either with XA_NOTR or XA_ACTIVE, which is guarded by server callers. Thus is_explicit_XA() is acceptable replacement for XA_ACTIVE check (which was likely wrong anyway). Setting xa_state to XA_PREPARED in spider_internal_xa_prepare() isn't meaningful, as this value is never accessed later. It can't be accessed by current thread and it can't be recovered either. It can only be accessed by spider internally, which never happens. Make spider_xa_lock()/spider_xa_unlock() static. Part of MDEV-7974 - backport fix for mysql bug#12161 (XA and binlog)
* | MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from ↵Vladislav Vaintroub2018-02-061-4/+2
| | | | | | | | | | | | | | | | | | | | | | 'size_t' to 'type', possible loss of data) Handle string length as size_t, consistently (almost always:)) Change function prototypes to accept size_t, where in the past ulong or uint were used. change local/member variables to size_t when appropriate. This fix excludes rocksdb, spider,spider, sphinx and connect for now.
* | Changed database, tablename and alias to be LEX_CSTRINGMonty2018-01-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was done in, among other things: - thd->db and thd->db_length - TABLE_LIST tablename, db, alias and schema_name - Audit plugin database name - lex->db - All db and table names in Alter_table_ctx - st_select_lex db Other things: - Changed a lot of functions to take const LEX_CSTRING* as argument for db, table_name and alias. See init_one_table() as an example. - Changed some function arguments from LEX_CSTRING to const LEX_CSTRING - Changed some lists from LEX_STRING to LEX_CSTRING - threads_mysql.result changed because process list_db wasn't always correctly updated - New append_identifier() function that takes LEX_CSTRING* as arguments - Added new element tmp_buff to Alter_table_ctx to separate temp name handling from temporary space - Ensure we store the length after my_casedn_str() of table/db names - Removed not used version of rename_table_in_stat_tables() - Changed Natural_join_column::table_name and db_name() to never return NULL (used for print) - thd->get_db() now returns db as a printable string (thd->db.str or "")
* | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-10-041-4/+4
|\ \
| * \ Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-10-021-4/+4
| |\ \ | | |/
| | * MDEV-13384 - misc Windows warnings fixedVladislav Vaintroub2017-09-281-4/+4
| | |
* | | Lots of small cleanupsMichael Widenius2017-08-241-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Simplified use_trans_cache() to return at once if is_transactional is set - Indentation and spelling errors fixed - Don't call signal_update() if update_binlog_end_pos() is called as the function already calls signal_update() - Removed not used function wait_for_update_bin_log(), which would cause errors if ever used. - Simplified handler::clone() by always allocating 'ref' in ha_open(). To do this I added an optional MEM_ROOT argument to ha_open() to be used when allocating 'ref' - Changed arguments to get_system_var() from LEX_CSTRING to LEX_CSTRING* - Added THD as argument to create_select_for_variable(). Changed also char* argument to LEX_CSTRING to avoid strlen() call. - Change calls to append() to use LEX_CSTRING
* | Changing field::field_name and Item::name to LEX_CSTRINGMonty2017-04-231-6/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-6112 multiple triggers per tableMonty2016-10-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is similar to MysQL Worklog 3253, but with a different implementation. The disk format and SQL syntax is identical with MySQL 5.7. Fetures supported: - "Any" ammount of any trigger - Supports FOLLOWS and PRECEDES to be able to put triggers in a certain execution order. Implementation details: - Class Trigger added to hold information about a trigger. Before this trigger information was stored in a set of lists in Table_triggers_list and in Table_triggers_list::bodies - Each Trigger has a next field that poinst to the next Trigger with the same action and time. - When accessing a trigger, we now always access all linked triggers - The list are now only used to load and save trigger files. - MySQL trigger test case (trigger_wl3253) added and we execute these identically. - Even more gracefully handling of wrong trigger files than before. This is useful if a trigger file uses functions or syntax not provided by the server. - Each trigger now has a "Created" field that shows when the trigger was created, with 2 decimals. Other comments: - Many of the changes in test files was done because of the new "Created" field in the trigger file. This shows up in SHOW ... TRIGGER and when using information_schema.trigger. - Don't check if all memory is released if on uses --gdb; This is needed to be able to get a list from safemalloc of not freed memory while debugging. - Added option to trim_whitespace() to know how many prefix characters was skipped. - Changed a few ulonglong sql_mode to sql_mode_t, to find some wrong usage of sql_mode.
* MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-114/+162
| | | | | Postreview fixes. New MySQL tests fixes.
* MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-106/+661
| | | | Transaction tracker
* MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-8/+757
| | | | System variables tracking
* MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-0/+358
initial commit to test