Commit graph

180027 commits

Author SHA1 Message Date
Marko Mäkelä
9ec2479778 Merge bb-10.2-ext into 10.3 2017-12-21 08:36:02 +02:00
Marko Mäkelä
40f4525f43 MDEV-14585: Adjust the innodb.innodb-alter-tempfile test case 2017-12-21 08:20:31 +02:00
Marko Mäkelä
1ec8d45c4d Merge bb-10.2-ext into 10.3 2017-12-20 23:18:41 +02:00
Marko Mäkelä
69e88de0fe MDEV-14585: Adjust the innodb.alter_crash test case 2017-12-20 23:15:44 +02:00
Marko Mäkelä
b4165985c9 MDEV-14585 Automatically remove #sql- tables in InnoDB dictionary during recovery
Now that MDEV-14717 made RENAME TABLE crash-safe within InnoDB,
it should be safe to drop the #sql- tables within InnoDB during
crash recovery. These tables can be one of two things:

(1) #sql-ib related to deferred DROP TABLE (follow-up to MDEV-13407)
or to table-rebuilding ALTER TABLE...ALGORITHM=INPLACE
(since MDEV-14378, only related to the intermediate copy of a table),

(2) #sql- related to the intermediate copy of a table during
ALTER TABLE...ALGORITHM=COPY

We will not drop tables whose name starts with #sql2, because
the server can be killed during an ALGORITHM=COPY operation at
a point where the original table was renamed to #sql2 but the
finished intermediate copy was not yet renamed from #sql-
to the original table name.
2017-12-20 22:47:01 +02:00
Marko Mäkelä
2534b5cb99 Merge bb-10.2-ext into 10.3 2017-12-20 22:37:24 +02:00
Marko Mäkelä
0bc36758ba MDEV-14717 RENAME TABLE in InnoDB is not crash-safe
InnoDB in MariaDB 10.2 appears to only write MLOG_FILE_RENAME2
redo log records during table-rebuilding ALGORITHM=INPLACE operations.
We must write the records for any .ibd file renames, so that the
operations are crash-safe.

If InnoDB is killed during a RENAME TABLE operation, it can happen that
the transaction for updating the data dictionary will be rolled back.
But, nothing will roll back the renaming of the .ibd file
(the MLOG_FILE_RENAME2 only guarantees roll-forward), or for that matter,
the renaming of the dict_table_t::name in the dict_sys cache. We introduce
the undo log record TRX_UNDO_RENAME_TABLE to fix this.

fil_space_for_table_exists_in_mem(): Remove the parameters
adjust_space, table_id and some code that was trying to work around
these deficiencies.

fil_name_write_rename(): Write a MLOG_FILE_RENAME2 record.

dict_table_rename_in_cache(): Invoke fil_name_write_rename().

trx_undo_rec_copy(): Set the first 2 bytes to the length of the
copied undo log record.

trx_undo_page_report_rename(), trx_undo_report_rename():
Write a TRX_UNDO_RENAME_TABLE record with the old table name.

row_rename_table_for_mysql(): Invoke trx_undo_report_rename()
before modifying any data dictionary tables.

row_undo_ins_parse_undo_rec(): Roll back TRX_UNDO_RENAME_TABLE
by invoking dict_table_rename_in_cache(), which will take care
of both renaming the table and the file.
2017-12-20 22:21:03 +02:00
Monty
b4e5d5e2db Updated result for alter_crash 2017-12-20 01:30:12 +02:00
Marko Mäkelä
0436a0ff3c Merge bb-10.2-ext into 10.3 2017-12-19 17:28:22 +02:00
Marko Mäkelä
88aff5f471 Follow-up to MDEV-13407 innodb.drop_table_background failed in buildbot with "Tablespace for table exists"
The InnoDB background DROP TABLE queue is something that we should
really remove, but are unable to until we remove dict_operation_lock
so that DDL and DML operations can be combined in a single transaction.

Because the queue is not persistent, it is not crash-safe. We should
in some way ensure that the deferred-dropped tables will be dropped
after server restart.

The existence of two separate transactions complicates the error handling
of CREATE TABLE...SELECT. We should really not break locks in DROP TABLE.

Our solution to these problems is to rename the table to a temporary
name, and to drop such-named tables on InnoDB startup. Also, the
queue will use table IDs instead of names from now on.

check-testcase.test: Ignore #sql-ib*.ibd files, because tables may enter
the background DROP TABLE queue shortly before the test finishes.

innodb.drop_table_background: Test CREATE...SELECT and the creation of
tables whose file name starts with #sql-ib.

innodb.alter_crash: Adjust the recovery, now that the #sql-ib tables
will be dropped on InnoDB startup.

row_mysql_drop_garbage_tables(): New function, to drop all #sql-ib tables
on InnoDB startup.

row_drop_table_for_mysql_in_background(): Remove an unnecessary and
misplaced call to log_buffer_flush_to_disk(). (The call should have been
after the transaction commit. We do not care about flushing the redo log
here, because the table would be dropped again at server startup.)

Remove the entry from the list after the table no longer exists.

If server shutdown has been initiated, empty the list without actually
dropping any tables. They will be dropped again on startup.

row_drop_table_for_mysql(): Do not call lock_remove_all_on_table().
Instead, if locks exist, defer the DROP TABLE until they do not exist.
If the table name does not start with #sql-ib, rename it to that prefix
before adding it to the background DROP TABLE queue.
2017-12-19 17:12:39 +02:00
Marko Mäkelä
028e91f380 Merge 10.2 into bb-10.2-ext 2017-12-19 17:12:14 +02:00
Marko Mäkelä
8d70097c21 Merge 10.1 to 10.2
Follow-up fix to MDEV-14008: Let Field_double::val_uint() silently
return 0 on error
2017-12-19 16:48:28 +02:00
Jan Lindström
252e690c85 Fix galera.view test case crash.
WSREP_TO_ISOLATION_BEGIN() call must be after view name is back
on tables list.
2017-12-19 16:13:35 +02:00
Marko Mäkelä
0fd3def284 Remove MLOG_UNDO_ERASE_END 2017-12-19 15:36:36 +02:00
Marko Mäkelä
9ee8917dfd Replace MLOG_UNDO_INSERT with MLOG_WRITE_STRING, MLOG_2BYTES 2017-12-19 15:34:02 +02:00
Marko Mäkelä
ccb3550221 Replace MLOG_UNDO_INIT with MLOG_2BYTES, MLOG_4BYTES 2017-12-19 14:42:34 +02:00
Galina Shalygina
079c359971 MDEV-14629: failing assertion when a user-defined variable is defined by the recursive CTE
During the user-defined variable defined by the recursive CTE handling procedure
check_dependencies_in_with_clauses that checks dependencies between the tables
that are defined in the CTE and find recursive definitions wasn't called.
2017-12-19 11:49:40 +02:00
Daniel Black
3464b67025 mysys: handle T, P, E suffixs
Signed-off-by: Daniel Black <daniel@linux.vnet.ibm.com>
2017-12-19 13:40:05 +04:00
Eugene Kosov
22f2b39c14 fix data races in rwlock 2017-12-19 13:03:04 +04:00
Daniel Black
ce4cdfa0f8 MDEV-13809: [service] should [Service] in systemd service files 2017-12-19 12:53:24 +04:00
Daniel Black
64f1fab068 MDEV-12128: systemd - add Documentation= directives 2017-12-19 12:48:34 +04:00
Andrei Elkin
ca9ed393ef MDEV-13073. rpl.perf_buildin_semisync_issue40 is corrected to expect the Rpl_semi_sync_master_clients value of 1 (ll.307..). Explicit sleeps are converted to wait_xyz. 2017-12-18 22:59:05 +02:00
Marko Mäkelä
09c5bbf471 Merge 10.0 into 10.1 2017-12-18 20:05:50 +02:00
Marko Mäkelä
40088bfc7e MDEV-13407 innodb.drop_table_background failed in buildbot with "Tablespace for table exists"
The InnoDB background DROP TABLE queue is something that we should
really remove, but are unable to until we remove dict_operation_lock
so that DDL and DML operations can be combined in a single transaction.

Because the queue is not persistent, it is not crash-safe. In stable
versions of MariaDB, we can only try harder to drop all enqueued
tables before server shutdown.

row_mysql_drop_t::table_id: Replaces table_name.

row_drop_tables_for_mysql_in_background():
Do not remove the entry from the list as long as the table exists.
In this way, the table should eventually be dropped.
2017-12-18 19:51:44 +02:00
Nirbhay Choubey
682c3bfd25 MDEV-10442: "Address already in use" on restart
SST processes should inherit mysqld's process group.
2017-12-18 16:57:54 +01:00
sjaakola
91daf8819c MW-416
Moved TOI replication to happen after ACL checking for commands:
SQLCOM_CREATE_EVENT
SQLCOM_ALTER_EVENT
SQLCOM_DROP_EVENT
SQLCOM_CREATE_VIEW
SQLCOM_CREATE_TRIGGER
SQLCOM_DROP_TRIGGER
SQLCOM_INSTALL_PLUGIN
SQLCOM_UNINSTALL_PLUGIN
2017-12-18 16:41:40 +01:00
Sergei Golubchik
beabe6b216 MDEV-13969 sst mysqldump and xtrabackup-v2 handle WSREP_SST_OPT_CONF incorrectly
$WSREP_SST_OPT_CONF already includes --defaults-extra-file= prefix.
2017-12-18 16:41:40 +01:00
Martynas Bendorius
1c2f59f7fb MDEV-13969 sst mysqldump and xtrabackup-v2 handle WSREP_SST_OPT_CONF incorrectly
wrep_sst_common: Setting "-c ''" for my_print_defaults just takes no values from config at all. $MY_PRINT_DEFAULTS is already set at the top of the script to have --defaults-file and --defaults-extra-file. If WSREP_SST_OPT_CONF if set to "--defaults-file=/etc/my.cnf --defaults-extra-file=/etc/my.extra.cnf", then "my_print_defaults -c "" --defaults-file=/etc/my.cnf" succeeds, but if WSREP_SST_OPT_CONF is empty - no default values are taken at all.
wsrep_sst_xtrabackup-v2: innobackupex does not support --defaults-extra-file, so ${WSREP_SST_OPT_CONF} cannot be used as an argument, it has been changed to ${WSREP_SST_OPT_DEFAULT}. Removed --defaults-file= from INNOMOVE line, because WSREP_SST_OPT_CONF already includes it (INNOBACKUP was fine, INNOMOVE - not).
2017-12-18 16:41:40 +01:00
Vladislav Vaintroub
f32063c513 MDEV-13620 - improve help message for 'plugin-dir' and 'plugin-load'
options.
2017-12-18 15:37:06 +00:00
Sergei Golubchik
03e91ce324 MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
make sure that mysql_create_frm_image() and fast_alter_partition_table()
use the same code to derive HA_OPTION_PACK_RECORD from
create_info->row_type.
2017-12-18 16:16:42 +01:00
Galina Shalygina
3791d0cfcf Test result changed 2017-12-18 15:51:27 +02:00
Galina Shalygina
86308aa995 MDEV-14579: New tests for condition pushdown into materialized views/defined tables
defined with INTERSECT/EXCEPT	added
2017-12-18 15:51:27 +02:00
Andrei Elkin
529120e1cb MDEV-13073. This patch is a followup of the previous one to convert the trailing underscore identifier to mariadb standard. For identifier representing class private members the underscore is replaced with a m_ prefix. Otherwise _ is just removed. 2017-12-18 13:43:38 +02:00
Andrei Elkin
f279d3c43a MDEV-13073. This part converts the Ali patch`s identifiers to the MariaDB standard. Also some renaming is done as well as white spaces removal. 2017-12-18 13:43:38 +02:00
Andrei Elkin
6a84e3407d MDEV-13073. This patch replaces semisync's native function_enter,exit
and its custom trace faciltiy with standard DBUG_ based equivalents.
2017-12-18 13:43:38 +02:00
Andrei Elkin
c0ea3056b6 MDEV-13073. This is a part with a new test (refined Ali's
one) and affected result files.

Specifically to rpl_semi_sync_after_sync*, the changed results reflect
a fact that thanks to fixes in the dump thread functionality
there's no longer zombie thread to kill neither such thread represent
a semisync client (so the counter drops).
2017-12-18 13:43:37 +02:00
Andrei Elkin
74b35b6874 MDEV-13073. This part patch weeds out RUN_HOOK from the server as semisync
is defined statically. Consequently the observer interfaces are removed
as well.
2017-12-18 13:43:37 +02:00
Andrei Elkin
e972125f11 MDEV-13073 This part merges the Ali semisync related changes
and specifically the ack receiving functionality.
Semisync is turned to be static instead of plugin so its functions
are invoked at the same points as RUN_HOOKS.
The RUN_HOOKS and the observer interface remain to be removed by later
patch.

Todo:
  React on killed status by repl_semisync_master.wait_after_sync(). Currently
  Repl_semi_sync_master::commit_trx does not check the killed status.

  There were few bugfixes found that are present in mysql and its unclear
  whether/how they are covered. Those include:

  Bug#15985893: GTID SKIPPED EVENTS ON MASTER CAUSE SEMI SYNC TIME-OUTS
  Bug#17932935 CALLING IS_SEMI_SYNC_SLAVE() IN EACH FUNCTION CALL
                 HAS BAD PERFORMANCE
  Bug#20574628: SEMI-SYNC REPLICATION PERFORMANCE DEGRADES WITH A HIGH NUMBER OF THREADS
2017-12-18 13:43:37 +02:00
Monty
abceaa7542 Optimize RUN_HOOK() call
RUN_HOOK() is only called if semisync is enabled

As the server can't disable the hooks if something is in progress, I added
a new variable, run_hooks_enabled, that is set the first time semi sync is
used. This means that RUN_HOOK will have no overhead, unless semi sync
master or slave has been enabled once.

Some of the changes was just to get rid of warnings for embedded server
2017-12-18 13:43:37 +02:00
Monty
13770edbcb Changed from using LOCK_log to LOCK_binlog_end_pos for binary log
Part of MDEV-13073 AliSQL Optimize performance of semisync

The idea it to use a dedicated lock detecting if there is new data in
the master's binary log instead of the overused LOCK_log.

Changes:
- Use dedicated COND variables for the relay and binary log signaling.
  This was needed as we where the old 'update_cond' variable was used
  with different mutex's, which could cause deadlocks.
   - Relay log uses now COND_relay_log_updated and LOCK_log
   - Binary log uses now COND_bin_log_updated and LOCK_binlog_end_pos
- Renamed signal_cnt to relay_signal_cnt (as we now have two signals)
- Added some missing error handling in MYSQL_BIN_LOG::new_file_impl()
- Reformatted some comments with old style
- Renamed m_key_LOCK_binlog_end_pos to key_LOCK_binlog_end_pos
- Changed 'signal_update()' to update_binlog_end_pos() which works for
  both relay and binary log
2017-12-18 13:43:37 +02:00
Monty
ea37c129f9 Removed not used lock argument from read_log_event 2017-12-18 13:43:36 +02:00
Monty
2e53b96a0a Moved semisync from a plugin to normal server
Part of MDEV-13073 AliSQL Optimize performance of semisync

Did the following renames to match other similar variables
key_ss_mutex_LOCK_binlog_       > key_LOCK_bing
key_ss_cond_COND_binlog_send_  -> key_COND_binlog_send
COND_binlog_send_              -> COND_binlog_send
LOCK_binlog_                   -> LOCK_binlog

debian/mariadb-server-10.2.install does not install semisync libs.
2017-12-18 13:43:36 +02:00
Alexey Botchkov
6ee9cba745 MDEV-10486 MariaDB 10.x does not update rows_examined in performance_schema tables.
Save the rows_examined counter before it gets emptied.
2017-12-18 15:21:50 +04:00
Alexey Botchkov
8ed78cf7f9 xa.test fixed to be thread-stable. 2017-12-18 12:24:02 +04:00
Alexander Barkov
c1e5fef05d MDEV-14008 Assertion failing: `!is_set() || (m_status == DA_OK_BULK && is_bulk_op()) 2017-12-18 11:25:38 +04:00
Takuro Ashie
77030649fb Fix typos in some comments 2017-12-18 11:16:47 +04:00
Vesa Pentti
7fd7805574 MDEV-14315 -- Reflect use of tcmalloc in a system variable and error log
* The version of tcmalloc is written to the system variable
    'version_malloc_library' if tcmalloc is used, similarly to
    jemalloc
  * Extracted method guess_malloc_library()
2017-12-18 06:48:36 +00:00
Alexey Botchkov
0acac4fe5f MDEV-14593 human-readable XA RECOVER.
The 'data' field in the XA RECOVER resultset changed
        to be charset_bin. It seems to me right and also
        --binary-as-hex starts working.  The XA RECOVER FORMAT='SQL' option
        implemented.  It returns the XID string that fits to be an argument for the
        XA ... statements.
2017-12-18 01:55:40 +04:00
Monty
06f0b23a78 Fixed memory leak in my_rocks
rocksdb_sys_vars.rocksdb_update_cf_options_basic.test failed with
reports about not freed memory.
2017-12-17 17:53:53 +02:00
Vesa Pentti
d91d1c8dbc Test cleanup related to MDEV-12501
* Removing unnecessary --plugin-maturity=unknown definitions from tests
2017-12-16 15:34:48 +00:00