summaryrefslogtreecommitdiff
path: root/sql/slave.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-07-121-2/+27
|\
| * Merge branch '10.1' into 10.2Sergei Golubchik2017-07-081-2/+27
| |\
| | * Merge branch '10.0' into 10.1Sergei Golubchik2017-07-071-3/+29
| | |\
| | | * Fix for MDEV-9670 server_id mysteriously set to 0Andrei Elkin2017-07-021-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem was that in a circular replication setup the master remembers position to events it has generated itself when reading from a slave. If there are no new events in the queue from the slave, a Gtid_list_log_event is generated to remember the last skipped event. The problem happens if there is a network delay and we generate a Gtid_list_log_event in the middle of the transaction, in which case there will be an implicit comment and a new transaction with serverid=0 will be logged. The fix was to not generate any Gtid_list_log_events in the middle of a transaction.
* | | | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-06-151-3/+2
|\ \ \ \ | |/ / /
| * | | Merge 10.1 into 10.2Marko Mäkelä2017-05-221-3/+2
| |\ \ \ | | |/ /
| | * | Merge 10.0 into 10.1Marko Mäkelä2017-05-191-3/+2
| | |\ \ | | | |/
| | | * Silence bogus GCC 7 warnings -Wimplicit-fallthroughMarko Mäkelä2017-05-171-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | | * MDEV-9998 Fix issues caught by Clang's -Wpointer-bool-conversion warningSergei Golubchik2017-05-151-3/+2
| | | | | | | | | | | | | | | | | | | | remove useless checks and a couple of others
| | * | Silence bogus GCC 7 warnings -Wimplicit-fallthroughMarko Mäkelä2017-05-171-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge tag 'mariadb-10.2.6' into bb-10.2-extAlexander Barkov2017-05-261-5/+1
|\ \ \ \ | |/ / /
| * | | MDEV-10332 support for OpenSSL 1.1 and LibreSSLSergei Golubchik2017-05-091-18/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | post-review fixes: * move all ssl implementation related ifdefs/defines to one file (ssl_compat.h) * work around OpenSSL-1.1 desire to malloc every EVP context by run-time checking that context allocated on the stack is big enough (openssl.c) * use newer version of the AWS SDK for OpenSSL 1.1 * use get_dh2048() function as generated by openssl 1.1 (viosslfactories.c)
| * | | MDEV-10332 support for OpenSSL 1.1 and LibreSSLGeorg Richter2017-05-091-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initial support tested against OpenSSL 1.0.1, 1.0.2, 1.1.0, Yassl and LibreSSL not working on Windows with native SChannel support, due to wrong cipher mapping: Latter one requires push of CONC-241 fixes. Please note that OpenSSL 0.9.8 and OpenSSL 1.1.0 will not work: Even if the build succeeds, test cases will fail with various errors, especially when using different tls libraries or versions for client and server.
* | | | Fixed compiler warnings and warnings from build.tagsMonty2017-05-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Other things - Ensure that ut_d() is set to EXPR if ut_ad() is DEBUG_ASSERT() If not, we will get a crash in purge_sys_t::~purge_sys_t() as this ut_ad() code expect's that the ut_d() codes has been executed
* | | | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-05-051-1/+2
|\ \ \ \ | |/ / /
| * | | Merge 10.1 into 10.2Marko Mäkelä2017-04-281-1/+2
| |\ \ \ | | |/ /
| | * | Merge 10.0 into 10.1Marko Mäkelä2017-04-211-1/+2
| | |\ \ | | | |/
| | | * MDEV-11201: gtid_ignore_duplicates incorrectly ignores statements when GTID ↵Kristian Nielsen2017-04-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | replication is not enabled When master_use_gtid=no, the IO thread loads the slave GTID state from the master during connect. This races with the SQL thread when gtid_ignore_duplicates=1. If an event is in the relay log from before the new connect and has not been applied yet, moving the slave position causes the SQL thread to think that event should be skipped due to gtid_ignore_duplicates=1. This patch simply disables gtid_ignore_duplicates when not using GTID, which seems to be what one would expect.
* | | | Changing field::field_name and Item::name to LEX_CSTRINGMonty2017-04-231-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Golubchik2017-03-301-68/+92
|\ \ \ | |/ /
| * | Merge branch '10.0' into 10.1Sergei Golubchik2017-03-211-7/+16
| |\ \ | | |/
| | * Wait for slave threads to start during startupMonty2017-03-161-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Before this patch during startup all slave threads was started without any check that they had started properly. - If one did a START SLAVE, STOP SLAVE or CHANGE MASTER as first command to the server there was a chance that server could access structures that where not properly initialized which could lead to crashes in Log_event::read_log_event - Fixed by waiting for slave threads to start up properly also during server startup, like we do with START SLAVE.
| * | Merge 10.0 into 10.1Marko Mäkelä2017-03-031-61/+76
| |\ \ | | |/
| | * Add protection to not access is_open() without LOCK_log mutexMonty2017-02-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Protection added to reopen_file() and new_file_impl(). Without this we could get an assert in fn_format() as name == 0, because the file was closed and name reset, atthe same time new_file_impl() was called.
| | * Don't allow one to kill START SLAVE while the slaves IO_THREAD or SQL_THREADMonty2017-02-281-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | is starting. This is needed as if we kill the START SLAVE thread too early during shutdown then the IO_THREAD or SQL_THREAD will not have time to properly initlize it's replication or THD structures and clean_up() will try to delete master_info structures that are still in use.
| | * Added error checking for all calls to flush_relay_log_info() and stmt_done()Monty2017-02-281-2/+12
| | |
| | * Added a separate lock for start/stop/reset slave.Monty2017-02-281-15/+7
| | | | | | | | | | | | | | | This solves some possible dead locks when one calls stop slave while slave is starting.
| | * MDEV-9573 'Stop slave' hangs on replication slaveMonty2017-02-281-36/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for this is that stop slave takes LOCK_active_mi over the whole operation while some slave operations will also need LOCK_active_mi which causes deadlocks. Fixed by introducing object counting for Master_info and not taking LOCK_active_mi over stop slave or even stop_all_slaves() Another benefit of this approach is that it allows: - Multiple threads can run SHOW SLAVE STATUS at the same time - START/STOP/RESET/SLAVE STATUS on a slave will not block other slaves - Simpler interface for handling get_master_info() - Added some missing unlock of 'log_lock' in error condtions - Moved rpl_parallel_inactivate_pool(&global_rpl_thread_pool) to end of stop_slave() to not have to use LOCK_active_mi inside terminate_slave_threads() - Changed argument for remove_master_info() to Master_info, as we always have this available - Fixed core dump when doing FLUSH TABLES WITH READ LOCK and parallel replication. Problem was that waiting for pause_for_ftwrl was not done when deleting rpt->current_owner after a force_abort.
| * | Merge 10.0 into 10.1Marko Mäkelä2017-01-101-11/+4
| |\ \ | | |/
| | * MDEV-10271: Stopped SQL slave thread doesn't print a message to error log ↵Kristian Nielsen2017-01-061-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | like IO thread does Make the slave SQL thread always output to the error log the message "Slave SQL thread exiting, replication stopped in ..." whenever it previously outputted "Slave SQL thread initialized, starting replication ...". Before this patch, it was somewhat inconsistent in which cases the message would be output and in which not, depending on the exact time and cause of the condition that caused the SQL thread to stop.
* | | Fix several compile warnings on WindowsVladislav Vaintroub2017-03-101-1/+1
| | |
* | | Merge branch '10.1' into 10.2Sergei Golubchik2016-12-291-3/+29
|\ \ \ | |/ /
| * | Merge branch '10.0' into 10.1Sergei Golubchik2016-12-111-0/+7
| |\ \ | | |/
| | * Fix incorrect reading of events from relaylog in parallel replication.Kristian Nielsen2016-11-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SQL thread keeps track of the position in the current relay log from which to read the next event. This position is not normally used, but a certain interaction with the IO thread can cause the SQL thread to re-open the relay log and seek to the stored position. In parallel replication, there were a couple of places where the position was not updated. This created a race where a re-open of the relay log could seek to the wrong position and start re-reading and processing events already handled once, causing various kinds of problems. Fix this by moving the position update into a single place in apply_event_and_update_pos(), which should ensure that the position is always updated in the parallel replication case. This problem was found from the testcase of MDEV-10863, but it is logically a separate problem.
| | * Back-port Master_info::using_parallel() to 10.0.Kristian Nielsen2016-11-151-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | This has no functional changes, but it helps avoid merge problems from 10.0 to 10.1. In 10.0, code that checks for parallel replication uses opt_slave_parallel_threads > 0, but this check needs to be mi->using_parallel() in 10.1. By using the same check in 10.0 (with unchanged semantics), merge problems to 10.1 are avoided.
| * | Merge branch 'mdev10863' into 10.1Kristian Nielsen2016-11-151-1/+15
| |\ \ | | |/
| | * MDEV-10863: parallel replication tries to continue from wrong positionKristian Nielsen2016-11-041-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This occured when the SQL thread (but not the IO thread) stops while GTID and parallel replication are used with multiple domain ids in the GTID position, and is restarted. In this case, the SQL needs to start some way back in the relay log, applying or skipping events within each replication domain as appropriate. The SQL threads starts at the beginning of an old relay log file, and this position may be in the middle of an event group. The bug was that such partial event group could be re-applied, causing replication corruption. This patch fixes the issue, by making sure to skip any initial events that were part of an earlier (already applied) event group.
| * | Merge branch '10.0-galera' into 10.1Sergei Golubchik2016-11-021-2/+7
| |\ \
| | * \ Merge tag 'mariadb-10.0.28' into 10.0-galeraNirbhay Choubey2016-10-281-2/+7
| | |\ \ | | | |/
| | | * MDEV-8345 STOP SLAVE should not cause an ERROR to be logged to the error logSergei Golubchik2016-10-261-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cherry-pick from 5.7: commit 6b24763 Author: Manish Kumar <manish.4.kumar@oracle.com> Date: Tue Mar 27 13:10:42 2012 +0530 BUG#12977988 - ON STOP SLAVE: ERROR READING PACKET FROM SERVER: LOST CONNECTION TO MYSQL SERVER BUG#11761457 - ERROR 2013 + "ERROR READING RELAY LOG EVENT" ON STOP SLAVEBUG#12977988 - ON STOP SLAVE: ERROR READING PACKET FROM SERVER: LOST CONNECTION TO MYSQL SERVER
| | * | Merge branch '10.0' into 10.0-galeraNirbhay Choubey2016-08-241-2/+3
| | |\ \ | | | |/
* | | | fix build and some warningskevg2016-11-241-5/+3
| | | |
* | | | MDEV-11065: Compressed binary log. Merge code into current 10.2.Kristian Nielsen2016-11-031-12/+66
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Conflicts: sql/share/errmsg-utf8.txt
| * | | | two fix:vinchen2016-10-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 1.Avoid overflowing buffers in case of corrupt events 2.Check the compressed algorithm.
| * | | | MDEV-11065: Compressed binary logKristian Nielsen2016-10-201-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Minor review comments/changes: - A bunch of style-fixes. - Change macros to static inline functions. - Update check_event_type() with compressed event types. - Small .result file update.
| * | | | optimize the memory allocation for compressed binlog eventvinchen2016-10-191-8/+15
| | | | |
| * | | | Binlog compressedvinchen2016-10-191-12/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add some event types for the compressed event, there are: QUERY_COMPRESSED_EVENT, WRITE_ROWS_COMPRESSED_EVENT_V1, UPDATE_ROWS_COMPRESSED_EVENT_V1, DELETE_POWS_COMPRESSED_EVENT_V1, WRITE_ROWS_COMPRESSED_EVENT, UPDATE_ROWS_COMPRESSED_EVENT, DELETE_POWS_COMPRESSED_EVENT. These events inheritance the uncompressed editor events. One of their constructor functions and write function have been overridden for uncompressing and compressing. Anything but this is totally the same. On slave, The IO thread will uncompress and convert them When it receiving the events from the master. So the SQL and worker threads can be stay unchanged. Now we use zlib as compress algorithm. It maybe support other algorithm in the future.
* | | | | fix the ABI and stop slave hang problemvinchen2016-10-211-14/+26
| | | | |
* | | | | fix code style..vinchen2016-10-191-5/+7
| | | | |
* | | | | fix the code style for read_binlog_speed_limitvinchen2016-10-191-9/+9
| | | | |