Commit graph

178497 commits

Author SHA1 Message Date
Michael Widenius
8e722064f7 Remove dumping of some not needed core's when running test suite
Before this patch running full mtr generated some 70 cores (at least
on systemd). Now no cores should be generated.

- Changed DBUG_ABORT()'s used by mysql-test-run to DBUG_SUICIDE()
- Changed DBUG_ABORT() used to crash server with core to DBUG_ASSERT(0)
- DBUG_ASSERT now flushes DBUG files
2017-08-24 01:05:52 +02:00
Michael Widenius
94bbe8ad58 Affected rows for a SP now includes affected rows for all statements
The old behavior of returning the affected rows for the last statement
in a stored procedure was more an accident than design. Having the number
of affected rows for all sub statements is more useful and will not change
just because on changes the order of statements in the stored procedure.
2017-08-24 01:05:52 +02:00
Monty
4be15fe065 Added missing ; after WSREP_TO_ISOLATION_BEGIN
- Changed also a few ;; to ;
2017-08-24 01:05:51 +02: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
Monty
536215e32f Added DBUG_ASSERT_AS_PRINTF compile flag
If compiling a non DBUG binary with
-DDBUG_ASSERT_AS_PRINTF asserts will be
changed to printf + stack trace (of stack
trace are enabled).

- Changed #ifndef DBUG_OFF to
  #ifdef DBUG_ASSERT_EXISTS
  for those DBUG_OFF that was just used to enable
  assert
- Assert checking that could greatly impact
  performance where changed to DBUG_ASSERT_SLOW which
  is not affected by DBUG_ASSERT_AS_PRINTF
- Added one extra option to my_print_stacktrace() to
  get more silent in case of stack trace printing as
  part of assert.
2017-08-24 01:05:50 +02:00
Monty
52a1e4d613 Fixed sequence.gtid 2017-08-24 01:05:50 +02:00
Michael Widenius
9e1cc831f2 Fixed some compiler warnings 2017-08-24 01:05:50 +02:00
Michael Widenius
f71bed08ca Safety fix: lock binlog_end_pos before calling signal_update
The mutex is needed to ensure that sql thread should not not miss the error
signal.
2017-08-24 01:05:50 +02:00
Michael Widenius
458d5ed8aa Lots of small cleanups
- 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
2017-08-24 01:05:49 +02:00
Michael Widenius
a70f7aad55 Print thread_id instead of pthread_self to error log
- Now we have same thread_id in general log, slow long and error log
  instead of a long meaningless thread number that may even change for
  one user.
- Align error and slow log header with output
- Extend thread_id with one number to handle nice printing up to ten
  million connections
2017-08-24 01:05:49 +02:00
Michael Widenius
af06683b73 Optimize make_lex_string() to not call alloc_root twice. 2017-08-24 01:05:49 +02:00
Michael Widenius
8bfda2f0af Simplify test if we can use table in query cache
- Added TABLE_SHARE->not_usable_by_query_cache
- Moved TABLE->no_replicate to TABLE_SHARE->no_replicate as it's same for
  all TABLE instances
- Renamed TABLE_SHARE->cached_row_logging_check to can_do_row_logging
2017-08-24 01:05:49 +02:00
Michael Widenius
1ed605e490 Added sql_alloc.h
- Moved declaration of Sql_alloc from Sql_list.h as they are independent
  structures.
2017-08-24 01:05:48 +02:00
Sergei Golubchik
828602356c Don't include my_global.h in "pure" plugins
this partially reverts 6e56ebbb498
2017-08-24 01:05:48 +02:00
Sergei Golubchik
a6e215f221 Fix compilation warnings in plugins
* update cracklib_password_check to match the new prototype
* cannot use __attribute__((format)) for my_snprintf, because
  we support format extensions that the compiler doesn't know about.
2017-08-24 01:05:48 +02:00
Sergei Golubchik
d5a6bae7c0 Fix compilation errors 2017-08-24 01:05:48 +02:00
Michael Widenius
4aaa38d26e Enusure that my_global.h is included first
- Added sql/mariadb.h file that should be included first by files in sql
  directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables
  that must be done before my_global.h is included)
- Removed a lot of include my_global.h from include files
- Removed include's of some files that my_global.h automatically includes
- Removed duplicated include's of my_sys.h
- Replaced include my_config.h with my_global.h
2017-08-24 01:05:44 +02:00
Michael Widenius
b0da8897b0 Added copyright message to some files 2017-08-24 01:05:17 +02:00
Monty
b77bb43f60 Use microsecond_interval_timer() instead of my_time() in replicaiton
- Use microsecond_interval_timer() to calculate time for applying row events.
  (Faster execution)
- Removed return value for set_row_stmt_start_timestamp()
  as it was never used.
2017-08-24 01:04:35 +02:00
Monty
44676ed5b1 Cleaned up output from thr_print_locks 2017-08-24 01:04:34 +02:00
Sergei Golubchik
4040a17ea2 Compile mariabackup with its own copy of net_serv.cc
Don't use the server's version, that expects a valid THD.
Modify net_serv.cc not not use any THD if MYSQL_SERVER isn't defined.

This reverts commit aaddac5cd7.
2017-08-23 19:05:13 +02:00
Sergei Golubchik
7a5eb00322 fix 64-bit tests too 2017-08-23 15:22:31 +02:00
Sergei Golubchik
4246fe802e 32-bit fixes 2017-08-23 12:28:02 +02:00
Vladislav Vaintroub
aaddac5cd7 fix compile errors 2017-08-23 08:27:46 +00:00
Vladislav Vaintroub
58cd69fc80 MDEV-11159 Server proxy protocol support
accept proxy protocol header from client connections.
The new server variable 'proxy_protocol_networks' contains list
of networks from which proxy header is accepted.
2017-08-22 21:08:38 +02:00
Alexander Barkov
d258a2bd1f Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-08-22 20:27:10 +04:00
Alexander Barkov
b0dbc707b8 MDEV-13617 tokudb_parts tests failed in buildbot 2017-08-22 20:25:59 +04:00
Sergei Golubchik
1b7a2e4ca2 MDEV-13510 main.delete_use_source fails in buildbot and outside with wrong plan 2017-08-20 20:21:23 +02:00
Igor Babaev
a1e444e1cc Corrected the function compare_order_elements() to make it
platform independent.
2017-08-19 20:59:24 -07:00
Igor Babaev
d7b45e01b4 This patch complements the patch for mdev-10855.
It allows to push conditions into derived with window functions not
only in the cases when the window specifications of these window
functions use the same partition, but also in the cases when the window
functions use partitions that share only some fields. In these
cases only the conditions over the common fields are pushed.
2017-08-19 15:02:29 -07:00
Alexander Barkov
935c6f502f Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-08-18 18:30:52 +04:00
Alexander Barkov
4305c3ca57 MDEV-13581 ROW TYPE OF t1 and t1%ROWTYPE for routine parameters 2017-08-18 18:29:33 +04:00
Alexander Barkov
83ea51a28d Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-08-17 09:45:05 +04:00
Alexander Barkov
a70809c0fc MDEV-13555 Assertion `!item->null_value' failed in Type_handler::Item_send_str 2017-08-17 07:07:11 +04:00
Marko Mäkelä
ff3cf74974 Silence a -Wimplicit-fallthrough warning 2017-08-16 14:46:24 +03:00
Marko Mäkelä
92f9be495b Work around MDEV-13542 Crashing on a corrupted page is unhelpful
With MDEV-12288 and MDEV-13536, the InnoDB purge threads will access
pages more often, causing all sorts of debug assertion failures in
the B-tree code.

Work around this problem by amending the corruption tests with
--innodb-purge-rseg-truncate-frequency=1 --skip-innodb-fast-shutdown
so that everything will be purged before the server
is restarted to deal with the corruption.
2017-08-16 13:09:56 +03:00
Marko Mäkelä
f4b379d6ca MDEV-13536 DB_TRX_ID is not actually being reset when the history is removed
This should have been part of MDEV-12288.

trx_undo_t::del_marks: Remove.
Purge needs to process all undo log records in order to
reset the DB_TRX_ID. Before MDEV-12288, it sufficed to only delete
the purgeable delete-marked records, and it ignore other undo log.

trx_rseg_t::needs_purge: Renamed from trx_rseg_t::last_del_marks.
Indicates whether a rollback segment needs to be processed by purge.

TRX_UNDO_NEEDS_PURGE: Renamed from TRX_UNDO_DEL_MARKS.
Indicates whether a rollback segment needs to be processed by purge.
This will be 1 until trx_purge_free_segment() has been invoked.

row_purge_record_func(): Set the is_insert flag for TRX_UNDO_INSERT_REC,
so that the DB_ROLL_PTR will match in row_purge_reset_trx_id().

trx_purge_fetch_next_rec(): Add a comment about row_purge_record_func()
going to set the is_insert flag.

trx_purge_read_undo_rec(): Always attempt to read the undo log record.

trx_purge_get_next_rec(): Do not skip any undo log records.
Even when no clustered index record is going to be removed,
we may want to reset some DB_TRX_ID,DB_ROLL_PTR.

trx_undo_rec_get_cmpl_info(), trx_undo_rec_get_extern_storage(): Remove.

trx_purge_add_undo_to_history(): Set the TRX_UNDO_NEEDS_PURGE flag
so that the resetting will work on undo logs that were originally
created before MDEV-12288 (MariaDB 10.3.1).

trx_undo_roll_ptr_is_insert(), trx_purge_free_segment(): Cleanup
(should be no functional change).
2017-08-16 13:08:44 +03:00
Igor Babaev
58c5145d60 Adjusted the result file for sys_vars.sysvars_server_embedded. 2017-08-15 08:30:18 -07:00
Alexander Barkov
442ac9229b Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-08-15 17:54:46 +04:00
Alexander Barkov
3fd30508b2 Recording more tests for MDEV-13500 sql_mode=ORACLE: can't create a virtual column with function MOD
Some affected tests require --big-test.
They were forgotten in the main patch.
2017-08-15 17:53:08 +04:00
Alexander Barkov
6ac3d7511c Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-08-15 17:13:59 +04:00
Alexander Barkov
b5098f3dae MDEV-13533 Remove the THD parameter from sp_head::init_sp_name() 2017-08-15 16:41:58 +04:00
Alexander Barkov
3f7f0c6a29 MDEV-13531 Add Database_qualified_name::copy() 2017-08-15 14:58:42 +04:00
Alexander Barkov
4d50594dfc MDEV-13529 Add class Sql_cmd_call 2017-08-15 14:13:42 +04:00
Alexander Barkov
966cc80299 MDEV-13528 Add LEX::sp_body_finalize_{procedure|function} 2017-08-15 11:15:18 +04:00
Alexander Barkov
1743883d55 Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-08-15 09:59:17 +04:00
Alexander Barkov
22c9663d85 MDEV-13527 Crash when EXPLAIN SELECT .. INTO row_sp_variable.field 2017-08-15 09:55:09 +04:00
Alexander Barkov
6179a8efdc MDEV-13526 Add Type_handler::Item_val_bool() 2017-08-15 09:37:16 +04:00
Alexander Barkov
6db1b0188c Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-08-15 07:52:48 +04:00
Alexander Barkov
9822fb1f19 Fixing test results for MDEV-13500 sql_mode=ORACLE: can't create a virtual column with function MOD 2017-08-15 07:49:18 +04:00