diff options
author | guilhem@mysql.com <> | 2004-03-01 15:15:58 +0100 |
---|---|---|
committer | guilhem@mysql.com <> | 2004-03-01 15:15:58 +0100 |
commit | bce65d4b76a31bcdc2739afbda7ae6290237f7e4 (patch) | |
tree | 08b3a130d4ec9656ddc3810bedfddc4b3a7b9357 /sql | |
parent | e022ba60634621c698ef0c093085234123eec50e (diff) | |
download | mariadb-git-bce65d4b76a31bcdc2739afbda7ae6290237f7e4.tar.gz |
Fix for BUG#3015
"(binlog, position) stored by InnoDB for a replication slave can be wrong".
This code contains conditional #if to distinguish between versions;
it should be merged into 4.1 and 5.0.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_innodb.cc | 14 | ||||
-rw-r--r-- | sql/log_event.cc | 30 | ||||
-rw-r--r-- | sql/slave.h | 14 |
3 files changed, 42 insertions, 16 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index ec384478777..4d1bbacc3ed 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -938,19 +938,17 @@ innobase_commit_low( return; } - /* TODO: Guilhem should check if master_log_name, pending - etc. are right if the master log gets rotated! Possible bug here. - Comment by Heikki March 4, 2003. */ - if (current_thd->slave_thread) { /* Update the replication position info inside InnoDB */ trx->mysql_master_log_file_name = active_mi->rli.master_log_name; - trx->mysql_master_log_pos = ((ib_longlong) - (active_mi->rli.master_log_pos + - active_mi->rli.event_len + - active_mi->rli.pending)); + trx->mysql_master_log_pos = (ib_longlong) +#if MYSQL_VERSION_ID < 40100 + (active_mi->rli.future_master_log_pos); +#else + (active_mi->rli.future_group_master_log_pos); +#endif } trx_commit_for_mysql(trx); diff --git a/sql/log_event.cc b/sql/log_event.cc index 038c17ffaba..603c8431b03 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1792,10 +1792,15 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) /* InnoDB internally stores the master log position it has processed so far; - position to store is really pos + pending + event_len - since we must store the pos of the END of the current log event + position to store is of the END of the current log event. */ - rli->event_len= get_event_len(); +#if MYSQL_VERSION_ID < 40100 + rli->future_master_log_pos= log_pos + get_event_len(); +#elif MYSQL_VERSION_ID < 50000 + rli->future_group_master_log_pos= log_pos + get_event_len(); +#else + rli->future_group_master_log_pos= log_pos; +#endif thd->query_error= 0; // clear error thd->clear_error(); @@ -1935,6 +1940,17 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, thd->query_error = 0; thd->clear_error(); + if (!use_rli_only_for_errors) + { +#if MYSQL_VERSION_ID < 40100 + rli->future_master_log_pos= log_pos + get_event_len(); +#elif MYSQL_VERSION_ID < 50000 + rli->future_group_master_log_pos= log_pos + get_event_len(); +#else + rli->future_group_master_log_pos= log_pos; +#endif + } + /* We test replicate_*_db rules. Note that we have already prepared the file to load, even if we are going to ignore and delete it now. So it is possible @@ -2392,6 +2408,14 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) lev->exec_event is the place where the table is loaded (it calls mysql_load()). */ + +#if MYSQL_VERSION_ID < 40100 + rli->future_master_log_pos= log_pos + get_event_len(); +#elif MYSQL_VERSION_ID < 50000 + rli->future_group_master_log_pos= log_pos + get_event_len(); +#else + rli->future_group_master_log_pos= log_pos; +#endif if (lev->exec_event(0,rli,1)) { /* diff --git a/sql/slave.h b/sql/slave.h index ed34c12985a..8331e722a51 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -177,12 +177,16 @@ typedef struct st_relay_log_info bool ignore_log_space_limit; /* - InnoDB internally stores the master log position it has processed - so far; the position to store is really the sum of - pos + pending + event_len here since we must store the pos of the - END of the current log event + When it commits, InnoDB internally stores the master log position it has + processed so far; the position to store is the one of the end of the + committing event (the COMMIT query event, or the event if in autocommit + mode). */ - int event_len; +#if MYSQL_VERSION_ID < 40100 + ulonglong future_master_log_pos; +#else + ulonglong future_group_master_log_pos; +#endif /* Needed for problems when slave stops and we want to restart it |