From: Date: October 29 2007 12:47pm Subject: bk commit into 5.0 tree (aelkin:1.2543) BUG#28597 List-Archive: http://lists.mysql.com/commits/36542 X-Bug: 28597 Message-Id: <200710291147.l9TBlVkO005696@koti.dsl.inet.fi> Below is the list of changes that have just been committed into a local 5.0 repository of elkin. When elkin does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-10-29 13:47:25+02:00, aelkin@stripped +3 -0 Bug #28597 Replication doesn't start after upgrading to 5.1.18 Since bug@20166, which replaced the binlog file name generating to base on pidfile_name instead of the previous glob_hostname, the binlog file name generating and its storing into the binlog index suddenly started to be solely in the absolute path format, including a case when --log-bin option meant a relative path. An existed algorithm on master to find a requested binlog file for slave was limited to compare only homogenous paths either absolute or relative but never mixed. In effect of two facts if --log-bin value means a relative path, comparison on the buggy 5.1.18 of an allways absolute value (read from the index) with a relative was doomed. Fixed with leaving `pidfile_name' but stripping off its directory part that restores the original logics of storing the names in compatible with --log-bin option format. The comparison algorithm is refined to be able to match any format two paths converting them to the absolute paths. Side effects for this fix: correcting bug#27070; ensuring no overrun for buff can happen anymore (Bug#31836 insufficient space reserved for the suffix of relay log file name); bug#31837 --remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql missed in rpl_temporary.test; fixes Bug@28603 Invalid log-bin default location; a minor issue with the malformed line noted in log.cc; mysql-test/t/rpl_dual_pos_advance.test@stripped, 2007-10-29 13:47:20+02:00, aelkin@stripped +0 -6 After correcting the logics of log file name composing workaround for Bug #27070 server logs are created unrequested and in wrong directory is removed. mysql-test/t/rpl_temporary.test@stripped, 2007-10-29 13:47:20+02:00, aelkin@stripped +2 -0 remaining temp file of the test removed sql/log.cc@stripped, 2007-10-29 13:47:22+02:00, aelkin@stripped +31 -11 stripping off the directory part of `pidfile_name' for binlog name generating; a new function static bool equalp_paths() compares two paths; ensuring no overrun for buff can happen anymore (Bug #31836 insufficient space reserved for the suffix of relay log file name); eliminating a potential issue (yet another possible bug) when binlog index consisted of a malformed not-`\n'-terminated line which was silently discarded in the old code. diff -Nrup a/mysql-test/t/rpl_dual_pos_advance.test b/mysql-test/t/rpl_dual_pos_advance.test --- a/mysql-test/t/rpl_dual_pos_advance.test 2007-03-20 12:15:14 +02:00 +++ b/mysql-test/t/rpl_dual_pos_advance.test 2007-10-29 13:47:20 +02:00 @@ -106,9 +106,3 @@ connection slave; sync_with_master; # End of 4.1 tests - -# Cleanup -# The A->B->A replication causes the master to start writing relay logs -# in var/run, remove them -remove_file $MYSQLTEST_VARDIR/run/master-relay-bin.000001; -remove_file $MYSQLTEST_VARDIR/run/master-relay-bin.index; diff -Nrup a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test --- a/mysql-test/t/rpl_temporary.test 2007-02-27 15:54:31 +02:00 +++ b/mysql-test/t/rpl_temporary.test 2007-10-29 13:47:20 +02:00 @@ -211,6 +211,8 @@ select * from t1; connection master; drop table t1; +--remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql + # Delete the anonymous users source include/delete_anonymous_users.inc; diff -Nrup a/sql/log.cc b/sql/log.cc --- a/sql/log.cc 2007-07-30 18:27:30 +03:00 +++ b/sql/log.cc 2007-10-29 13:47:22 +02:00 @@ -448,13 +448,11 @@ const char *MYSQL_LOG::generate_name(con { if (!log_name || !log_name[0]) { - /* - TODO: The following should be using fn_format(); We just need to - first change fn_format() to cut the file name if it's too long. - */ - strmake(buff, pidfile_name,FN_REFLEN-5); - strmov(fn_ext(buff),suffix); - return (const char *)buff; + strmake(buff, pidfile_name, FN_REFLEN - strlen(suffix) - 1); + return (const char *) + fn_format(buff, buff, "", suffix, + MYF(MY_UNPACK_FILENAME|MY_REPLACE_EXT|MY_REPLACE_DIR)); + } // get rid of extension if the log is binary to avoid problems if (strip_ext) @@ -821,8 +819,14 @@ int MYSQL_LOG::find_log_pos(LOG_INFO *li bool need_lock) { int error= 0; + uint flag= MYF(MY_RETURN_REAL_PATH); + char abs_path_bi[2*FN_REFLEN]; // abs path for binlog index file + char abs_path_lf[2*FN_REFLEN]; // for log file argument + char *fname= linfo->log_file_name; uint log_name_len= log_name ? (uint) strlen(log_name) : 0; + if (log_name) + fn_format(abs_path_lf, log_name, mysql_real_data_home, "", flag); DBUG_ENTER("find_log_pos"); DBUG_PRINT("enter",("log_name: %s", log_name ? log_name : "NULL")); @@ -839,7 +843,7 @@ int MYSQL_LOG::find_log_pos(LOG_INFO *li for (;;) { - uint length; + uint length, plen; my_off_t offset= my_b_tell(&index_file); /* If we get 0 or 1 characters, this is the end of the file */ @@ -849,14 +853,30 @@ int MYSQL_LOG::find_log_pos(LOG_INFO *li error= !index_file.error ? LOG_INFO_EOF : LOG_INFO_IO; break; } + else + { + if (fname[length - 1] == '\n') + { + fname[length - 1]= 0; + fn_format(abs_path_bi, fname, mysql_real_data_home, "", flag); + } + else + { + if (log_name) + continue; + else + { + error= LOG_INFO_IO; + } + } + } // if the log entry matches, null string matching anything if (!log_name || - (log_name_len == length-1 && fname[log_name_len] == '\n' && - !memcmp(fname, log_name, log_name_len))) + ((plen= strlen(abs_path_lf)) == strlen(abs_path_bi) + && memcmp(abs_path_lf, abs_path_bi, plen) == 0)) { DBUG_PRINT("info",("Found log file entry")); - fname[length-1]=0; // remove last \n linfo->index_file_start_offset= offset; linfo->index_file_offset = my_b_tell(&index_file); break;