You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3475 lines
104 KiB

26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
26 years ago
25 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
BUG#22864 (Rollback following CREATE... SELECT discards 'CREATE TABLE' from log): When row-based logging is used, the CREATE-SELECT is written as two parts: as a CREATE TABLE statement and as the rows for the table. For both transactional and non-transactional tables, the CREATE TABLE statement was written to the transaction cache, as were the rows, and on statement end, the entire transaction cache was written to the binary log if the table was non-transactional. For transactional tables, the events were kept in the transaction cache until end of transaction (or statement that were not part of a transaction). For the case when AUTOCOMMIT=0 and we are creating a transactional table using a create select, we would then keep the CREATE TABLE statement and the rows for the CREATE-SELECT, while executing the following statements. On a rollback, the transaction cache would then be cleared, which would also remove the CREATE TABLE statement. Hence no table would be created on the slave, while there is an empty table on the master. This relates to BUG#22865 where the table being created exists on the master, but not on the slave during insertion of rows into the newly created table. This occurs since the CREATE TABLE statement were still in the transaction cache until the statement finished executing, and possibly longer if the table was transactional. This patch changes the behaviour of the CREATE-SELECT statement by adding an implicit commit at the end of the statement when creating non-temporary tables. Hence, non-temporary tables will be written to the binary log on completion, and in the even of AUTOCOMMIT=0, a new transaction will be started. Temporary tables do not commit an ongoing transaction: neither as a pre- not a post-commit. The events for both transactional and non-transactional tables are saved in the transaction cache, and written to the binary log at end of the statement.
19 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
BUG#22864 (Rollback following CREATE... SELECT discards 'CREATE TABLE' from log): When row-based logging is used, the CREATE-SELECT is written as two parts: as a CREATE TABLE statement and as the rows for the table. For both transactional and non-transactional tables, the CREATE TABLE statement was written to the transaction cache, as were the rows, and on statement end, the entire transaction cache was written to the binary log if the table was non-transactional. For transactional tables, the events were kept in the transaction cache until end of transaction (or statement that were not part of a transaction). For the case when AUTOCOMMIT=0 and we are creating a transactional table using a create select, we would then keep the CREATE TABLE statement and the rows for the CREATE-SELECT, while executing the following statements. On a rollback, the transaction cache would then be cleared, which would also remove the CREATE TABLE statement. Hence no table would be created on the slave, while there is an empty table on the master. This relates to BUG#22865 where the table being created exists on the master, but not on the slave during insertion of rows into the newly created table. This occurs since the CREATE TABLE statement were still in the transaction cache until the statement finished executing, and possibly longer if the table was transactional. This patch changes the behaviour of the CREATE-SELECT statement by adding an implicit commit at the end of the statement when creating non-temporary tables. Hence, non-temporary tables will be written to the binary log on completion, and in the even of AUTOCOMMIT=0, a new transaction will be started. Temporary tables do not commit an ongoing transaction: neither as a pre- not a post-commit. The events for both transactional and non-transactional tables are saved in the transaction cache, and written to the binary log at end of the statement.
19 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
BUG#22864 (Rollback following CREATE... SELECT discards 'CREATE TABLE' from log): When row-based logging is used, the CREATE-SELECT is written as two parts: as a CREATE TABLE statement and as the rows for the table. For both transactional and non-transactional tables, the CREATE TABLE statement was written to the transaction cache, as were the rows, and on statement end, the entire transaction cache was written to the binary log if the table was non-transactional. For transactional tables, the events were kept in the transaction cache until end of transaction (or statement that were not part of a transaction). For the case when AUTOCOMMIT=0 and we are creating a transactional table using a create select, we would then keep the CREATE TABLE statement and the rows for the CREATE-SELECT, while executing the following statements. On a rollback, the transaction cache would then be cleared, which would also remove the CREATE TABLE statement. Hence no table would be created on the slave, while there is an empty table on the master. This relates to BUG#22865 where the table being created exists on the master, but not on the slave during insertion of rows into the newly created table. This occurs since the CREATE TABLE statement were still in the transaction cache until the statement finished executing, and possibly longer if the table was transactional. This patch changes the behaviour of the CREATE-SELECT statement by adding an implicit commit at the end of the statement when creating non-temporary tables. Hence, non-temporary tables will be written to the binary log on completion, and in the even of AUTOCOMMIT=0, a new transaction will be started. Temporary tables do not commit an ongoing transaction: neither as a pre- not a post-commit. The events for both transactional and non-transactional tables are saved in the transaction cache, and written to the binary log at end of the statement.
19 years ago
BUG#22864 (Rollback following CREATE... SELECT discards 'CREATE TABLE' from log): When row-based logging is used, the CREATE-SELECT is written as two parts: as a CREATE TABLE statement and as the rows for the table. For both transactional and non-transactional tables, the CREATE TABLE statement was written to the transaction cache, as were the rows, and on statement end, the entire transaction cache was written to the binary log if the table was non-transactional. For transactional tables, the events were kept in the transaction cache until end of transaction (or statement that were not part of a transaction). For the case when AUTOCOMMIT=0 and we are creating a transactional table using a create select, we would then keep the CREATE TABLE statement and the rows for the CREATE-SELECT, while executing the following statements. On a rollback, the transaction cache would then be cleared, which would also remove the CREATE TABLE statement. Hence no table would be created on the slave, while there is an empty table on the master. This relates to BUG#22865 where the table being created exists on the master, but not on the slave during insertion of rows into the newly created table. This occurs since the CREATE TABLE statement were still in the transaction cache until the statement finished executing, and possibly longer if the table was transactional. This patch changes the behaviour of the CREATE-SELECT statement by adding an implicit commit at the end of the statement when creating non-temporary tables. Hence, non-temporary tables will be written to the binary log on completion, and in the even of AUTOCOMMIT=0, a new transaction will be started. Temporary tables do not commit an ongoing transaction: neither as a pre- not a post-commit. The events for both transactional and non-transactional tables are saved in the transaction cache, and written to the binary log at end of the statement.
19 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
19 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
23 years ago
23 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
18 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
26 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
26 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
26 years ago
26 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
23 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
26 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
Fix for BUG#24432 "INSERT... ON DUPLICATE KEY UPDATE skips auto_increment values". When in an INSERT ON DUPLICATE KEY UPDATE, using an autoincrement column, we inserted some autogenerated values and also updated some rows, some autogenerated values were not used (for example, even if 10 was the largest autoinc value in the table at the start of the statement, 12 could be the first autogenerated value inserted by the statement, instead of 11). One autogenerated value was lost per updated row. Led to exhausting the range of the autoincrement column faster. Bug introduced by fix of BUG#20188; present since 5.0.24 and 5.1.12. This bug breaks replication from a pre-5.0.24 master. But the present bugfix, as it makes INSERT ON DUP KEY UPDATE behave like pre-5.0.24, breaks replication from a [5.0.24,5.0.34] master to a fixed (5.0.36) slave! To warn users against this when they upgrade their slave, as agreed with the support team, we add code for a fixed slave to detect that it is connected to a buggy master in a situation (INSERT ON DUP KEY UPDATE into autoinc column) likely to break replication, in which case it cannot replicate so stops and prints a message to the slave's error log and to SHOW SLAVE STATUS. For 5.0.36->[5.0.24,5.0.34] replication we cannot warn as master does not know the slave's version (but we always recommended to users to have slave at least as new as master). As agreed with support, I'll also ask for an alert to be put into the MySQL Network Monitoring and Advisory Service.
19 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
Fix for BUG#24432 "INSERT... ON DUPLICATE KEY UPDATE skips auto_increment values". When in an INSERT ON DUPLICATE KEY UPDATE, using an autoincrement column, we inserted some autogenerated values and also updated some rows, some autogenerated values were not used (for example, even if 10 was the largest autoinc value in the table at the start of the statement, 12 could be the first autogenerated value inserted by the statement, instead of 11). One autogenerated value was lost per updated row. Led to exhausting the range of the autoincrement column faster. Bug introduced by fix of BUG#20188; present since 5.0.24 and 5.1.12. This bug breaks replication from a pre-5.0.24 master. But the present bugfix, as it makes INSERT ON DUP KEY UPDATE behave like pre-5.0.24, breaks replication from a [5.0.24,5.0.34] master to a fixed (5.0.36) slave! To warn users against this when they upgrade their slave, as agreed with the support team, we add code for a fixed slave to detect that it is connected to a buggy master in a situation (INSERT ON DUP KEY UPDATE into autoinc column) likely to break replication, in which case it cannot replicate so stops and prints a message to the slave's error log and to SHOW SLAVE STATUS. For 5.0.36->[5.0.24,5.0.34] replication we cannot warn as master does not know the slave's version (but we always recommended to users to have slave at least as new as master). As agreed with support, I'll also ask for an alert to be put into the MySQL Network Monitoring and Advisory Service.
19 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
26 years ago
26 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
26 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
This will be pushed only after I fix the testsuite. This is the main commit for Worklog tasks: * A more dynamic binlog format which allows small changes (1064) * Log session variables in Query_log_event (1063) Below 5.0 means 5.0.0. MySQL 5.0 is able to replicate FOREIGN_KEY_CHECKS, UNIQUE_KEY_CHECKS (for speed), SQL_AUTO_IS_NULL, SQL_MODE. Not charsets (WL#1062), not some vars (I can only think of SQL_SELECT_LIMIT, which deserves a special treatment). Note that this works for queries, except LOAD DATA INFILE (for this it would have to wait for Dmitri's push of WL#874, which in turns waits for the present push, so... the deadlock must be broken!). Note that when Dmitri pushes WL#874 in 5.0.1, 5.0.0 won't be able to replicate a LOAD DATA INFILE from 5.0.1. Apart from that, the new binlog format is designed so that it can tolerate a little variation in the events (so that a 5.0.0 slave could replicate a 5.0.1 master, except for LOAD DATA INFILE unfortunately); that is, when I later add replication of charsets it should break nothing. And when I later add a UID to every event, it should break nothing. The main change brought by this patch is a new type of event, Format_description_log_event, which describes some lengthes in other event types. This event is needed for the master/slave/mysqlbinlog to understand a 5.0 log. Thanks to this event, we can later add more bytes to the header of every event without breaking compatibility. Inside Query_log_event, we have some additional dynamic format, as every Query_log_event can have a different number of status variables, stored as pairs (code, value); that's how SQL_MODE and session variables and catalog are stored. Like this, we can later add count of affected rows, charsets... and we can have options --don't-log-count-affected-rows if we want. MySQL 5.0 is able to run on 4.x relay logs, 4.x binlogs. Upgrading a 4.x master to 5.0 is ok (no need to delete binlogs), upgrading a 4.x slave to 5.0 is ok (no need to delete relay logs); so both can be "hot" upgrades. Upgrading a 3.23 master to 5.0 requires as much as upgrading it to 4.0. 3.23 and 4.x can't be slaves of 5.0. So downgrading from 5.0 to 4.x may be complicated. Log_event::log_pos is now the position of the end of the event, which is more useful than the position of the beginning. We take care about compatibility with <5.0 (in which log_pos is the beginning). I added a short test for replication of SQL_MODE and some other variables. TODO: - after committing this, merge the latest 5.0 into it - fix all tests - update the manual with upgrade notes.
22 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
18 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
18 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
18 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
18 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
18 years ago
WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
19 years ago
BUG#21842 (Cluster fails to replicate to innodb or myisam with err 134 using TPC-B): Problem: A RBR event can contain incomplete row data (only key value and fields which have been changed). In that case, when the row is unpacked into record and written to a table, the missing fields get incorrect NULL values leading to master-slave inconsistency. Solution: Use values found in slave's table for columns which are not given in the rows event. The code for writing a single row uses the following algorithm: 1. unpack row_data into table->record[0], 2. try to insert record, 3. if duplicate record found, fetch it into table->record[0], 4. unpack row_data into table->record[0], 5. write table->record[0] into the table. Where row_data is the row as stored in the data area of a rows event. Thus: a) unpacking of row_data happens at the time when row is written into a table, b) when unpacking (in step 4), only columns present in row_data are overwritten - all other columns remain as they were found in the table. Since all data needed for the above algorithm is stored inside Rows_log_event class, functions which locate and write rows are turned into methods of that class. replace_record() -> Rows_log_event::write_row() find_and_fetch_row() -> Rows_log_event::find_row() Both methods take row data from event's data buffer - the row being processed is pointed by m_curr_row. They unpack the data as needed into table's record buffers record[0] or record[1]. When row is unpacked, m_curr_row_end is set to point at next row in the data buffer. Other changes introduced in this changeset: - Change signature of unpack_row(): don't report errors and don't setup table's rw_set here. Errors can happen only when setting default values in prepare_record() function and are detected there. - In Rows_log_event and derived classes, don't pass arguments to the execution primitives (do_...() member functions) but use class members instead. - Move old row handling code into log_event_old.cc to be used by *_rows_log_event_old classes. Also, a new test rpl_ndb_2other is added which tests basic replication from master using ndb tables to slave storing the same tables using (possibly) different engine (myisam,innodb). Test is based on existing tests rpl_ndb_2myisam and rpl_ndb_2innodb. However, these tests doesn't work for various reasons and currently are disabled (see BUG#19227). The new test differs from the ones it is based on as follows: 1. Single test tests replication with different storage engines on slave (myisam, innodb, ndb). 2. Include file extra/rpl_tests/rpl_ndb_2multi_eng.test containing original tests is replaced by extra/rpl_tests/rpl_ndb_2multi_basic.test which doesn't contain tests using partitioned tables as these don't work currently. Instead, it tests replication to a slave which has more or less columns than master. 3. Include file include/rpl_multi_engine3.inc is replaced with include/rpl_multi_engine2.inc. The later differs by performing slightly different operations (updating more than one row in the table) and clearing table with "TRUNCATE TABLE" statement instead of "DELETE FROM" as replication of "DELETE" doesn't work well in this setting. 4. Slave must use option --log-slave-updates=0 as otherwise execution of replication events generated by ndb fails if table uses a different storage engine on slave (see BUG#29569).
18 years ago
18 years ago
  1. /* Copyright (C) 2000-2006 MySQL AB
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  12. /**
  13. @addtogroup Replication
  14. @{
  15. @file
  16. @brief Binary log event definitions. This includes generic code
  17. common to all types of log events, as well as specific code for each
  18. type of log event.
  19. */
  20. #ifndef _log_event_h
  21. #define _log_event_h
  22. #if defined(USE_PRAGMA_INTERFACE) && !defined(MYSQL_CLIENT)
  23. #pragma interface /* gcc class implementation */
  24. #endif
  25. #include <my_bitmap.h>
  26. #include "rpl_constants.h"
  27. #ifndef MYSQL_CLIENT
  28. #include "rpl_record.h"
  29. #include "rpl_reporting.h"
  30. #endif
  31. /**
  32. Either assert or return an error.
  33. In debug build, the condition will be checked, but in non-debug
  34. builds, the error code given will be returned instead.
  35. @param COND Condition to check
  36. @param ERRNO Error number to return in non-debug builds
  37. */
  38. #ifdef DBUG_OFF
  39. #define ASSERT_OR_RETURN_ERROR(COND, ERRNO) \
  40. do { if (!(COND)) return ERRNO; } while (0)
  41. #else
  42. #define ASSERT_OR_RETURN_ERROR(COND, ERRNO) \
  43. DBUG_ASSERT(COND)
  44. #endif
  45. #define LOG_READ_EOF -1
  46. #define LOG_READ_BOGUS -2
  47. #define LOG_READ_IO -3
  48. #define LOG_READ_MEM -5
  49. #define LOG_READ_TRUNC -6
  50. #define LOG_READ_TOO_LARGE -7
  51. #define LOG_EVENT_OFFSET 4
  52. /*
  53. 3 is MySQL 4.x; 4 is MySQL 5.0.0.
  54. Compared to version 3, version 4 has:
  55. - a different Start_log_event, which includes info about the binary log
  56. (sizes of headers); this info is included for better compatibility if the
  57. master's MySQL version is different from the slave's.
  58. - all events have a unique ID (the triplet (server_id, timestamp at server
  59. start, other) to be sure an event is not executed more than once in a
  60. multimaster setup, example:
  61. M1
  62. / \
  63. v v
  64. M2 M3
  65. \ /
  66. v v
  67. S
  68. if a query is run on M1, it will arrive twice on S, so we need that S
  69. remembers the last unique ID it has processed, to compare and know if the
  70. event should be skipped or not. Example of ID: we already have the server id
  71. (4 bytes), plus:
  72. timestamp_when_the_master_started (4 bytes), a counter (a sequence number
  73. which increments every time we write an event to the binlog) (3 bytes).
  74. Q: how do we handle when the counter is overflowed and restarts from 0 ?
  75. - Query and Load (Create or Execute) events may have a more precise
  76. timestamp (with microseconds), number of matched/affected/warnings rows
  77. and fields of session variables: SQL_MODE,
  78. FOREIGN_KEY_CHECKS, UNIQUE_CHECKS, SQL_AUTO_IS_NULL, the collations and
  79. charsets, the PASSWORD() version (old/new/...).
  80. */
  81. #define BINLOG_VERSION 4
  82. /*
  83. We could have used SERVER_VERSION_LENGTH, but this introduces an
  84. obscure dependency - if somebody decided to change SERVER_VERSION_LENGTH
  85. this would break the replication protocol
  86. */
  87. #define ST_SERVER_VER_LEN 50
  88. /*
  89. These are flags and structs to handle all the LOAD DATA INFILE options (LINES
  90. TERMINATED etc).
  91. */
  92. /*
  93. These are flags and structs to handle all the LOAD DATA INFILE options (LINES
  94. TERMINATED etc).
  95. DUMPFILE_FLAG is probably useless (DUMPFILE is a clause of SELECT, not of LOAD
  96. DATA).
  97. */
  98. #define DUMPFILE_FLAG 0x1
  99. #define OPT_ENCLOSED_FLAG 0x2
  100. #define REPLACE_FLAG 0x4
  101. #define IGNORE_FLAG 0x8
  102. #define FIELD_TERM_EMPTY 0x1
  103. #define ENCLOSED_EMPTY 0x2
  104. #define LINE_TERM_EMPTY 0x4
  105. #define LINE_START_EMPTY 0x8
  106. #define ESCAPED_EMPTY 0x10
  107. /*****************************************************************************
  108. old_sql_ex struct
  109. ****************************************************************************/
  110. struct old_sql_ex
  111. {
  112. char field_term;
  113. char enclosed;
  114. char line_term;
  115. char line_start;
  116. char escaped;
  117. char opt_flags;
  118. char empty_flags;
  119. };
  120. #define NUM_LOAD_DELIM_STRS 5
  121. /*****************************************************************************
  122. sql_ex_info struct
  123. ****************************************************************************/
  124. struct sql_ex_info
  125. {
  126. sql_ex_info() {} /* Remove gcc warning */
  127. char* field_term;
  128. char* enclosed;
  129. char* line_term;
  130. char* line_start;
  131. char* escaped;
  132. int cached_new_format;
  133. uint8 field_term_len,enclosed_len,line_term_len,line_start_len, escaped_len;
  134. char opt_flags;
  135. char empty_flags;
  136. // store in new format even if old is possible
  137. void force_new_format() { cached_new_format = 1;}
  138. int data_size()
  139. {
  140. return (new_format() ?
  141. field_term_len + enclosed_len + line_term_len +
  142. line_start_len + escaped_len + 6 : 7);
  143. }
  144. bool write_data(IO_CACHE* file);
  145. char* init(char* buf,char* buf_end,bool use_new_format);
  146. bool new_format()
  147. {
  148. return ((cached_new_format != -1) ? cached_new_format :
  149. (cached_new_format=(field_term_len > 1 ||
  150. enclosed_len > 1 ||
  151. line_term_len > 1 || line_start_len > 1 ||
  152. escaped_len > 1)));
  153. }
  154. };
  155. /*****************************************************************************
  156. MySQL Binary Log
  157. This log consists of events. Each event has a fixed-length header,
  158. possibly followed by a variable length data body.
  159. The data body consists of an optional fixed length segment (post-header)
  160. and an optional variable length segment.
  161. See the #defines below for the format specifics.
  162. The events which really update data are Query_log_event,
  163. Execute_load_query_log_event and old Load_log_event and
  164. Execute_load_log_event events (Execute_load_query is used together with
  165. Begin_load_query and Append_block events to replicate LOAD DATA INFILE.
  166. Create_file/Append_block/Execute_load (which includes Load_log_event)
  167. were used to replicate LOAD DATA before the 5.0.3).
  168. ****************************************************************************/
  169. #define LOG_EVENT_HEADER_LEN 19 /* the fixed header length */
  170. #define OLD_HEADER_LEN 13 /* the fixed header length in 3.23 */
  171. /*
  172. Fixed header length, where 4.x and 5.0 agree. That is, 5.0 may have a longer
  173. header (it will for sure when we have the unique event's ID), but at least
  174. the first 19 bytes are the same in 4.x and 5.0. So when we have the unique
  175. event's ID, LOG_EVENT_HEADER_LEN will be something like 26, but
  176. LOG_EVENT_MINIMAL_HEADER_LEN will remain 19.
  177. */
  178. #define LOG_EVENT_MINIMAL_HEADER_LEN 19
  179. /* event-specific post-header sizes */
  180. // where 3.23, 4.x and 5.0 agree
  181. #define QUERY_HEADER_MINIMAL_LEN (4 + 4 + 1 + 2)
  182. // where 5.0 differs: 2 for len of N-bytes vars.
  183. #define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 2)
  184. #define LOAD_HEADER_LEN (4 + 4 + 4 + 1 +1 + 4)
  185. #define START_V3_HEADER_LEN (2 + ST_SERVER_VER_LEN + 4)
  186. #define ROTATE_HEADER_LEN 8 // this is FROZEN (the Rotate post-header is frozen)
  187. #define CREATE_FILE_HEADER_LEN 4
  188. #define APPEND_BLOCK_HEADER_LEN 4
  189. #define EXEC_LOAD_HEADER_LEN 4
  190. #define DELETE_FILE_HEADER_LEN 4
  191. #define FORMAT_DESCRIPTION_HEADER_LEN (START_V3_HEADER_LEN+1+LOG_EVENT_TYPES)
  192. #define ROWS_HEADER_LEN 8
  193. #define TABLE_MAP_HEADER_LEN 8
  194. #define EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN (4 + 4 + 4 + 1)
  195. #define EXECUTE_LOAD_QUERY_HEADER_LEN (QUERY_HEADER_LEN + EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN)
  196. #define INCIDENT_HEADER_LEN 2
  197. /*
  198. Max number of possible extra bytes in a replication event compared to a
  199. packet (i.e. a query) sent from client to master;
  200. First, an auxiliary log_event status vars estimation:
  201. */
  202. #define MAX_SIZE_LOG_EVENT_STATUS (4 /* flags2 */ + \
  203. 8 /* sql mode */ + \
  204. 1 + 1 + 255 /* catalog */ + \
  205. 4 /* autoinc */ + \
  206. 6 /* charset */ + \
  207. MAX_TIME_ZONE_NAME_LENGTH)
  208. #define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
  209. LOG_EVENT_HEADER_LEN + /* write_header */ \
  210. QUERY_HEADER_LEN + /* write_data */ \
  211. EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
  212. MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
  213. NAME_LEN + 1)
  214. /*
  215. Event header offsets;
  216. these point to places inside the fixed header.
  217. */
  218. #define EVENT_TYPE_OFFSET 4
  219. #define SERVER_ID_OFFSET 5
  220. #define EVENT_LEN_OFFSET 9
  221. #define LOG_POS_OFFSET 13
  222. #define FLAGS_OFFSET 17
  223. /* start event post-header (for v3 and v4) */
  224. #define ST_BINLOG_VER_OFFSET 0
  225. #define ST_SERVER_VER_OFFSET 2
  226. #define ST_CREATED_OFFSET (ST_SERVER_VER_OFFSET + ST_SERVER_VER_LEN)
  227. #define ST_COMMON_HEADER_LEN_OFFSET (ST_CREATED_OFFSET + 4)
  228. /* slave event post-header (this event is never written) */
  229. #define SL_MASTER_PORT_OFFSET 8
  230. #define SL_MASTER_POS_OFFSET 0
  231. #define SL_MASTER_HOST_OFFSET 10
  232. /* query event post-header */
  233. #define Q_THREAD_ID_OFFSET 0
  234. #define Q_EXEC_TIME_OFFSET 4
  235. #define Q_DB_LEN_OFFSET 8
  236. #define Q_ERR_CODE_OFFSET 9
  237. #define Q_STATUS_VARS_LEN_OFFSET 11
  238. #define Q_DATA_OFFSET QUERY_HEADER_LEN
  239. /* these are codes, not offsets; not more than 256 values (1 byte). */
  240. #define Q_FLAGS2_CODE 0
  241. #define Q_SQL_MODE_CODE 1
  242. /*
  243. Q_CATALOG_CODE is catalog with end zero stored; it is used only by MySQL
  244. 5.0.x where 0<=x<=3. We have to keep it to be able to replicate these
  245. old masters.
  246. */
  247. #define Q_CATALOG_CODE 2
  248. #define Q_AUTO_INCREMENT 3
  249. #define Q_CHARSET_CODE 4
  250. #define Q_TIME_ZONE_CODE 5
  251. /*
  252. Q_CATALOG_NZ_CODE is catalog withOUT end zero stored; it is used by MySQL
  253. 5.0.x where x>=4. Saves one byte in every Query_log_event in binlog,
  254. compared to Q_CATALOG_CODE. The reason we didn't simply re-use
  255. Q_CATALOG_CODE is that then a 5.0.3 slave of this 5.0.x (x>=4) master would
  256. crash (segfault etc) because it would expect a 0 when there is none.
  257. */
  258. #define Q_CATALOG_NZ_CODE 6
  259. #define Q_LC_TIME_NAMES_CODE 7
  260. #define Q_CHARSET_DATABASE_CODE 8
  261. /* Intvar event post-header */
  262. #define I_TYPE_OFFSET 0
  263. #define I_VAL_OFFSET 1
  264. /* Rand event post-header */
  265. #define RAND_SEED1_OFFSET 0
  266. #define RAND_SEED2_OFFSET 8
  267. /* User_var event post-header */
  268. #define UV_VAL_LEN_SIZE 4
  269. #define UV_VAL_IS_NULL 1
  270. #define UV_VAL_TYPE_SIZE 1
  271. #define UV_NAME_LEN_SIZE 4
  272. #define UV_CHARSET_NUMBER_SIZE 4
  273. /* Load event post-header */
  274. #define L_THREAD_ID_OFFSET 0
  275. #define L_EXEC_TIME_OFFSET 4
  276. #define L_SKIP_LINES_OFFSET 8
  277. #define L_TBL_LEN_OFFSET 12
  278. #define L_DB_LEN_OFFSET 13
  279. #define L_NUM_FIELDS_OFFSET 14
  280. #define L_SQL_EX_OFFSET 18
  281. #define L_DATA_OFFSET LOAD_HEADER_LEN
  282. /* Rotate event post-header */
  283. #define R_POS_OFFSET 0
  284. #define R_IDENT_OFFSET 8
  285. /* CF to DF handle LOAD DATA INFILE */
  286. /* CF = "Create File" */
  287. #define CF_FILE_ID_OFFSET 0
  288. #define CF_DATA_OFFSET CREATE_FILE_HEADER_LEN
  289. /* AB = "Append Block" */
  290. #define AB_FILE_ID_OFFSET 0
  291. #define AB_DATA_OFFSET APPEND_BLOCK_HEADER_LEN
  292. /* EL = "Execute Load" */
  293. #define EL_FILE_ID_OFFSET 0
  294. /* DF = "Delete File" */
  295. #define DF_FILE_ID_OFFSET 0
  296. /* TM = "Table Map" */
  297. #define TM_MAPID_OFFSET 0
  298. #define TM_FLAGS_OFFSET 6
  299. /* RW = "RoWs" */
  300. #define RW_MAPID_OFFSET 0
  301. #define RW_FLAGS_OFFSET 6
  302. /* ELQ = "Execute Load Query" */
  303. #define ELQ_FILE_ID_OFFSET QUERY_HEADER_LEN
  304. #define ELQ_FN_POS_START_OFFSET ELQ_FILE_ID_OFFSET + 4
  305. #define ELQ_FN_POS_END_OFFSET ELQ_FILE_ID_OFFSET + 8
  306. #define ELQ_DUP_HANDLING_OFFSET ELQ_FILE_ID_OFFSET + 12
  307. /* 4 bytes which all binlogs should begin with */
  308. #define BINLOG_MAGIC "\xfe\x62\x69\x6e"
  309. /*
  310. The 2 flags below were useless :
  311. - the first one was never set
  312. - the second one was set in all Rotate events on the master, but not used for
  313. anything useful.
  314. So they are now removed and their place may later be reused for other
  315. flags. Then one must remember that Rotate events in 4.x have
  316. LOG_EVENT_FORCED_ROTATE_F set, so one should not rely on the value of the
  317. replacing flag when reading a Rotate event.
  318. I keep the defines here just to remember what they were.
  319. */
  320. #ifdef TO_BE_REMOVED
  321. #define LOG_EVENT_TIME_F 0x1
  322. #define LOG_EVENT_FORCED_ROTATE_F 0x2
  323. #endif
  324. /*
  325. This flag only makes sense for Format_description_log_event. It is set
  326. when the event is written, and *reset* when a binlog file is
  327. closed (yes, it's the only case when MySQL modifies already written
  328. part of binlog). Thus it is a reliable indicator that binlog was
  329. closed correctly. (Stop_log_event is not enough, there's always a
  330. small chance that mysqld crashes in the middle of insert and end of
  331. the binlog would look like a Stop_log_event).
  332. This flag is used to detect a restart after a crash, and to provide
  333. "unbreakable" binlog. The problem is that on a crash storage engines
  334. rollback automatically, while binlog does not. To solve this we use this
  335. flag and automatically append ROLLBACK to every non-closed binlog (append
  336. virtually, on reading, file itself is not changed). If this flag is found,
  337. mysqlbinlog simply prints "ROLLBACK" Replication master does not abort on
  338. binlog corruption, but takes it as EOF, and replication slave forces a
  339. rollback in this case.
  340. Note, that old binlogs does not have this flag set, so we get a
  341. a backward-compatible behaviour.
  342. */
  343. #define LOG_EVENT_BINLOG_IN_USE_F 0x1
  344. /**
  345. @def LOG_EVENT_THREAD_SPECIFIC_F
  346. If the query depends on the thread (for example: TEMPORARY TABLE).
  347. Currently this is used by mysqlbinlog to know it must print
  348. SET @@PSEUDO_THREAD_ID=xx; before the query (it would not hurt to print it
  349. for every query but this would be slow).
  350. */
  351. #define LOG_EVENT_THREAD_SPECIFIC_F 0x4
  352. /**
  353. @def LOG_EVENT_SUPPRESS_USE_F
  354. Suppress the generation of 'USE' statements before the actual
  355. statement. This flag should be set for any events that does not need
  356. the current database set to function correctly. Most notable cases
  357. are 'CREATE DATABASE' and 'DROP DATABASE'.
  358. This flags should only be used in exceptional circumstances, since
  359. it introduce a significant change in behaviour regarding the
  360. replication logic together with the flags --binlog-do-db and
  361. --replicated-do-db.
  362. */
  363. #define LOG_EVENT_SUPPRESS_USE_F 0x8
  364. /*
  365. The table map version internal to the log should be increased after
  366. the event has been written to the binary log.
  367. */
  368. #define LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F 0x10
  369. /**
  370. @def OPTIONS_WRITTEN_TO_BIN_LOG
  371. OPTIONS_WRITTEN_TO_BIN_LOG are the bits of thd->options which must
  372. be written to the binlog. OPTIONS_WRITTEN_TO_BIN_LOG could be
  373. written into the Format_description_log_event, so that if later we
  374. don't want to replicate a variable we did replicate, or the
  375. contrary, it's doable. But it should not be too hard to decide once
  376. for all of what we replicate and what we don't, among the fixed 32
  377. bits of thd->options.
  378. I (Guilhem) have read through every option's usage, and it looks
  379. like OPTION_AUTO_IS_NULL and OPTION_NO_FOREIGN_KEYS are the only
  380. ones which alter how the query modifies the table. It's good to
  381. replicate OPTION_RELAXED_UNIQUE_CHECKS too because otherwise, the
  382. slave may insert data slower than the master, in InnoDB.
  383. OPTION_BIG_SELECTS is not needed (the slave thread runs with
  384. max_join_size=HA_POS_ERROR) and OPTION_BIG_TABLES is not needed
  385. either, as the manual says (because a too big in-memory temp table
  386. is automatically written to disk).
  387. */
  388. #define OPTIONS_WRITTEN_TO_BIN_LOG \
  389. (OPTION_AUTO_IS_NULL | OPTION_NO_FOREIGN_KEY_CHECKS | \
  390. OPTION_RELAXED_UNIQUE_CHECKS | OPTION_NOT_AUTOCOMMIT)
  391. /* Shouldn't be defined before */
  392. #define EXPECTED_OPTIONS \
  393. ((ULL(1) << 14) | (ULL(1) << 26) | (ULL(1) << 27) | (ULL(1) << 19))
  394. #if OPTIONS_WRITTEN_TO_BIN_LOG != EXPECTED_OPTIONS
  395. #error OPTIONS_WRITTEN_TO_BIN_LOG must NOT change their values!
  396. #endif
  397. #undef EXPECTED_OPTIONS /* You shouldn't use this one */
  398. /**
  399. @enum Log_event_type
  400. Enumeration type for the different types of log events.
  401. */
  402. enum Log_event_type
  403. {
  404. /*
  405. Every time you update this enum (when you add a type), you have to
  406. fix Format_description_log_event::Format_description_log_event().
  407. */
  408. UNKNOWN_EVENT= 0,
  409. START_EVENT_V3= 1,
  410. QUERY_EVENT= 2,
  411. STOP_EVENT= 3,
  412. ROTATE_EVENT= 4,
  413. INTVAR_EVENT= 5,
  414. LOAD_EVENT= 6,
  415. SLAVE_EVENT= 7,
  416. CREATE_FILE_EVENT= 8,
  417. APPEND_BLOCK_EVENT= 9,
  418. EXEC_LOAD_EVENT= 10,
  419. DELETE_FILE_EVENT= 11,
  420. /*
  421. NEW_LOAD_EVENT is like LOAD_EVENT except that it has a longer
  422. sql_ex, allowing multibyte TERMINATED BY etc; both types share the
  423. same class (Load_log_event)
  424. */
  425. NEW_LOAD_EVENT= 12,
  426. RAND_EVENT= 13,
  427. USER_VAR_EVENT= 14,
  428. FORMAT_DESCRIPTION_EVENT= 15,
  429. XID_EVENT= 16,
  430. BEGIN_LOAD_QUERY_EVENT= 17,
  431. EXECUTE_LOAD_QUERY_EVENT= 18,
  432. TABLE_MAP_EVENT = 19,
  433. /*
  434. These event numbers were used for 5.1.0 to 5.1.15 and are
  435. therefore obsolete.
  436. */
  437. PRE_GA_WRITE_ROWS_EVENT = 20,
  438. PRE_GA_UPDATE_ROWS_EVENT = 21,
  439. PRE_GA_DELETE_ROWS_EVENT = 22,
  440. /*
  441. These event numbers are used from 5.1.16 and forward
  442. */
  443. WRITE_ROWS_EVENT = 23,
  444. UPDATE_ROWS_EVENT = 24,
  445. DELETE_ROWS_EVENT = 25,
  446. /*
  447. Something out of the ordinary happened on the master
  448. */
  449. INCIDENT_EVENT= 26,
  450. /*
  451. Add new events here - right above this comment!
  452. Existing events (except ENUM_END_EVENT) should never change their numbers
  453. */
  454. ENUM_END_EVENT /* end marker */
  455. };
  456. /*
  457. The number of types we handle in Format_description_log_event (UNKNOWN_EVENT
  458. is not to be handled, it does not exist in binlogs, it does not have a
  459. format).
  460. */
  461. #define LOG_EVENT_TYPES (ENUM_END_EVENT-1)
  462. enum Int_event_type
  463. {
  464. INVALID_INT_EVENT = 0, LAST_INSERT_ID_EVENT = 1, INSERT_ID_EVENT = 2
  465. };
  466. #ifndef MYSQL_CLIENT
  467. class String;
  468. class MYSQL_BIN_LOG;
  469. class THD;
  470. #endif
  471. class Format_description_log_event;
  472. class Relay_log_info;
  473. #ifdef MYSQL_CLIENT
  474. /*
  475. A structure for mysqlbinlog to know how to print events
  476. This structure is passed to the event's print() methods,
  477. There are two types of settings stored here:
  478. 1. Last db, flags2, sql_mode etc comes from the last printed event.
  479. They are stored so that only the necessary USE and SET commands
  480. are printed.
  481. 2. Other information on how to print the events, e.g. short_form,
  482. hexdump_from. These are not dependent on the last event.
  483. */
  484. typedef struct st_print_event_info
  485. {
  486. /*
  487. Settings for database, sql_mode etc that comes from the last event
  488. that was printed.
  489. */
  490. // TODO: have the last catalog here ??
  491. char db[FN_REFLEN+1]; // TODO: make this a LEX_STRING when thd->db is
  492. bool flags2_inited;
  493. uint32 flags2;
  494. bool sql_mode_inited;
  495. ulong sql_mode; /* must be same as THD.variables.sql_mode */
  496. ulong auto_increment_increment, auto_increment_offset;
  497. bool charset_inited;
  498. char charset[6]; // 3 variables, each of them storable in 2 bytes
  499. char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH];
  500. uint lc_time_names_number;
  501. uint charset_database_number;
  502. st_print_event_info()
  503. :flags2_inited(0), sql_mode_inited(0),
  504. auto_increment_increment(1),auto_increment_offset(1), charset_inited(0),
  505. lc_time_names_number(0), charset_database_number(0)
  506. {
  507. /*
  508. Currently we only use static PRINT_EVENT_INFO objects, so zeroed at
  509. program's startup, but these explicit bzero() is for the day someone
  510. creates dynamic instances.
  511. */
  512. bzero(db, sizeof(db));
  513. bzero(charset, sizeof(charset));
  514. bzero(time_zone_str, sizeof(time_zone_str));
  515. delimiter[0]= ';';
  516. delimiter[1]= 0;
  517. myf const flags = MYF(MY_WME | MY_NABP);
  518. open_cached_file(&head_cache, NULL, NULL, 0, flags);
  519. open_cached_file(&body_cache, NULL, NULL, 0, flags);
  520. }
  521. ~st_print_event_info() {
  522. close_cached_file(&head_cache);
  523. close_cached_file(&body_cache);
  524. }
  525. bool init_ok() /* tells if construction was successful */
  526. { return my_b_inited(&head_cache) && my_b_inited(&body_cache); }
  527. /* Settings on how to print the events */
  528. bool short_form;
  529. bool base64_output;
  530. my_off_t hexdump_from;
  531. uint8 common_header_len;
  532. char delimiter[16];
  533. /*
  534. These two caches are used by the row-based replication events to
  535. collect the header information and the main body of the events
  536. making up a statement.
  537. */
  538. IO_CACHE head_cache;
  539. IO_CACHE body_cache;
  540. } PRINT_EVENT_INFO;
  541. #endif
  542. /**
  543. @class Log_event
  544. This is the abstract base class for binary log events.
  545. @section Log_event_binary_format Binary Format
  546. Any Log_event saved on disk consists of the following three
  547. components.
  548. @li Common-Header
  549. @li Post-Header
  550. @li Body
  551. The Common-Header, documented below, always has the same form and
  552. length within one version of MySQL. Each event type specifies a
  553. form and length of the Post-Header common to all events of the type.
  554. The Body may be of different form and length even for different
  555. events of the same type. The binary formats of Post-Header and Body
  556. are documented separately in each subclass. The binary format of
  557. Common-Header is as follows.
  558. <table>
  559. <caption>Common-Header</caption>
  560. <tr>
  561. <th>Name</th>
  562. <th>Format<br/></th>
  563. <th>Description</th>
  564. </tr>
  565. <tr>
  566. <td>timestamp</td>
  567. <td>4 byte unsigned integer</td>
  568. <td>The number of seconds since 1970.
  569. </td>
  570. </tr>
  571. <tr>
  572. <td>type</td>
  573. <td>1 byte enumeration</td>
  574. <td>See enum #Log_event_type.</td>
  575. </tr>
  576. <tr>
  577. <td>master_id</td>
  578. <td>4 byte integer</td>
  579. <td>Server ID of the server that created the event.</td>
  580. </tr>
  581. <tr>
  582. <td>total_size</td>
  583. <td>4 byte integer</td>
  584. <td>The total size of this event, in bytes. In other words, this
  585. is the sum of the sizes of Common-Header, Post-Header, and Body.
  586. </td>
  587. </tr>
  588. <tr>
  589. <td>master_position</td>
  590. <td>4 byte integer</td>
  591. <td>The position of the next event in the master binary log, in
  592. bytes from the beginning of the file.
  593. </td>
  594. </tr>
  595. <tr>
  596. <td>flags</td>
  597. <td>2 byte bitfield</td>
  598. <td>See Log_event::flags.</td>
  599. </tr>
  600. </table>
  601. Summing up the numbers above, we see that the total size of the
  602. common header is 19 bytes.
  603. @subsection Log_event_endianness_and_string_formats Endianness and String Formats
  604. All numbers, whether they are 16-, 32-, or 64-bit, are stored in
  605. little endian, i.e., the least significant byte first.
  606. Strings are stored in various formats. The format of each string is
  607. documented separately.
  608. */
  609. class Log_event
  610. {
  611. public:
  612. /**
  613. Enumeration of what kinds of skipping (and non-skipping) that can
  614. occur when the slave executes an event.
  615. @see shall_skip
  616. @see do_shall_skip
  617. */
  618. enum enum_skip_reason {
  619. /**
  620. Don't skip event.
  621. */
  622. EVENT_SKIP_NOT,
  623. /**
  624. Skip event by ignoring it.
  625. This means that the slave skip counter will not be changed.
  626. */
  627. EVENT_SKIP_IGNORE,
  628. /**
  629. Skip event and decrease skip counter.
  630. */
  631. EVENT_SKIP_COUNT
  632. };
  633. /*
  634. The following type definition is to be used whenever data is placed
  635. and manipulated in a common buffer. Use this typedef for buffers
  636. that contain data containing binary and character data.
  637. */
  638. typedef unsigned char Byte;
  639. /*
  640. The offset in the log where this event originally appeared (it is
  641. preserved in relay logs, making SHOW SLAVE STATUS able to print
  642. coordinates of the event in the master's binlog). Note: when a
  643. transaction is written by the master to its binlog (wrapped in
  644. BEGIN/COMMIT) the log_pos of all the queries it contains is the
  645. one of the BEGIN (this way, when one does SHOW SLAVE STATUS it
  646. sees the offset of the BEGIN, which is logical as rollback may
  647. occur), except the COMMIT query which has its real offset.
  648. */
  649. my_off_t log_pos;
  650. /*
  651. A temp buffer for read_log_event; it is later analysed according to the
  652. event's type, and its content is distributed in the event-specific fields.
  653. */
  654. char *temp_buf;
  655. /*
  656. Timestamp on the master(for debugging and replication of
  657. NOW()/TIMESTAMP). It is important for queries and LOAD DATA
  658. INFILE. This is set at the event's creation time, except for Query
  659. and Load (et al.) events where this is set at the query's
  660. execution time, which guarantees good replication (otherwise, we
  661. could have a query and its event with different timestamps).
  662. */
  663. time_t when;
  664. /* The number of seconds the query took to run on the master. */
  665. ulong exec_time;
  666. /* Number of bytes written by write() function */
  667. ulong data_written;
  668. /*
  669. The master's server id (is preserved in the relay log; used to
  670. prevent from infinite loops in circular replication).
  671. */
  672. uint32 server_id;
  673. /**
  674. Some 16 flags. See the definitions above for LOG_EVENT_TIME_F,
  675. LOG_EVENT_FORCED_ROTATE_F, LOG_EVENT_THREAD_SPECIFIC_F, and
  676. LOG_EVENT_SUPPRESS_USE_F for notes.
  677. */
  678. uint16 flags;
  679. bool cache_stmt;
  680. /**
  681. A storage to cache the global system variable's value.
  682. Handling of a separate event will be governed its member.
  683. */
  684. ulong slave_exec_mode;
  685. #ifndef MYSQL_CLIENT
  686. THD* thd;
  687. Log_event();
  688. Log_event(THD* thd_arg, uint16 flags_arg, bool cache_stmt);
  689. /*
  690. read_log_event() functions read an event from a binlog or relay
  691. log; used by SHOW BINLOG EVENTS, the binlog_dump thread on the
  692. master (reads master's binlog), the slave IO thread (reads the
  693. event sent by binlog_dump), the slave SQL thread (reads the event
  694. from the relay log). If mutex is 0, the read will proceed without
  695. mutex. We need the description_event to be able to parse the
  696. event (to know the post-header's size); in fact in read_log_event
  697. we detect the event's type, then call the specific event's
  698. constructor and pass description_event as an argument.
  699. */
  700. static Log_event* read_log_event(IO_CACHE* file,
  701. pthread_mutex_t* log_lock,
  702. const Format_description_log_event
  703. *description_event);
  704. static int read_log_event(IO_CACHE* file, String* packet,
  705. pthread_mutex_t* log_lock);
  706. /*
  707. init_show_field_list() prepares the column names and types for the
  708. output of SHOW BINLOG EVENTS; it is used only by SHOW BINLOG
  709. EVENTS.
  710. */
  711. static void init_show_field_list(List<Item>* field_list);
  712. #ifdef HAVE_REPLICATION
  713. int net_send(Protocol *protocol, const char* log_name, my_off_t pos);
  714. /*
  715. pack_info() is used by SHOW BINLOG EVENTS; as print() it prepares and sends
  716. a string to display to the user, so it resembles print().
  717. */
  718. virtual void pack_info(Protocol *protocol);
  719. #endif /* HAVE_REPLICATION */
  720. virtual const char* get_db()
  721. {
  722. return thd ? thd->db : 0;
  723. }
  724. #else
  725. Log_event() : temp_buf(0) {}
  726. /* avoid having to link mysqlbinlog against libpthread */
  727. static Log_event* read_log_event(IO_CACHE* file,
  728. const Format_description_log_event
  729. *description_event);
  730. /* print*() functions are used by mysqlbinlog */
  731. virtual void print(FILE* file, PRINT_EVENT_INFO* print_event_info) = 0;
  732. void print_timestamp(IO_CACHE* file, time_t *ts = 0);
  733. void print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
  734. bool is_more);
  735. void print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
  736. bool is_more);
  737. #endif
  738. static void *operator new(size_t size)
  739. {
  740. return (void*) my_malloc((uint)size, MYF(MY_WME|MY_FAE));
  741. }
  742. static void operator delete(void *ptr, size_t size)
  743. {
  744. my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
  745. }
  746. /* Placement version of the above operators */
  747. static void *operator new(size_t, void* ptr) { return ptr; }
  748. static void operator delete(void*, void*) { }
  749. #ifndef MYSQL_CLIENT
  750. bool write_header(IO_CACHE* file, ulong data_length);
  751. virtual bool write(IO_CACHE* file)
  752. {
  753. return (write_header(file, get_data_size()) ||
  754. write_data_header(file) ||
  755. write_data_body(file));
  756. }
  757. virtual bool write_data_header(IO_CACHE* file)
  758. { return 0; }
  759. virtual bool write_data_body(IO_CACHE* file __attribute__((unused)))
  760. { return 0; }
  761. inline time_t get_time()
  762. {
  763. THD *tmp_thd;
  764. if (when)
  765. return when;
  766. if (thd)
  767. return thd->start_time;
  768. if ((tmp_thd= current_thd))
  769. return tmp_thd->start_time;
  770. return my_time(0);
  771. }
  772. #endif
  773. virtual Log_event_type get_type_code() = 0;
  774. virtual bool is_valid() const = 0;
  775. virtual bool is_artificial_event() { return 0; }
  776. inline bool get_cache_stmt() const { return cache_stmt; }
  777. Log_event(const char* buf, const Format_description_log_event
  778. *description_event);
  779. virtual ~Log_event() { free_temp_buf();}
  780. void register_temp_buf(char* buf) { temp_buf = buf; }
  781. void free_temp_buf()
  782. {
  783. if (temp_buf)
  784. {
  785. my_free(temp_buf, MYF(0));
  786. temp_buf = 0;
  787. }
  788. }
  789. /*
  790. Get event length for simple events. For complicated events the length
  791. is calculated during write()
  792. */
  793. virtual int get_data_size() { return 0;}
  794. static Log_event* read_log_event(const char* buf, uint event_len,
  795. const char **error,
  796. const Format_description_log_event
  797. *description_event);
  798. /* returns the human readable name of the event's type */
  799. const char* get_type_str();
  800. /* Return start of query time or current time */
  801. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  802. public:
  803. /**
  804. Apply the event to the database.
  805. This function represents the public interface for applying an
  806. event.
  807. @see do_apply_event
  808. */
  809. int apply_event(Relay_log_info const *rli)
  810. {
  811. return do_apply_event(rli);
  812. }
  813. /**
  814. Update the relay log position.
  815. This function represents the public interface for "stepping over"
  816. the event and will update the relay log information.
  817. @see do_update_pos
  818. */
  819. int update_pos(Relay_log_info *rli)
  820. {
  821. return do_update_pos(rli);
  822. }
  823. /**
  824. Decide if the event shall be skipped, and the reason for skipping
  825. it.
  826. @see do_shall_skip
  827. */
  828. enum_skip_reason shall_skip(Relay_log_info *rli)
  829. {
  830. return do_shall_skip(rli);
  831. }
  832. protected:
  833. /**
  834. Helper function to ignore an event w.r.t. the slave skip counter.
  835. This function can be used inside do_shall_skip() for functions
  836. that cannot end a group. If the slave skip counter is 1 when
  837. seeing such an event, the event shall be ignored, the counter
  838. left intact, and processing continue with the next event.
  839. A typical usage is:
  840. @code
  841. enum_skip_reason do_shall_skip(Relay_log_info *rli) {
  842. return continue_group(rli);
  843. }
  844. @endcode
  845. @return Skip reason
  846. */
  847. enum_skip_reason continue_group(Relay_log_info *rli);
  848. /**
  849. Primitive to apply an event to the database.
  850. This is where the change to the database is made.
  851. @note The primitive is protected instead of private, since there
  852. is a hierarchy of actions to be performed in some cases.
  853. @see Format_description_log_event::do_apply_event()
  854. @param rli Pointer to relay log info structure
  855. @retval 0 Event applied successfully
  856. @retval errno Error code if event application failed
  857. */
  858. virtual int do_apply_event(Relay_log_info const *rli)
  859. {
  860. return 0; /* Default implementation does nothing */
  861. }
  862. /**
  863. Advance relay log coordinates.
  864. This function is called to advance the relay log coordinates to
  865. just after the event. It is essential that both the relay log
  866. coordinate and the group log position is updated correctly, since
  867. this function is used also for skipping events.
  868. Normally, each implementation of do_update_pos() shall:
  869. - Update the event position to refer to the position just after
  870. the event.
  871. - Update the group log position to refer to the position just
  872. after the event <em>if the event is last in a group</em>
  873. @param rli Pointer to relay log info structure
  874. @retval 0 Coordinates changed successfully
  875. @retval errno Error code if advancing failed (usually just
  876. 1). Observe that handler errors are returned by the
  877. do_apply_event() function, and not by this one.
  878. */
  879. virtual int do_update_pos(Relay_log_info *rli);
  880. /**
  881. Decide if this event shall be skipped or not and the reason for
  882. skipping it.
  883. The default implementation decide that the event shall be skipped
  884. if either:
  885. - the server id of the event is the same as the server id of the
  886. server and <code>rli->replicate_same_server_id</code> is true,
  887. or
  888. - if <code>rli->slave_skip_counter</code> is greater than zero.
  889. @see do_apply_event
  890. @see do_update_pos
  891. @retval Log_event::EVENT_SKIP_NOT
  892. The event shall not be skipped and should be applied.
  893. @retval Log_event::EVENT_SKIP_IGNORE
  894. The event shall be skipped by just ignoring it, i.e., the slave
  895. skip counter shall not be changed. This happends if, for example,
  896. the originating server id of the event is the same as the server
  897. id of the slave.
  898. @retval Log_event::EVENT_SKIP_COUNT
  899. The event shall be skipped because the slave skip counter was
  900. non-zero. The caller shall decrease the counter by one.
  901. */
  902. virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
  903. #endif
  904. };
  905. /*
  906. One class for each type of event.
  907. Two constructors for each class:
  908. - one to create the event for logging (when the server acts as a master),
  909. called after an update to the database is done,
  910. which accepts parameters like the query, the database, the options for LOAD
  911. DATA INFILE...
  912. - one to create the event from a packet (when the server acts as a slave),
  913. called before reproducing the update, which accepts parameters (like a
  914. buffer). Used to read from the master, from the relay log, and in
  915. mysqlbinlog. This constructor must be format-tolerant.
  916. */
  917. /**
  918. @class Query_log_event
  919. Logs SQL queries.
  920. @section Query_log_event_binary_format Binary format
  921. The Post-Header has five components:
  922. <table>
  923. <caption>Post-Header for Query_log_event</caption>
  924. <tr>
  925. <th>Name</th>
  926. <th>Size<br/></th>
  927. <th>Description</th>
  928. </tr>
  929. <tr>
  930. <td>slave_proxy_id</td>
  931. <td>4 byte unsigned integer</td>
  932. <td>An integer identifying the client thread, which is unique on
  933. the server. (Note, however, that two threads on different servers
  934. may have the same slave_proxy_id.) This is used when a client
  935. thread creates a temporary table. Temporary tables are local to
  936. the client, and the slave_proxy_id is used to distinguish
  937. temporary tables belonging to different clients.
  938. </td>
  939. </tr>
  940. <tr>
  941. <td>exec_time</td>
  942. <td>4 byte integer</td>
  943. <td>???TODO</td>
  944. </tr>
  945. <tr>
  946. <td>db_len</td>
  947. <td>1 byte integer</td>
  948. <td>The length of the name of the currently selected
  949. database.
  950. </td>
  951. </tr>
  952. <tr>
  953. <td>error_code</td>
  954. <td>2 byte integer</td>
  955. <td>Error code generated by the master. If the master fails, the
  956. slave will fail with the same error code, except for the error
  957. codes ER_DB_CREATE_EXISTS==1007 and ER_DB_DROP_EXISTS==1008.
  958. </td>
  959. </tr>
  960. <tr>
  961. <td>status_vars_len</td>
  962. <td>2 byte integer</td>
  963. <td>The length of the status_vars block of the Body, in bytes. See
  964. <a href="#query_log_event_status_vars">below</a>.
  965. </td>
  966. </tr>
  967. <tr>
  968. <td>Post-Header-For-Derived</td>
  969. <td>0 bytes</td>
  970. <td>This field is only written by the subclass
  971. Execute_load_query_log_event. In this base class, it takes 0
  972. bytes. See separate documentation for
  973. Execute_load_query_log_event.
  974. </td>
  975. </tr>
  976. </table>
  977. The Body has the following components:
  978. <table>
  979. <caption>Body for Query_log_event</caption>
  980. <tr>
  981. <th>Name</th>
  982. <th>Size<br/></th>
  983. <th>Description</th>
  984. </tr>
  985. <tr>
  986. <td><a name="query_log_event_status_vars" /> status_vars</td>
  987. <td>variable length</td>
  988. <td>Zero or more status variables. Each status variable consists
  989. of one byte identifying the variable stored, followed by the value
  990. of the variable. The possible variables are listed separately in
  991. the table below. MySQL always writes events in the order defined
  992. below; however, it is capable of reading them in any order.
  993. </td>
  994. </tr>
  995. <tr>
  996. <td>db</td>
  997. <td>db_len+1</td>
  998. <td>The currently selected database, as a null-terminated string.
  999. (The trailing zero is redundant since the length is already known;
  1000. it is db_len from Post-Header.)
  1001. </td>
  1002. </tr>
  1003. <tr>
  1004. <td>query</td>
  1005. <td>variable length string without trailing zero, extending to the
  1006. end of the event (determined by the length field of the
  1007. Common-Header)
  1008. </td>
  1009. <td>The SQL query.</td>
  1010. </tr>
  1011. </table>
  1012. The following table lists the status variables that may appear in
  1013. the status_vars field.
  1014. <table>
  1015. <caption>Status variables for Query_log_event</caption>
  1016. <tr>
  1017. <th>Status variable</th>
  1018. <th>1-byte identifier</th>
  1019. <th>Size<br/></th>
  1020. <th>Description</th>
  1021. </tr>
  1022. <tr>
  1023. <td>flags2</td>
  1024. <td>Q_FLAGS2_CODE == 0</td>
  1025. <td>4 byte bitfield</td>
  1026. <td>The flags in thd->options, binary AND-ed with
  1027. OPTIONS_WRITTEN_TO_BIN_LOG. The thd->options bitfield contains
  1028. options for SELECT. OPTIONS_WRITTEN identifies those options that
  1029. need to be written to the binlog (not all do). Specifically,
  1030. OPTIONS_WRITTEN_TO_BIN_LOG equals (OPTION_AUTO_IS_NULL |
  1031. OPTION_NO_FOREIGN_KEY_CHECKS | OPTION_RELAXED_UNIQUE_CHECKS |
  1032. OPTION_NOT_AUTOCOMMIT), or 0x0c084000 in hex.
  1033. These flags correspond to the SQL variables SQL_AUTO_IS_NULL,
  1034. FOREIGN_KEY_CHECKS, UNIQUE_CHECKS, and AUTOCOMMIT, documented in
  1035. the "SET Syntax" section of the MySQL Manual.
  1036. This field is always written to the binlog in version >= 5.0, and
  1037. never written in version < 5.0.
  1038. </td>
  1039. </tr>
  1040. <tr>
  1041. <td>sql_mode</td>
  1042. <td>Q_SQL_MODE_CODE == 1</td>
  1043. <td>8 byte integer</td>
  1044. <td>The sql_mode variable. See the section "SQL Modes" in the
  1045. MySQL manual, and see mysql_priv.h for a list of the possible
  1046. flags. Currently (2007-10-04), the following flags are available:
  1047. <pre>
  1048. MODE_REAL_AS_FLOAT==0x1
  1049. MODE_PIPES_AS_CONCAT==0x2
  1050. MODE_ANSI_QUOTES==0x4
  1051. MODE_IGNORE_SPACE==0x8
  1052. MODE_NOT_USED==0x10
  1053. MODE_ONLY_FULL_GROUP_BY==0x20
  1054. MODE_NO_UNSIGNED_SUBTRACTION==0x40
  1055. MODE_NO_DIR_IN_CREATE==0x80
  1056. MODE_POSTGRESQL==0x100
  1057. MODE_ORACLE==0x200
  1058. MODE_MSSQL==0x400
  1059. MODE_DB2==0x800
  1060. MODE_MAXDB==0x1000
  1061. MODE_NO_KEY_OPTIONS==0x2000
  1062. MODE_NO_TABLE_OPTIONS==0x4000
  1063. MODE_NO_FIELD_OPTIONS==0x8000
  1064. MODE_MYSQL323==0x10000
  1065. MODE_MYSQL323==0x20000
  1066. MODE_MYSQL40==0x40000
  1067. MODE_ANSI==0x80000
  1068. MODE_NO_AUTO_VALUE_ON_ZERO==0x100000
  1069. MODE_NO_BACKSLASH_ESCAPES==0x200000
  1070. MODE_STRICT_TRANS_TABLES==0x400000
  1071. MODE_STRICT_ALL_TABLES==0x800000
  1072. MODE_NO_ZERO_IN_DATE==0x1000000
  1073. MODE_NO_ZERO_DATE==0x2000000
  1074. MODE_INVALID_DATES==0x4000000
  1075. MODE_ERROR_FOR_DIVISION_BY_ZERO==0x8000000
  1076. MODE_TRADITIONAL==0x10000000
  1077. MODE_NO_AUTO_CREATE_USER==0x20000000
  1078. MODE_HIGH_NOT_PRECEDENCE==0x40000000
  1079. MODE_PAD_CHAR_TO_FULL_LENGTH==0x80000000
  1080. </pre>
  1081. All these flags are replicated from the server. However, all
  1082. flags except MODE_NO_DIR_IN_CREATE are honored by the slave; the
  1083. slave always preserves its old value of MODE_NO_DIR_IN_CREATE.
  1084. For a rationale, see comment in Query_log_event::do_apply_event in
  1085. log_event.cc.
  1086. This field is always written to the binlog.
  1087. </td>
  1088. </tr>
  1089. <tr>
  1090. <td>catalog</td>
  1091. <td>Q_CATALOG_NZ_CODE == 6</td>
  1092. <td>Variable-length string: the length in bytes (1 byte) followed
  1093. by the characters (at most 255 bytes)
  1094. </td>
  1095. <td>Stores the client's current catalog. Every database belongs
  1096. to a catalog, the same way that every table belongs to a
  1097. database. Currently, there is only one catalog, 'std'.
  1098. This field is written if the length of the catalog is > 0;
  1099. otherwise it is not written.
  1100. </td>
  1101. </tr>
  1102. <tr>
  1103. <td>auto_increment</td>
  1104. <td>Q_AUTO_INCREMENT == 3</td>
  1105. <td>two 2 byte unsigned integers, totally 2+2=4 bytes</td>
  1106. <td>The two variables auto_increment_increment and
  1107. auto_increment_offset, in that order. For more information, see
  1108. "System variables" in the MySQL manual.
  1109. This field is written if auto_increment>1; otherwise it is not
  1110. written.
  1111. </td>
  1112. </tr>
  1113. <tr>
  1114. <td>charset</td>
  1115. <td>Q_CHARSET_CODE == 4</td>
  1116. <td>three 2-byte unsigned integers (i.e., 6 bytes)</td>
  1117. <td>The three variables character_set_client,
  1118. collation_connection, and collation_server, in that order.
  1119. `character_set_client' is a code identifying the character set and
  1120. collation used by the client to encode the query.
  1121. `collation_connection' identifies the character set and collation
  1122. that the master converts the query to when it receives it; this is
  1123. useful when comparing literal strings. `collation_server' is the
  1124. default character set and collation used when a new database is
  1125. created.
  1126. See also "Connection Character Sets and Collations" in the MySQL
  1127. 5.1 manual.
  1128. All three variables are codes identifying a (character set,
  1129. collation) pair. To see which codes map to which pairs, run the
  1130. query "SELECT id, character_set_name, collation_name FROM
  1131. COLLATIONS".
  1132. Cf. Q_CHARSET_DATABASE_NUMBER below.
  1133. This field is always written.
  1134. </td>
  1135. </tr>
  1136. <tr>
  1137. <td>time_zone</td>
  1138. <td>Q_TIME_ZONE_CODE == 5</td>
  1139. <td>Variable-length string: the length in bytes (1 byte) followed
  1140. by the characters (at most 255 bytes).
  1141. <td>The time_zone of the master.
  1142. See also "System Variables" and "MySQL Server Time Zone Support"
  1143. in the MySQL manual.
  1144. This field is written if the length of the time zone string is >
  1145. 0; otherwise, it is not written.
  1146. </td>
  1147. </tr>
  1148. <tr>
  1149. <td>lc_time_names_number</td>
  1150. <td>Q_LC_TIME_NAMES_CODE == 7</td>
  1151. <td>2 byte integer</td>
  1152. <td>A code identifying a table of month and day names. The
  1153. mapping from codes to languages is defined in sql_locale.cc.
  1154. This field is written if it is != 0, i.e., if the locale is not
  1155. en_US.
  1156. </td>
  1157. </tr>
  1158. <tr>
  1159. <td>charset_database_number</td>
  1160. <td>Q_CHARSET_DATABASE_NUMBER == 8</td>
  1161. <td>2 byte integer</td>
  1162. <td>The value of the collation_database system variable (in the
  1163. source code stored in thd->variables.collation_database), which
  1164. holds the code for a (character set, collation) pair as described
  1165. above (see Q_CHARSET_CODE).
  1166. `collation_database' was used in old versions (???WHEN). Its
  1167. value was loaded when issuing a "use db" command and could be
  1168. changed by issuing a "SET collation_database=xxx" command. It
  1169. used to affect the "LOAD DATA INFILE" and "CREATE TABLE" commands.
  1170. In newer versions, "CREATE TABLE" has been changed to take the
  1171. character set from the database of the created table, rather than
  1172. the database of the current database. This makes a difference
  1173. when creating a table in another database than the current one.
  1174. "LOAD DATA INFILE" has not yet changed to do this, but there are
  1175. plans to eventually do it, and to make collation_database
  1176. read-only.
  1177. This field is written if it is not 0.
  1178. </td>
  1179. </tr>
  1180. </table>
  1181. @subsection Query_log_event_notes_on_previous_versions Notes on Previous Versions
  1182. @li Status vars were introduced in version 5.0. To read earlier
  1183. versions correctly, check the length of the Post-Header.
  1184. @li The status variable Q_CATALOG_CODE == 2 existed in MySQL 5.0.x,
  1185. where 0<=x<=3. It was identical to Q_CATALOG_CODE, except that the
  1186. string had a trailing '\0'. The '\0' was removed in 5.0.4 since it
  1187. was redundant (the string length is stored before the string). The
  1188. Q_CATALOG_CODE will never be written by a new master, but can still
  1189. be understood by a new slave.
  1190. @li See Q_CHARSET_DATABASE_NUMBER in the table above.
  1191. */
  1192. class Query_log_event: public Log_event
  1193. {
  1194. protected:
  1195. Log_event::Byte* data_buf;
  1196. public:
  1197. const char* query;
  1198. const char* catalog;
  1199. const char* db;
  1200. /*
  1201. If we already know the length of the query string
  1202. we pass it with q_len, so we would not have to call strlen()
  1203. otherwise, set it to 0, in which case, we compute it with strlen()
  1204. */
  1205. uint32 q_len;
  1206. uint32 db_len;
  1207. uint16 error_code;
  1208. ulong thread_id;
  1209. /*
  1210. For events created by Query_log_event::do_apply_event (and
  1211. Load_log_event::do_apply_event()) we need the *original* thread
  1212. id, to be able to log the event with the original (=master's)
  1213. thread id (fix for BUG#1686).
  1214. */
  1215. ulong slave_proxy_id;
  1216. /*
  1217. Binlog format 3 and 4 start to differ (as far as class members are
  1218. concerned) from here.
  1219. */
  1220. uint catalog_len; // <= 255 char; 0 means uninited
  1221. /*
  1222. We want to be able to store a variable number of N-bit status vars:
  1223. (generally N=32; but N=64 for SQL_MODE) a user may want to log the number
  1224. of affected rows (for debugging) while another does not want to lose 4
  1225. bytes in this.
  1226. The storage on disk is the following:
  1227. status_vars_len is part of the post-header,
  1228. status_vars are in the variable-length part, after the post-header, before
  1229. the db & query.
  1230. status_vars on disk is a sequence of pairs (code, value) where 'code' means
  1231. 'sql_mode', 'affected' etc. Sometimes 'value' must be a short string, so
  1232. its first byte is its length. For now the order of status vars is:
  1233. flags2 - sql_mode - catalog - autoinc - charset
  1234. We should add the same thing to Load_log_event, but in fact
  1235. LOAD DATA INFILE is going to be logged with a new type of event (logging of
  1236. the plain text query), so Load_log_event would be frozen, so no need. The
  1237. new way of logging LOAD DATA INFILE would use a derived class of
  1238. Query_log_event, so automatically benefit from the work already done for
  1239. status variables in Query_log_event.
  1240. */
  1241. uint16 status_vars_len;
  1242. /*
  1243. 'flags2' is a second set of flags (on top of those in Log_event), for
  1244. session variables. These are thd->options which is & against a mask
  1245. (OPTIONS_WRITTEN_TO_BIN_LOG).
  1246. flags2_inited helps make a difference between flags2==0 (3.23 or 4.x
  1247. master, we don't know flags2, so use the slave server's global options) and
  1248. flags2==0 (5.0 master, we know this has a meaning of flags all down which
  1249. must influence the query).
  1250. */
  1251. bool flags2_inited;
  1252. bool sql_mode_inited;
  1253. bool charset_inited;
  1254. uint32 flags2;
  1255. /* In connections sql_mode is 32 bits now but will be 64 bits soon */
  1256. ulong sql_mode;
  1257. ulong auto_increment_increment, auto_increment_offset;
  1258. char charset[6];
  1259. uint time_zone_len; /* 0 means uninited */
  1260. const char *time_zone_str;
  1261. uint lc_time_names_number; /* 0 means en_US */
  1262. uint charset_database_number;
  1263. #ifndef MYSQL_CLIENT
  1264. Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
  1265. bool using_trans, bool suppress_use,
  1266. THD::killed_state killed_err_arg= THD::KILLED_NO_VALUE);
  1267. const char* get_db() { return db; }
  1268. #ifdef HAVE_REPLICATION
  1269. void pack_info(Protocol* protocol);
  1270. #endif /* HAVE_REPLICATION */
  1271. #else
  1272. void print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info);
  1273. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  1274. #endif
  1275. Query_log_event();
  1276. Query_log_event(const char* buf, uint event_len,
  1277. const Format_description_log_event *description_event,
  1278. Log_event_type event_type);
  1279. ~Query_log_event()
  1280. {
  1281. if (data_buf)
  1282. my_free((uchar*) data_buf, MYF(0));
  1283. }
  1284. Log_event_type get_type_code() { return QUERY_EVENT; }
  1285. #ifndef MYSQL_CLIENT
  1286. bool write(IO_CACHE* file);
  1287. virtual bool write_post_header_for_derived(IO_CACHE* file) { return FALSE; }
  1288. #endif
  1289. bool is_valid() const { return query != 0; }
  1290. /*
  1291. Returns number of bytes additionaly written to post header by derived
  1292. events (so far it is only Execute_load_query event).
  1293. */
  1294. virtual ulong get_post_header_size_for_derived() { return 0; }
  1295. /* Writes derived event-specific part of post header. */
  1296. public: /* !!! Public in this patch to allow old usage */
  1297. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  1298. virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
  1299. virtual int do_apply_event(Relay_log_info const *rli);
  1300. virtual int do_update_pos(Relay_log_info *rli);
  1301. int do_apply_event(Relay_log_info const *rli,
  1302. const char *query_arg,
  1303. uint32 q_len_arg);
  1304. #endif /* HAVE_REPLICATION */
  1305. };
  1306. /**
  1307. @class Muted_query_log_event
  1308. Pretends to log SQL queries, but doesn't actually do so.
  1309. @section Muted_query_log_event_binary_format Binary Format
  1310. This log event is not stored, and thus the binary format is 0 bytes
  1311. long. Note that not even the Common-Header is stored.
  1312. */
  1313. class Muted_query_log_event: public Query_log_event
  1314. {
  1315. public:
  1316. #ifndef MYSQL_CLIENT
  1317. Muted_query_log_event();
  1318. bool write(IO_CACHE* file) { return(false); };
  1319. virtual bool write_post_header_for_derived(IO_CACHE* file) { return FALSE; }
  1320. #else
  1321. Muted_query_log_event() {}
  1322. #endif
  1323. };
  1324. #ifdef HAVE_REPLICATION
  1325. /**
  1326. @class Slave_log_event
  1327. Note that this class is currently not used at all; no code writes a
  1328. Slave_log_event (though some code in repl_failsafe.cc reads
  1329. Slave_log_event). So it's not a problem if this code is not
  1330. maintained.
  1331. @section Slave_log_event_binary_format Binary Format
  1332. This event type has no Post-Header. The Body has the following
  1333. four components.
  1334. <table>
  1335. <caption>Body for Slave_log_event</caption>
  1336. <tr>
  1337. <th>Name</th>
  1338. <th>Size<br/></th>
  1339. <th>Description</th>
  1340. </tr>
  1341. <tr>
  1342. <td>master_pos</td>
  1343. <td>8 byte integer</td>
  1344. <td>???TODO
  1345. </td>
  1346. </tr>
  1347. <tr>
  1348. <td>master_port</td>
  1349. <td>2 byte integer</td>
  1350. <td>???TODO</td>
  1351. </tr>
  1352. <tr>
  1353. <td>master_host</td>
  1354. <td>null-terminated string</td>
  1355. <td>???TODO</td>
  1356. </tr>
  1357. <tr>
  1358. <td>master_log</td>
  1359. <td>null-terminated string</td>
  1360. <td>???TODO</td>
  1361. </tr>
  1362. </table>
  1363. */
  1364. class Slave_log_event: public Log_event
  1365. {
  1366. protected:
  1367. char* mem_pool;
  1368. void init_from_mem_pool(int data_size);
  1369. public:
  1370. my_off_t master_pos;
  1371. char* master_host;
  1372. char* master_log;
  1373. int master_host_len;
  1374. int master_log_len;
  1375. uint16 master_port;
  1376. #ifndef MYSQL_CLIENT
  1377. Slave_log_event(THD* thd_arg, Relay_log_info* rli);
  1378. void pack_info(Protocol* protocol);
  1379. #else
  1380. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  1381. #endif
  1382. Slave_log_event(const char* buf, uint event_len);
  1383. ~Slave_log_event();
  1384. int get_data_size();
  1385. bool is_valid() const { return master_host != 0; }
  1386. Log_event_type get_type_code() { return SLAVE_EVENT; }
  1387. #ifndef MYSQL_CLIENT
  1388. bool write(IO_CACHE* file);
  1389. #endif
  1390. private:
  1391. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  1392. virtual int do_apply_event(Relay_log_info const* rli);
  1393. #endif
  1394. };
  1395. #endif /* HAVE_REPLICATION */
  1396. /**
  1397. @class Load_log_event
  1398. This log event corresponds to a "LOAD DATA INFILE" SQL query on the
  1399. following form:
  1400. @verbatim
  1401. (1) USE db;
  1402. (2) LOAD DATA [LOCAL] INFILE 'file_name'
  1403. (3) [REPLACE | IGNORE]
  1404. (4) INTO TABLE 'table_name'
  1405. (5) [FIELDS
  1406. (6) [TERMINATED BY 'field_term']
  1407. (7) [[OPTIONALLY] ENCLOSED BY 'enclosed']
  1408. (8) [ESCAPED BY 'escaped']
  1409. (9) ]
  1410. (10) [LINES
  1411. (11) [TERMINATED BY 'line_term']
  1412. (12) [LINES STARTING BY 'line_start']
  1413. (13) ]
  1414. (14) [IGNORE skip_lines LINES]
  1415. (15) (field_1, field_2, ..., field_n)@endverbatim
  1416. @section Load_log_event_binary_format Binary Format
  1417. The Post-Header consists of the following six components.
  1418. <table>
  1419. <caption>Post-Header for Load_log_event</caption>
  1420. <tr>
  1421. <th>Name</th>
  1422. <th>Size<br/></th>
  1423. <th>Description</th>
  1424. </tr>
  1425. <tr>
  1426. <td>slave_proxy_id</td>
  1427. <td>4 byte unsigned integer</td>
  1428. <td>An integer identifying the client thread, which is unique on
  1429. the server. (Note, however, that the same slave_proxy_id may
  1430. appear on different servers.) This is used when a client thread
  1431. creates a temporary table. Temporary tables are local to the
  1432. client, and the slave_proxy_id is used to distinguish temporary
  1433. tables belonging to different clients.
  1434. </td>
  1435. </tr>
  1436. <tr>
  1437. <td>exec_time</td>
  1438. <td>4 byte unsigned integer</td>
  1439. <td>???TODO</td>
  1440. </tr>
  1441. <tr>
  1442. <td>skip_lines</td>
  1443. <td>4 byte unsigned integer</td>
  1444. <td>The number on line (14) above, if present, or 0 if line (14)
  1445. is left out.
  1446. </td>
  1447. </tr>
  1448. <tr>
  1449. <td>table_name_len</td>
  1450. <td>1 byte unsigned integer</td>
  1451. <td>The length of 'table_name' on line (4) above.</td>
  1452. </tr>
  1453. <tr>
  1454. <td>db_len</td>
  1455. <td>1 byte unsigned integer</td>
  1456. <td>The length of 'db' on line (1) above.</td>
  1457. </tr>
  1458. <tr>
  1459. <td>num_fields</td>
  1460. <td>4 byte unsigned integer</td>
  1461. <td>The number n of fields on line (15) above.</td>
  1462. </tr>
  1463. </table>
  1464. The Body contains the following components.
  1465. <table>
  1466. <caption>Body of Load_log_event</caption>
  1467. <tr>
  1468. <th>Name</th>
  1469. <th>Size<br/></th>
  1470. <th>Description</th>
  1471. </tr>
  1472. <tr>
  1473. <td>sql_ex</td>
  1474. <td>variable length</td>
  1475. <td>Describes the part of the query on lines (3) and
  1476. (5)&ndash;(13) above. More precisely, it stores the five strings
  1477. (on lines) field_term (6), enclosed (7), escaped (8), line_term
  1478. (11), and line_start (12); as well as a bitfield indicating the
  1479. presence of the keywords REPLACE (3), IGNORE (3), and OPTIONALLY
  1480. (7).
  1481. The data is stored in one of two formats, called "old" and "new".
  1482. The type field of Common-Header determines which of these two
  1483. formats is used: type LOAD_EVENT means that the old format is
  1484. used, and type NEW_LOAD_EVENT means that the new format is used.
  1485. When MySQL writes a Load_log_event, it uses the new format if at
  1486. least one of the five strings is two or more bytes long.
  1487. Otherwise (i.e., if all strings are 0 or 1 bytes long), the old
  1488. format is used.
  1489. The new and old format differ in the way the five strings are
  1490. stored.
  1491. <ul>
  1492. <li> In the new format, the strings are stored in the order
  1493. field_term, enclosed, escaped, line_term, line_start. Each string
  1494. consists of a length (1 byte), followed by a sequence of
  1495. characters (0-255 bytes). Finally, a boolean combination of the
  1496. following flags is stored in 1 byte: REPLACE_FLAG==0x4,
  1497. IGNORE_FLAG==0x8, and OPT_ENCLOSED_FLAG==0x2. If a flag is set,
  1498. it indicates the presence of the corresponding keyword in the SQL
  1499. query.
  1500. <li> In the old format, we know that each string has length 0 or
  1501. 1. Therefore, only the first byte of each string is stored. The
  1502. order of the strings is the same as in the new format. These five
  1503. bytes are followed by the same 1-byte bitfield as in the new
  1504. format. Finally, a 1 byte bitfield called empty_flags is stored.
  1505. The low 5 bits of empty_flags indicate which of the five strings
  1506. have length 0. For each of the following flags that is set, the
  1507. corresponding string has length 0; for the flags that are not set,
  1508. the string has length 1: FIELD_TERM_EMPTY==0x1,
  1509. ENCLOSED_EMPTY==0x2, LINE_TERM_EMPTY==0x4, LINE_START_EMPTY==0x8,
  1510. ESCAPED_EMPTY==0x10.
  1511. </ul>
  1512. Thus, the size of the new format is 6 bytes + the sum of the sizes
  1513. of the five strings. The size of the old format is always 7
  1514. bytes.
  1515. </td>
  1516. </tr>
  1517. <tr>
  1518. <td>field_lens</td>
  1519. <td>num_fields 1-byte unsigned integers</td>
  1520. <td>An array of num_fields integers representing the length of
  1521. each field in the query. (num_fields is from the Post-Header).
  1522. </td>
  1523. </tr>
  1524. <tr>
  1525. <td>fields</td>
  1526. <td>num_fields null-terminated strings</td>
  1527. <td>An array of num_fields null-terminated strings, each
  1528. representing a field in the query. (The trailing zero is
  1529. redundant, since the length are stored in the num_fields array.)
  1530. The total length of all strings equals to the sum of all
  1531. field_lens, plus num_fields bytes for all the trailing zeros.
  1532. </td>
  1533. </tr>
  1534. <tr>
  1535. <td>table_name</td>
  1536. <td>null-terminated string of length table_len+1 bytes</td>
  1537. <td>The 'table_name' from the query, as a null-terminated string.
  1538. (The trailing zero is actually redundant since the table_len is
  1539. known from Post-Header.)
  1540. </td>
  1541. </tr>
  1542. <tr>
  1543. <td>db</td>
  1544. <td>null-terminated string of length db_len+1 bytes</td>
  1545. <td>The 'db' from the query, as a null-terminated string.
  1546. (The trailing zero is actually redundant since the db_len is known
  1547. from Post-Header.)
  1548. </td>
  1549. </tr>
  1550. <tr>
  1551. <td>file_name</td>
  1552. <td>variable length string without trailing zero, extending to the
  1553. end of the event (determined by the length field of the
  1554. Common-Header)
  1555. </td>
  1556. <td>The 'file_name' from the query.
  1557. </td>
  1558. </tr>
  1559. </table>
  1560. @subsection Load_log_event_notes_on_previous_versions Notes on Previous Versions
  1561. */
  1562. class Load_log_event: public Log_event
  1563. {
  1564. private:
  1565. uint get_query_buffer_length();
  1566. void print_query(bool need_db, char *buf, char **end,
  1567. char **fn_start, char **fn_end);
  1568. protected:
  1569. int copy_log_event(const char *buf, ulong event_len,
  1570. int body_offset,
  1571. const Format_description_log_event* description_event);
  1572. public:
  1573. ulong thread_id;
  1574. ulong slave_proxy_id;
  1575. uint32 table_name_len;
  1576. /*
  1577. No need to have a catalog, as these events can only come from 4.x.
  1578. TODO: this may become false if Dmitri pushes his new LOAD DATA INFILE in
  1579. 5.0 only (not in 4.x).
  1580. */
  1581. uint32 db_len;
  1582. uint32 fname_len;
  1583. uint32 num_fields;
  1584. const char* fields;
  1585. const uchar* field_lens;
  1586. uint32 field_block_len;
  1587. const char* table_name;
  1588. const char* db;
  1589. const char* fname;
  1590. uint32 skip_lines;
  1591. sql_ex_info sql_ex;
  1592. bool local_fname;
  1593. /* fname doesn't point to memory inside Log_event::temp_buf */
  1594. void set_fname_outside_temp_buf(const char *afname, uint alen)
  1595. {
  1596. fname= afname;
  1597. fname_len= alen;
  1598. local_fname= TRUE;
  1599. }
  1600. /* fname doesn't point to memory inside Log_event::temp_buf */
  1601. int check_fname_outside_temp_buf()
  1602. {
  1603. return local_fname;
  1604. }
  1605. #ifndef MYSQL_CLIENT
  1606. String field_lens_buf;
  1607. String fields_buf;
  1608. Load_log_event(THD* thd, sql_exchange* ex, const char* db_arg,
  1609. const char* table_name_arg,
  1610. List<Item>& fields_arg, enum enum_duplicates handle_dup, bool ignore,
  1611. bool using_trans);
  1612. void set_fields(const char* db, List<Item> &fields_arg,
  1613. Name_resolution_context *context);
  1614. const char* get_db() { return db; }
  1615. #ifdef HAVE_REPLICATION
  1616. void pack_info(Protocol* protocol);
  1617. #endif /* HAVE_REPLICATION */
  1618. #else
  1619. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  1620. void print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool commented);
  1621. #endif
  1622. /*
  1623. Note that for all the events related to LOAD DATA (Load_log_event,
  1624. Create_file/Append/Exec/Delete, we pass description_event; however as
  1625. logging of LOAD DATA is going to be changed in 4.1 or 5.0, this is only used
  1626. for the common_header_len (post_header_len will not be changed).
  1627. */
  1628. Load_log_event(const char* buf, uint event_len,
  1629. const Format_description_log_event* description_event);
  1630. ~Load_log_event()
  1631. {}
  1632. Log_event_type get_type_code()
  1633. {
  1634. return sql_ex.new_format() ? NEW_LOAD_EVENT: LOAD_EVENT;
  1635. }
  1636. #ifndef MYSQL_CLIENT
  1637. bool write_data_header(IO_CACHE* file);
  1638. bool write_data_body(IO_CACHE* file);
  1639. #endif
  1640. bool is_valid() const { return table_name != 0; }
  1641. int get_data_size()
  1642. {
  1643. return (table_name_len + db_len + 2 + fname_len
  1644. + LOAD_HEADER_LEN
  1645. + sql_ex.data_size() + field_block_len + num_fields);
  1646. }
  1647. public: /* !!! Public in this patch to allow old usage */
  1648. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  1649. virtual int do_apply_event(Relay_log_info const* rli)
  1650. {
  1651. return do_apply_event(thd->slave_net,rli,0);
  1652. }
  1653. int do_apply_event(NET *net, Relay_log_info const *rli,
  1654. bool use_rli_only_for_errors);
  1655. #endif
  1656. };
  1657. extern char server_version[SERVER_VERSION_LENGTH];
  1658. /**
  1659. @class Start_log_event_v3
  1660. Start_log_event_v3 is the Start_log_event of binlog format 3 (MySQL 3.23 and
  1661. 4.x).
  1662. Format_description_log_event derives from Start_log_event_v3; it is the
  1663. Start_log_event of binlog format 4 (MySQL 5.0), that is, the event that
  1664. describes the other events' header/postheader lengths. This event is sent by
  1665. MySQL 5.0 whenever it starts sending a new binlog if the requested position
  1666. is >4 (otherwise if ==4 the event will be sent naturally).
  1667. @section Start_log_event_v3_binary_format Binary Format
  1668. */
  1669. class Start_log_event_v3: public Log_event
  1670. {
  1671. public:
  1672. /*
  1673. If this event is at the start of the first binary log since server
  1674. startup 'created' should be the timestamp when the event (and the
  1675. binary log) was created. In the other case (i.e. this event is at
  1676. the start of a binary log created by FLUSH LOGS or automatic
  1677. rotation), 'created' should be 0. This "trick" is used by MySQL
  1678. >=4.0.14 slaves to know whether they must drop stale temporary
  1679. tables and whether they should abort unfinished transaction.
  1680. Note that when 'created'!=0, it is always equal to the event's
  1681. timestamp; indeed Start_log_event is written only in log.cc where
  1682. the first constructor below is called, in which 'created' is set
  1683. to 'when'. So in fact 'created' is a useless variable. When it is
  1684. 0 we can read the actual value from timestamp ('when') and when it
  1685. is non-zero we can read the same value from timestamp
  1686. ('when'). Conclusion:
  1687. - we use timestamp to print when the binlog was created.
  1688. - we use 'created' only to know if this is a first binlog or not.
  1689. In 3.23.57 we did not pay attention to this identity, so mysqlbinlog in
  1690. 3.23.57 does not print 'created the_date' if created was zero. This is now
  1691. fixed.
  1692. */
  1693. time_t created;
  1694. uint16 binlog_version;
  1695. char server_version[ST_SERVER_VER_LEN];
  1696. /*
  1697. artifical_event is 1 in the case where this is a generated event that
  1698. should not case any cleanup actions. We handle this in the log by
  1699. setting log_event == 0 (for now).
  1700. */
  1701. bool artificial_event;
  1702. /*
  1703. We set this to 1 if we don't want to have the created time in the log,
  1704. which is the case when we rollover to a new log.
  1705. */
  1706. bool dont_set_created;
  1707. #ifndef MYSQL_CLIENT
  1708. Start_log_event_v3();
  1709. #ifdef HAVE_REPLICATION
  1710. void pack_info(Protocol* protocol);
  1711. #endif /* HAVE_REPLICATION */
  1712. #else
  1713. Start_log_event_v3() {}
  1714. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  1715. #endif
  1716. Start_log_event_v3(const char* buf,
  1717. const Format_description_log_event* description_event);
  1718. ~Start_log_event_v3() {}
  1719. Log_event_type get_type_code() { return START_EVENT_V3;}
  1720. #ifndef MYSQL_CLIENT
  1721. bool write(IO_CACHE* file);
  1722. #endif
  1723. bool is_valid() const { return 1; }
  1724. int get_data_size()
  1725. {
  1726. return START_V3_HEADER_LEN; //no variable-sized part
  1727. }
  1728. virtual bool is_artificial_event() { return artificial_event; }
  1729. protected:
  1730. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  1731. virtual int do_apply_event(Relay_log_info const *rli);
  1732. virtual enum_skip_reason do_shall_skip(Relay_log_info*)
  1733. {
  1734. /*
  1735. Events from ourself should be skipped, but they should not
  1736. decrease the slave skip counter.
  1737. */
  1738. if (this->server_id == ::server_id)
  1739. return Log_event::EVENT_SKIP_IGNORE;
  1740. else
  1741. return Log_event::EVENT_SKIP_NOT;
  1742. }
  1743. #endif
  1744. };
  1745. /**
  1746. @class Format_description_log_event
  1747. For binlog version 4.
  1748. This event is saved by threads which read it, as they need it for future
  1749. use (to decode the ordinary events).
  1750. @section Format_description_log_event_binary_format Binary Format
  1751. */
  1752. class Format_description_log_event: public Start_log_event_v3
  1753. {
  1754. public:
  1755. /*
  1756. The size of the fixed header which _all_ events have
  1757. (for binlogs written by this version, this is equal to
  1758. LOG_EVENT_HEADER_LEN), except FORMAT_DESCRIPTION_EVENT and ROTATE_EVENT
  1759. (those have a header of size LOG_EVENT_MINIMAL_HEADER_LEN).
  1760. */
  1761. uint8 common_header_len;
  1762. uint8 number_of_event_types;
  1763. /* The list of post-headers' lengthes */
  1764. uint8 *post_header_len;
  1765. uchar server_version_split[3];
  1766. Format_description_log_event(uint8 binlog_ver, const char* server_ver=0);
  1767. Format_description_log_event(const char* buf, uint event_len,
  1768. const Format_description_log_event
  1769. *description_event);
  1770. ~Format_description_log_event() { my_free((uchar*)post_header_len, MYF(0)); }
  1771. Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;}
  1772. #ifndef MYSQL_CLIENT
  1773. bool write(IO_CACHE* file);
  1774. #endif
  1775. bool is_valid() const
  1776. {
  1777. return ((common_header_len >= ((binlog_version==1) ? OLD_HEADER_LEN :
  1778. LOG_EVENT_MINIMAL_HEADER_LEN)) &&
  1779. (post_header_len != NULL));
  1780. }
  1781. int get_data_size()
  1782. {
  1783. /*
  1784. The vector of post-header lengths is considered as part of the
  1785. post-header, because in a given version it never changes (contrary to the
  1786. query in a Query_log_event).
  1787. */
  1788. return FORMAT_DESCRIPTION_HEADER_LEN;
  1789. }
  1790. void calc_server_version_split();
  1791. protected:
  1792. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  1793. virtual int do_apply_event(Relay_log_info const *rli);
  1794. virtual int do_update_pos(Relay_log_info *rli);
  1795. virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
  1796. #endif
  1797. };
  1798. /**
  1799. @class Intvar_log_event
  1800. Logs special variables related to auto_increment values.
  1801. @section Intvar_log_event_binary_format Binary Format
  1802. The Post-Header has two components:
  1803. <table>
  1804. <caption>Post-Header for Intvar_log_event</caption>
  1805. <tr>
  1806. <th>Name</th>
  1807. <th>Size<br/></th>
  1808. <th>Description</th>
  1809. </tr>
  1810. <tr>
  1811. <td>Type</td>
  1812. <td>1 byte enumeration</td>
  1813. <td>One byte identifying the type of variable stored. Currently,
  1814. two identifiers are supported: LAST_INSERT_ID_EVENT==1 and
  1815. INSERT_ID_EVENT==2.
  1816. </td>
  1817. </tr>
  1818. <tr>
  1819. <td>value</td>
  1820. <td>8 byte unsigned integer</td>
  1821. <td>The value of the variable.</td>
  1822. </tr>
  1823. </table>
  1824. */
  1825. class Intvar_log_event: public Log_event
  1826. {
  1827. public:
  1828. ulonglong val;
  1829. uchar type;
  1830. #ifndef MYSQL_CLIENT
  1831. Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg)
  1832. :Log_event(thd_arg,0,0),val(val_arg),type(type_arg)
  1833. {}
  1834. #ifdef HAVE_REPLICATION
  1835. void pack_info(Protocol* protocol);
  1836. #endif /* HAVE_REPLICATION */
  1837. #else
  1838. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  1839. #endif
  1840. Intvar_log_event(const char* buf,
  1841. const Format_description_log_event *description_event);
  1842. ~Intvar_log_event() {}
  1843. Log_event_type get_type_code() { return INTVAR_EVENT;}
  1844. const char* get_var_type_name();
  1845. int get_data_size() { return 9; /* sizeof(type) + sizeof(val) */;}
  1846. #ifndef MYSQL_CLIENT
  1847. bool write(IO_CACHE* file);
  1848. #endif
  1849. bool is_valid() const { return 1; }
  1850. private:
  1851. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  1852. virtual int do_apply_event(Relay_log_info const *rli);
  1853. virtual int do_update_pos(Relay_log_info *rli);
  1854. virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
  1855. #endif
  1856. };
  1857. /**
  1858. @class Rand_log_event
  1859. Logs random seed used by the next RAND(), and by PASSWORD() in 4.1.0.
  1860. 4.1.1 does not need it (it's repeatable again) so this event needn't be
  1861. written in 4.1.1 for PASSWORD() (but the fact that it is written is just a
  1862. waste, it does not cause bugs).
  1863. @section Rand_log_event_binary_format Binary Format
  1864. This event type has no Post-Header. The Body of this event type has
  1865. two components:
  1866. @li seed1 (8 bytes): 64 bit random seed1.
  1867. @li seed2 (8 bytes): 64 bit random seed2.
  1868. The state of the random number generation consists of 128 bits,
  1869. which are stored internally as two 64-bit numbers.
  1870. */
  1871. class Rand_log_event: public Log_event
  1872. {
  1873. public:
  1874. ulonglong seed1;
  1875. ulonglong seed2;
  1876. #ifndef MYSQL_CLIENT
  1877. Rand_log_event(THD* thd_arg, ulonglong seed1_arg, ulonglong seed2_arg)
  1878. :Log_event(thd_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
  1879. {}
  1880. #ifdef HAVE_REPLICATION
  1881. void pack_info(Protocol* protocol);
  1882. #endif /* HAVE_REPLICATION */
  1883. #else
  1884. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  1885. #endif
  1886. Rand_log_event(const char* buf,
  1887. const Format_description_log_event *description_event);
  1888. ~Rand_log_event() {}
  1889. Log_event_type get_type_code() { return RAND_EVENT;}
  1890. int get_data_size() { return 16; /* sizeof(ulonglong) * 2*/ }
  1891. #ifndef MYSQL_CLIENT
  1892. bool write(IO_CACHE* file);
  1893. #endif
  1894. bool is_valid() const { return 1; }
  1895. private:
  1896. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  1897. virtual int do_apply_event(Relay_log_info const *rli);
  1898. virtual int do_update_pos(Relay_log_info *rli);
  1899. virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
  1900. #endif
  1901. };
  1902. /**
  1903. @class Xid_log_event
  1904. Logs xid of the transaction-to-be-committed in the 2pc protocol.
  1905. Has no meaning in replication, slaves ignore it.
  1906. @section Xid_log_event_binary_format Binary Format
  1907. */
  1908. #ifdef MYSQL_CLIENT
  1909. typedef ulonglong my_xid; // this line is the same as in handler.h
  1910. #endif
  1911. class Xid_log_event: public Log_event
  1912. {
  1913. public:
  1914. my_xid xid;
  1915. #ifndef MYSQL_CLIENT
  1916. Xid_log_event(THD* thd_arg, my_xid x): Log_event(thd_arg,0,0), xid(x) {}
  1917. #ifdef HAVE_REPLICATION
  1918. void pack_info(Protocol* protocol);
  1919. #endif /* HAVE_REPLICATION */
  1920. #else
  1921. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  1922. #endif
  1923. Xid_log_event(const char* buf,
  1924. const Format_description_log_event *description_event);
  1925. ~Xid_log_event() {}
  1926. Log_event_type get_type_code() { return XID_EVENT;}
  1927. int get_data_size() { return sizeof(xid); }
  1928. #ifndef MYSQL_CLIENT
  1929. bool write(IO_CACHE* file);
  1930. #endif
  1931. bool is_valid() const { return 1; }
  1932. private:
  1933. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  1934. virtual int do_apply_event(Relay_log_info const *rli);
  1935. enum_skip_reason do_shall_skip(Relay_log_info *rli);
  1936. #endif
  1937. };
  1938. /**
  1939. @class User_var_log_event
  1940. Every time a query uses the value of a user variable, a User_var_log_event is
  1941. written before the Query_log_event, to set the user variable.
  1942. @section User_var_log_event_binary_format Binary Format
  1943. */
  1944. class User_var_log_event: public Log_event
  1945. {
  1946. public:
  1947. char *name;
  1948. uint name_len;
  1949. char *val;
  1950. ulong val_len;
  1951. Item_result type;
  1952. uint charset_number;
  1953. bool is_null;
  1954. #ifndef MYSQL_CLIENT
  1955. User_var_log_event(THD* thd_arg, char *name_arg, uint name_len_arg,
  1956. char *val_arg, ulong val_len_arg, Item_result type_arg,
  1957. uint charset_number_arg)
  1958. :Log_event(), name(name_arg), name_len(name_len_arg), val(val_arg),
  1959. val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg)
  1960. { is_null= !val; }
  1961. void pack_info(Protocol* protocol);
  1962. #else
  1963. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  1964. #endif
  1965. User_var_log_event(const char* buf,
  1966. const Format_description_log_event *description_event);
  1967. ~User_var_log_event() {}
  1968. Log_event_type get_type_code() { return USER_VAR_EVENT;}
  1969. #ifndef MYSQL_CLIENT
  1970. bool write(IO_CACHE* file);
  1971. #endif
  1972. bool is_valid() const { return 1; }
  1973. private:
  1974. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  1975. virtual int do_apply_event(Relay_log_info const *rli);
  1976. virtual int do_update_pos(Relay_log_info *rli);
  1977. virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
  1978. #endif
  1979. };
  1980. /**
  1981. @class Stop_log_event
  1982. @section Stop_log_event_binary_format Binary Format
  1983. The Post-Header and Body for this event type are empty; it only has
  1984. the Common-Header.
  1985. */
  1986. class Stop_log_event: public Log_event
  1987. {
  1988. public:
  1989. #ifndef MYSQL_CLIENT
  1990. Stop_log_event() :Log_event()
  1991. {}
  1992. #else
  1993. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  1994. #endif
  1995. Stop_log_event(const char* buf,
  1996. const Format_description_log_event *description_event):
  1997. Log_event(buf, description_event)
  1998. {}
  1999. ~Stop_log_event() {}
  2000. Log_event_type get_type_code() { return STOP_EVENT;}
  2001. bool is_valid() const { return 1; }
  2002. private:
  2003. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2004. virtual int do_update_pos(Relay_log_info *rli);
  2005. virtual enum_skip_reason do_shall_skip(Relay_log_info *rli)
  2006. {
  2007. /*
  2008. Events from ourself should be skipped, but they should not
  2009. decrease the slave skip counter.
  2010. */
  2011. if (this->server_id == ::server_id)
  2012. return Log_event::EVENT_SKIP_IGNORE;
  2013. else
  2014. return Log_event::EVENT_SKIP_NOT;
  2015. }
  2016. #endif
  2017. };
  2018. /**
  2019. @class Rotate_log_event
  2020. This will be deprecated when we move to using sequence ids.
  2021. @section Rotate_log_event_binary_format Binary Format
  2022. The Post-Header has one component:
  2023. <table>
  2024. <caption>Post-Header for Rotate_log_event</caption>
  2025. <tr>
  2026. <th>Name</th>
  2027. <th>Size<br/></th>
  2028. <th>Description</th>
  2029. </tr>
  2030. <tr>
  2031. <td>pos</td>
  2032. <td>8 byte integer</td>
  2033. <td>???TODO</td>
  2034. </tr>
  2035. </table>
  2036. The Body has one component:
  2037. <table>
  2038. <caption>Body for Rotate_log_event</caption>
  2039. <tr>
  2040. <th>Name</th>
  2041. <th>Size<br/></th>
  2042. <th>Description</th>
  2043. </tr>
  2044. <tr>
  2045. <td>new_log_ident</td>
  2046. <td>variable length string without trailing zero, extending to the
  2047. end of the event (determined by the length field of the
  2048. Common-Header)
  2049. </td>
  2050. <td>???TODO</td>
  2051. </tr>
  2052. </table>
  2053. */
  2054. class Rotate_log_event: public Log_event
  2055. {
  2056. public:
  2057. enum {
  2058. DUP_NAME= 2 // if constructor should dup the string argument
  2059. };
  2060. const char* new_log_ident;
  2061. ulonglong pos;
  2062. uint ident_len;
  2063. uint flags;
  2064. #ifndef MYSQL_CLIENT
  2065. Rotate_log_event(const char* new_log_ident_arg,
  2066. uint ident_len_arg,
  2067. ulonglong pos_arg, uint flags);
  2068. #ifdef HAVE_REPLICATION
  2069. void pack_info(Protocol* protocol);
  2070. #endif /* HAVE_REPLICATION */
  2071. #else
  2072. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  2073. #endif
  2074. Rotate_log_event(const char* buf, uint event_len,
  2075. const Format_description_log_event* description_event);
  2076. ~Rotate_log_event()
  2077. {
  2078. if (flags & DUP_NAME)
  2079. my_free((uchar*) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
  2080. }
  2081. Log_event_type get_type_code() { return ROTATE_EVENT;}
  2082. int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
  2083. bool is_valid() const { return new_log_ident != 0; }
  2084. #ifndef MYSQL_CLIENT
  2085. bool write(IO_CACHE* file);
  2086. #endif
  2087. private:
  2088. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2089. virtual int do_update_pos(Relay_log_info *rli);
  2090. virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
  2091. #endif
  2092. };
  2093. /* the classes below are for the new LOAD DATA INFILE logging */
  2094. /**
  2095. @class Create_file_log_event
  2096. @section Create_file_log_event_binary_format Binary Format
  2097. */
  2098. class Create_file_log_event: public Load_log_event
  2099. {
  2100. protected:
  2101. /*
  2102. Pretend we are Load event, so we can write out just
  2103. our Load part - used on the slave when writing event out to
  2104. SQL_LOAD-*.info file
  2105. */
  2106. bool fake_base;
  2107. public:
  2108. char* block;
  2109. const char *event_buf;
  2110. uint block_len;
  2111. uint file_id;
  2112. bool inited_from_old;
  2113. #ifndef MYSQL_CLIENT
  2114. Create_file_log_event(THD* thd, sql_exchange* ex, const char* db_arg,
  2115. const char* table_name_arg,
  2116. List<Item>& fields_arg,
  2117. enum enum_duplicates handle_dup, bool ignore,
  2118. char* block_arg, uint block_len_arg,
  2119. bool using_trans);
  2120. #ifdef HAVE_REPLICATION
  2121. void pack_info(Protocol* protocol);
  2122. #endif /* HAVE_REPLICATION */
  2123. #else
  2124. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  2125. void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
  2126. bool enable_local);
  2127. #endif
  2128. Create_file_log_event(const char* buf, uint event_len,
  2129. const Format_description_log_event* description_event);
  2130. ~Create_file_log_event()
  2131. {
  2132. my_free((char*) event_buf, MYF(MY_ALLOW_ZERO_PTR));
  2133. }
  2134. Log_event_type get_type_code()
  2135. {
  2136. return fake_base ? Load_log_event::get_type_code() : CREATE_FILE_EVENT;
  2137. }
  2138. int get_data_size()
  2139. {
  2140. return (fake_base ? Load_log_event::get_data_size() :
  2141. Load_log_event::get_data_size() +
  2142. 4 + 1 + block_len);
  2143. }
  2144. bool is_valid() const { return inited_from_old || block != 0; }
  2145. #ifndef MYSQL_CLIENT
  2146. bool write_data_header(IO_CACHE* file);
  2147. bool write_data_body(IO_CACHE* file);
  2148. /*
  2149. Cut out Create_file extentions and
  2150. write it as Load event - used on the slave
  2151. */
  2152. bool write_base(IO_CACHE* file);
  2153. #endif
  2154. private:
  2155. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2156. virtual int do_apply_event(Relay_log_info const *rli);
  2157. #endif
  2158. };
  2159. /**
  2160. @class Append_block_log_event
  2161. @section Append_block_log_event_binary_format Binary Format
  2162. */
  2163. class Append_block_log_event: public Log_event
  2164. {
  2165. public:
  2166. char* block;
  2167. uint block_len;
  2168. uint file_id;
  2169. /*
  2170. 'db' is filled when the event is created in mysql_load() (the
  2171. event needs to have a 'db' member to be well filtered by
  2172. binlog-*-db rules). 'db' is not written to the binlog (it's not
  2173. used by Append_block_log_event::write()), so it can't be read in
  2174. the Append_block_log_event(const char* buf, int event_len)
  2175. constructor. In other words, 'db' is used only for filtering by
  2176. binlog-*-db rules. Create_file_log_event is different: it's 'db'
  2177. (which is inherited from Load_log_event) is written to the binlog
  2178. and can be re-read.
  2179. */
  2180. const char* db;
  2181. #ifndef MYSQL_CLIENT
  2182. Append_block_log_event(THD* thd, const char* db_arg, char* block_arg,
  2183. uint block_len_arg, bool using_trans);
  2184. #ifdef HAVE_REPLICATION
  2185. void pack_info(Protocol* protocol);
  2186. virtual int get_create_or_append() const;
  2187. #endif /* HAVE_REPLICATION */
  2188. #else
  2189. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  2190. #endif
  2191. Append_block_log_event(const char* buf, uint event_len,
  2192. const Format_description_log_event
  2193. *description_event);
  2194. ~Append_block_log_event() {}
  2195. Log_event_type get_type_code() { return APPEND_BLOCK_EVENT;}
  2196. int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;}
  2197. bool is_valid() const { return block != 0; }
  2198. #ifndef MYSQL_CLIENT
  2199. bool write(IO_CACHE* file);
  2200. const char* get_db() { return db; }
  2201. #endif
  2202. private:
  2203. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2204. virtual int do_apply_event(Relay_log_info const *rli);
  2205. #endif
  2206. };
  2207. /**
  2208. @class Delete_file_log_event
  2209. @section Delete_file_log_event_binary_format Binary Format
  2210. */
  2211. class Delete_file_log_event: public Log_event
  2212. {
  2213. public:
  2214. uint file_id;
  2215. const char* db; /* see comment in Append_block_log_event */
  2216. #ifndef MYSQL_CLIENT
  2217. Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans);
  2218. #ifdef HAVE_REPLICATION
  2219. void pack_info(Protocol* protocol);
  2220. #endif /* HAVE_REPLICATION */
  2221. #else
  2222. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  2223. void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
  2224. bool enable_local);
  2225. #endif
  2226. Delete_file_log_event(const char* buf, uint event_len,
  2227. const Format_description_log_event* description_event);
  2228. ~Delete_file_log_event() {}
  2229. Log_event_type get_type_code() { return DELETE_FILE_EVENT;}
  2230. int get_data_size() { return DELETE_FILE_HEADER_LEN ;}
  2231. bool is_valid() const { return file_id != 0; }
  2232. #ifndef MYSQL_CLIENT
  2233. bool write(IO_CACHE* file);
  2234. const char* get_db() { return db; }
  2235. #endif
  2236. private:
  2237. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2238. virtual int do_apply_event(Relay_log_info const *rli);
  2239. #endif
  2240. };
  2241. /**
  2242. @class Execute_load_log_event
  2243. @section Delete_file_log_event_binary_format Binary Format
  2244. */
  2245. class Execute_load_log_event: public Log_event
  2246. {
  2247. public:
  2248. uint file_id;
  2249. const char* db; /* see comment in Append_block_log_event */
  2250. #ifndef MYSQL_CLIENT
  2251. Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans);
  2252. #ifdef HAVE_REPLICATION
  2253. void pack_info(Protocol* protocol);
  2254. #endif /* HAVE_REPLICATION */
  2255. #else
  2256. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  2257. #endif
  2258. Execute_load_log_event(const char* buf, uint event_len,
  2259. const Format_description_log_event
  2260. *description_event);
  2261. ~Execute_load_log_event() {}
  2262. Log_event_type get_type_code() { return EXEC_LOAD_EVENT;}
  2263. int get_data_size() { return EXEC_LOAD_HEADER_LEN ;}
  2264. bool is_valid() const { return file_id != 0; }
  2265. #ifndef MYSQL_CLIENT
  2266. bool write(IO_CACHE* file);
  2267. const char* get_db() { return db; }
  2268. #endif
  2269. private:
  2270. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2271. virtual int do_apply_event(Relay_log_info const *rli);
  2272. #endif
  2273. };
  2274. /**
  2275. @class Begin_load_query_log_event
  2276. Event for the first block of file to be loaded, its only difference from
  2277. Append_block event is that this event creates or truncates existing file
  2278. before writing data.
  2279. @section Begin_load_query_log_event_binary_format Binary Format
  2280. */
  2281. class Begin_load_query_log_event: public Append_block_log_event
  2282. {
  2283. public:
  2284. #ifndef MYSQL_CLIENT
  2285. Begin_load_query_log_event(THD* thd_arg, const char *db_arg,
  2286. char* block_arg, uint block_len_arg,
  2287. bool using_trans);
  2288. #ifdef HAVE_REPLICATION
  2289. Begin_load_query_log_event(THD* thd);
  2290. int get_create_or_append() const;
  2291. #endif /* HAVE_REPLICATION */
  2292. #endif
  2293. Begin_load_query_log_event(const char* buf, uint event_len,
  2294. const Format_description_log_event
  2295. *description_event);
  2296. ~Begin_load_query_log_event() {}
  2297. Log_event_type get_type_code() { return BEGIN_LOAD_QUERY_EVENT; }
  2298. private:
  2299. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2300. virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
  2301. #endif
  2302. };
  2303. /*
  2304. Elements of this enum describe how LOAD DATA handles duplicates.
  2305. */
  2306. enum enum_load_dup_handling { LOAD_DUP_ERROR= 0, LOAD_DUP_IGNORE,
  2307. LOAD_DUP_REPLACE };
  2308. /**
  2309. @class Execute_load_query_log_event
  2310. Event responsible for LOAD DATA execution, it similar to Query_log_event
  2311. but before executing the query it substitutes original filename in LOAD DATA
  2312. query with name of temporary file.
  2313. @section Execute_load_query_log_event_binary_format Binary Format
  2314. */
  2315. class Execute_load_query_log_event: public Query_log_event
  2316. {
  2317. public:
  2318. uint file_id; // file_id of temporary file
  2319. uint fn_pos_start; // pointer to the part of the query that should
  2320. // be substituted
  2321. uint fn_pos_end; // pointer to the end of this part of query
  2322. /*
  2323. We have to store type of duplicate handling explicitly, because
  2324. for LOAD DATA it also depends on LOCAL option. And this part
  2325. of query will be rewritten during replication so this information
  2326. may be lost...
  2327. */
  2328. enum_load_dup_handling dup_handling;
  2329. #ifndef MYSQL_CLIENT
  2330. Execute_load_query_log_event(THD* thd, const char* query_arg,
  2331. ulong query_length, uint fn_pos_start_arg,
  2332. uint fn_pos_end_arg,
  2333. enum_load_dup_handling dup_handling_arg,
  2334. bool using_trans, bool suppress_use,
  2335. THD::killed_state
  2336. killed_err_arg= THD::KILLED_NO_VALUE);
  2337. #ifdef HAVE_REPLICATION
  2338. void pack_info(Protocol* protocol);
  2339. #endif /* HAVE_REPLICATION */
  2340. #else
  2341. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  2342. /* Prints the query as LOAD DATA LOCAL and with rewritten filename */
  2343. void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
  2344. const char *local_fname);
  2345. #endif
  2346. Execute_load_query_log_event(const char* buf, uint event_len,
  2347. const Format_description_log_event
  2348. *description_event);
  2349. ~Execute_load_query_log_event() {}
  2350. Log_event_type get_type_code() { return EXECUTE_LOAD_QUERY_EVENT; }
  2351. bool is_valid() const { return Query_log_event::is_valid() && file_id != 0; }
  2352. ulong get_post_header_size_for_derived();
  2353. #ifndef MYSQL_CLIENT
  2354. bool write_post_header_for_derived(IO_CACHE* file);
  2355. #endif
  2356. private:
  2357. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2358. virtual int do_apply_event(Relay_log_info const *rli);
  2359. #endif
  2360. };
  2361. #ifdef MYSQL_CLIENT
  2362. /**
  2363. @class Unknown_log_event
  2364. @section Unknown_log_event_binary_format Binary Format
  2365. */
  2366. class Unknown_log_event: public Log_event
  2367. {
  2368. public:
  2369. /*
  2370. Even if this is an unknown event, we still pass description_event to
  2371. Log_event's ctor, this way we can extract maximum information from the
  2372. event's header (the unique ID for example).
  2373. */
  2374. Unknown_log_event(const char* buf,
  2375. const Format_description_log_event *description_event):
  2376. Log_event(buf, description_event)
  2377. {}
  2378. ~Unknown_log_event() {}
  2379. void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
  2380. Log_event_type get_type_code() { return UNKNOWN_EVENT;}
  2381. bool is_valid() const { return 1; }
  2382. };
  2383. #endif
  2384. char *str_to_hex(char *to, const char *from, uint len);
  2385. /**
  2386. @class Table_map_log_event
  2387. Create a mapping from a (database name, table name) couple to a table
  2388. identifier (an integer number).
  2389. @section Table_map_log_event_binary_format Binary Format
  2390. */
  2391. class Table_map_log_event : public Log_event
  2392. {
  2393. public:
  2394. /* Constants */
  2395. enum
  2396. {
  2397. TYPE_CODE = TABLE_MAP_EVENT
  2398. };
  2399. /**
  2400. Enumeration of the errors that can be returned.
  2401. */
  2402. enum enum_error
  2403. {
  2404. ERR_OPEN_FAILURE = -1, /**< Failure to open table */
  2405. ERR_OK = 0, /**< No error */
  2406. ERR_TABLE_LIMIT_EXCEEDED = 1, /**< No more room for tables */
  2407. ERR_OUT_OF_MEM = 2, /**< Out of memory */
  2408. ERR_BAD_TABLE_DEF = 3, /**< Table definition does not match */
  2409. ERR_RBR_TO_SBR = 4 /**< daisy-chanining RBR to SBR not allowed */
  2410. };
  2411. enum enum_flag
  2412. {
  2413. /*
  2414. Nothing here right now, but the flags support is there in
  2415. preparation for changes that are coming. Need to add a
  2416. constant to make it compile under HP-UX: aCC does not like
  2417. empty enumerations.
  2418. */
  2419. ENUM_FLAG_COUNT
  2420. };
  2421. typedef uint16 flag_set;
  2422. /* Special constants representing sets of flags */
  2423. enum
  2424. {
  2425. TM_NO_FLAGS = 0U
  2426. };
  2427. void set_flags(flag_set flag) { m_flags |= flag; }
  2428. void clear_flags(flag_set flag) { m_flags &= ~flag; }
  2429. flag_set get_flags(flag_set flag) const { return m_flags & flag; }
  2430. #ifndef MYSQL_CLIENT
  2431. Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
  2432. bool is_transactional, uint16 flags);
  2433. #endif
  2434. #ifdef HAVE_REPLICATION
  2435. Table_map_log_event(const char *buf, uint event_len,
  2436. const Format_description_log_event *description_event);
  2437. #endif
  2438. ~Table_map_log_event();
  2439. virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; }
  2440. virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ }
  2441. virtual int get_data_size() { return m_data_size; }
  2442. #ifndef MYSQL_CLIENT
  2443. virtual int save_field_metadata();
  2444. virtual bool write_data_header(IO_CACHE *file);
  2445. virtual bool write_data_body(IO_CACHE *file);
  2446. virtual const char *get_db() { return m_dbnam; }
  2447. #endif
  2448. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2449. virtual void pack_info(Protocol *protocol);
  2450. #endif
  2451. #ifdef MYSQL_CLIENT
  2452. virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
  2453. #endif
  2454. private:
  2455. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2456. virtual int do_apply_event(Relay_log_info const *rli);
  2457. virtual int do_update_pos(Relay_log_info *rli);
  2458. virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
  2459. #endif
  2460. #ifndef MYSQL_CLIENT
  2461. TABLE *m_table;
  2462. #endif
  2463. char const *m_dbnam;
  2464. size_t m_dblen;
  2465. char const *m_tblnam;
  2466. size_t m_tbllen;
  2467. ulong m_colcnt;
  2468. uchar *m_coltype;
  2469. uchar *m_memory;
  2470. ulong m_table_id;
  2471. flag_set m_flags;
  2472. size_t m_data_size;
  2473. uchar *m_field_metadata; // buffer for field metadata
  2474. /*
  2475. The size of field metadata buffer set by calling save_field_metadata()
  2476. */
  2477. ulong m_field_metadata_size;
  2478. uchar *m_null_bits;
  2479. uchar *m_meta_memory;
  2480. };
  2481. /**
  2482. @class Rows_log_event
  2483. Common base class for all row-containing log events.
  2484. RESPONSIBILITIES
  2485. Encode the common parts of all events containing rows, which are:
  2486. - Write data header and data body to an IO_CACHE.
  2487. - Provide an interface for adding an individual row to the event.
  2488. @section Rows_log_event_binary_format Binary Format
  2489. */
  2490. class Rows_log_event : public Log_event
  2491. {
  2492. public:
  2493. /**
  2494. Enumeration of the errors that can be returned.
  2495. */
  2496. enum enum_error
  2497. {
  2498. ERR_OPEN_FAILURE = -1, /**< Failure to open table */
  2499. ERR_OK = 0, /**< No error */
  2500. ERR_TABLE_LIMIT_EXCEEDED = 1, /**< No more room for tables */
  2501. ERR_OUT_OF_MEM = 2, /**< Out of memory */
  2502. ERR_BAD_TABLE_DEF = 3, /**< Table definition does not match */
  2503. ERR_RBR_TO_SBR = 4 /**< daisy-chanining RBR to SBR not allowed */
  2504. };
  2505. /*
  2506. These definitions allow you to combine the flags into an
  2507. appropriate flag set using the normal bitwise operators. The
  2508. implicit conversion from an enum-constant to an integer is
  2509. accepted by the compiler, which is then used to set the real set
  2510. of flags.
  2511. */
  2512. enum enum_flag
  2513. {
  2514. /* Last event of a statement */
  2515. STMT_END_F = (1U << 0),
  2516. /* Value of the OPTION_NO_FOREIGN_KEY_CHECKS flag in thd->options */
  2517. NO_FOREIGN_KEY_CHECKS_F = (1U << 1),
  2518. /* Value of the OPTION_RELAXED_UNIQUE_CHECKS flag in thd->options */
  2519. RELAXED_UNIQUE_CHECKS_F = (1U << 2),
  2520. /**
  2521. Indicates that rows in this event are complete, that is contain
  2522. values for all columns of the table.
  2523. */
  2524. COMPLETE_ROWS_F = (1U << 3)
  2525. };
  2526. typedef uint16 flag_set;
  2527. /* Special constants representing sets of flags */
  2528. enum
  2529. {
  2530. RLE_NO_FLAGS = 0U
  2531. };
  2532. virtual ~Rows_log_event();
  2533. void set_flags(flag_set flags_arg) { m_flags |= flags_arg; }
  2534. void clear_flags(flag_set flags_arg) { m_flags &= ~flags_arg; }
  2535. flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }
  2536. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2537. virtual void pack_info(Protocol *protocol);
  2538. #endif
  2539. #ifdef MYSQL_CLIENT
  2540. /* not for direct call, each derived has its own ::print() */
  2541. virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0;
  2542. #endif
  2543. #ifndef MYSQL_CLIENT
  2544. int add_row_data(uchar *data, size_t length)
  2545. {
  2546. return do_add_row_data(data,length);
  2547. }
  2548. #endif
  2549. /* Member functions to implement superclass interface */
  2550. virtual int get_data_size();
  2551. MY_BITMAP const *get_cols() const { return &m_cols; }
  2552. size_t get_width() const { return m_width; }
  2553. ulong get_table_id() const { return m_table_id; }
  2554. #ifndef MYSQL_CLIENT
  2555. virtual bool write_data_header(IO_CACHE *file);
  2556. virtual bool write_data_body(IO_CACHE *file);
  2557. virtual const char *get_db() { return m_table->s->db.str; }
  2558. #endif
  2559. /*
  2560. Check that malloc() succeeded in allocating memory for the rows
  2561. buffer and the COLS vector. Checking that an Update_rows_log_event
  2562. is valid is done in the Update_rows_log_event::is_valid()
  2563. function.
  2564. */
  2565. virtual bool is_valid() const
  2566. {
  2567. return m_rows_buf && m_cols.bitmap;
  2568. }
  2569. uint m_row_count; /* The number of rows added to the event */
  2570. protected:
  2571. /*
  2572. The constructors are protected since you're supposed to inherit
  2573. this class, not create instances of this class.
  2574. */
  2575. #ifndef MYSQL_CLIENT
  2576. Rows_log_event(THD*, TABLE*, ulong table_id,
  2577. MY_BITMAP const *cols, bool is_transactional);
  2578. #endif
  2579. Rows_log_event(const char *row_data, uint event_len,
  2580. Log_event_type event_type,
  2581. const Format_description_log_event *description_event);
  2582. #ifdef MYSQL_CLIENT
  2583. void print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name);
  2584. #endif
  2585. #ifndef MYSQL_CLIENT
  2586. virtual int do_add_row_data(uchar *data, size_t length);
  2587. #endif
  2588. #ifndef MYSQL_CLIENT
  2589. TABLE *m_table; /* The table the rows belong to */
  2590. #endif
  2591. ulong m_table_id; /* Table ID */
  2592. MY_BITMAP m_cols; /* Bitmap denoting columns available */
  2593. ulong m_width; /* The width of the columns bitmap */
  2594. /*
  2595. Bitmap for columns available in the after image, if present. These
  2596. fields are only available for Update_rows events. Observe that the
  2597. width of both the before image COLS vector and the after image
  2598. COLS vector is the same: the number of columns of the table on the
  2599. master.
  2600. */
  2601. MY_BITMAP m_cols_ai;
  2602. ulong m_master_reclength; /* Length of record on master side */
  2603. /* Bit buffers in the same memory as the class */
  2604. uint32 m_bitbuf[128/(sizeof(uint32)*8)];
  2605. uint32 m_bitbuf_ai[128/(sizeof(uint32)*8)];
  2606. uchar *m_rows_buf; /* The rows in packed format */
  2607. uchar *m_rows_cur; /* One-after the end of the data */
  2608. uchar *m_rows_end; /* One-after the end of the allocated space */
  2609. flag_set m_flags; /* Flags for row-level events */
  2610. /* helper functions */
  2611. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2612. const uchar *m_curr_row; /* Start of the row being processed */
  2613. const uchar *m_curr_row_end; /* One-after the end of the current row */
  2614. uchar *m_key; /* Buffer to keep key value during searches */
  2615. int find_row(const Relay_log_info *const);
  2616. int write_row(const Relay_log_info *const, const bool);
  2617. // Unpack the current row into m_table->record[0]
  2618. int unpack_current_row(const Relay_log_info *const rli)
  2619. {
  2620. DBUG_ASSERT(m_table);
  2621. ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT);
  2622. int const result= ::unpack_row(rli, m_table, m_width, m_curr_row, &m_cols,
  2623. &m_curr_row_end, &m_master_reclength);
  2624. ASSERT_OR_RETURN_ERROR(m_curr_row_end <= m_rows_end, HA_ERR_CORRUPT_EVENT);
  2625. return result;
  2626. }
  2627. #endif
  2628. private:
  2629. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2630. virtual int do_apply_event(Relay_log_info const *rli);
  2631. virtual int do_update_pos(Relay_log_info *rli);
  2632. virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
  2633. /*
  2634. Primitive to prepare for a sequence of row executions.
  2635. DESCRIPTION
  2636. Before doing a sequence of do_prepare_row() and do_exec_row()
  2637. calls, this member function should be called to prepare for the
  2638. entire sequence. Typically, this member function will allocate
  2639. space for any buffers that are needed for the two member
  2640. functions mentioned above.
  2641. RETURN VALUE
  2642. The member function will return 0 if all went OK, or a non-zero
  2643. error code otherwise.
  2644. */
  2645. virtual
  2646. int do_before_row_operations(const Slave_reporting_capability *const log) = 0;
  2647. /*
  2648. Primitive to clean up after a sequence of row executions.
  2649. DESCRIPTION
  2650. After doing a sequence of do_prepare_row() and do_exec_row(),
  2651. this member function should be called to clean up and release
  2652. any allocated buffers.
  2653. The error argument, if non-zero, indicates an error which happened during
  2654. row processing before this function was called. In this case, even if
  2655. function is successful, it should return the error code given in the argument.
  2656. */
  2657. virtual
  2658. int do_after_row_operations(const Slave_reporting_capability *const log,
  2659. int error) = 0;
  2660. /*
  2661. Primitive to do the actual execution necessary for a row.
  2662. DESCRIPTION
  2663. The member function will do the actual execution needed to handle a row.
  2664. The row is located at m_curr_row. When the function returns,
  2665. m_curr_row_end should point at the next row (one byte after the end
  2666. of the current row).
  2667. RETURN VALUE
  2668. 0 if execution succeeded, 1 if execution failed.
  2669. */
  2670. virtual int do_exec_row(const Relay_log_info *const rli) = 0;
  2671. #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
  2672. friend class Old_rows_log_event;
  2673. };
  2674. /**
  2675. @class Write_rows_log_event
  2676. Log row insertions and updates. The event contain several
  2677. insert/update rows for a table. Note that each event contains only
  2678. rows for one table.
  2679. @section Write_rows_log_event_binary_format Binary Format
  2680. */
  2681. class Write_rows_log_event : public Rows_log_event
  2682. {
  2683. public:
  2684. enum
  2685. {
  2686. /* Support interface to THD::binlog_prepare_pending_rows_event */
  2687. TYPE_CODE = WRITE_ROWS_EVENT
  2688. };
  2689. #if !defined(MYSQL_CLIENT)
  2690. Write_rows_log_event(THD*, TABLE*, ulong table_id,
  2691. MY_BITMAP const *cols, bool is_transactional);
  2692. #endif
  2693. #ifdef HAVE_REPLICATION
  2694. Write_rows_log_event(const char *buf, uint event_len,
  2695. const Format_description_log_event *description_event);
  2696. #endif
  2697. #if !defined(MYSQL_CLIENT)
  2698. static bool binlog_row_logging_function(THD *thd, TABLE *table,
  2699. bool is_transactional,
  2700. MY_BITMAP *cols,
  2701. uint fields,
  2702. const uchar *before_record
  2703. __attribute__((unused)),
  2704. const uchar *after_record)
  2705. {
  2706. return thd->binlog_write_row(table, is_transactional,
  2707. cols, fields, after_record);
  2708. }
  2709. #endif
  2710. private:
  2711. virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
  2712. #ifdef MYSQL_CLIENT
  2713. void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
  2714. #endif
  2715. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2716. virtual int do_before_row_operations(const Slave_reporting_capability *const);
  2717. virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
  2718. virtual int do_exec_row(const Relay_log_info *const);
  2719. #endif
  2720. };
  2721. /**
  2722. @class Update_rows_log_event
  2723. Log row updates with a before image. The event contain several
  2724. update rows for a table. Note that each event contains only rows for
  2725. one table.
  2726. Also note that the row data consists of pairs of row data: one row
  2727. for the old data and one row for the new data.
  2728. @section Update_rows_log_event_binary_format Binary Format
  2729. */
  2730. class Update_rows_log_event : public Rows_log_event
  2731. {
  2732. public:
  2733. enum
  2734. {
  2735. /* Support interface to THD::binlog_prepare_pending_rows_event */
  2736. TYPE_CODE = UPDATE_ROWS_EVENT
  2737. };
  2738. #ifndef MYSQL_CLIENT
  2739. Update_rows_log_event(THD*, TABLE*, ulong table_id,
  2740. MY_BITMAP const *cols_bi,
  2741. MY_BITMAP const *cols_ai,
  2742. bool is_transactional);
  2743. Update_rows_log_event(THD*, TABLE*, ulong table_id,
  2744. MY_BITMAP const *cols,
  2745. bool is_transactional);
  2746. void init(MY_BITMAP const *cols);
  2747. #endif
  2748. virtual ~Update_rows_log_event();
  2749. #ifdef HAVE_REPLICATION
  2750. Update_rows_log_event(const char *buf, uint event_len,
  2751. const Format_description_log_event *description_event);
  2752. #endif
  2753. #if !defined(MYSQL_CLIENT)
  2754. static bool binlog_row_logging_function(THD *thd, TABLE *table,
  2755. bool is_transactional,
  2756. MY_BITMAP *cols,
  2757. uint fields,
  2758. const uchar *before_record,
  2759. const uchar *after_record)
  2760. {
  2761. return thd->binlog_update_row(table, is_transactional,
  2762. cols, fields, before_record, after_record);
  2763. }
  2764. #endif
  2765. virtual bool is_valid() const
  2766. {
  2767. return Rows_log_event::is_valid() && m_cols_ai.bitmap;
  2768. }
  2769. protected:
  2770. virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
  2771. #ifdef MYSQL_CLIENT
  2772. void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
  2773. #endif
  2774. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2775. virtual int do_before_row_operations(const Slave_reporting_capability *const);
  2776. virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
  2777. virtual int do_exec_row(const Relay_log_info *const);
  2778. #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
  2779. };
  2780. /**
  2781. @class Delete_rows_log_event
  2782. Log row deletions. The event contain several delete rows for a
  2783. table. Note that each event contains only rows for one table.
  2784. RESPONSIBILITIES
  2785. - Act as a container for rows that has been deleted on the master
  2786. and should be deleted on the slave.
  2787. COLLABORATION
  2788. Row_writer
  2789. Create the event and add rows to the event.
  2790. Row_reader
  2791. Extract the rows from the event.
  2792. @section Delete_rows_log_event_binary_format Binary Format
  2793. */
  2794. class Delete_rows_log_event : public Rows_log_event
  2795. {
  2796. public:
  2797. enum
  2798. {
  2799. /* Support interface to THD::binlog_prepare_pending_rows_event */
  2800. TYPE_CODE = DELETE_ROWS_EVENT
  2801. };
  2802. #ifndef MYSQL_CLIENT
  2803. Delete_rows_log_event(THD*, TABLE*, ulong,
  2804. MY_BITMAP const *cols, bool is_transactional);
  2805. #endif
  2806. #ifdef HAVE_REPLICATION
  2807. Delete_rows_log_event(const char *buf, uint event_len,
  2808. const Format_description_log_event *description_event);
  2809. #endif
  2810. #if !defined(MYSQL_CLIENT)
  2811. static bool binlog_row_logging_function(THD *thd, TABLE *table,
  2812. bool is_transactional,
  2813. MY_BITMAP *cols,
  2814. uint fields,
  2815. const uchar *before_record,
  2816. const uchar *after_record
  2817. __attribute__((unused)))
  2818. {
  2819. return thd->binlog_delete_row(table, is_transactional,
  2820. cols, fields, before_record);
  2821. }
  2822. #endif
  2823. protected:
  2824. virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
  2825. #ifdef MYSQL_CLIENT
  2826. void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
  2827. #endif
  2828. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2829. virtual int do_before_row_operations(const Slave_reporting_capability *const);
  2830. virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
  2831. virtual int do_exec_row(const Relay_log_info *const);
  2832. #endif
  2833. };
  2834. #include "log_event_old.h"
  2835. /**
  2836. @class Incident_log_event
  2837. Class representing an incident, an occurance out of the ordinary,
  2838. that happened on the master.
  2839. The event is used to inform the slave that something out of the
  2840. ordinary happened on the master that might cause the database to be
  2841. in an inconsistent state.
  2842. <table id="IncidentFormat">
  2843. <caption>Incident event format</caption>
  2844. <tr>
  2845. <th>Symbol</th>
  2846. <th>Size<br/>(bytes)</th>
  2847. <th>Description</th>
  2848. </tr>
  2849. <tr>
  2850. <td>INCIDENT</td>
  2851. <td align="right">2</td>
  2852. <td>Incident number as an unsigned integer</td>
  2853. </tr>
  2854. <tr>
  2855. <td>MSGLEN</td>
  2856. <td align="right">1</td>
  2857. <td>Message length as an unsigned integer</td>
  2858. </tr>
  2859. <tr>
  2860. <td>MESSAGE</td>
  2861. <td align="right">MSGLEN</td>
  2862. <td>The message, if present. Not null terminated.</td>
  2863. </tr>
  2864. </table>
  2865. @section Delete_rows_log_event_binary_format Binary Format
  2866. */
  2867. class Incident_log_event : public Log_event {
  2868. public:
  2869. #ifndef MYSQL_CLIENT
  2870. Incident_log_event(THD *thd_arg, Incident incident)
  2871. : Log_event(thd_arg, 0, FALSE), m_incident(incident)
  2872. {
  2873. DBUG_ENTER("Incident_log_event::Incident_log_event");
  2874. DBUG_PRINT("enter", ("m_incident: %d", m_incident));
  2875. m_message.str= NULL; /* Just as a precaution */
  2876. m_message.length= 0;
  2877. DBUG_VOID_RETURN;
  2878. }
  2879. Incident_log_event(THD *thd_arg, Incident incident, LEX_STRING const msg)
  2880. : Log_event(thd_arg, 0, FALSE), m_incident(incident)
  2881. {
  2882. DBUG_ENTER("Incident_log_event::Incident_log_event");
  2883. DBUG_PRINT("enter", ("m_incident: %d", m_incident));
  2884. m_message= msg;
  2885. DBUG_VOID_RETURN;
  2886. }
  2887. #endif
  2888. #ifndef MYSQL_CLIENT
  2889. void pack_info(Protocol*);
  2890. #endif
  2891. Incident_log_event(const char *buf, uint event_len,
  2892. const Format_description_log_event *descr_event);
  2893. virtual ~Incident_log_event();
  2894. #ifdef MYSQL_CLIENT
  2895. virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
  2896. #endif
  2897. #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
  2898. virtual int do_apply_event(Relay_log_info const *rli);
  2899. #endif
  2900. virtual bool write_data_header(IO_CACHE *file);
  2901. virtual bool write_data_body(IO_CACHE *file);
  2902. virtual Log_event_type get_type_code() { return INCIDENT_EVENT; }
  2903. virtual bool is_valid() const { return 1; }
  2904. virtual int get_data_size() {
  2905. return INCIDENT_HEADER_LEN + 1 + m_message.length;
  2906. }
  2907. private:
  2908. const char *description() const;
  2909. Incident m_incident;
  2910. LEX_STRING m_message;
  2911. };
  2912. static inline bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache,
  2913. FILE *file)
  2914. {
  2915. return
  2916. my_b_copy_to_file(cache, file) ||
  2917. reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
  2918. }
  2919. /**
  2920. @} (end of group Replication)
  2921. */
  2922. #endif /* _log_event_h */