Commit graph

27 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
Marko Mäkelä
be85d3e61b Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
Vicențiu Ciorbaru
cb248f8806 Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
Monty
c2118a08b1 Move all kill mutex protection to LOCK_thd_kill
LOCK_thd_data was used to protect both THD data and
ensure that the THD is not deleted while it was in use

This patch moves the THD delete protection to LOCK_thd_kill,
which already protects the THD for kill.

The benefits are:
- More well defined what LOCK_thd_data protects
- LOCK_thd_data usage is now much simpler and easier to verify
- Less chance of deadlocks in SHOW PROCESS LIST as there is less
  chance of interactions between mutexes
- Remove not needed LOCK_thread_count from
  thd_get_error_context_description()
- Fewer mutex taken for thd->awake()

Other things:
- Don't take mysys->var mutex in show processlist to check if thread
  is kill marked
- thd->awake() now automatically takes the LOCK_thd_kill mutex
  (Simplifies code)
- Apc uses LOCK_thd_kill instead of LOCK_thd_data
2017-12-08 13:46:23 +02:00
iangilfillan
f0ec34002a Correct FSF address 2017-03-10 18:21:29 +01:00
Sergey Vojtovich
84568c2965 MDEV-8030 - Apc_target::disable() locks mutex twice
Moved Apc_target::destroy(), Apc_target::enable() and Apc_targe::disable()
definitions to my_apc.h so that they can be inlined.

Apc_targe::disable() now calls Apc_target::process_apc_requests() only if
there're APC requests. This saves one pthread_mutex_lock() call.

Overhead change:
Apc_target::disable              0.04% -> out of radar
Apc_target::enable               0.03% -> out of radar
Apc_target::process_apc_requests 0.02% -> out of radar
pthread_mutex_lock               0.43% -> 0.42%
pthread_mutex_unlock             0.26% -> 0.25%
2015-06-23 09:54:36 +04:00
Sergey Vojtovich
d12c7adf71 MDEV-5314 - Compiling fails on OSX using clang
This is port of fix for MySQL BUG#17647863.

revno: 5572
revision-id: jon.hauglid@oracle.com-20131030232243-b0pw98oy72uka2sj
committer: Jon Olav Hauglid <jon.hauglid@oracle.com>
timestamp: Thu 2013-10-31 00:22:43 +0100
message:
  Bug#17647863: MYSQL DOES NOT COMPILE ON OSX 10.9 GM

  Rename test() macro to MY_TEST() to avoid conflict with libc++.
2014-02-19 14:05:15 +04:00
Sergey Vojtovich
1da6d6880b MDEV-5220 - [PATCH] MariaDB 10.0.4 doesn't compile without perfschema
Fixed the following compilation errors and test failures:
- maria SE: "stage_waiting_for_a_resource" wasn't declared w/o PFS
- sql_repl.h: PSI_mutex_key is not available in non-PFS builds
- mysqld.cc: pfs_param is not available in non-PFS builds
- mysqld.cc: init_show_explain_psi_keys() is not available in non-PFS builds
- mysqld.cc: call net_before_header_psi, net_after_header_psi even if PFS
  is not available so that thread enters stage_init at proper time. Fixes
  sp-threads and a few tests in funcs_1.
- myisam_file_io.opt: added missing loose prefix
2013-11-14 18:00:00 +04:00
Sergey Petrunya
e21b32d7fa [SHOW] EXPLAIN UPDATE/DELETE - Merge with 10.0-base 2013-05-27 09:31:41 +04:00
Sergei Golubchik
e56cad4b15 small cleanup 2013-04-07 14:03:43 +02:00
Sergey Petrunya
18fec5128b EXPLAIN DELETE for MariaDB
- Backported the code to 10.0-base
- Removed incorrect assert
2013-02-12 08:20:14 +04:00
Sergey Petrunya
2368f8895d MWL#182: Explain running statements
- Address feedback from the second code review.
2012-07-17 21:52:08 +04:00
Sergey Petrunya
f913ba7a60 MWL#182: Explain running statements: address review feedback
- Make THD::check_killed() an inline function which makes calls to non-inline 
  functions only whern there are APC requests to be served.
2012-07-11 13:39:56 +04:00
Sergey Petrunya
a931467e17 Enable PERFORMANCE_SCHEMA tracking for SHOW EXPLAIN's conditions. 2012-07-07 08:47:41 +04:00
Sergey Petrunya
3e90dc1f77 MWL#182: Explain running statements
- Make SHOW EXPLAIN command be KILLable with KILL QUERY.
2012-07-05 22:04:13 +04:00
Sergey Petrunya
b97678f066 Better comments 2012-06-30 08:29:29 +04:00
Sergey Petrunya
00ff7345fa - More "local" code in show_explain.test
- Better comments
- Make unittest compile on Windows
2012-06-30 06:05:06 +04:00
Sergey Petrunya
b9093d370b MWL#182: Explain running statements: address review feedback
- Fix the year in Monty Program Ab copyrights in the new files.
- Fix permissions handling so that SHOW EXPLAIN's handling is the 
  same as SHOW PROCESSLIST's.
2012-06-29 22:17:16 +04:00
Sergey Petrunya
84fd4e2542 MWL#182: Explain running statements: address review feedback
- Move standalone tests to a unittest.
- Added comments.
2012-06-28 16:46:24 +04:00
Sergey Petrunya
c62c0c5516 MWL#182: Explain running statements: address review feedback
- Add Monty Program Ab copyright in new files
- Change Apc_target::make_apc_call() to accept a C++-style
  functor (instead of C-style function + parameter)
2012-06-28 13:58:37 +04:00
Sergey Petrunya
66c62de103 MWL#182: Explain running statements
- Remove out-of-date comments, add dbug assertions.
2012-06-25 18:39:26 +04:00
Sergey Petrunya
6eb2ce5863 SHOW EXPLAIN: better comments 2012-06-19 18:10:32 +04:00
Sergey Petrunya
cf8461a0f7 SHOW EXPLAIN: Code cleanup 2012-06-08 02:19:36 +04:00
Sergey Petrunya
2c1e737c6c MDEV-297: SHOW EXPLAIN: Server gets stuck until timeout occurs while executing SHOW
INDEX and SHOW EXPLAIN in parallel
- Rework locking code to use the LOCK_thd_data mutex for all synchronization. This also
  fixed MDEV-301.
2012-06-07 12:19:06 +04:00
Sergey Petrunya
ca8aa3901c MWL#182: Explain running statements
- Code cleanup
2012-04-26 06:40:36 +05:30
Sergey Petrunya
203bbfe569 MWL#182: Explain running statements
- Implement new approach to testing (the DBUG_EXECUTE_IF variant)
- add an 'evalp' mysqltest command that is like 'eval' except that
  it prints the original query.
- Fix select_describe() not to change join_tab[i]->type
- More tests
2011-09-24 21:56:42 +04:00
Sergey Petrunya
7e66213444 MWL#182: Explain running statements
First code
- "Asynchronous procedure call" system
- new THD::check_killed() that serves APC request is called from within most important loops
- EXPLAIN code is now able to generate EXPLAIN output on-the-fly [incomplete]

Parts that are still missing:
- put THD::check_killed() call into every loop where we could spend significant amount of time
- Make sure EXPLAIN code works for group-by queries that replace JOIN::join_tab with make_simple_join() 
  and other such cases.
- User interface: what error code to use, where to get timeout settings from, etc.
2011-08-23 19:28:32 +04:00