diff options
author | unknown <monty@mashka.mysql.fi> | 2002-09-11 06:40:08 +0300 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2002-09-11 06:40:08 +0300 |
commit | c3d4b40dc359766a8ba3fd018c6da57a31daefe7 (patch) | |
tree | 6ef035adfec09ec1e444dd169712750e2de1efeb /sql/log_event.cc | |
parent | 411d2e5ddb874aecfbdcf1c382255f006c691da2 (diff) | |
download | mariadb-git-c3d4b40dc359766a8ba3fd018c6da57a31daefe7.tar.gz |
Portability fixes.
Improve mysql-test to be more robust.
Fix that GRANT doesn't delete SSL options
Change innobase_flush_log_at_trx_commit to uint.
Don't rotate logs if we read a rotate log entry from the master.
Docs/manual.texi:
Changelog
client/mysqlbinlog.cc:
Handle empty binlogfiles gracefully
client/mysqltest.c:
Do a sleep after 'sync_with_master'
Cleaned up sleep() handling.
Free all memory on exit
configure.in:
Fix for Mac OS 10.2
include/my_sys.h:
Added my_strdup_with_length()
innobase/btr/btr0cur.c:
Fixed wrong printf()
libmysql/libmysql.c:
Added DBUG_PRINT statements.
Assume that mysql_...send() functions has correct query length.
mysql-test/mysql-test-run.sh:
Properly remove log files before starting new tests.
mysql-test/r/grant.result:
Update for new test results
mysql-test/r/innodb.result:
Update for new test results
mysql-test/r/myisam.result:
Update for new test results
mysql-test/r/rpl_log.result:
Update for new test results
mysql-test/r/rpl_rotate_logs.result:
Update for new test results
mysql-test/r/variables.result:
Update for new test results
mysql-test/t/grant.test:
Test that GRANT doesn't delete SSL options
mysql-test/t/myisam.test:
Test long key usage
mysql-test/t/rpl_log.test:
Disable 'show new master'
mysql-test/t/rpl_mystery22.test:
Longer sleep for more safety.
mysql-test/t/rpl_rotate_logs.test:
More comments
mysys/my_malloc.c:
Added my_strdup_with_length()
mysys/safemalloc.c:
Added my_strdup_with_length()
mysys/thr_alarm.c:
Fix of alarms for windows.
sql/ha_innodb.cc:
Change innobase_flush_log_at_trx_commit to uint
mysql-test/r/rpl_redirect.result:
Updated test results
mysql-test/t/rpl_redirect.test:
Added more tests to improve code coverage.
sql/ha_innodb.h:
Change innobase_flush_log_at_trx_commit to uint
sql/item_func.cc:
Return GLOBAL and SESSION as part of column names
sql/log.cc:
Only write STOP events when server goes down.
sql/log_event.cc:
Don't rotate logs if we read a rotate log entry from the master.
sql/log_event.h:
Change ident_len to uint (more efficient)
sql/mysqld.cc:
Change innobase_flush_log_at_trx_commit to uint
sql/net_serv.cc:
More debug output
sql/repl_failsafe.cc:
More DEBUG
Search until we find next position in binary log (and not only =)
sql/slave.cc:
More DBUG & comments
Don't rotate the binary log on master flush logs
sql/slave.h:
indentation change
sql/sql_acl.cc:
Test that GRANT doesn't delete SSL options
sql/sql_parse.cc:
Disable show_new_master.
sql/sql_repl.cc:
Chamger show_binlog_events() to use my_error()
sql/sql_table.cc:
Fixed check for too long keys in MyISAM
sql/sql_udf.cc:
Fix udf handling
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r-- | sql/log_event.cc | 75 |
1 files changed, 22 insertions, 53 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index 1f7a4013d80..ec5b7c4b5a5 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -690,7 +690,10 @@ void Rotate_log_event::print(FILE* file, bool short_form, char* last_db) if (new_log_ident) my_fwrite(file, (byte*) new_log_ident, (uint)ident_len, MYF(MY_NABP | MY_WME)); - fprintf(file, " pos: %s\n", llstr(pos, buf)); + fprintf(file, " pos: %s", llstr(pos, buf)); + if (flags & LOG_EVENT_FORCED_ROTATE_F) + fprintf(file," forced by master"); + fputc('\n', file); fflush(file); } @@ -730,20 +733,22 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len, buf += header_size; if (old_format) { - ident_len = (uchar)(event_len - OLD_HEADER_LEN); + ident_len = (uint)(event_len - OLD_HEADER_LEN); pos = 4; ident_offset = 0; } else { - ident_len = (uchar)(event_len - ROTATE_EVENT_OVERHEAD); + ident_len = (uint)(event_len - ROTATE_EVENT_OVERHEAD); pos = uint8korr(buf + R_POS_OFFSET); ident_offset = ROTATE_HEADER_LEN; } - if (!(new_log_ident = (char*) my_memdup((byte*) buf + ident_offset, - (uint) ident_len, MYF(MY_WME)))) + set_if_smaller(ident_len,FN_REFLEN-1); + if (!(new_log_ident= (char*) my_strdup_with_length((byte*) buf + + ident_offset, + (uint) ident_len, + MYF(MY_WME)))) return; - alloced = 1; } @@ -1614,7 +1619,6 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) int expected_error,actual_error = 0; init_sql_alloc(&thd->mem_root, 8192,0); thd->db = rewrite_db((char*)db); - DBUG_ASSERT(q_len == strlen(query)); /* InnoDB internally stores the master log position it has processed so far; @@ -1643,6 +1647,8 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) if (ignored_error_code((expected_error = error_code)) || !check_expected_error(thd,rli,expected_error)) { + mysql_log.write(thd,COM_QUERY,"%s",thd->query); + DBUG_PRINT("query",("%s",thd->query)); mysql_parse(thd, thd->query, q_len); if ((expected_error != (actual_error = thd->net.last_errno)) && expected_error && @@ -1861,71 +1867,34 @@ int Stop_log_event::exec_event(struct st_relay_log_info* rli) Got a rotate log even from the master IMPLEMENTATION - - Rotate the log file if the name of the log file changed - (In practice this should always be the case) + This is mainly used so that we can later figure out the logname and + position for the master. - TODO - - Investigate/Test if we can't ignore all rotate log events - that we get from the master (and not even write it to the local - binary log). + We can't rotate the slave as this will cause infinitive rotations + in a A -> B -> A setup. RETURN VALUES - 0 ok - 1 Impossible new log file name (rotate log event is ignored) -*/ + 0 ok + */ int Rotate_log_event::exec_event(struct st_relay_log_info* rli) { - bool rotate_binlog = 0, write_slave_event = 0; char* log_name = rli->master_log_name; DBUG_ENTER("Rotate_log_event::exec_event"); pthread_mutex_lock(&rli->data_lock); - /* - TODO: probably needs re-write - rotate local binlog only if the name of remote has changed - */ - if (!*log_name || (memcmp(log_name, new_log_ident, ident_len) || - log_name[ident_len] != 0)) - { - write_slave_event = (!(flags & LOG_EVENT_FORCED_ROTATE_F) && - mysql_bin_log.is_open()); - rotate_binlog = (*log_name && write_slave_event); - if (ident_len >= sizeof(rli->master_log_name)) - { - // This should be impossible - pthread_mutex_unlock(&rli->data_lock); - DBUG_RETURN(1); - } - memcpy(log_name, new_log_ident, ident_len); - log_name[ident_len] = 0; - } + memcpy(log_name, new_log_ident, ident_len+1); rli->master_log_pos = pos; rli->relay_log_pos += get_event_len(); - if (rotate_binlog) - { - mysql_bin_log.new_file(); - rli->master_log_pos = BIN_LOG_HEADER_SIZE; - } DBUG_PRINT("info", ("master_log_pos: %d", (ulong) rli->master_log_pos)); - pthread_cond_broadcast(&rli->data_cond); pthread_mutex_unlock(&rli->data_lock); + pthread_cond_broadcast(&rli->data_cond); flush_relay_log_info(rli); - - if (write_slave_event) - { - Slave_log_event s(thd, rli); - if (s.master_host) - { - s.set_log_pos(&mysql_bin_log); - s.server_id = ::server_id; - mysql_bin_log.write(&s); - } - } DBUG_RETURN(0); } + int Intvar_log_event::exec_event(struct st_relay_log_info* rli) { switch (type) { |