Commit graph

19 commits

Author SHA1 Message Date
Marko Mäkelä
be85d3e61b Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
Marko Mäkelä
26a14ee130 Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
Vicențiu Ciorbaru
f177f125d4 Merge branch '5.5' into 10.1 2019-05-11 19:15:57 +03:00
Michal Schorm
17b4f99928 Update FSF address
This commit is based on the work of Michal Schorm, rebased on the
earliest MariaDB version.

Th command line used to generate this diff was:

find ./ -type f \
  -exec sed -i -e 's/Foundation, Inc., 59 Temple Place, Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \
  -exec sed -i -e 's/Foundation, Inc. 59 Temple Place.* Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \
  -exec sed -i -e 's/MA.*.....-1307.*USA/MA 02110-1335 USA/g' {} \; \
  -exec sed -i -e 's/Foundation, Inc., 59 Temple/Foundation, Inc., 51 Franklin/g' {} \; \
  -exec sed -i -e 's/Place, Suite 330, Boston, MA.*02111-1307.*USA/Street, Fifth Floor, Boston, MA 02110-1335 USA/g' {} \; \
  -exec sed -i -e 's/MA.*.....-1307/MA 02110-1335/g' {} \;
2019-05-10 20:52:00 +03:00
Sergei Golubchik
b64fde8f38 Merge branch '10.2' into 10.3 2019-03-17 13:06:41 +01:00
Sergei Golubchik
0508d327ae Merge branch '10.1' into 10.2 2019-03-15 21:00:41 +01:00
Sergei Golubchik
dda2e940fb pass the slow logging information in thd->query_plan_flags
This solves the following issues:

* unlike lex->m_sql_cmd and lex->sql_command, thd->query_plan_flags
  is not reset in Prepared_statement::execute, it survives
  till the log_slow_statement(), so slow logging behaves correctly in --ps

* using thd->query_plan_flags for both slow_log_filter and
  log_slow_admin_statements means the definition of "admin" statements
  for the slow log is the same no matter how it is filtered out.
2019-03-12 13:10:49 +01:00
Monty
21518ab2e4 New option for slow logging (log_slow_disable_statements)
This fixes MDEV-7742 and MDEV-8305 (Allow user to specify if stored
procedures should be logged in the slow and general log)

New functionality:
- Added new variables log_slow_disable_statements and log_disable_statements
  that can be used to disable logging of certain queries to slow and
  general log. Currently supported options are 'admin', 'call', 'slave'
  and 'sp'.
  Defaults are as before. Only 'sp' (stored procedure statements) is
  disabled for  slow and general_log.
- Slow log to files now includes the following new information:
  - When logging stored procedure statements the name of stored
    procedure is logged.
  - Number of created tmp_tables, tmp_disk_tables and the space used
    by temporary tables.
- When logging 'call', the logged status now contains the sum of all
  included statements.  Before only 'time' was correct.
- Added filsort_priority_queue as an option for log_slow_filter (this
  variable existed before, but was not exposed)
- Added support for BIT types in my_getopt()

Mapped some old variables to bitmaps (old variables can still be used)
- Variable 'log_queries_not_using_indexes' is mapped to
  log_slow_filter='not_using_index'
- Variable 'log_slow_slave_statements' is mapped to
  log_slow_disabled_statements='slave'
- Variable 'log_slow_admin_statements' is mapped to
  log_slow_disabled_statements='admin'
- All the above variables are changed to session variables from global
  variables

Other things:
- Simplified LOGGER::log_command. We don't need to check for super if
  OPTION_LOG_OFF is set as this flag can only be set if one is a super
  user.
- Removed some setting of enable_slow_log as it's guaranteed to be set by
  mysql_parse()
- mysql_admin_table() now sets thd->enable_slow_log
- Added prepare_logs_for_admin_command() to reset thd->enable_slow_log if
  needed.
- Added new functions to store, restore and add slow query status
- Added new functions to store and restore query start time
- Reorganized Sub_statement_state according to types
- Added code in dispatch_command() to ensure that
  thd->reset_for_next_command() is always called for a query.
- Added thd->last_sql_command to simplify checking of what was the type
  of the last command. Needed when logging to slow log as lex->sql_command
  may have changed before slow logging is called.
- Moved QPLAN_TMP_... to where status for tmp tables are updated
- Added new THD variable, affected_rows, to be able to correctly log
  number of affected rows to slow log.
2017-08-24 01:05:51 +02:00
Sergei Golubchik
da4d71d10d Merge branch '10.1' into 10.2 2017-03-30 12:48:42 +02:00
iangilfillan
f0ec34002a Correct FSF address 2017-03-10 18:21:29 +01:00
Marko Mäkelä
47396ddea9 Merge 5.5 into 10.0
Also, implement MDEV-11027 a little differently from 5.5:

recv_sys_t::report(ib_time_t): Determine whether progress should
be reported.

recv_apply_hashed_log_recs(): Rename the parameter to last_batch.
2017-03-08 11:40:43 +02:00
Marko Mäkelä
6860a4b556 MDEV-12206 Query_cache::send_result_to_client() may corrupt THD::query_plan_flags
This is essentially a backport of the 10.0
commit 203f4d4193
that fixes a bug and silences a GCC 6.3.0 warning
about a left shift of a signed integer.

Missing parenthesis in a macro definition caused wrong operation
in the Query_cache::send_result_to_client() statement
   thd->query_plan_flags= (thd->query_plan_flags & ~QPLAN_QC_NO) | QPLAN_QC;

This would expand to
   thd->query_plan_flags= (thd->query_plan_flags & ~1) << 6 | 1 << 5;

which would shift the flags by 6 and clear an unrelated flag, instead
of clearing the flag (1 << 6).
2017-03-08 10:31:06 +02: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
Pavel Ivanov
203f4d4193 Add parenthesis in macro definitions to prevent order of operation problems.
When macro is expanded in an expression like ~QPLAN_QC_NO (e.g. in the
Query_cache::send_result_to_client() function in sql/sql_cache.cc) then without
the parenthesis the expression will be evaluated to a wrong value.
2015-07-16 16:03:06 -07:00
Sergey Petrunya
16779f6069 MDEV-6430: It is impossible to see if "filesort with small limit" optimization was used
- Make log_slow_verbosity print "Priority_queue: (Yes|No)" into the slow query log.
  (but we do not add a correspoding column to P_S.*statement* tables).
2014-07-09 12:32:00 +04:00
Sergey Petrunya
2add402891 MDEV-407: Print EXPLAIN [ANALYZE] in the slow query log
- Initial implementation.
2013-09-19 08:33:58 +04:00
Sergei Golubchik
0accbd0364 lots of post-merge changes 2011-04-25 17:22:25 +02:00
Sergei Golubchik
37f87d73ae updated sys_vars.cc (converting 5.3 mysqld.cc and set_var.cc
changes appropriately)
2010-11-26 12:22:40 +01:00
Michael Widenius
cd3047fc89 Updated documentation files to reflect MariaDB and not the Maria storage engine or MySQL
Added (rewritten) patch from Percona to get extended statistics in slow.log:
- Added handling of 'set' variables to set_var.cc. Changed sql_mode to use this
- Added extra logging to slow log of 'Thread_id, Schema, Query Cache hit, Rows sent and Rows examined'
- Added optional logging to slow log, through log_slow_verbosity, of query plan statistics
- Added new user variables log_slow_rate_limit, log_slow_verbosity, log_slow_filter
- Added log-slow-file as synonym for 'slow-log-file', as most slow-log variables starts with 'log-slow'
- Added log-slow-time as synonym for long-query-time
Some trivial MyISAM optimizations:
- In prepare for drop, flush key blocks
- Don't call mi_lock_database if my_disable_locking is used

KNOWN_BUGS.txt:
  Updated file to reflect MariaDB and not the Maria storage engine
README:
  Updated file to reflect MariaDB
mysql-test/r/log_slow.result:
  Test new options for slow query log
mysql-test/r/variables.result:
  Updated result (old version cut of things at 79 characters)
mysql-test/t/log_slow.test:
  Test new options for slow query log
sql/Makefile.am:
  Added log_slow.h
sql/event_data_objects.cc:
  Removed not needed test for enable_slow_log (is done when the flag is tested elsewhere)
sql/events.cc:
  Use the general make_set() function instead of 'symbolic_mode_representation'
sql/filesort.cc:
  Added status for used query plans
sql/log.cc:
  Reset counters if no query_length (from Percona's patch; Not sure if needed, but can do no harm)
  Added extra logging to slow log of 'Thread_id, Schema, Query Cache hit, Rows sent and Rows examined'
  Added optional logging to slow log, through log_slow_verbosity, of query plan statistics
  Fixed wrong test of error condition
sql/log_slow.h:
  Defines and variables for log_slow_verbosity and log_slow_filter
sql/mysql_priv.h:
  Include log_slow.h
sql/mysqld.cc:
  Added new user variables log_slow_rate_limit, log_slow_verbosity, log_slow_filter
  Added log-slow-file as synonym for 'slow-log-file', as most slow-log variables starts with 'log-slow'
  Added log-slow-time as synonym for long-query-time
  Added note that one should use log-slow-filter instead of log-slow-admin-statements
  Updated comment from 'slow_query_log_file'
sql/set_var.cc:
  Added long_slow_time as synonym for long_query_time
  Added new user variables log_slow_rate_limit, log_slow_verbosity, log_slow_filter
  dded handling of 'set' variables to set_var.cc. Changed sql_mode to use this
sql/set_var.h:
  - Added handling of 'set' variables. Changed sql_mode to use this
sql/slave.cc:
  Use global filter also for slaves
sql/sp_head.cc:
  Simplify saving of general_slow_log state
  Use the general make_set() function instead of 'symbolic_mode_representation'
sql/sql_cache.cc:
  Added status for used query plans
sql/sql_class.cc:
  Remember/restore query_plan_flags over complex statements
sql/sql_class.h:
  Added variables to handle extended slow log statistics
sql/sql_parse.cc:
  Added status for used query plans
  Added test for filtering slow_query_log
sql/sql_select.cc:
  Added status for used query plans
sql/sql_show.cc:
  Use the general make_set() function instead of 'symbolic_mode_representation'
sql/strfunc.cc:
  Report first error (not last) if something is wrong in a set
  Removed compiler warning
storage/myisam/mi_extra.c:
  In prepare for drop, flush key blocks (speed optimization)
storage/myisam/mi_locking.c:
  Don't call mi_lock_database if my_disable_locking is used (speed optimization)
2009-09-03 17:05:38 +03:00