mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
22 commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
unknown
|
edb7733c83 |
BUG#34541: mysqlbinlog prints 'set;' in stm mode after changing autocommit mode
Problem: a typo in the code. When autocommit, foreign_key_checks, sql_auto_is_null, or unique_checks changes, it prints "SET", and then a comma-separated list of assignments. However, it does not print the assignment to the @@autocommit variable. Fix: print the @@autocommit variable. mysql-test/r/mysqlbinlog.result: Updated result file since output of mysqlbinlog changed. mysql-test/r/mysqlbinlog2.result: Updated result file since output of mysqlbinlog changed. mysql-test/r/user_var-binlog.result: Updated result file since output of mysqlbinlog changed. mysql-test/suite/binlog/r/binlog_base64_flag.result: Updated result file since output of mysqlbinlog changed. mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result: Updated result file since output of mysqlbinlog changed. mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result: Updated result file since output of mysqlbinlog changed. sql/log_event.cc: Just a typo: mysqlbinlog should print the autocommit flag when the value of the flag changes. Also fixed nearby indentation. |
||
unknown
|
875ad6d8b8 |
BUG#31168: @@hostname does not replicate
Problem: in mixed and statement mode, a query that refers to a system variable will use the slave's value when replayed on slave. So if the value of a system variable is inserted into a table, the slave will differ from the master. Fix: mark statements that refer to a system variable as "unsafe", meaning they will be replicated by row in mixed mode and produce a warning in statement mode. There are some exceptions: some variables are actually replicated. Those should *not* be marked as unsafe. BUG#34732: mysqlbinlog does not print default values for auto_increment variables Problem: mysqlbinlog does not print default values for some variables, including auto_increment_increment and others. So if a client executing the output of mysqlbinlog has different default values, replication will be wrong. Fix: Always print default values for all variables that are replicated. I need to fix the two bugs at the same time, because the test cases would fail if I only fixed one of them. include/m_ctype.h: Added definition of ILLEGAL_CHARSET_INFO_NUMBER. We just need a symbol for a number that will never be used by any charset. ~0U should be safe since charset numbers are sequential, starting from 0. mysql-test/include/commit.inc: Upated test to avoid making statements unsafe. mysql-test/r/commit_1innodb.result: Updated test needs updated result file. mysql-test/r/mysqlbinlog.result: Updated result file. mysql-test/r/mysqlbinlog2.result: Updated result file. mysql-test/r/user_var-binlog.result: Updated result file. mysql-test/suite/binlog/r/binlog_base64_flag.result: Updated result file. mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result: Updated result file. mysql-test/suite/binlog/r/binlog_unsafe.result: Modified test file needs modified result file. mysql-test/suite/binlog/t/binlog_base64_flag.test: Need to filter out pseudo_thread_id from result since it is nondeterministic. mysql-test/suite/binlog/t/binlog_unsafe.test: Add tests that using variables is unsafe. The 'CREATE VIEW' tests didn't make sense, so I removed them. SHOW WARNINGS is not necessary either, because we get warnings for each statement in the result file. mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result: Updated result file. mysql-test/suite/rpl/r/rpl_skip_error.result: Updated result file. mysql-test/suite/rpl/t/rpl_skip_error.test: The test used @@server_id, which is not safe to replicate, so it would have given a warning. The way it used @@server_id was hackish (issue a query on master that removes rows only on master), so I replaced it by a more robust way to do the same thing (connect to slave and insert the rows only there). Also clarified what the test case does. mysql-test/t/mysqlbinlog2.test: Use --short-form instead of manually filtering out nondeterministic stuff from mysqlbinlog (because we added the nondeterministic @@pseudo_thread_id to the output). sql/item_func.cc: Added method of Item_func_get_system_var that indicates whether the given system variable will be written to the binlog or not. sql/item_func.h: Added method of Item_func_get_system_var that indicates whether the given system variable will be written to the binlog or not. sql/log_event.cc: - auto_increment_offset was not written to the binlog if auto_increment_increment=1 - mysqlbinlog did not output default values for some variables (BUG#34732). In st_print_event_info, we remember for each variable whether it has been printed or not. This is achieved in different ways for different variables: - For auto_increment_*, lc_time_names, charset_database_number, we set the default values in st_print_event_info to something illegal, so that it will look like they have changed the first time they are seen. - For charset, sql_mode, pseudo_thread_id, we add a flag to st_print_event_info which indicates whether the variable has been printed. - Since pseudo_thread_id is now printed more often, and its value is not guaranteed to be constant across different runs of the same test script, I replaced it by a constant if --short-form is used. - Moved st_print_event_info constructor from log_event.h to log_event.cc, since it now depends on ILLEGAL_CHARSET_NUMBER, which is defined in m_ctype.h, which is better to include from a .cc file than from a header file. sql/log_event.h: Added fields to st_print_event_info that indicate whether some of the variables have been written or not. Since the initialization of charset_database_number now depends on ILLEGAL_CHARSET_INFO_NUMBER, which is defined in a header file, which we'd better not include from this header file -- I moved the constructor from here to log_event.cc. sql/set_var.cc: System variables now have a flag binlog_status, which indicates if they are written to the binlog. If nothing is specified, all variables are marked as not written to the binlog (NOT_IN_BINLOG) when created. In this file, the variables that are written to the binlog are marked with SESSION_VARIABLE_IN_BINLOG. sql/set_var.h: Added flag binlog_status to class sys_var. Added a getter and a constructor parameter that sets it. Since I had to change sys_var_thd_enum constructor anyways, I simplified it to use default values of arguments instead of three copies of the constructor. sql/sql_yacc.yy: Mark statements that refer to a system variable as "unsafe", meaning they will be replicated by row in mixed mode. Added comment to explain strange piece of code just above. mysql-test/include/diff_tables.inc: New auxiliary test file that tests whether two tables (possibly one on master and one on slave) differ. mysql-test/suite/rpl/r/rpl_variables.result: New test case needs new result file. mysql-test/suite/rpl/r/rpl_variables_stm.result: New test file needs new result file. mysql-test/suite/rpl/t/rpl_variables.test: Test that INSERT of @@variables is replicated correctly (by switching to row-based mode). mysql-test/suite/rpl/t/rpl_variables_stm.test: Test that replication of @@variables which are replicated explicitly works as expected in statement mode (without giving warnings). |
||
unknown
|
7477060bb3 |
Merge hezx.(none):/media/sda3/work/mysql/bkwork/bug#32205/5.1
into hezx.(none):/media/sda3/work/mysql/bkwork/bug#32205/mysql-5.1-new-rpl mysql-test/r/mysqlbinlog2.result: Auto merged mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: Auto merged mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result: Auto merged sql/log_event.cc: Auto merged |
||
unknown
|
0968c713aa |
BUG#32205 Replaying statements from mysqlbinlog fails with a syntax error, replicates
fine The reason of this bug is that when mysqlbinlog dumps a query, the query is written to output with a delimeter appended right after it, if the query string ends with a '--' comment, then the delimeter would be considered as part of the comment, if there are any statements after this query, then it will cause a syntax error. Start a newline before appending delimiter after a query string mysql-test/r/mysqlbinlog.result: Update result for BUG#32205 mysql-test/r/mysqlbinlog2.result: Update result for BUG#32205 mysql-test/r/user_var-binlog.result: Update result for BUG#32205 mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result: Update result for BUG#32205 mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: Update result for BUG#32205 mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test: fix test for BUG#32205 mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result: Update result for BUG#32205 mysql-test/suite/rpl/r/rpl_stm_charset.result: Update result for BUG#32205 sql/log_event.cc: Start a newline before appending delimiter after a query string mysql-test/suite/binlog/r/binlog_start_comment.result: Add test for BUG#32205 mysql-test/suite/binlog/t/binlog_start_comment.test: Add test for BUG#32205 |
||
unknown
|
8d37a30eac |
BUG#32407: Impossible to do point-in-time recovery from older binlog
Problem: it is unsafe to read base64-printed events without first reading the Format_description_log_event (FD). Currently, mysqlbinlog cannot print the FD. As a side effect, another bug has also been fixed: When mysqlbinlog --start-position=X was specified, no ROLLBACK was printed. I changed this, so that ROLLBACK is always printed. This patch does several things: - Format_description_log_event (FD) now print themselves in base64 format. - mysqlbinlog is now able to print FD events. It has three modes: --base64-output=auto Print row events in base64 output, and print FD event. The FD event is printed even if it is outside the range specified with --start-position, because it would not be safe to read row events otherwise. This is the default. --base64-output=always Like --base64-output=auto, but also print base64 output for query events. This is like the old --base64-output flag, which is also a shorthand for --base64-output=always --base64-output=never Never print base64 output, generate error if row events occur in binlog. This is useful to suppress the FD event in binlogs known not to contain row events (e.g., because BINLOG statement is unsafe, requires root privileges, is not SQL, etc) - the BINLOG statement now handles FD events correctly, by setting the thread's rli's relay log's description_event_for_exec to the loaded event. In fact, executing a BINLOG statement is almost the same as reading an event from a relay log. Before my patch, the code for this was separated (exec_relay_log_event in slave.cc executes events from the relay log, mysql_client_binlog_statement in sql_binlog.cc executes BINLOG statements). I needed to augment mysql_client_binlog_statement to do parts of what exec_relay_log_event does. Hence, I did a small refactoring and moved parts of exec_relay_log_event to a new function, which I named apply_event_and_update_pos. apply_event_and_update_pos is called both from exec_relay_log_event and from mysql_client_binlog_statement. - When a non-FD event is executed in a BINLOG statement, without previously executing a FD event in a BINLOG statement, it generates an error, because that's unsafe. I took a new error code for that: ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENTS. In order to get a decent error message containing the name of the event, I added the class method char* Log_event::get_type_str(Log_event_type type), which returns a string name for the given Log_event_type. This is just like the existing char* Log_event::get_type_str(), except it is a class method that takes the log event type as parameter. I also added PRE_GA_*_ROWS_LOG_EVENT to Log_event::get_type_str(), so that names of old rows event are properly printed. - When reading an event, I added a check that the event type is known by the current Format_description_log_event. Without this, it may crash on bad input (and I was struck by this several times). - I patched the following test cases, which all contain BINLOG statements for row events which must be preceded by BINLOG statements for FD events: - rpl_bug31076 While I was here, I fixed some small things in log_event.cc: - replaced hard-coded 4 by EVENT_TYPE_OFFSET in 3 places - replaced return by DBUG_VOID_RETURN in one place - The name of the logfile can be '-' to indicate stdin. Before my patch, the code just checked if the first character is '-'; now it does a full strcmp(). Probably, all arguments that begin with a - are already handled somewhere else as flags, but I still think it is better that the code reflects what it is supposed to do, with as little dependencies as possible on other parts of the code. If we one day implement that all command line arguments after -- are files (as most unix tools do), then we need this. I also fixed the following in slave.cc: - next_event() was declared twice, and queue_event was not static but should be static (not used outside the file). client/client_priv.h: Declared the new option for base64 output. client/mysqlbinlog.cc: - Change from using the two-state command line option "default/--base64-output" to the three-state "--base64-output=[never|auto|always]" - Print the FD event even if it is outside the --start-position range. - Stop if a row event is about to be printed without a preceding FD event. - Minor fixes: * changed 4 to EVENT_TYPE_OFFSET in some places * Added comments * before, "mysqlbinlog -xyz" read from stdin; now it does not (only "mysqlbinlog -" reads stdin). mysql-test/r/mysqlbinlog2.result: Updated result file: mysqlbinlog now prints ROLLBACK always. mysql-test/suite/binlog/t/disabled.def: The test must be disabled since it reveals another bug: see BUG#33247. mysql-test/suite/rpl/r/rpl_bug31076.result: Updated result file mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result: Updated result file mysql-test/suite/rpl/t/rpl_bug31076.test: Had to add explicit Format_description_log_event before other BINLOG statements mysql-test/t/mysqlbinlog2.test: we must suppress base64 output in result file because it contains a timestamp sql/log_event.cc: - Made FD events able to print themselves - Added check that the current FD event knows about the event type, when an event is about to be read. (Hint to reviewers: I had to re-indent a big block because of this; use diff -b) * To get a decent error message, I also added a class method const char* Log_event::get_type_str(Log_event_type) which converts number to event type string without having a Log_event object. * Made Log_event::get_type_str aware of PRE_GA_*_ROWS_LOG_EVENT. - Minor fixes: * Changed return to DBUG_VOID_RETURN sql/log_event.h: - Declared enum to describe the three base64_output modes - Use the enum instead of a flag - Declare the new class method get_type_str (see log_event.cc) sql/share/errmsg.txt: Added error msg. sql/slave.cc: - Factored out part of exec_relay_log_event to the new function apply_event_and_update_pos, because that code is needed when executing BINLOG statements. (this is be functionally equivalent to the previous code, except: (1) skipping events is now optional, controlled by a parameter to the new function (2) the return value of exec_relay_log_event has changed; see next item). - Changed returned error value to always be 1. Before, it would return the error value from apply_log_event, which was unnecessary. This change is safe because the exact return value of exec_relay_log_event is never examined; it is only tested to be ==0 or !=0. - Added comments describing exec_relay_log_event and apply_event_and_update_pos. - Minor fixes: * Removed duplicate declaration of next_event, made queue_event static. * Added doxygen code to include this file. sql/slave.h: Declared the new apply_event_and_update_pos sql/sql_binlog.cc: - Made mysql_binlog_statement set the current FD event when the given event is an FD event. This entails using the new function apply_event_and_update_pos from slave.cc instead of just calling the ev->apply method. - Made mysql_binlog_statement fail if the first BINLOG statement is not an FD event. mysql-test/suite/binlog/r/binlog_base64_flag.result: New test file needs new result file mysql-test/suite/binlog/t/binlog_base64_flag.test: Added test case to verify that: - my patch fixes the bug - the new --base64-output flag works as expected - base64 events not preceded by an FD event give an error - an event of a type not known by the current FD event fails cleanly. mysql-test/suite/binlog/std_data/binlog-bug32407.000001: BitKeeper file /home/sven/bk/b32407-5.1-new-rpl-mysqlbinlog_base64/mysql-test/suite/binlog/std_data/binlog-bug32407.000001 |
||
unknown
|
3250963e7b |
Correct bad merge, and remove version numbers from test case.
mysql-test/r/mysqlbinlog2.result: Change test case to remove server version number. mysql-test/t/mysqlbinlog2.test: Change test case to remove server version number. mysys/mf_iocache2.c: Correcting bad merge. |
||
unknown
|
a2873d545f |
Contributed patch from Jorge Bernal Ordovás. CLA#42
Bug#27894: mysqlbinlog formats timestamp wrong in comment Date stamps lack zero padding, and so are meaningless. Implement minimum-width zero padding for the percent-escape sequences used in the logging code. mysql-test/r/mysqlbinlog2.result: Include the long form, so we notice that it may be broken. Replace away specific elements that vary from run to run. mysql-test/t/mysqlbinlog2.test: Include the long form, so we notice that it may be broken. Replace away specific elements that vary from run to run. mysys/mf_iocache2.c: Implement minimum-width padding for printf-style percent-expressions. |
||
unknown
|
b89367f2f8 |
Fixes for tests after merge from 5.0
mysql-test/r/grant.result: Fixed a result. Editor added wrong characters. mysql-test/r/mysqlbinlog2.result: Fixed mysql-test/r/sp.result: Fixed a result, moved lines around. mysql-test/r/sp_trans.result: Fixed a result, moved lines around. mysql-test/t/mysqlbinlog2.test: Merged tests from 5.0 mysql-test/t/sp_trans.test: Merged test from 5.0 and fixed to be compatible with 5.1 sql/sql_class.cc: Merged from 5.0 sql/sql_error.cc: Fixed push_warning() |
||
unknown
|
374718ff45 |
Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0-marvel
into ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel client/mysql.cc: Auto merged client/mysqlbinlog.cc: Auto merged BitKeeper/deleted/.del-my_lread.c: Auto merged BitKeeper/deleted/.del-my_lwrite.c: Auto merged BitKeeper/deleted/.del-raid.cc~488f5fa6538394e1: Auto merged BitKeeper/deleted/.del-raid.h~2d2503a66b128ac6: Auto merged client/mysqldump.c: Auto merged extra/perror.c: Auto merged include/my_sys.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/libmysqld.c: Auto merged mysql-test/r/mysqlbinlog2.result: Auto merged mysql-test/r/sp-security.result: Auto merged mysql-test/r/view_grant.result: Auto merged mysql-test/t/grant.test: Auto merged mysql-test/t/sp-security.test: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/sp_trans.test: Auto merged mysql-test/t/view_grant.test: Auto merged mysys/default.c: Auto merged mysys/hash.c: Auto merged mysys/mf_iocache.c: Auto merged mysys/mf_keycache.c: Auto merged mysys/my_alloc.c: Auto merged mysys/my_dup.c: Auto merged mysys/my_getwd.c: Auto merged mysys/my_handler.c: Auto merged mysys/my_lib.c: Auto merged mysys/my_malloc.c: Auto merged mysys/my_pread.c: Auto merged mysys/my_read.c: Auto merged mysys/my_seek.c: Auto merged mysys/my_static.c: Auto merged mysys/safemalloc.c: Auto merged mysys/thr_alarm.c: Auto merged mysys/typelib.c: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.h: Auto merged sql/item_subselect.cc: Auto merged sql/log_event.cc: Auto merged sql/net_serv.cc: Auto merged sql/opt_range.cc: Auto merged sql/slave.cc: Auto merged sql/sp.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_view.cc: Auto merged sql/strfunc.cc: Auto merged sql/table.cc: Auto merged sql/tztime.cc: Auto merged sql/unireg.cc: Auto merged sql-common/client.c: Auto merged sql-common/my_time.c: Auto merged storage/archive/ha_archive.cc: Auto merged storage/heap/_check.c: Auto merged storage/heap/hp_delete.c: Auto merged storage/heap/hp_hash.c: Auto merged storage/heap/hp_open.c: Auto merged storage/heap/hp_rkey.c: Auto merged storage/heap/hp_rrnd.c: Auto merged storage/heap/hp_write.c: Auto merged storage/innobase/handler/ha_innodb.cc: Auto merged storage/myisam/mi_close.c: Auto merged storage/myisam/mi_delete.c: Auto merged storage/myisam/mi_dynrec.c: Auto merged storage/myisam/mi_keycache.c: Auto merged storage/myisam/mi_page.c: Auto merged storage/myisam/mi_statrec.c: Auto merged storage/myisam/myisamchk.c: Auto merged storage/myisammrg/myrg_extra.c: Auto merged storage/ndb/src/mgmclient/CommandInterpreter.cpp: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/r/grant.result: Merged from 5.0 mysql-test/r/sp.result: Merged from 5.0 mysql-test/r/sp_trans.result: Merged from 5.0 mysql-test/t/mysqlbinlog2.test: Merged from 5.0 mysys/thr_lock.c: Merged from 5.0 sql/ha_ndbcluster.cc: Merged from 5.0 sql/log.cc: Merged from 5.0 sql/mysql_priv.h: Merged from 5.0 sql/mysqld.cc: Merged from 5.0 sql/set_var.cc: Merged from 5.0 sql/sql_db.cc: Merged from 5.0 sql/sql_insert.cc: Merged from 5.0 sql/sql_parse.cc: Merged from 5.0 sql/sql_show.cc: Merged from 5.0 sql/sql_update.cc: Merged from 5.0 |
||
unknown
|
e2e06e3abe |
Bug#27171 mysqlbinlog produces different output depends from option -R
Server starts any binlog dump from Format_description_log_event, this shifted all offset calculations in mysqlbinlog and made it to stop the dump earlier than --stop-position. Now mysqlbinlog takes Format_description_log_event into account mysql-test/r/mysqlbinlog2.result: Bug#27171 mysqlbinlog produces different output depends from option -R mysql-test/t/mysqlbinlog2.test: Bug#27171 mysqlbinlog produces different output depends from option -R |
||
unknown
|
e653222d30 |
Bug#17642 mysqlbinlog: Restore from row-based binlog fails
Problem: mysqlbinlog_base64 failed sporadically. Reason: Missing "flush logs" before running $MYSQL_BINLOG, which could start dumping the log file before server has finished writting into it. Fix: - implementing --force-if-open option to "mysqlbinlog" - adding --disable-force-if-open to make $MYSQL_BINLOG fail on non-closed log files, to garantee that nobody will forget "flush logs" in the future. - adding "flush logs" into all affected tests. client/mysqlbinlog.cc: Implementing --force-if-open option with TRUE by default mysql-test/mysql-test-run.pl: Using --disable-force-if-open for all tests to avoid sporadic test failures because of running "mysqlbinlog" on a non-flushed binlog files. mysql-test/r/binlog_row_mix_innodb_myisam.result: FLush log before running dumping. mysql-test/r/binlog_stm_mix_innodb_myisam.result: FLush log before running dumping. mysql-test/r/mysqlbinlog.result: FLush log before running dumping. mysql-test/r/mysqlbinlog2.result: FLush log before running dumping. mysql-test/r/mysqlbinlog_base64.result: FLush log before running dumping. mysql-test/r/user_var-binlog.result: FLush log before running dumping. mysql-test/t/binlog_row_mix_innodb_myisam.test: FLush log before running dumping. mysql-test/t/binlog_stm_mix_innodb_myisam.test: FLush log before running dumping. mysql-test/t/mysqlbinlog.test: FLush log before running dumping. Adding new tests: - checking that $MYSQL_BINLOG returns an error on a non-closed binlog file because of --disable-force-if-open - checking that it does not return an error with --force-if-open mysql-test/t/mysqlbinlog2.test: FLush log before running dumping. mysql-test/t/mysqlbinlog_base64.test: FLush log before running dumping. mysql-test/t/user_var-binlog.test: FLush log before running dumping. |
||
unknown
|
36c7cfd71e |
Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
Problem: when loading mysqlbinlog dumps, CREATE PROCEDURE having semicolons in their bodies failed. Fix: Using safe delimiter "/*!*/;" to dump log entries. client/mysqlbinlog.cc: - Adding PRINT_EVENT_INFO argument to dump_xxx_log_entries() - Setting delimiter to "/*!*/;" before calling dump functions mysql-test/r/ctype_ucs_binlog.result: Fixing test results mysql-test/r/mix_innodb_myisam_binlog.result: Fixing test results mysql-test/r/mysqlbinlog.result: Fixing test results Adding test case mysql-test/r/mysqlbinlog2.result: Fixing test results mysql-test/r/rpl_charset.result: Fixing test results mysql-test/r/rpl_timezone.result: Fixing test results mysql-test/r/user_var-binlog.result: Fixing test results mysql-test/t/mix_innodb_myisam_binlog.test: Fixing LIKE expression mysql-test/t/mysqlbinlog.test: Adding test case sql/log_event.cc: Using print_event_info->delimiter instead of hard-coded semicolon as a query end marker. sql/log_event.h: Adding new member to store delimiter. |
||
unknown
|
e025e47a76 |
BUG#16217 forced to introduce a separate mysql client command to adopt its
internal charset to one associated with currently being handled query. To note such a query can come from interactive client either. There was a discussion within replication team and Monty who's suggestion won. It avoids straightforward parsing of all `set' queries that could affect client side character set. According to the idea, mysql client does not parse `set' queries but rather cares of `charset new_cs_name' command. This command is generated by mysqlbinlog in form of exclaiming comment (Lars' suggestion) so that enlightened clients like `mysql' knows what to do with it. Interactive human can switch between many multi-byte charsets during the session providing the command explicitly. To note that setting new internal mysql's charset does not trigger sending any `SET' sql statement to the server. client/mysql.cc: BUG#16217 revealed the problem of switching between charsets in mysql client. Such switching is necessary in a case when being scanned query consists of multi-byte chars and internal charset was initialized differently. mysql finds `/' escape and misiterprete it while in fact one could be a part of a multi-byte symbol like the bug page reported. This patch extends mysql `charset' command, '\C' shortcut. mysql-test/r/ctype_ucs_binlog.result: comment line generated by mysqlbinlog for processing of logs with multi-byte chars. mysql-test/r/mysql.result: results are altered due to #16217 mysql-test/r/mysqlbinlog.result: Results are altered due to #16217 mysql-test/r/mysqlbinlog2.result: commeted command for mysql client due to multi-byte binlog mysql-test/r/rpl_charset.result: commented command for mysql due to multi-byte binlogs mysql-test/r/rpl_timezone.result: commented command for mysql client due to multi-byte binlogs mysql-test/r/user_var-binlog.result: commented command for mysql client due to multi-byte binlogs mysql-test/t/mysql.test: Main test for mysql client is extended to check `charset' command. mysql-test/t/mysqlbinlog.test: Checking how /*! \C cs_name */ are added to the output of mysqlbinlog. The exclaiming comment is for further processing by mysql client. The added part mimics the failure to recover tables from binlog - see BUG#16217. sql/log_event.cc: Sending into output instructions for mysql client to switch internally to appropriate charset. mysql client is supposed to be invoked with --default-character-set= "to default character set of the server created the binlog". |
||
unknown
|
1e148ca472 |
Tell the user that this ROLLBACK is added by mysqlbinlog (so that he does not wonder if it's present in binlog). This was brought up by Salle - thanks Salle.
client/mysqlbinlog.cc: tell the user that this ROLLBACK is added by mysqlbinlog (so that he does not wonder if it's present in binlog) mysql-test/r/ctype_ucs_binlog.result: update mysql-test/r/mysqlbinlog.result: update mysql-test/r/mysqlbinlog2.result: update mysql-test/r/rpl_charset.result: update mysql-test/r/rpl_timezone.result: update mysql-test/r/user_var-binlog.result: update |
||
unknown
|
906cd821e2 | Added clarification comment regarding added ROLLBACK to mysqlbinlog output | ||
unknown
|
4b2ee4854f |
result fixes after my change to mysqlbinlog (which was accidentally
pushed some minutes ago) mysql-test/r/ctype_ucs.result: result fix mysql-test/r/mysqlbinlog.result: result fix mysql-test/r/mysqlbinlog2.result: result fix mysql-test/r/rpl_charset.result: result fix mysql-test/r/user_var.result: result fix |
||
unknown
|
c5c497164f |
post-review fixes. Now ROLLBACK is done in Format_description_log_event
mysql-test/t/mix_innodb_myisam_binlog.test: fix for --ps-protocol |
||
unknown
|
2d8b51991c |
manually merged
client/mysqlbinlog.cc: Auto merged configure.in: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged innobase/trx/trx0trx.c: Auto merged mysql-test/include/varchar.inc: Auto merged mysql-test/r/bdb.result: Auto merged mysql-test/r/myisam.result: Auto merged mysql-test/r/mysqlbinlog2.result: Auto merged mysql-test/t/ctype_ucs.test: Auto merged mysql-test/t/user_var.test: Auto merged mysys/hash.c: Auto merged sql/item_func.cc: Auto merged sql/log_event.cc: Auto merged sql/log_event.h: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sp_head.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_repl.cc: Auto merged sql/sql_repl.h: Auto merged sql/sql_table.cc: Auto merged sql/sql_trigger.cc: Auto merged mysql-test/r/ctype_ucs.result: ul mysql-test/r/drop_temp_table.result: ul mysql-test/r/innodb.result: ul mysql-test/r/insert_select.result: ul mysql-test/r/mix_innodb_myisam_binlog.result: ul mysql-test/r/rpl_change_master.result: ul mysql-test/r/rpl_charset.result: ul mysql-test/r/rpl_error_ignored_table.result: ul mysql-test/r/rpl_flush_log_loop.result: ul mysql-test/r/rpl_flush_tables.result: ul mysql-test/r/rpl_loaddata.result: ul mysql-test/r/rpl_loaddata_rule_m.result: ul mysql-test/r/rpl_log.result: ul mysql-test/r/rpl_max_relay_size.result: ul mysql-test/r/rpl_relayrotate.result: ul mysql-test/r/rpl_replicate_do.result: ul mysql-test/r/rpl_rotate_logs.result: ul mysql-test/r/rpl_temporary.result: ul mysql-test/r/rpl_timezone.result: ul mysql-test/r/rpl_until.result: ul mysql-test/r/rpl_user_variables.result: ul mysql-test/r/user_var.result: ul |
||
unknown
|
9297872d75 |
auto-ROLLBACK if binlog was not closed properly
auto-commit on Xid_log_event client/mysqlbinlog.cc: auto-ROLLBACK if binlog was not closed properly. mysql-test/r/ctype_ucs.result: results updated mysql-test/r/mix_innodb_myisam_binlog.result: results updated mysql-test/r/mysqlbinlog2.result: results updated mysql-test/r/rpl_relayrotate.result: results updated mysql-test/r/user_var.result: results updated mysql-test/t/ctype_ucs.test: finalize binlog before calling mysqlbinlog mysql-test/t/user_var.test: finalize binlog before calling mysqlbinlog sql/log_event.cc: commit at Xid_log_event comments edited sql/mysqld.cc: free(0) fixed sql/slave.cc: rollback at fake Rotate_log_event sql/sql_class.h: no commit_or_rollback argument for binlog->write(THD *thd, IO_CACHE *cache) sql/log.cc: don't write "COMMIT" query, Xid_log_event is enough sql/log_event.h: more comments for LOG_EVENT_BINLOG_IN_USE_F LOG_EVENT_FORCE_ROLLBACK_F added sql/sql_repl.cc: rollback at Rotate_log_event. don't consider binlog corrupted if it was open when we read Formar_description but closed when we got to the end sql/sql_repl.h: style fix |
||
unknown
|
7636b12f6c |
WL#1062 "log charset info into all Query_log_event":
we store 7 bytes (1 + 2*3) in every Query_log_event. In the future if users want binlog optimized for small size and less safe, we could add --binlog-no-charset (and binlog-no-sql-mode etc): charset info is something by design optional (even if for now we don't offer possibility to disable it): it's not a binlog format change. We try to reduce the number of get_charset() calls in the slave SQL thread to a minimum by caching the charset read from the previous event (which will often be equal to the one of the current event). We don't use SET ONE_SHOT for charset-aware repl (we still do for timezones, will be fixed later). No more errors if one changes the global value of charset vars on master or slave (as we log charset info in all Query_log_event). Not fixing Load_log_event as it will be rewritten soon by Dmitri. Testing how mysqlbinlog behaves in rpl_charset.test. mysqlbinlog needs to know where charset file is (to be able to convert a charset number found in binlog (e.g. in User_var_log_event) to a charset name); mysql-test-run needs to pass the correct value for this option to mysqlbinlog. Many result udpates (adding charset info into every event shifts log_pos in SHOW BINLOG EVENTS). Roughly the same job is to be done for timezones :) client/mysqlbinlog.cc: mysqlbinlog needs charsets knowledge, to be able to convert a charset number found in binlog to a charset name (to be able to print things like this: SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`; mysql-test/mysql-test-run.sh: tell mysqlbinlog about charsets dir mysql-test/r/ctype_ucs.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/drop_temp_table.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/insert_select.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/mix_innodb_myisam_binlog.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/mysqlbinlog.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/mysqlbinlog2.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. The log_pos shift is why the SET INSERT_ID=4 event changes position in the result. mysql-test/r/rpl_charset.result: Running mysqlbinlog to check how it behaves on charset stuff. SET ONE_SHOT is now gone. Repl of LOAD DATA INFILE is not yet charset-aware (will soon be, when WL#874 is pushed) and, anyway result has a dependency on the temp filename (SQL-LOAD-*-[0-9] which is not constant). No more errors if one changes global character sets. mysql-test/r/rpl_error_ignored_table.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_flush_log_loop.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_flush_tables.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_loaddata.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_loaddata_rule_m.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_log.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_max_relay_size.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_relayrotate.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_replicate_do.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_rotate_logs.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_temporary.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_timezone.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/rpl_user_variables.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/r/user_var.result: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. mysql-test/t/rpl_charset.test: Running mysqlbinlog to check how it behaves on charset stuff (so, need fixed timestamp). SET ONE_SHOT is not printed to binlog anymore, so no need to test if ::exec_event() works ok. Repl of LOAD DATA INFILE is not yet charset-aware (will soon be, when WL#874 is pushed) and, anyway result has a dependency on the temp filename (SQL-LOAD-*-[0-9] which is not constant). No more errors if one changes global character sets. mysql-test/t/rpl_user_variables.test: different binlogging of charsets results in shifted log_pos and one added SET @@CHARACTER_SET... per mysqlbinlog run. sql/log.cc: No more SET ONE_SHOT for charsets (remains for TZ until solved with Dmitri). sql/log_event.cc: We now log charset info in each Query_log_event in binlog. It's 2*3 = 6 bytes: session character_set_client, session collation_connection, session collation_server. Now we would need only one byte per variable, but Bar said 2 is safer for the future. When slave or mysqlbinlog reads that info, it needs to get_charset() on these numbers (so, 3 get_charset() calls), as most of the time the 6-byte charset info will be equal to the previous event's, we cache the previous event's charset and if equal, no need to get_charset(). As "flags2", SQL_MODE, catalog, autoinc variables, charset info is not a permanent addition: in the future we can add options to the master to not log any of these, old 5.0 should be able to parse these. A little bit of cleanup on autoinc stuff in replication. Fixing a bug in Start_log_event_v3::exec_event() where we used rli->relay_log.description_event_for_exec->binlog_version while we should use binlog_version (if it's a 3.23 master, that's all that counts; not the fact that the relay log is in 5.0 format). sql/log_event.h: binlogging of charset info in each Query_log_event. sql/mysql_priv.h: comment sql/set_var.cc: checks to refuse change of global charset variables are removed: they were needed for 4.1->4.1 but not for 5.0.3->5.0.3. Yes this opens a breach if one does 4.1->5.0.3, where the checks would still be needed. But these checks would need reading relay_log.description_event_for_queue, which is currently an object used in many places by the I/O thread and only it. So, currently we don't take mutexes for this object, and if we read the object in set_var.cc (client thread) we need to add mutexes everywhere, but the replication code is already too broken with mutexes now (no consistent use of mutexes); mutex usage in replication should be fixed but preferrably during/after multimaster coding as it's going to shuffle mutexes already. sql/set_var.h: Since we don't forbid global change of charset vars for replication/binlogging, don't need specific ::check() methods anymore sql/slave.cc: Some little debug info which has nothing to do with charsets. Disabling master's charset check when slave I/O thread connects. Functions for charset caching/invalidating in the slave SQL thread. sql/slave.h: Cached charset in the slave SQL thread. |
||
unknown
|
33efc9677d |
After merge fixes of merge with 4.1 that included the new arena code.
Fixed (together with Guilhem) bugs in mysqlbinlog regarding --offset Prefix addresses with 0x for easier comparisons of debug logs Fixed problem where MySQL choosed index-read even if there would be a much better range on the same index This fix changed some 'index' queries to 'range' queries in the test suite Don't create 'dummy' WHERE clause for trivial WHERE clauses where we can remove the WHERE clause. This fix removed of a lot of 'Using where' notes in the test suite. Give NOTE instead of WARNING if table/function doesn't exists when using DROP IF EXISTS Give NOTE instead of WARNING for safe field-type conversions Makefile.am: Don't automaticly update files from bk client/mysqlbinlog.cc: Merge with 4.1 (+ apply bug fixes for --offset and --start-position) include/my_sys.h: Faster clear_alloc_root() mysql-test/r/bdb.result: Updated results after merge mysql-test/r/create.result: Updated results after merge mysql-test/r/func_group.result: Updated results after merge mysql-test/r/func_if.result: Updated results after merge mysql-test/r/heap_btree.result: Updated results after merge mysql-test/r/index_merge.result: Updated results after merge mysql-test/r/index_merge_ror.result: Updated results after merge mysql-test/r/innodb.result: Updated results after merge mysql-test/r/join_outer.result: Updated results after merge mysql-test/r/mysqlbinlog2.result: Updated results after merge mysql-test/r/negation_elimination.result: Updated results after merge mysql-test/r/null.result: Updated results after merge Added more tests mysql-test/r/null_key.result: Updated results after merge Added more tests mysql-test/r/order_by.result: Updated results after merge mysql-test/r/range.result: Updated results after merge Added more tests mysql-test/r/rpl_charset.result: Updated results after merge mysql-test/r/sp-error.result: Updated results after merge mysql-test/r/sp.result: Updated results after merge Added delete of some stored procedures in an attempt to be able to re-run test even if it aborts in the middle mysql-test/r/type_blob.result: Updated results after merge (Some warnings are now notes) mysql-test/r/user_var.result: Updated results after merge Added more tests mysql-test/r/variables.result: Updated results after merge mysql-test/r/view.result: Updated results after merge mysql-test/t/mysqlbinlog2.test: Updated tests to use new positions mysql-test/t/null.test: More tests mysql-test/t/null_key.test: More tests mysql-test/t/range.test: More tests mysql-test/t/rpl_charset.test: Avoid big diffs in the future if tests changes mysql-test/t/sp-error.test: Updated error numbers mysql-test/t/sp-security.test: Updated error numbers mysql-test/t/sp.test: Updated results after merge Added delete of some stored procedures in an attempt to be able to re-run test even if it aborts in the middle mysql-test/t/user_var.test: More tests mysql-test/t/view.test: Updated error numbers mysys/my_alloc.c: Write into debug log the address of the allocated area sql/ha_isam.cc: Prefix addresses with 0x for easier comparisons of debug logs sql/ha_myisam.cc: Prefix addresses with 0x for easier comparisons of debug logs sql/ha_ndbcluster.cc: Add missing enum to switch sql/handler.cc: remove compiler warning sql/item.cc: More debugging Simple cleanup sql/item.h: Move Item::cleanup() to item.cc sql/item_cmpfunc.cc: Fix arena code sql/item_subselect.cc: After merge fixes sql/item_subselect.h: After merge fixes sql/item_sum.cc: Updated comment sql/log_event.cc: Remove wrong test sql/mysql_priv.h: Indentation fixes sql/mysqld.cc: After merge fixes Added 0x to pointers in debug log sql/opt_range.cc: Fixed problem where MySQL choosed index-read even if there would be a much better range on the same index This fix changed some 'index' queries to 'range' queries in the test suite sql/set_var.cc: Indentation fixes sql/sp_head.cc: Set state to INITIALIZED to make SP work with new arena code sql/sql_base.cc: After merge fixes sql/sql_class.cc: More debugging Use clear_alloc_root() instead of init_alloc_root() as the former is faster sql/sql_class.h: New method 'only_prepare()' sql/sql_lex.cc: After merge fixes sql/sql_lex.h: After merge fixes sql/sql_parse.cc: Fix for timezone tables. (The old way to add timezone tables to global list in 'create_total_list' doesn't work anymore) Give NOTE instead of WARNING if table/function doesn't exists when using DROP IF EXISTS sql/sql_prepare.cc: After merge fixes sql/sql_select.cc: Don't create 'dummy' WHERE clause for trivial WHERE clauses where we can remove the WHERE clause. This fix removed of a lot of 'Using where' notes in the test suite sql/sql_table.cc: Give NOTE instead of WARNING if table/function doesn't exists when using DROP IF EXISTS sql/sql_union.cc: After merge fix sql/sql_view.cc: After merge fix sql/table.cc: After merge fix sql/tztime.cc: Update timezone table handling to use new table lists structure sql/tztime.h: Update timezone table handling to use new table lists structure sql/unireg.cc: Use 0x before pointers |
||
unknown
|
88e3aead85 |
WL#1580: --start-datetime, --stop-datetime, --start-position (alias for --position) and --stop-position
options for mysqlbinlog, with a test file. This enables user to say "recover my database to how it was this morning at 10:30" (mysqlbinlog "--stop-datetime=2003-07-29 10:30:00"). Using time functions into client/ made me move them out of sql/ into sql-common/. + (small) fix for BUG#4507 "mysqlbinlog --read-from-remote-server sometimes cannot accept 2 binlogs" (that is, on command line). client/client_priv.h: new options for mysqlbinlog client/mysqlbinlog.cc: WL#1580: --start-datetime, --stop-datetime, --start-position (alias for --position) and --stop-position. (small) fix for BUG#4507 "mysqlbinlog --read-from-remote-server sometimes cannot accept 2 binlogs". include/my_time.h: importing time functions so that client/ files can use them. include/mysql_time.h: importing time types so that client/ files can use them. sql-common/my_time.c: importing time functions so that client/ files can use them. sql/mysql_priv.h: moving time functions out of sql/ into sql-common/ sql/time.cc: moving time functions out of sql/ into sql-common/ sql/tztime.h: moving time functions out of sql/ into sql-common/ |