summaryrefslogtreecommitdiff
path: root/sql/log_event.h
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-11319 mysqlbinlog crashes or fails with out of memory while reading ↵Sergei Golubchik2016-12-061-2/+5
| | | | | | | some encrypted binlogs support encrypted binlogs. Not decryption, but at least recognizing that event are encrypted and prining them as such
* Ignore MySQL 5.7 log events not relevant for MariaDBMonty2015-11-101-0/+5
| | | | | | - XA - Transaction_context_event (used by MysQL group replication) - View change event (used by MysQL group replication)
* table->write_set was changed if binary logging was used, which caused theMonty2015-11-101-3/+3
| | | | | | | | | | | | | | | changes in query execution plans. Fixed by introducing table->rpl_write_set which holds which columns should be stored in the binary log. Other things: - Removed some not needed references to read_set and write_set to make code really changing read_set and write_set easier to read (in opt_range.cc) - Added error handling of failed unpack_current_row() - Added missing call to mark_columns_needed_for_insert() for DELAYED INSERT - Removed not used functions in_read_set() and in_write_set() - In rpl_record.cc, removed not used variable error
* Remove THD argment from Log_event->net_send() and Protocol::pack_info() asMichael Widenius2015-10-221-24/+23
| | | | THD is already available in Protocol
* Merge branch '10.0' into 10.1Sergei Golubchik2015-10-121-1/+73
|\
| * MDEV-4487 Allow replication from MySQL 5.6+ when GTID is enabled on the masterMonty2015-10-081-0/+72
| | | | | | | | | | | | | | | | | | | | | | MDEV-8685 MariaDB fails to decode Anonymous_GTID entries MDEV-5705 Replication testing: 5.6->10.0 - Ignoring GTID events from MySQL 5.6+ (Allows replication from MySQL 5.6+ with GTID enabled) - Added ignorable events from MySQL 5.6 - mysqlbinlog now writes information about GTID and ignorable events. - Added more information in error message when replication stops because of wrong information in binary log. - Fixed wrong test when write_on_release() should flush cache.
| * MDEV-8450: PATCH] Wrong macro expansion in Query_cache::send_result_to_client()Oleksandr Byelkin2015-09-061-1/+1
| | | | | | | | Expression in macro protected by ()
* | MDEV-8264 encryption for binlogSergei Golubchik2015-09-041-4/+99
| | | | | | | | | | | | | | * Start_encryption_log_event * --encrypt-binlog command line option based on google patches.
* | cleanup: Log_event::write() and MYSQL_BIN_LOG::write_cache()Sergei Golubchik2015-09-041-98/+116
| | | | | | | | | | | | | | | | | | | | | | | | Introduce Log_event_writer() that encapsulates writing data to an IO_CACHE with automatic checksum calculation. Now all events properly checksum themselves as needed. Use Log_event_writer in MYSQL_BIN_LOG::write_cache() instead of copy-pasting its logic all over. Later Log_event_writer will also do encryption.
* | cleanup: remove Slave_log_event (unused since 2002)Sergei Golubchik2015-09-041-90/+0
| |
* | cleanup: use enum_binlog_checksum_alg, not uint8Sergei Golubchik2015-09-041-19/+10
| | | | | | | | | | | | * fix unireg.h includes * use enum_binlog_checksum_alg for binlog checksum variables, not uint8
* | cleanup: commentsSergei Golubchik2015-09-041-3/+3
| |
* | cleanup: reformatSergei Golubchik2015-09-041-1/+0
| | | | | | | | | | | | | | * reformat long lines * remove useless 'const' * remove unneeded do { ... } while(false} wrapper * remove unneeded method
* | cleanup: Log_event::read_log_event()Sergei Golubchik2015-09-041-43/+37
| | | | | | | | | | | | | | | | | | | | | | There are three Log_event::read_log_event() methods: 1. read the event image from IO_CACHE into String 2. create Log_event from the in-memory event image 3. read the event image from IO_CACHE and create Log_event The 3rd was reading event image into memory and invoking the 2nd to create Log_event. Now the 3rd also uses the 1st to read the event image from IO_CACHE into memory, instead of duplicating its functionality.
* | MDEV-8010 - Avoid sql_alloc() in Items (Patch #1)Sergey Vojtovich2015-08-211-1/+1
| | | | | | | | | | | | | | Added mandatory thd parameter to Item (and all derivative classes) constructor. Added thd parameter to all routines that may create items. Also removed "current_thd" from Item::Item. This reduced number of pthread_getspecific() calls from 290 to 177 per OLTP RO transaction.
* | [MDEV-6877] Change replication event loop to account for empty events10.1-MDEV-6877-binlog_row_imageVicențiu Ciorbaru2015-06-301-3/+6
| | | | | | | | | | | | | | When writing rows with a minimal row image, it is possible to receive empty events. In that case m_curr_row and m_rows_end are the same, however the event implies an insert into the table with the default values associated for that table.
* | [MDEV-6877] Fixed Update_rows_log_event to correctly apply update log eventsVicențiu Ciorbaru2015-06-301-0/+8
| | | | | | | | | | Update_rows_log_event must make use of the after image bitmap when detecting which columns to update.
* | [MDEV-6877] Add binlog writing according to columnsVicențiu Ciorbaru2015-06-301-10/+3
| | | | | | | | | | The logging function now writes to the binlog according to the bitmap columns implied by the binlog_row_image variable.
* | [MDEV-6877] Update Update, Delete and Write row log eventVicențiu Ciorbaru2015-06-301-10/+3
| | | | | | | | The row events no longer require columns arguments.
* | [MDEV-6877] Added a bitmap compare function for binlog_row_imageVicențiu Ciorbaru2015-06-301-0/+49
| | | | | | | | | | The function compares bitmaps according to the binlog_row_image variable setting.
* | MDEV-6676: Optimistic parallel replicationKristian Nielsen2015-02-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjust the configuration options, as discussed on the maria-developers@ mailing list. The option to hint a transaction to not be replicated in parallel is now called @@skip_parallel_replication, consistent with @@skip_replication. And the --slave-parallel-mode is now simplified to have just one of the following values: none minimal conservative optimistic aggressive This reflects successively harder efforts to find opportunities to run things in parallel on the slave. It allows to extend the server with more automatic heuristics in the future without having to introduce a new configuration option for each and every one.
* | Merge branch '10.0' into merge-wipSergei Golubchik2015-01-311-2/+2
|\ \ | |/
| * 5.5 mergeSergei Golubchik2015-01-211-2/+2
| |\
| | * mysql-5.5.41 mergeSergei Golubchik2014-12-191-2/+2
| | |\
| | | * Bug#19145698: READ OUT OF BOUNDS ISSUESujatha Sivakumar2014-10-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ======== In a master slave replication if a slave receives a Start_log_event_v3 the payload is expected to be of fixed size. If a payload which is smaller than the fixed size is received it causes a read out of bounds issue. Analysis: ======== According to documentation the fixed data part of Start_log_event_v3 looks as shown below. 2 bytes: The binary log format version 50 bytes: The MySQL server's version 4 bytes: Timestamp in seconds when this event was created Since the payload is expected to be of fixed size, therefore ST_SERVER_VER_LEN (50) bytes are memcpy'ed into server_version. But if a malicious master sends a shorter payload it causes a read out of bounds issue. Fix: === In Start_log_event_v3 event's constructor a check has been added which expects the minimum payload length to be of size common_header_len + ST_COMMON_HEADER_LEN_OFFSET bytes. If a malicious packet of lesser length is received it will be considered as an invalid event. sql/log_event.cc: Added code changes to check the minimum packet length of Start_log_event_v3 should be > 56. sql/log_event.h: Moved server_version from stack to heap and modified is_valid function for Start_log_event_v3.
* | | | MDEV-6676: Optimistic parallel replicationKristian Nielsen2014-12-061-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement a new mode for parallel replication. In this mode, all transactions are optimistically attempted applied in parallel. In case of conflicts, the offending transaction is rolled back and retried later non-parallel. This is an early-release patch to facilitate testing, more changes to user interface / options will be expected. The new mode is not enabled by default.
* | | | Merge 10.0.14 into 10.1Sergei Golubchik2014-10-151-1/+10
|\ \ \ \ | |/ / /
| * | | MDEV-5799: Error messages written upon LOST EVENTS incident are corruptedKristian Nielsen2014-06-251-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is MySQL Bug#59123. The message string stored in an INCIDENT event was not zero-terminated. This caused any following checksum bytes (if enabled on the master) to be output to the error log as trailing garbage when the message was printed to the error log. Backport the patch from MySQL 5.6: revno: 2876.228.200 revision-id: zhenxing.he@sun.com-20110111051323-w2xnzvcjn46x6h6u committer: He Zhenxing <zhenxing.he@sun.com> timestamp: Tue 2011-01-11 13:13:23 +0800 message: BUG#59123 rpl_stm_binlog_max_cache_size fails sporadically with found warnings Also add a test case.
* | | | MDEV-6247: Merge 10.0-galera to 10.1.Jan Lindström2014-08-261-1/+5
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | Merged lp:maria/maria-10.0-galera up to revision 3879. Added a new functions to handler API to forcefully abort_transaction, producing fake_trx_id, get_checkpoint and set_checkpoint for XA. These were added for future possiblity to add more storage engines that could use galera replication.
* | | MDEV-6153 Trivial Lintian errors in MariaDB sources: spelling errors and ↵Sergei Golubchik2014-05-131-1/+1
| | | | | | | | | | | | wrong executable bits
* | | 5.5 mergeSergei Golubchik2014-05-091-3/+17
|\ \ \ | |/ /
| * | mysql-5.5.37 selective mergeSergei Golubchik2014-03-271-1/+15
| |\ \ | | |/
| | * BUG#17066269Luis Soares2014-01-091-1/+15
| | |\ | | | | | | | | | | | | | | | | | | | | - Automerged from bug branch into latest mysql-5.5. - Fixed trailing whitespaces. - Updated the copyright notice year to 2014.
| | | * BUG#17066269: AUTO_INC VALUE NOT PROPERLY GENERATED WITH RBR ANDLuis Soares2013-12-181-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AUTO_INC COLUMN ONLY ON SLAVE In RBR, if the slave's table as one additional auto_inc column, then, it will insert the value 0 instead of generating the next auto_inc number. We fix this by checking that if an auto_inc extra column exists, when compared to column data of the row event, we explicitly set it to NULL and flag the engine that a nulled auto_inc column will be inserted.
* | | | commentsSergei Golubchik2014-05-011-2/+5
| | | |
* | | | make append_query_string() more usable:Sergei Golubchik2014-03-261-3/+0
| | | | | | | | | | | | | | | | simplify the prototype and move it to sql_string.h
* | | | RBR triggers compiled-out with ifdefs in 10.0unknown2014-03-191-1/+1
| | | |
* | | | MDEV-9095: Executing triggers on slave in row-based replicationunknown2014-03-191-2/+25
| | | |
* | | | Merge MDEV-5754, MDEV-5769, and MDEV-5764 into 10.0unknown2014-03-041-3/+6
|\ \ \ \
| * | | | MDEV-5754: MySQL 5.5 slaves cannot replicate from MariaDB 10.0unknown2014-03-041-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was when a GTID event was part of a group commit, and so contained a commit id. The code that replaces GTID with a BEGIN event for old slaves did not correctly handle this case. Fix the code so that the GTID with commit id can also be properly replaced with a BEGIN query event. The extra two bytes are in the BEGIN event replaced with a dummy, empty time zone string.
* | | | | 10.0-base mergeSergei Golubchik2014-02-261-7/+2
|\ \ \ \ \
| * \ \ \ \ 5.5 mergeSergei Golubchik2014-02-251-7/+2
| |\ \ \ \ \ | | |/ / / / | |/| / / / | | |/ / /
| | * | | MySQL-5.5.36 mergeSergei Golubchik2014-02-171-7/+2
| | |\ \ \ | | | |/ / | | | | | | | | | | (without few incorrect bugfixes and with 1250 files where only a copyright year was changed)
| | | * | Bug#17632978 SLAVE CRASHES IF ROW EVENT IS CORRUPTEDVenkatesh Duggirala2013-12-171-6/+2
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (MYSQLBINLOG -V CRASHES WITH THAT BINLOG) Problem: If slave receives a corrupted row event, slave server is crashing. Analysis: When slave is unpacking the row event, it is not validating the data before applying the event. If the data is corrupted for eg: the length of a field is wrong, it could end up reading wrong data leading to a crash. A similar problem happens when mysqlbinlog tool is used against a corrupted binlog using '-v' option. Due to -v option, the tool tries to print the values of all the fields. Corrupted field length could lead to a crash. Fix: Before unpacking the field, a verification will be made on the length. If it falls into the event range, only then it will be unpacked. Otherwise, "ER_SLAVE_CORRUPT_EVENT" error will be thrown. Incase mysqlbinlog -v case, the field value will not be printed and the processing of the file will be stopped. sql/field.h: Removed a function which is not required anymore sql/log_event.cc: Adding a validation on the field length before the tool tries to print the value. sql/log_event.h: Changing unpack_row call according to the new arguments sql/log_event_old.h: Changing unpack_row call according to the new arguments sql/rpl_record.cc: Adding a new argument 'row_end' which tells the end position of the complete data in the row event. It will be used to do validation before doing 'unpack' field. sql/rpl_record.h: Adding a new argument 'row_end' which tells the end position of the complete data in the row event. It will be used to do validation before doing 'unpack' field. sql/rpl_utility.cc: Now calc_field_size() is required for client too.
* | | | Merge 10.0-base -> 10.0unknown2014-02-111-0/+2
|\ \ \ \ | |/ / /
| * | | MDEV-4937: sql_slave_skip_counter does not work with GTIDunknown2014-02-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a side-effect of purge_relay_logs(), sql_slave_skip_counter was silently ignored in GTID mode. But sql_slave_skip_counter in fact is not a good match with GTID. And it is not really needed either, as users can explicitly set @@gtid_slave_pos to skip specific GTIDs, in a way that matches well how GTID replication works. So with this patch, we give an error on attempts to set sql_slave_skip_counter when using GTID, with a suggestion to use gtid_slave_pos instead, if needed.
* | | | MDEV-5115 RBR from MySQL 5.6 to MariaDB 10.0 does not workSergei Golubchik2013-12-091-10/+38
|/ / / | | | | | | | | | Patially merge WL#5917, to understand v2 row events
* | | Merge MDEV-4506: Parallel replication into 10.0-base.unknown2013-11-011-80/+114
|\ \ \
| * | | Fixes for parallel slave:Michael Widenius2013-10-141-20/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Made slaves temporary table multi-thread slave safe by adding mutex around save_temporary_table usage. - rli->save_temporary_tables is the active list of all used temporary tables - This is copied to THD->temporary_tables when temporary tables are opened and updated when temporary tables are closed - Added THD->lock_temporary_tables() and THD->unlock_temporary_tables() to simplify this. - Relay_log_info->sql_thd renamed to Relay_log_info->sql_driver_thd to avoid wrong usage for merged code. - Added is_part_of_group() to mark functions that are part of the next function. This replaces setting IN_STMT when events are executed. - Added is_begin(), is_commit() and is_rollback() functions to Query_log_event to simplify code. - If slave_skip_counter is set run things in single threaded mode. This simplifies code for skipping events. - Updating state of relay log (IN_STMT and IN_TRANSACTION) is moved to one single function: update_state_of_relay_log() We can't use OPTION_BEGIN to check for the state anymore as the sql_driver and sql execution threads may be different. Clear IN_STMT and IN_TRANSACTION in init_relay_log_pos() and Relay_log_info::cleanup_context() to ensure the flags doesn't survive slave restarts is_in_group() is now independent of state of executed transaction. - Reset thd->transaction.all.modified_non_trans_table() if we did set it for single table row events. This was mainly for keeping the flag as documented. - Changed slave_open_temp_tables to uint32 to be able to use atomic operators on it. - Relay_log_info::sleep_lock -> rpl_group_info::sleep_lock - Relay_log_info::sleep_cond -> rpl_group_info::sleep_cond - Changed some functions to take rpl_group_info instead of Relay_log_info to make them multi-slave safe and to simplify usage - do_shall_skip() - continue_group() - sql_slave_killed() - next_event() - Simplifed arguments to io_salve_killed(), check_io_slave_killed() and sql_slave_killed(); No reason to supply THD as this is part of the given structure. - set_thd_in_use_temporary_tables() removed as in_use is set on usage - Added information to thd_proc_info() which thread is waiting for slave mutex to exit. - In open_table() reuse code from find_temporary_table() Other things: - More DBUG statements - Fixed the rpl_incident.test can be run with --debug - More comments - Disabled not used function rpl_connect_master() mysql-test/suite/perfschema/r/all_instances.result: Moved sleep_lock and sleep_cond to rpl_group_info mysql-test/suite/rpl/r/rpl_incident.result: Updated result mysql-test/suite/rpl/t/rpl_incident-master.opt: Not needed anymore mysql-test/suite/rpl/t/rpl_incident.test: Fixed that test can be run with --debug sql/handler.cc: More DBUG_PRINT sql/log.cc: More comments sql/log_event.cc: Added DBUG statements do_shall_skip(), continue_group() now takes rpl_group_info param Use is_begin(), is_commit() and is_rollback() functions instead of inspecting query string We don't have set slaves temporary tables 'in_use' as this is now done when tables are opened. Removed IN_STMT flag setting. This is now done in update_state_of_relay_log() Use IN_TRANSACTION flag to test state of relay log. In rows_event_stmt_cleanup() reset thd->transaction.all.modified_non_trans_table if we had set this before. sql/log_event.h: do_shall_skip(), continue_group() now takes rpl_group_info param Added is_part_of_group() to mark events that are part of the next event. This replaces setting IN_STMT when events are executed. Added is_begin(), is_commit() and is_rollback() functions to Query_log_event to simplify code. sql/log_event_old.cc: Removed IN_STMT flag setting. This is now done in update_state_of_relay_log() do_shall_skip(), continue_group() now takes rpl_group_info param sql/log_event_old.h: Added is_part_of_group() to mark events that are part of the next event. do_shall_skip(), continue_group() now takes rpl_group_info param sql/mysqld.cc: Changed slave_open_temp_tables to uint32 to be able to use atomic operators on it. Relay_log_info::sleep_lock -> Rpl_group_info::sleep_lock Relay_log_info::sleep_cond -> Rpl_group_info::sleep_cond sql/mysqld.h: Updated types and names sql/rpl_gtid.cc: More DBUG sql/rpl_parallel.cc: Updated TODO section Set thd for event that is execution Use new is_begin(), is_commit() and is_rollback() functions. More comments sql/rpl_rli.cc: sql_thd -> sql_driver_thd Relay_log_info::sleep_lock -> rpl_group_info::sleep_lock Relay_log_info::sleep_cond -> rpl_group_info::sleep_cond Clear IN_STMT and IN_TRANSACTION in init_relay_log_pos() and Relay_log_info::cleanup_context() to ensure the flags doesn't survive slave restarts. Reset table->in_use for temporary tables as the table may have been used by another THD. Use IN_TRANSACTION instead of OPTION_BEGIN to check state of relay log. Removed IN_STMT flag setting. This is now done in update_state_of_relay_log() sql/rpl_rli.h: Changed relay log state flags to bit masks instead of bit positions (most other code we have uses bit masks) Added IN_TRANSACTION to mark if we are in a BEGIN ... COMMIT section. save_temporary_tables is now thread safe Relay_log_info::sleep_lock -> rpl_group_info::sleep_lock Relay_log_info::sleep_cond -> rpl_group_info::sleep_cond Relay_log_info->sql_thd renamed to Relay_log_info->sql_driver_thd to avoid wrong usage for merged code is_in_group() is now independent of state of executed transaction. sql/slave.cc: Simplifed arguments to io_salve_killed(), sql_slave_killed() and check_io_slave_killed(); No reason to supply THD as this is part of the given structure. set_thd_in_use_temporary_tables() removed as in_use is set on usage in sql_base.cc sql_thd -> sql_driver_thd More DBUG Added update_state_of_relay_log() which will calculate the IN_STMT and IN_TRANSACTION state of the relay log after the current element is executed. If slave_skip_counter is set run things in single threaded mode. Simplifed arguments to io_salve_killed(), check_io_slave_killed() and sql_slave_killed(); No reason to supply THD as this is part of the given structure. Added information to thd_proc_info() which thread is waiting for slave mutex to exit. Disabled not used function rpl_connect_master() Updated argument to next_event() sql/sql_base.cc: Added mutex around usage of slave's temporary tables. The active list is always kept up to date in sql->rgi_slave->save_temporary_tables. Clear thd->temporary_tables after query (safety) More DBUG When using temporary table, set table->in_use to current thd as the THD may be different for slave threads. Some code is ifdef:ed with REMOVE_AFTER_MERGE_WITH_10 as the given code in 10.0 is not yet in this tree. In open_table() reuse code from find_temporary_table() sql/sql_binlog.cc: rli->sql_thd -> rli->sql_driver_thd Remove duplicate setting of rgi->rli sql/sql_class.cc: Added helper functions rgi_lock_temporary_tables() and rgi_unlock_temporary_tables() Would have been nicer to have these inline, but there was no easy way to do that sql/sql_class.h: Added functions to protect slaves temporary tables sql/sql_parse.cc: Added DBUG_PRINT sql/transaction.cc: Added comment
| * | | MDEV-4506: parallel replication.unknown2013-09-161-8/+8
| | | | | | | | | | | | | | | | | | | | Add a simple test case. Fix bugs found.