diff options
author | Michael Widenius <monty@askmonty.org> | 2012-01-24 18:07:35 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2012-01-24 18:07:35 +0200 |
commit | 59f5c05a387de0d3dadc85f8e2dfc68f24a255f5 (patch) | |
tree | cf220ba7c9e2e2c52c64007ed5f523dc643ebfbd /sql/log_event_old.cc | |
parent | 92bd8a5c6023927c64a110b6137a5cfa0659a01c (diff) | |
download | mariadb-git-59f5c05a387de0d3dadc85f8e2dfc68f24a255f5.tar.gz |
Don't crash with: UPDATE performance_schema.setup_instruments SET ENABLED="NO";
Don't log updates to performance schema in replication log.
Ensure that we don't call ha_update after ha_index_or_rnd_end() is called on slave.
.bzrignore:
Ignore some generated files
mysql-test/include/show_slave_status.inc:
Ensure that ./ is removed from file names
mysql-test/suite/perfschema/r/binlog_mix.result:
Updated results
mysql-test/suite/perfschema/r/binlog_row.result:
Updated results
mysql-test/suite/perfschema/r/binlog_stmt.result:
Updated results
mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result:
Updated results
mysql-test/suite/rpl/r/rpl_performance_schema.result:
Ensure that we don't crash slave when we update performance schema
mysql-test/suite/rpl/t/rpl_performance_schema.test:
Ensure that we don't crash slave when we update performance schema
sql/log_event.cc:
Ensure that we don't call ha_update after ha_index_or_rnd_end() is called.
Remove old code that is not needed anymore (like restarting read loop over all rows if no matcing row is found)
Simplify code
sql/log_event_old.cc:
Ensure that we don't call ha_update after ha_index_or_rnd_end() is called.
storage/myisam/ha_myisam.cc:
More DBUG_PRINT
storage/perfschema/ha_perfschema.h:
Don't log updates to performance schema in replication log.
Diffstat (limited to 'sql/log_event_old.cc')
-rw-r--r-- | sql/log_event_old.cc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 49d35197d60..09a58e29c18 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -2218,7 +2218,11 @@ Old_rows_log_event::write_row(const Relay_log_info *const rli, @note If the engine allows random access of the records, a combination of @c position() and @c rnd_pos() will be used. - */ + + Note that one MUST call ha_index_or_rnd_end() after this function if + it returns 0 as we must leave the row position in the handler intact + for any following update/delete command. +*/ int Old_rows_log_event::find_row(const Relay_log_info *rli) { @@ -2361,15 +2365,14 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli) /* Unique does not have non nullable part */ if (!(table->key_info->flags & (HA_NULL_PART_KEY))) { - table->file->ha_index_end(); DBUG_RETURN(0); } else { KEY *keyinfo= table->key_info; /* - Unique has nullable part. We need to check if there is any field in the - BI image that is null and part of UNNI. + Unique has nullable part. We need to check if there is any + field in the BI image that is null and part of UNNI. */ bool null_found= FALSE; for (uint i=0; i < keyinfo->key_parts && !null_found; i++) @@ -2381,7 +2384,6 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli) if (!null_found) { - table->file->ha_index_end(); DBUG_RETURN(0); } @@ -2424,11 +2426,6 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli) DBUG_RETURN(error); } } - - /* - Have to restart the scan to be able to fetch the next row. - */ - table->file->ha_index_end(); } else { @@ -2462,8 +2459,10 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli) if (++restart_count < 2) { int error2; + table->file->ha_rnd_end(); if ((error2= table->file->ha_rnd_init_with_error(1))) DBUG_RETURN(error2); + goto restart_rnd_next; } break; @@ -2489,7 +2488,8 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli) DBUG_PRINT("info", ("Record not found")); else DBUG_DUMP("record found", table->record[0], table->s->reclength); - table->file->ha_rnd_end(); + if (error) + table->file->ha_rnd_end(); DBUG_ASSERT(error == HA_ERR_END_OF_FILE || error == 0); DBUG_RETURN(error); @@ -2738,6 +2738,7 @@ int Delete_rows_log_event_old::do_exec_row(const Relay_log_info *const rli) Delete the record found, located in record[0] */ error= m_table->file->ha_delete_row(m_table->record[0]); + m_table->file->ha_index_or_rnd_end(); } return error; } @@ -2874,6 +2875,8 @@ Update_rows_log_event_old::do_exec_row(const Relay_log_info *const rli) #endif error= m_table->file->ha_update_row(m_table->record[1], m_table->record[0]); + m_table->file->ha_index_or_rnd_end(); + if (error == HA_ERR_RECORD_IS_THE_SAME) error= 0; |