summaryrefslogtreecommitdiff
path: root/sql/rpl_mi.cc
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-28609 refine gtid-strict-mode to ignore same server-id gtid from the pastAndrei2022-07-261-1/+2
| | | | | | | | | | | | | | | | | | | ... on semisync slave To provide semisync master crash-recovery the same server-id transactions were made to accept for execution on the semisync slave when the strict gtid mode (see MDEV-27760). That however caused out-of-order error on a master's transaction server of the circular setup. The error was fair in the sense of the gtid strict mode rule as indeed under the condition of the circular setup the replicated transaction already exists in the local binlog. This is fixed by the commit to ignore on the gtid strict mode semisync slave those gtids that exist in the slave's binlog that effectively restores the default same-server-id ignore policy. At the same time the fixes complies with MDEV-21117 semisync slave recovery to accept the same server-id transactions that do not exist in local binlog.
* Merge 10.5 into 10.6Marko Mäkelä2021-10-211-0/+8
|\
| * Merge 10.4 into 10.5Marko Mäkelä2021-10-211-0/+8
| |\
| | * Merge 10.3 into 10.4Marko Mäkelä2021-10-211-0/+8
| | |\
| | | * Merge 10.2 into 10.3Marko Mäkelä2021-10-211-0/+8
| | | |\
| | | | * MDEV-25284: Assertion `info->type == READ_CACHE || info->type == ↵bb-10.2-MDEV-25284Brandon Nesterenko2021-10-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | WRITE_CACHE' failed Problem: ======== This patch addresses two issues. First, if a CHANGE MASTER command is issued and an error happens while locating the replica’s relay logs, the logs can be put into an invalid state where future updates fail and future CHANGE MASTER calls crash the server. More specifically, right before a replica purges the relay logs (part of the `CHANGE MASTER TO` logic), the relay log is temporarily closed with state LOG_TO_BE_OPENED. If the server errors in-between the temporary log closure and purge, i.e. during the function find_log_pos, the log should be closed. MDEV-25284 reveals the log is not properly closed. Second, upon issuing a RESET SLAVE ALL command, a slave’s GTID filters are not cleared (DO_DOMAIN_IDS, IGNORE_DOMIAN_IDS, IGNORE_SERVER_IDS). MySQL had a similar bug report, Bug #18816897, which fixed this issue to clear IGNORE_SERVER_IDS after issuing RESET SLAVE ALL in version 5.7. Solution: ========= To fix the first problem, the CHANGE MASTER error handling logic was extended to transition the relay log state to LOG_CLOSED from LOG_TO_BE_OPENED. To fix the second problem, the RESET SLAVE ALL logic is extended to clear the domain_id filter and ignore_server_ids. Reviewed By: ============ Andrei Elkin <andrei.elkin@mariadb.com>
* | | | | Less noise in the error logMonty2021-05-191-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | - Updated error messages for recovery - Changed printing of debug sync point information to make it fit 80 char
* | | | | Reduce usage of strlen()Monty2021-05-191-3/+4
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes: - To detect automatic strlen() I removed the methods in String that uses 'const char *' without a length: - String::append(const char*) - Binary_string(const char *str) - String(const char *str, CHARSET_INFO *cs) - append_for_single_quote(const char *) All usage of append(const char*) is changed to either use String::append(char), String::append(const char*, size_t length) or String::append(LEX_CSTRING) - Added STRING_WITH_LEN() around constant string arguments to String::append() - Added overflow argument to escape_string_for_mysql() and escape_quotes_for_mysql() instead of returning (size_t) -1 on overflow. This was needed as most usage of the above functions never tested the result for -1 and would have given wrong results or crashes in case of overflows. - Added Item_func_or_sum::func_name_cstring(), which returns LEX_CSTRING. Changed all Item_func::func_name()'s to func_name_cstring()'s. The old Item_func_or_sum::func_name() is now an inline function that returns func_name_cstring().str. - Changed Item::mode_name() and Item::func_name_ext() to return LEX_CSTRING. - Changed for some functions the name argument from const char * to to const LEX_CSTRING &: - Item::Item_func_fix_attributes() - Item::check_type_...() - Type_std_attributes::agg_item_collations() - Type_std_attributes::agg_item_set_converter() - Type_std_attributes::agg_arg_charsets...() - Type_handler_hybrid_field_type::aggregate_for_result() - Type_handler_geometry::check_type_geom_or_binary() - Type_handler::Item_func_or_sum_illegal_param() - Predicant_to_list_comparator::add_value_skip_null() - Predicant_to_list_comparator::add_value() - cmp_item_row::prepare_comparators() - cmp_item_row::aggregate_row_elements_for_comparison() - Cursor_ref::print_func() - Removes String_space() as it was only used in one cases and that could be simplified to not use String_space(), thanks to the fixed my_vsnprintf(). - Added some const LEX_CSTRING's for common strings: - NULL_clex_str, DATA_clex_str, INDEX_clex_str. - Changed primary_key_name to a LEX_CSTRING - Renamed String::set_quick() to String::set_buffer_if_not_allocated() to clarify what the function really does. - Rename of protocol function: bool store(const char *from, CHARSET_INFO *cs) to bool store_string_or_null(const char *from, CHARSET_INFO *cs). This was done to both clarify the difference between this 'store' function and also to make it easier to find unoptimal usage of store() calls. - Added Protocol::store(const LEX_CSTRING*, CHARSET_INFO*) - Changed some 'const char*' arrays to instead be of type LEX_CSTRING. - class Item_func_units now used LEX_CSTRING for name. Other things: - Fixed a bug in mysql.cc:construct_prompt() where a wrong escape character in the prompt would cause some part of the prompt to be duplicated. - Fixed a lot of instances where the length of the argument to append is known or easily obtain but was not used. - Removed some not needed 'virtual' definition for functions that was inherited from the parent. I added override to these. - Fixed Ordered_key::print() to preallocate needed buffer. Old code could case memory overruns. - Simplified some loops when adding char * to a String with delimiters.
* | | | cleanup: PSI key is *always* the first argumentSergei Golubchik2020-03-101-6/+5
| | | |
* | | | perfschema memory related instrumentation changesSergei Golubchik2020-03-101-6/+9
| | | |
* | | | perfschema - various collateral cleanups and small changesSergei Golubchik2020-03-101-0/+2
|/ / /
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-12-091-1/+1
|\ \ \ | |/ /
| * | Lintian complains on spelling errorFaustin Lammler2019-12-021-1/+1
| | | | | | | | | | | | | | | The lintian check complains on spelling error: https://salsa.debian.org/mariadb-team/mariadb-10.3/-/jobs/95739
* | | Merge 10.3 into 10.4Marko Mäkelä2019-07-251-9/+0
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Eugene Kosov2019-07-161-9/+0
| |\ \ | | |/
| | * Merge 10.1 into 10.2Eugene Kosov2019-07-091-9/+0
| | |\
| | | * fix Galera memory leakEugene Kosov2019-07-081-7/+0
| | | | | | | | | | | | | | | | This was caused by 7f2cfa8f47cf05d8dbea65ced3656fd0fc6efbf5
| | | * MDEV-8874 Replication filters configured in my.cnf are ignored if slave ↵Sachin2019-06-271-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | reset and reconfigured Don't delete the rpl_filter on RESET SLAVE.
* | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-06-141-1/+1
|\ \ \ \ | |/ / /
| * | | Merge branch '10.2' into 10.3Oleksandr Byelkin2019-06-141-1/+1
| |\ \ \ | | |/ /
| | * | Merge 10.1 into 10.2Marko Mäkelä2019-06-121-1/+1
| | |\ \ | | | |/
| | | * MDEV-18913: typo in error logSujatha2019-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ======== Following typo in error log: 2019-03-13 15:58:10 0 [Note] Reading of all Master_info entries succeded Should be 'succeeded' Fix: === Fixed the typo with the right word 'succeeded'.
* | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-1/+1
|\ \ \ \ | |/ / /
| * | | 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
| | | |\
| | | | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | * Update wrong zip-code
* | | | | MDEV-18400 - Move shutdown handling to main threadSergey Vojtovich2019-01-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signal handler is now respoinsible for setting abort_loop and breaking poll() in main thread. The rest is handled by main thread itself. Removed redundant LOCK_error_log init/destroy wrappers. Removed redundant unireg_end(): it is trivial and it has only one caller. Removed unused ready_to_exit from PFS. Removed kill_in_progress: duplicates abort_loop. Removed shutdown_in_progress: duplicates abort_loop. Removed ready_to_exit: was used to make sure main thread waits for cleanups, which are now done by main thread itself. Removed SIGNALS_DONT_BREAK_READ, MAYBE_BROKEN_SYSCALL, kill_broken_server: never defined/used. Make clean_up() static.
* | | | | mysys: rename ME_xxx flags to match plugin apiSergei Golubchik2018-06-041-3/+3
|/ / / /
* | | | Add likely/unlikely to speed up executionMonty2018-05-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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()
* | | | Mdev-10664 Add statuses about optimistic parallel replication stallsSachin Setiya2018-04-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this commit we are adding three more status variable to SHOW SLAVE STATUS. Slave_DDL_Events and Slave_Non_Transactional_Events. Slave_DDL_Groups:- This status variable counts the occurrence of DDL statements Slave_Non_Transactional_Groups:- This variable count the occurrence of non-transnational event group. Slave_Transactional_Groups:- This variable count the occurrence of transnational event group. Patch Credit:- Kristian Nielsen
* | | | MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from ↵Vladislav Vaintroub2018-02-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'size_t' to 'type', possible loss of data) Handle string length as size_t, consistently (almost always:)) Change function prototypes to accept size_t, where in the past ulong or uint were used. change local/member variables to size_t when appropriate. This fix excludes rocksdb, spider,spider, sphinx and connect for now.
* | | | Merge branch 'bb-10.2-ext' into 10.3Sergei Golubchik2017-08-261-3/+3
|\ \ \ \
| * \ \ \ Merge branch '10.2' into bb-10.2-extSergei Golubchik2017-08-251-3/+3
| |\ \ \ \ | | |/ / /
| | * | | Merge branch '10.1' into 10.2Sergei Golubchik2017-08-171-3/+3
| | |\ \ \ | | | |/ /
| | | * | Merge branch '10.0' into 10.1Sergei Golubchik2017-08-081-3/+3
| | | |\ \
| | | | * | memory leak: add a missing end_relay_log_info()Sergei Golubchik2017-07-271-0/+1
| | | | | |
| | | | * | Merge remote-tracking branch 'origin/5.5' into 10.0Vicențiu Ciorbaru2017-07-251-3/+2
| | | | |\ \ | | | | | |/
| | | | | * Merge remote-tracking branch 'mysql/5.5' into 5.5Sergei Golubchik2017-07-181-3/+2
| | | | | |\
| | | | | | * Bug#24901077: RESET SLAVE ALL DOES NOT ALWAYS RESET SLAVESujatha Sivakumar2017-02-281-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Description: ============ If you have a relay log index file that has ended up with some relay log files that do not exists, then RESET SLAVE ALL is not enough to get back to a clean state. Analysis: ========= In the bug scenario slave server is in stopped state and some of the relay logs got deleted but the relay log index file is not updated. During slave server restart replication initialization fails as some of the required relay logs are missing. User executes RESET SLAVE/RESET SLAVE ALL command to start a clean slave. As per the documentation RESET SLAVE command clears the master info and relay log info repositories, deletes all the relay log files, and starts a new relay log file. But in a scenario where the slave server's Relay_log_info object is not initialized slave will not purge the existing relay logs. Hence the index file still remains in a bad state. Users will not be able to start the slave unless these files are cleared. Fix: === RESET SLAVE/RESET SLAVE ALL commands should do the cleanup even in a scenario where Relay_log_info object initialization failed. Backported a flag named 'error_on_rli_init_info' which is required to identify slave's Relay_log_info object initialization failure. This flag exists in MySQL-5.6 onwards as part of BUG#14021292 fix. During RESET SLAVE/RESET SLAVE ALL execution this flag indicates the Relay_log_info initialization failure. In such a case open the relay log index/relay log files and do the required clean up.
| | | | | | * Updated/added copyright headersMySQL Build Team2012-02-161-1/+1
| | | | | | |\
| | | | | | * | BUG#11752315 - 43460: STOP SLAVE UNABLE TO COMPLETE WHEN SLAVE THREAD IS ↵Manish Kumar2012-01-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TRYING TO RECONNECT TO Problem : The basic problem is the way the thread sleeps in mysql-5.5 and also in mysql-5.1 when we execute a stop slave on windows platform. On windows platform if the stop slave is executed after the master dies, we have this long wait before the stop slave return a value. This is because there is a sleep of the thread. The sleep is uninterruptable in the two above version, which was fixed by Davi patch for the BUG#11765860 for mysql-trunk. Backporting his patch for mysql-5.5 fixes the problem. Solution : A new pair of mutex and condition variable is introduced to synchronize thread sleep and finalization. A new mutex is required because the slave threads are terminated while holding the slave thread locks (run_lock), which can not be relinquished during termination as this would affect the lock order.
| | | | | | * | BUG#11809016 - NO WAY TO DISCOVER AN INSTANCE IS NO LONGER A SLAVE FOLLOWING ↵Alfranio Correia2011-07-181-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MYSQL BUG#28796 Before BUG#28796, an empty host was used to identify that an instance was no longer a slave. However, BUG#28796 changed this behavior and one cannot set an empty host. Besides, a RESET SLAVE only cleans up information on the next event to retrieve from the master, disables ssl and resets heartbeat period. So a call to SHOW SLAVE STATUS after issuing a RESET SLAVE still returns some valid information, such as host, port, user and password. To fix this problem, we have introduced the command RESET SLAVE ALL that does what a regular RESET SLAVE does and also clears host, port, user and password information thus allowing users to identify when an instance is no longer a slave.
| | | | | | * | Updated/added copyright headersKent Boortz2011-06-301-2/+2
| | | | | | |\ \ | | | | | | | |/
| | | | | | | * Updated/added copyright headersKent Boortz2011-06-301-2/+4
| | | | | | | |
| | | | | | * | Merge of mysql-trunk-bugfixing into mysql-trunk-merge.Davi Arnaut2010-07-151-1/+23
| | | | | | |\ \
| | | | | | | * | Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabledDavi Arnaut2010-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives.
| | | | | | | * | BUG#54509: rpl_show_slave_running crashes the server sporadicallyLuis Soares2010-06-241-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: SQL and IO thread were racing for the IO_CACHE. The former to flush it, the latter to close it. In some cases this would cause the SQL thread to lock an invalid IO_CACHE mutex (it had been destroyed by IO thread). This would happen when SQL thread was initializing the master.info Solution: We solve this by locking the log and checking if it is hot. If it is we keep the log while seeking. Otherwise we release it right away, because a log can get from hot to cold, but not from cold to hot.
| | | | | | * | | Merge of mysql-5.1-bugteam into mysql-trunk-merge.Davi Arnaut2010-07-091-8/+5
| | | | | | |\ \ \ | | | | | | | |/ / | | | | | | |/| / | | | | | | | |/
| | | | | | | * BUG#53657: Slave crashed with error 22 when trying to lock mutexLuis Soares2010-05-241-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | at mf_iocache.c, line 1722 The slave crashed while two threads: IO thread and user thread raced for the same mutex (the append_buffer_lock protecting the relay log's IO_CACHE). The IO thread was trying to flush the cache, and for that was grabbing the append_buffer_lock. However, the other thread was closing and reopening the relay log when the IO thread tried to lock. Closing and reopening the log includes destroying and reinitialising the IO_CACHE mutex. Therefore, the IO thread tried to lock a destroyed mutex. We fix this by backporting patch for BUG#50364 which fixed this bug in mysql server 5.5+. The patch deploys missing synchronization when flush_master_info is called and the relay log is flushed by the IO thread. In detail the patch backports revision (from mysql-trunk): - luis.soares@sun.com-20100203165617-b1yydr0ee24ycpjm This patch already includes the post-push fix also in BUG#50364: - luis.soares@sun.com-20100222002629-0cijwqk6baxhj7gr