Commit graph

65 commits

Author SHA1 Message Date
Brandon Nesterenko
840fe316d4 MDEV-34348: my_hash_get_key fixes
Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

Change the type of my_hash_get_key to:
 1) Return const
 2) Change the context parameter to be const void*

Also fix casting in hash adjacent areas.

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
2024-11-23 08:14:22 -07:00
Sergei Golubchik
23d7dc1ea1 MDEV-35086 Trying to lock mutex when the mutex was already locked (session_tracker.cc), server hangs
followup for 9021f40b8e
2024-10-08 15:31:02 +02:00
Sergei Golubchik
9021f40b8e MDEV-35050 Found wrong usage of mutex upon setting plugin session variables 2024-10-01 18:29:11 +02:00
Oleksandr Byelkin
7564be1352 Merge branch '10.4' into 10.5 2023-07-26 16:02:57 +02:00
Oleksandr Byelkin
cf50379b91 MDEV-25237 crash after setting global session_track_system_variables to an invalid value
Fix of typo in checking variable list corectness.

Fix of error handling in case of variable list parse error
2023-07-20 10:42:30 +02:00
Daniel Black
d067de20d6 MDEV-23133 session tracker - warning message typo
Concatenation error leads to typo in the warning message
2023-07-20 14:58:17 +10:00
Marko Mäkelä
898521e2dd Merge 10.4 into 10.5 2020-10-30 11:15:30 +02:00
Marko Mäkelä
7b2bb67113 Merge 10.3 into 10.4 2020-10-29 13:38:38 +02:00
Marko Mäkelä
a8de8f261d Merge 10.2 into 10.3 2020-10-28 10:01:50 +02:00
Alexey Botchkov
8761571a71 MDEV-22524 SIGABRT in safe_mutex_unlock with
session_track_system_variables and max_relay_log_size.

lock LOCK_global_system_variables around the get_one_variable() call
in the Session_sysvars_tracker::store_variable().
2020-10-27 16:44:11 +04:00
Marko Mäkelä
50a11f396a Merge 10.4 into 10.5 2020-08-01 14:42:51 +03:00
Marko Mäkelä
9216114ce7 Merge 10.3 into 10.4 2020-07-31 18:09:08 +03:00
Oleksandr Byelkin
0ec641ea1e MDEV-22134: handle_fatal_signal (sig=11) in __strlen_avx2 on START SLAVE | Assertion `global_system_variables.session_track_system_variables' failed in Session_sysvars_tracker::init | *** buffer overflow detected *** (on optimized builds)
Prohibit assigning NULL as for other system variables.
2020-07-23 09:38:58 +02:00
Monty
0fd89a1a89 Merge remote-tracking branch 'origin/10.4' into 10.5 2020-07-03 23:31:12 +03:00
Monty
5211af1c16 Merge remote-tracking branch 'origin/10.3' into 10.4 2020-07-03 00:35:28 +03:00
Monty
65f831d17c Fixed bugs found by valgrind
- Some of the bug fixes are backports from 10.5!
- The fix in innobase/fil/fil0fil.cc is just a backport to get less
  error messages in mysqld.1.err when running with valgrind.
- Renamed HAVE_valgrind_or_MSAN to HAVE_valgrind
2020-07-02 17:57:34 +03:00
Oleksandr Byelkin
82f3ceed12 MDEV-16470: switch off user variables (and fixes of its support) 2020-06-12 12:14:14 +02:00
Monty
d1d472646d Change THD->transaction to a pointer to enable multiple transactions
All changes (except one) is of type
thd->transaction.  -> thd->transaction->

thd->transaction points by default to 'thd->default_transaction'
This allows us to 'easily' have multiple active transactions for a
THD object, like when reading data from the mysql.proc table
2020-05-23 12:29:10 +03:00
Monty
36019df323 Proper fix of User_variables_tracker::store
- Don't use 'auto' to declare variables (lazy and makes code harder to read)
- Fixed length to use correct type
2020-05-23 12:29:10 +03:00
Sergei Golubchik
13038e4705 Merge branch '10.4' into 10.5 2020-05-09 20:43:36 +02:00
Sergei Golubchik
f5844e7c4b Merge branch '10.3' into 10.4 2020-05-09 20:36:58 +02:00
Sergei Golubchik
607467bd63 Merge branch '10.2' into 10.3 2020-05-09 20:20:02 +02:00
Oleksandr Byelkin
e84c62d59b MDEV-22504: Session tracking return incorrectly long traking data
When we move data we should fix buffer string length
2020-05-08 13:07:24 +02:00
Marko Mäkelä
2c3c851d2c Merge 10.3 into 10.4 2020-05-05 20:33:10 +03:00
Oleksandr Byelkin
7fb73ed143 Merge branch '10.2' into 10.3 2020-05-04 16:47:11 +02:00
Marko Mäkelä
89aebdf964 MDEV-22337: Fix type mismatch 2020-04-29 21:03:45 +03:00
Alexey Botchkov
d4da131cff MDEV-22337 Assertion `Alloced_length >= (str_length + length + net_le… …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.
2020-04-29 11:40:14 +04:00
Alexey Botchkov
4af4284b79 MDEV-22337 Assertion `Alloced_length >= (str_length + length +...
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.
2020-04-29 11:06:48 +04:00
Sergei Golubchik
7c58e97bf6 perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
Marko Mäkelä
28c89b7151 Merge 10.4 into 10.5 2019-12-16 07:47:17 +02:00
Oleksandr Byelkin
a15234bf4b Merge branch '10.3' into 10.4 2019-12-09 15:09:41 +01:00
Faustin Lammler
2df2238cb8 Lintian complains on spelling error
The lintian check complains on spelling error:
https://salsa.debian.org/mariadb-team/mariadb-10.3/-/jobs/95739
2019-12-02 12:41:13 +02:00
Sergey Vojtovich
f5c3ad1913 MDEV-16470 - Session user variables tracker
Based on contribution by Dapeng Huang.
2019-09-24 15:49:35 +04:00
Sergey Vojtovich
ad77e3ac09 Cleanup session tracker
- 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
2019-09-24 15:49:35 +04:00
Monty
05619f6989 Fixes based on warnings from gcc/clang and valgrind
- 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.
2019-08-12 10:48:38 +03:00
Oleksandr Byelkin
c07325f932 Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
Sergey Vojtovich
9d805004d8 Added missing reset_changed()
Causes valgrind warnings, harmless otherwise.

Part of MDEV-14984 - regression in connect performance
2019-05-08 15:00:16 +04:00
Marko Mäkelä
d3dcec5d65 Merge 10.3 into 10.4 2019-05-05 15:06:44 +03:00
Sergey Vojtovich
779fb636da Revert THD::THD(skip_global_sys_var_lock) argument
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
2019-05-03 16:46:11 +04:00
Sergey Vojtovich
894df7edb6 Adieu find_sys_var_ex()
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
2019-05-03 16:46:11 +04:00
Sergey Vojtovich
53671a1fff Make connect speed great again
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
2019-05-03 16:46:10 +04:00
Sergey Vojtovich
1b5cf2f7e7 Safe session_track_system_variables snapshot
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
2019-05-03 16:46:05 +04:00
Sergey Vojtovich
554ac6f393 Allocate Session_sysvars_tracker statically
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
2019-05-03 16:43:29 +04:00
Sergey Vojtovich
a7adc2ce16 Allocate Transaction_state_tracker statically
One less new/delete per connection.

Part of MDEV-14984 - regression in connect performance
2019-05-03 16:40:58 +04:00
Sergey Vojtovich
47bd06d55e Static current schema and state change trackers
Saves 2 new/delete per connection.

Part of MDEV-14984 - regression in connect performance
2019-05-03 16:36:48 +04:00
Sergey Vojtovich
01e8f3c52b Allocate orig_list statically
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
2019-05-03 14:14:28 +04:00
Sergey Vojtovich
55bdd7f7b4 Get rid of not implemented SESSION_GTIDS_TRACKER
One less new/delete per connection.

Part of MDEV-14984 - regression in connect performance
2019-05-03 14:14:27 +04:00
Sergey Vojtovich
2be28a91b1 Cleanup session tracker API
- 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
2019-05-03 14:14:27 +04:00
Sergey Vojtovich
19d5ddccfd Cleanup session tracker redundancy
- 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
2019-05-03 14:14:18 +04:00
Sergey Vojtovich
8f594b3384 Session_sysvars_tracker::vars_list cleanups
- 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
2019-05-03 12:16:26 +04:00