| 7577 | */ |
| 7578 | |
| 7579 | int |
| 7580 | Write_rows_log_event::write_row(rpl_group_info *rgi, |
| 7581 | const bool overwrite) |
| 7582 | { |
| 7583 | DBUG_ENTER("write_row"); |
| 7584 | DBUG_ASSERT(m_table != NULL); |
| 7585 | DBUG_ASSERT(thd != NULL); |
| 7586 | |
| 7587 | TABLE *table= m_table; // pointer to event's table |
| 7588 | const bool invoke_triggers= (m_table->triggers && do_invoke_trigger()); |
| 7589 | |
| 7590 | prepare_record(table); |
| 7591 | |
| 7592 | /* unpack row into table->record[0] */ |
| 7593 | int error= unpack_current_row(rgi); |
| 7594 | if (unlikely(error)) |
| 7595 | { |
| 7596 | table->file->print_error(error, MYF(0)); |
| 7597 | DBUG_RETURN(error); |
| 7598 | } |
| 7599 | |
| 7600 | if (m_curr_row == m_rows_buf && !invoke_triggers && !table->s->long_unique_table) |
| 7601 | { |
| 7602 | /* |
| 7603 | This table has no triggers so we can do bulk insert. |
| 7604 | |
| 7605 | This is the first row to be inserted, we estimate the rows with |
| 7606 | the size of the first row and use that value to initialize |
| 7607 | storage engine for bulk insertion. |
| 7608 | */ |
| 7609 | /* this is the first row to be inserted, we estimate the rows with |
| 7610 | the size of the first row and use that value to initialize |
| 7611 | storage engine for bulk insertion */ |
| 7612 | DBUG_ASSERT(!(m_curr_row > m_curr_row_end)); |
| 7613 | ha_rows estimated_rows= 0; |
| 7614 | if (m_curr_row < m_curr_row_end) |
| 7615 | estimated_rows= (m_rows_end - m_curr_row) / (m_curr_row_end - m_curr_row); |
| 7616 | else if (m_curr_row == m_curr_row_end) |
| 7617 | estimated_rows= 1; |
| 7618 | |
| 7619 | table->file->ha_start_bulk_insert(estimated_rows); |
| 7620 | } |
| 7621 | |
| 7622 | /* |
| 7623 | Explicitly set the auto_inc to null to make sure that |
| 7624 | it gets an auto_generated value. |
| 7625 | */ |
| 7626 | if (is_auto_inc_in_extra_columns()) |
| 7627 | m_table->next_number_field->set_null(); |
| 7628 | |
| 7629 | DBUG_DUMP("record[0]", table->record[0], table->s->reclength); |
| 7630 | DBUG_PRINT_BITSET("debug", "rpl_write_set: %s", table->rpl_write_set); |
| 7631 | DBUG_PRINT_BITSET("debug", "read_set: %s", table->read_set); |
| 7632 | |
| 7633 | if (table->s->long_unique_table) |
| 7634 | table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_WRITE); |
| 7635 | |
| 7636 | bool trg_skip_row= false; |
nothing calls this directly
no test coverage detected