7762
7762
// row processing loop
7765
set the initial time of this ROWS statement if it was not done
7766
before in some other ROWS event.
7768
const_cast<Relay_log_info*>(rli)->set_row_stmt_start_timestamp();
7764
7770
while (error == 0 && m_curr_row < m_rows_end)
7766
7772
/* in_use can have been set to NULL in close_tables_for_reopen */
9262
Check if we are already spending too much time on this statement.
9263
if we are, warn user that it might be because table does not have
9264
a PK, but only if the warning was not printed before for this STMT.
9266
@param type The event type code.
9267
@param table_name The name of the table that the slave is
9269
@param is_index_scan States whether the slave is doing an index scan
9271
@param rli The relay metadata info.
9274
void issue_long_find_row_warning(Log_event_type type,
9275
const char *table_name,
9277
const Relay_log_info *rli)
9279
if ((global_system_variables.log_warnings > 1 &&
9280
!const_cast<Relay_log_info*>(rli)->is_long_find_row_note_printed()))
9282
time_t now= my_time(0);
9283
time_t stmt_ts= const_cast<Relay_log_info*>(rli)->get_row_stmt_start_timestamp();
9285
DBUG_EXECUTE_IF("inject_long_find_row_note",
9286
stmt_ts-=(LONG_FIND_ROW_THRESHOLD*2););
9288
long delta= (long) (now - stmt_ts);
9290
if (delta > LONG_FIND_ROW_THRESHOLD)
9292
const_cast<Relay_log_info*>(rli)->set_long_find_row_note_printed();
9293
const char* evt_type= type == DELETE_ROWS_EVENT ? " DELETE" : "n UPDATE";
9294
const char* scan_type= is_index_scan ? "scanning an index" : "scanning the table";
9296
sql_print_information("The slave is applying a ROW event on behalf of a%s statement "
9297
"on table %s and is currently taking a considerable amount "
9298
"of time (%ld seconds). This is due to the fact that it is %s "
9299
"while looking up records to be processed. Consider adding a "
9300
"primary key (or unique key) to the table to improve "
9301
"performance.", evt_type, table_name, delta, scan_type);
9256
9307
Locate the current row in event's table.
9620
if (is_table_scan || is_index_scan)
9621
issue_long_find_row_warning(get_type_code(), m_table->alias,
9622
is_index_scan, rli);
9564
9624
table->default_column_bitmaps();
9565
9625
DBUG_RETURN(0);
9628
if (is_table_scan || is_index_scan)
9629
issue_long_find_row_warning(get_type_code(), m_table->alias,
9630
is_index_scan, rli);
9568
9632
table->default_column_bitmaps();
9569
9633
DBUG_RETURN(error);