Commit graph

16 commits

Author SHA1 Message Date
Vicențiu Ciorbaru
08c852026d Apply clang-tidy to remove empty constructors / destructors
This patch is the result of running
run-clang-tidy -fix -header-filter=.* -checks='-*,modernize-use-equals-default' .

Code style changes have been done on top. The result of this change
leads to the following improvements:

1. Binary size reduction.
* For a -DBUILD_CONFIG=mysql_release build, the binary size is reduced by
  ~400kb.
* A raw -DCMAKE_BUILD_TYPE=Release reduces the binary size by ~1.4kb.

2. Compiler can better understand the intent of the code, thus it leads
   to more optimization possibilities. Additionally it enabled detecting
   unused variables that had an empty default constructor but not marked
   so explicitly.

   Particular change required following this patch in sql/opt_range.cc

   result_keys, an unused template class Bitmap now correctly issues
   unused variable warnings.

   Setting Bitmap template class constructor to default allows the compiler
   to identify that there are no side-effects when instantiating the class.
   Previously the compiler could not issue the warning as it assumed Bitmap
   class (being a template) would not be performing a NO-OP for its default
   constructor. This prevented the "unused variable warning".
2023-02-09 16:09:08 +02:00
Sergey Vojtovich
e8dd18a474 Restore vars_list destructor
Regression after reverting fair THD members constructors/destructors.
vars_list can be used standalone, in such cases destructor is needed.

Part of MDEV-14984 - regression in connect performance
2019-05-04 12:43:29 +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
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
0e91e0c377 A proper State_tracker::m_changed enacpsulation
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
2019-05-03 12:16:26 +04:00
Marko Mäkelä
89d80c1b0b Fix many -Wconversion warnings.
Define my_thread_id as an unsigned type, to avoid mismatch with
ulonglong.  Change some parameters to this type.

Use size_t in a few more places.

Declare many flag constants as unsigned to avoid sign mismatch
when shifting bits or applying the unary ~ operator.

When applying the unary ~ operator to enum constants, explictly
cast the result to an unsigned type, because enum constants can
be treated as signed.

In InnoDB, change the source code line number parameters from
ulint to unsigned type. Also, make some InnoDB functions return
a narrower type (unsigned or uint32_t instead of ulint;
bool instead of ibool).
2017-03-07 19:07:27 +02:00
Oleksandr Byelkin
6dfa1d374e MDEV-8931: (server part of) session state tracking
Postreview fixes.
New MySQL tests fixes.
2016-08-31 17:17:46 +02:00
Oleksandr Byelkin
0ee3e64c55 MDEV-8931: (server part of) session state tracking
Transaction tracker
2016-08-31 17:17:46 +02:00
Oleksandr Byelkin
c8948b0d0d MDEV-8931: (server part of) session state tracking
System variables tracking
2016-08-31 17:17:46 +02:00
Oleksandr Byelkin
e7608a78ef MDEV-8931: (server part of) session state tracking
initial commit to test
2016-08-31 17:17:46 +02:00