summaryrefslogtreecommitdiff
path: root/sql/rpl_gtid.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
|\
| * Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| |\
| | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | |
* | | Merge 10.2 into 10.3Marko Mäkelä2018-11-061-3/+3
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | main.derived_cond_pushdown: Move all 10.3 tests to the end, trim trailing white space, and add an "End of 10.3 tests" marker. Add --sorted_result to tests where the ordering is not deterministic. main.win_percentile: Add --sorted_result to tests where the ordering is no longer deterministic.
| * | Merge 10.1 into 10.2Marko Mäkelä2018-11-061-23/+53
| |\ \ | | |/
| | * MDEV-14431 binlog.binlog_flush_binlogs_delete_domain failed in buildbotAndrei Elkin2018-10-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test and also rpl_gtid_delete_domain failed on PPC64 platform due to an incorrectly specified actual key for searching in a gtid domain system hash. While the correct size is 32 bits the supplied value was 8 bytes of long int size on the platform. The problem became evident thanks to the big endiness which cut off the *least* significant part of the value field. Fixed with correcting a dynamic array initialization to hold now uint32 values as well as the values extraction for searching in the gtid domain system hash. A new added test ensures no overflowed values are accepted for deletion which prevents inadvertent action. Notice though MariaDB [test]> set @@session.gtid_domain_id=(1 << 32) + 1; MariaDB [test]> show warnings; +---------+------+--------------------------------------------------------+ | Level | Code | Message | +---------+------+--------------------------------------------------------+ | Warning | 1292 | Truncated incorrect gtid_domain_id value: '4294967297' | +---------+------+--------------------------------------------------------+ MariaDB [test]> select @@session.gtid_domain_id; +--------------------------+ | @@session.gtid_domain_id | +--------------------------+ | 4294967295 | +--------------------------+
* | | Merge branch 'gtid_table_garbage_rows' into 10.3Kristian Nielsen2018-10-131-0/+6
|\ \ \ | | |/ | |/|
| * | Fix build of embedded serverKristian Nielsen2018-10-131-0/+6
| | |
* | | Merge branch 'gtid_table_garbage_rows' into gtid_table_garbage_rows_10.3Kristian Nielsen2018-10-071-17/+41
|\ \ \ | |/ /
| * | Fix accumulation of old rows in mysql.gtid_slave_posKristian Nielsen2018-10-071-20/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This would happen especially in optimistic parallel replication, where there is a good chance that a transaction will be rolled back (due to conflicts) after it has executed record_gtid(). If the transaction did any deletions of old rows as part of record_gtid(), those deletions will be undone as well. And the code did not properly ensure that the deletions would be re-tried. This patch makes record_gtid() remember the list of deletions done as part of a transaction. Then in rpl_slave_state::update() when the changes have been committed, we discard the list. However, in case of error and rollback, in cleanup_context() we will instead put the list back into rpl_global_gtid_slave_state so that the deletions will be re-tried later. Probably fixes part of the cause of MDEV-12147 as well. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
* | | MDEV-13564 Mariabackup does not work with TRUNCATEMarko Mäkelä2018-09-071-0/+2
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a merge from 10.2, but the 10.2 version of this will not be pushed into 10.2 yet, because the 10.2 version would include backports of MDEV-14717 and MDEV-14585, which would introduce a crash recovery regression: Tables could be lost on table-rebuilding DDL operations, such as ALTER TABLE, OPTIMIZE TABLE or this new backup-friendly TRUNCATE TABLE. The test innodb.truncate_crash occasionally loses the table due to the following bug: MDEV-17158 log_write_up_to() sometimes fails
| * | MDEV-13564 Mariabackup does not work with TRUNCATEMarko Mäkelä2018-09-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement undo tablespace truncation via normal redo logging. Implement TRUNCATE TABLE as a combination of RENAME to #sql-ib name, CREATE, and DROP. Note: Orphan #sql-ib*.ibd may be left behind if MariaDB Server 10.2 is killed before the DROP operation is committed. If MariaDB Server 10.2 is killed during TRUNCATE, it is also possible that the old table was renamed to #sql-ib*.ibd but the data dictionary will refer to the table using the original name. In MariaDB Server 10.3, RENAME inside InnoDB is transactional, and #sql-* tables will be dropped on startup. So, this new TRUNCATE will be fully crash-safe in 10.3. ha_mroonga::wrapper_truncate(): Pass table options to the underlying storage engine, now that ha_innobase::truncate() will need them. rpl_slave_state::truncate_state_table(): Before truncating mysql.gtid_slave_pos, evict any cached table handles from the table definition cache, so that there will be no stale references to the old table after truncating. == TRUNCATE TABLE == WL#6501 in MySQL 5.7 introduced separate log files for implementing atomic and crash-safe TRUNCATE TABLE, instead of using the InnoDB undo and redo log. Some convoluted logic was added to the InnoDB crash recovery, and some extra synchronization (including a redo log checkpoint) was introduced to make this work. This synchronization has caused performance problems and race conditions, and the extra log files cannot be copied or applied by external backup programs. In order to support crash-upgrade from MariaDB 10.2, we will keep the logic for parsing and applying the extra log files, but we will no longer generate those files in TRUNCATE TABLE. A prerequisite for crash-safe TRUNCATE is a crash-safe RENAME TABLE (with full redo and undo logging and proper rollback). This will be implemented in MDEV-14717. ha_innobase::truncate(): Invoke RENAME, create(), delete_table(). Because RENAME cannot be fully rolled back before MariaDB 10.3 due to missing undo logging, add some explicit rename-back in case the operation fails. ha_innobase::delete(): Introduce a variant that takes sqlcom as a parameter. In TRUNCATE TABLE, we do not want to touch any FOREIGN KEY constraints. ha_innobase::create(): Add the parameters file_per_table, trx. In TRUNCATE, the new table must be created in the same transaction that renames the old table. create_table_info_t::create_table_info_t(): Add the parameters file_per_table, trx. row_drop_table_for_mysql(): Replace a bool parameter with sqlcom. row_drop_table_after_create_fail(): New function, wrapping row_drop_table_for_mysql(). dict_truncate_index_tree_in_mem(), fil_truncate_tablespace(), fil_prepare_for_truncate(), fil_reinit_space_header_for_table(), row_truncate_table_for_mysql(), TruncateLogger, row_truncate_prepare(), row_truncate_rollback(), row_truncate_complete(), row_truncate_fts(), row_truncate_update_system_tables(), row_truncate_foreign_key_checks(), row_truncate_sanity_checks(): Remove. row_upd_check_references_constraints(): Remove a check for TRUNCATE, now that the table is no longer truncated in place. The new test innodb.truncate_foreign uses DEBUG_SYNC to cover some race-condition like scenarios. The test innodb-innodb.truncate does not use any synchronization. We add a redo log subformat to indicate backup-friendly format. MariaDB 10.4 will remove support for the old TRUNCATE logging, so crash-upgrade from old 10.2 or 10.3 to 10.4 will involve limitations. == Undo tablespace truncation == MySQL 5.7 implements undo tablespace truncation. It is only possible when innodb_undo_tablespaces is set to at least 2. The logging is implemented similar to the WL#6501 TRUNCATE, that is, using separate log files and a redo log checkpoint. We can simply implement undo tablespace truncation within a single mini-transaction that reinitializes the undo log tablespace file. Unfortunately, due to the redo log format of some operations, currently, the total redo log written by undo tablespace truncation will be more than the combined size of the truncated undo tablespace. It should be acceptable to have a little more than 1 megabyte of log in a single mini-transaction. This will be fixed in MDEV-17138 in MariaDB Server 10.4. recv_sys_t: Add truncated_undo_spaces[] to remember for which undo tablespaces a MLOG_FILE_CREATE2 record was seen. namespace undo: Remove some unnecessary declarations. fil_space_t::is_being_truncated: Document that this flag now only applies to undo tablespaces. Remove some references. fil_space_t::is_stopping(): Do not refer to is_being_truncated. This check is for tablespaces of tables. Potentially used tablespaces are never truncated any more. buf_dblwr_process(): Suppress the out-of-bounds warning for undo tablespaces. fil_truncate_log(): Write a MLOG_FILE_CREATE2 with a nonzero page number (new size of the tablespace in pages) to inform crash recovery that the undo tablespace size has been reduced. fil_op_write_log(): Relax assertions, so that MLOG_FILE_CREATE2 can be written for undo tablespaces (without .ibd file suffix) for a nonzero page number. os_file_truncate(): Add the parameter allow_shrink=false so that undo tablespaces can actually be shrunk using this function. fil_name_parse(): For undo tablespace truncation, buffer MLOG_FILE_CREATE2 in truncated_undo_spaces[]. recv_read_in_area(): Avoid reading pages for which no redo log records remain buffered, after recv_addr_trim() removed them. trx_rseg_header_create(): Add a FIXME comment that we could write much less redo log. trx_undo_truncate_tablespace(): Reinitialize the undo tablespace in a single mini-transaction, which will be flushed to the redo log before the file size is trimmed. recv_addr_trim(): Discard any redo logs for pages that were logged after the new end of a file, before the truncation LSN. If the rec_list becomes empty, reduce n_addrs. After removing any affected records, actually truncate the file. recv_apply_hashed_log_recs(): Invoke recv_addr_trim() right before applying any log records. The undo tablespace files must be open at this point. buf_flush_or_remove_pages(), buf_flush_dirty_pages(), buf_LRU_flush_or_remove_pages(): Add a parameter for specifying the number of the first page to flush or remove (default 0). trx_purge_initiate_truncate(): Remove the log checkpoints, the extra logging, and some unnecessary crash points. Merge the code from trx_undo_truncate_tablespace(). First, flush all to-be-discarded pages (beyond the new end of the file), then trim the space->size to make the page allocation deterministic. At the only remaining crash injection point, flush the redo log, so that the recovery can be tested.
* | | MDEV-16286 Killed CREATE SEQUENCE leaves sequence in unusable stateMonty2018-05-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed by deleting the sequence if we where not able to initialize it I also noticed that we didn't always set the error message when check_killed(), which could lead to aborted queries without error beeing properly set. Fixed by default setting error message if check_error() noticed that killed had been called. This allowed me to remove a lot of calls to thd->send_kill_message().
* | | Add likely/unlikely to speed up executionMonty2018-05-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Added to: - if (error) - Lex - sql_yacc.yy and sql_yacc_ora.yy - In header files to alloc() calls - Added thd argument to thd_net_is_killed()
* | | Change C_STRING_WITH_LEN to STRING_WITH_LENMonty2018-01-301-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | This preserves const str for constant strings Other things - A few variables where changed from LEX_STRING to LEX_CSTRING - Incident_log_event::Incident_log_event and record_incident where changed to take LEX_CSTRING* as an argument instead of LEX_STRING
* | | Changed database, tablename and alias to be LEX_CSTRINGMonty2018-01-301-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was done in, among other things: - thd->db and thd->db_length - TABLE_LIST tablename, db, alias and schema_name - Audit plugin database name - lex->db - All db and table names in Alter_table_ctx - st_select_lex db Other things: - Changed a lot of functions to take const LEX_CSTRING* as argument for db, table_name and alias. See init_one_table() as an example. - Changed some function arguments from LEX_CSTRING to const LEX_CSTRING - Changed some lists from LEX_STRING to LEX_CSTRING - threads_mysql.result changed because process list_db wasn't always correctly updated - New append_identifier() function that takes LEX_CSTRING* as arguments - Added new element tmp_buff to Alter_table_ctx to separate temp name handling from temporary space - Ensure we store the length after my_casedn_str() of table/db names - Removed not used version of rename_table_in_stat_tables() - Changed Natural_join_column::table_name and db_name() to never return NULL (used for print) - thd->get_db() now returns db as a printable string (thd->db.str or "")
* | | Fix Windows buildVladislav Vaintroub2018-01-161-1/+1
| | |
* | | Merge bb-10.2-ext into 10.3Marko Mäkelä2018-01-051-6/+0
|\ \ \
| * \ \ Merge remote-tracking branch 'origin/10.2' into bb-10.2-extMonty2018-01-051-6/+0
| |\ \ \ | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mysql-test/r/cte_nonrecursive.result mysql-test/suite/galera/r/galera_bf_abort.result mysql-test/suite/galera/r/galera_bf_abort_get_lock.result mysql-test/suite/galera/r/galera_bf_abort_sleep.result mysql-test/suite/galera/r/galera_enum.result mysql-test/suite/galera/r/galera_fk_conflict.result mysql-test/suite/galera/r/galera_insert_multi.result mysql-test/suite/galera/r/galera_many_indexes.result mysql-test/suite/galera/r/galera_mdl_race.result mysql-test/suite/galera/r/galera_nopk_bit.result mysql-test/suite/galera/r/galera_nopk_blob.result mysql-test/suite/galera/r/galera_nopk_large_varchar.result mysql-test/suite/galera/r/galera_nopk_unicode.result mysql-test/suite/galera/r/galera_pk_bigint_signed.result mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result mysql-test/suite/galera/r/galera_serializable.result mysql-test/suite/galera/r/galera_toi_drop_database.result mysql-test/suite/galera/r/galera_toi_lock_exclusive.result mysql-test/suite/galera/r/galera_toi_truncate.result mysql-test/suite/galera/r/galera_unicode_pk.result mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result mysql-test/suite/galera/r/galera_wsrep_log_conficts.result sql/field.cc sql/rpl_gtid.cc sql/share/errmsg-utf8.txt sql/sql_acl.cc sql/sql_parse.cc sql/sql_partition_admin.cc sql/sql_prepare.cc sql/sql_repl.cc sql/sql_table.cc sql/sql_yacc.yy
| | * | Fixed wrong arguments to printf and related functionsMonty2018-01-041-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Other things, mainly to get create_mysqld_error_find_printf_error tool to work: - Added protection to not include mysqld_error.h twice - Include "unireg.h" instead of "mysqld_error.h" in server - Added protection if ER_XX messages are already defined - Removed wrong calls to my_error(ER_OUTOFMEMORY) as my_malloc() and my_alloc will do this automatically - Added missing %s to ER_DUP_QUERY_NAME - Removed old and wrong calls to my_strerror() when using MY_ERROR_ON_RENAME (wrong merge) - Fixed deadlock error message from Galera. Before the extra information given to ER_LOCK_DEADLOCK was missing because ER_LOCK_DEADLOCK doesn't provide any extra information. I kept #ifdef mysqld_error_find_printf_error_used in sql_acl.h to make it easy to do this kind of check again in the future
* | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2018-01-041-3/+2
|\ \ \ \ | |/ / /
| * | | mysqlbinlog now prints "# Number of rows" and stops on errorsMonty2017-12-291-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Main problem was that no log-event print function checked for disk full error on the IO_CACHE. All changes in this patch only affects mysqlbinlog, not the server! - Changed all log-event print functions to return 1 on error - Fixed memory usage when not using --flashback. - Added printing of number of rows in row events. Can be disabled with --print-row-count=0 - Print annotated rows when using mysqlbinlog --short-form - Fixed that mysqlbinlog --debug works - Fixed create_drop_binlog.test test failure - Reorganized fields in PRINT_EVENT_INFO to be according to size to optimize storage - Don't change print_row_event_position or print_row_counts if set by user - Remove some testing of argument to my_free is 0 - base64-output=never is now supported and works in all context - Updated help information for --base64-output and --short-form - print_row_count is now on by default. Reset automatically if --short-form is used - Removed obsolote warning for mysql 5.6.0 - More DBUG_PRINT for mysqltest.cc - my_b_write_byte() now checks for flush failures. This fixed a memory overrun on disk full - my_b_printf() now returns 1 on failure, 0 on ok. This simplifies code and no old code was using the old return value of my_b_printf(). - my_b_Write_backtick_quote() now returns 1 on failure and 0 on ok - Fixed some error conditions in log printing that was not previously handled. - Slave_rows_error_report() can now handle longlong positions - Write_on_release_cache() rewritten so that we can detect errors on flush. Not depending on automatic release anymore. - Changed types for Pos and End_log_pos to 64 bit in SHOW BINLOG EVENTS - Fixed that copy_event_cache_to_string_and_reinit() works with strings longer than 4G (Changed to use LEX_STRING instead of String) - Restricted binlog_rows_event_max_size to UINT32_MAX-1 as String's are anyway restricted to UINT32_MAX - Fixed bug in rpl_binlog_state::write_to_iocache() which hide write failures (duplicate variable name) - Fixed bug in String::append if original string was not allocated - Stop mysqlbinlog output at once if there is an error. - Before printing error message, flush result file. This ensures that the error message is printed last. (Easier to find)
* | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-11-301-1/+150
|\ \ \ \ | |/ / /
| * | | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-11-291-1/+150
| |\ \ \ | | |/ /
| | * | Merge branch '10.1' into 10.2Sergei Golubchik2017-11-211-1/+150
| | |\ \ | | | |/
| | | * MDEV-12012/MDEV-11969 Can't remove GTIDs for a stale GTID Domain IDAndrei Elkin2017-11-151-1/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported in MDEV-11969 "there's no way to ditch knowledge" about some domain that is no longer updated on a server. Besides being of annoyance to clutter output in DBA console stale domains can prevent the slave to connect the master as MDEV-12012 witnesses. What domain is obsolete must be evaluated by the user (DBA) according to whether the domain info is still relevant and will the domain ever receive any update. This patch introduces a method to discard obsolete gtid domains from the server binlog state. The removal requires no event group from such domain present in existing binlog files though. If there are any the containing logs must be first PURGEd in order for FLUSH BINARY LOGS DELETE_DOMAIN_ID=(list-of-domains) succeed. Otherwise the command returns an error. The list of obsolete domains can be computed through intersecting two sets - the earliest (first) binlog's Gtid_list and the current value of @@global.gtid_binlog_state - and extracting the domain id components from the intersection list items. The new DELETE_DOMAIN_ID featured FLUSH continues to rotate binlog omitting the deleted domains from the active binlog file's Gtid_list. Notice though when the command is ineffective - that none of requested to delete domain exists in the binlog state - rotation does not occur. Obsolete domain deletion is not harmful for connected slaves as long as master side binlog files *purge* is synchronized with FLUSH-DELETE_DOMAIN_ID. The slaves must have the last event from purged files processed as usual, in order not to bump later into requesting a gtid from a file which was already gone. While the command is not replicated (as ordinary FLUSH BINLOG LOGS is) slaves, even though having extra domains, won't suffer from reconnection errors thanks to master-slave gtid connection protocol allowing the master to be ignorant about a gtid domain. Should at failover such slave to be promoted into master role it may run the ex-master's FLUSH BINARY LOGS DELETE_DOMAIN_ID=(list-of-domains) to clean its own binlog state. NOTES. suite/perfschema/r/start_server_low_digest.result is re-recorded as consequence of internal parser codes changes.
* | | | Fixed assert when running rpl.rpl_parallel_partitionMonty2017-08-241-1/+19
| | | | | | | | | | | | | | | | | | | | The problem was that select_gtid_pos_table() was called by IO thread without mutex protection.
* | | | Added DBUG_ASSERT_AS_PRINTF compile flagMonty2017-08-241-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Enusure that my_global.h is included firstMichael Widenius2017-08-241-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* | | | MDEV-12179 post-merge fixes.Kristian Nielsen2017-07-031-3/+3
| | | | | | | | | | | | | | | | Fix LEX_STRING -> LEX_CSTRING issues.
* | | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-07-031-39/+235
|\ \ \ \ | |/ / / |/| | | | | | | Merge into MariaDB 10.3.
| * | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-05-101-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. Fix compilation failure with different my_atomic implementation. The my_atomic_loadptr* takes void ** as first argument, so variables updated with it needs to be void * (it is not legal C to cast some_type ** to void **).
| * | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. Fix compilation for embedded server.
| * | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-251-6/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. Implement status variables to aid the DBA in determining the need and/or effectiveness of the per-engine mylsq.gtid_slave_pos feature: transactions_multi_engine Number of transactions that changed data in multiple (transactional) storage engines. rpl_transactions_multi_engine Number of replicated transactions that involved changes in multiple (transactional) storage engines, before considering the update of the mysql.gtid_slave_posXXX table. transactions_gtid_foreign_engine Number of replicated transactions where the update of the mysql.gtid_slave_posXXX table had to choose a storage engine that did not otherwise participate in the transaction.
| * | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-251-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. Fix record_gtid()'s choice of mysql.gtid_slave_pos* table to only consider engines that participated in the transaction with write operations (ie. ignore read-only participation).
| * | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. Fix incorrect assertion. The hton in the list of pending GTIDs can be NULL, in the special case where we failed to load the mysql.gtid_slave_pos table at server startup, but nevertheless allow non-GTID replication to proceed.
| * | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-211-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. Implement auto-creation of mysql.gtid_slave_pos* tables with needed engines, if listed in --gtid-pos-auto-engines. Uses an asynchronous approach to minimise locking overhead. The list of available tables is extended with a flag. Extra entries are added for --gtid-pos-auto-engines tables that do not exist yet, marked as not existing but ready for auto-creation. If record_gtid() needs a table marked for auto-creation, it sends a request to the slave background thread to create the table, and continues to use an existing table for the current and immediately coming transactions. As soon as the slave background thread has made the new table available, it will be used for all subsequent relevant transactions in record_gtid(). This asynchronous approach also avoids a lot of complex issues around trying to do DDL in the middle of an on-going transaction.
| * | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-211-7/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. This commit implements that record_gtid() selects a gtid_slave_posXXX table with a storage engine already in use by current transaction, if any. The default table mysql.gtid_slave_pos is used if no match can be found on storage engine, or for GTID position updates with no specific storage engine. Table discovery of mysql.gtid_slave_pos* happens on initial GTID state load as well as on every START SLAVE. Some effort is made to make this possible without additional locking. New tables are added using lock-free atomics. Removing tables requires stopping all slaves first. A warning is given in the error log when a table is removed but a non-stopped slave still has a reference to it. If multiple mysql.gtid_slave_posXXX tables with same storage engine exist, one is chosen arbitrarily to be used, with a warning in the error log. GTID data from all tables is still read, but only one among redundant tables with same storage engine will be updated.
| * | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-211-27/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. When deleting old GTIDs, only pick those GTIDs that were recorded using the same engine. (Currently this is not used, there is only one table/engine active. This is in preparation for extending record_gtid to pick the table with the same engine as the active transaction, if any).
| * | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-211-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. For each GTID recorded in mysq.gtid_slave_pos, keep track of which engine the update was made in. This will be later used to know which rows can be deleted in the table of a given engine.
| * | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-211-1/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. Keep track of which mysql.gtid_slave_posXXX tables are available for each engine, by searching for all tables in the mysql schema with names that start with "gtid_slave_pos". The list is computed at server start when the GTID position is loaded, and it is re-computed on every START SLAVE command. This way, the DBA can manually add a table for a new engine, and it will be automatically picked up on next START SLAVE, so a full server restart is not needed. The list is not yet actually used in the code.
* | | | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-06-151-1/+1
|\ \ \ \ | | |/ / | |/| |
| * | | Merge 10.1 into 10.2Marko Mäkelä2017-05-221-1/+1
| |\ \ \ | | |/ / | |/| / | | |/
| | * Silence bogus GCC 7 warnings -Wimplicit-fallthroughMarko Mäkelä2017-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Do not silence uncertain cases, or fix any bugs. The only functional change should be that ha_federated::extra() is not calling DBUG_PRINT to report an unhandled case for HA_EXTRA_PREPARE_FOR_DROP.
* | | Changing field::field_name and Item::name to LEX_CSTRINGMonty2017-04-231-14/+14
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benefits of this patch: - Removed a lot of calls to strlen(), especially for field_string - Strings generated by parser are now const strings, less chance of accidently changing a string - Removed a lot of calls with LEX_STRING as parameter (changed to pointer) - More uniform code - Item::name_length was not kept up to date. Now fixed - Several bugs found and fixed (Access to null pointers, access of freed memory, wrong arguments to printf like functions) - Removed a lot of casts from (const char*) to (char*) Changes: - This caused some ABI changes - lex_string_set now uses LEX_CSTRING - Some fucntions are now taking const char* instead of char* - Create_field::change and after changed to LEX_CSTRING - handler::connect_string, comment and engine_name() changed to LEX_CSTRING - Checked printf() related calls to find bugs. Found and fixed several errors in old code. - A lot of changes from LEX_STRING to LEX_CSTRING, especially related to parsing and events. - Some changes from LEX_STRING and LEX_STRING & to LEX_CSTRING* - Some changes for char* to const char* - Added printf argument checking for my_snprintf() - Introduced null_clex_str, star_clex_string, temp_lex_str to simplify code - Added item_empty_name and item_used_name to be able to distingush between items that was given an empty name and items that was not given a name This is used in sql_yacc.yy to know when to give an item a name. - select table_name."*' is not anymore same as table_name.* - removed not used function Item::rename() - Added comparision of item->name_length before some calls to my_strcasecmp() to speed up comparison - Moved Item_sp_variable::make_field() from item.h to item.cc - Some minimal code changes to avoid copying to const char * - Fixed wrong error message in wsrep_mysql_parse() - Fixed wrong code in find_field_in_natural_join() where real_item() was set when it shouldn't - ER_ERROR_ON_RENAME was used with extra arguments. - Removed some (wrong) ER_OUTOFMEMORY, as alloc_root will already give the error. TODO: - Check possible unsafe casts in plugin/auth_examples/qa_auth_interface.c - Change code to not modify LEX_CSTRING for database name (as part of lower_case_table_names)
* | Merge branch '10.1' into 10.2Sergei Golubchik2016-12-291-13/+1
|\ \ | |/
| * MDEV-10435 crash with bad stat tables.Alexey Botchkov2016-12-091-13/+1
| | | | | | | | | | | | | | | | Functions from sql/statistics.cc don't seem to expect stat tables to fail or to have inadequate structure. Table open errors suppressed and some validity checks added. Invalid tables reported to the server log.
* | Fixed compiler warnings and test failures found by buildbotMonty2016-06-241-2/+2
| | | | | | | | Fixed ccfilter to detect errors where the column is included in the error message
* | Final fixes for Memory_usedMonty2016-04-281-2/+1
|/ | | | | | | | - Change some static variables to dynamic to ensure that we don't do any memory allocations before server starts or stops - Print more memory information on SIGHUP. Fixed output. - Write out if memory was lost if run with --debug-at-exit - Fixed wrong #ifdef in sql_cache.cc
* Fix to ensure updates in gtid_slave_state table do not get binlogged.Nirbhay Choubey2016-02-241-2/+2
| | | | | Also, renamed wsrep_skip_append_keys to wsrep_ignore_table. Test case : galera.galera_as_slave_gtid.test