mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
post-review fixes
HA_EXTRA_WRITE_CACHE now part of start_bulk_insert() test cleanups
This commit is contained in:
@ -264,17 +264,8 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
thd->proc_info="update";
|
||||
if (duplic != DUP_ERROR)
|
||||
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
|
||||
if ((lock_type != TL_WRITE_DELAYED && !(specialflag & SPECIAL_SAFE_MODE)) &&
|
||||
values_list.elements >= MIN_ROWS_TO_USE_BULK_INSERT)
|
||||
{
|
||||
table->file->extra_opt(HA_EXTRA_WRITE_CACHE,
|
||||
min(thd->variables.read_buff_size,
|
||||
table->avg_row_length*values_list.elements));
|
||||
if (lock_type != TL_WRITE_DELAYED)
|
||||
table->file->start_bulk_insert(values_list.elements);
|
||||
bulk_insert=1;
|
||||
}
|
||||
else
|
||||
bulk_insert=0;
|
||||
|
||||
while ((values= its++))
|
||||
{
|
||||
@ -352,24 +343,10 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (bulk_insert)
|
||||
if (table->file->end_bulk_insert() && !error)
|
||||
{
|
||||
if (table->file->extra(HA_EXTRA_NO_CACHE))
|
||||
{
|
||||
if (!error)
|
||||
{
|
||||
table->file->print_error(my_errno,MYF(0));
|
||||
error=1;
|
||||
}
|
||||
}
|
||||
if (table->file->end_bulk_insert())
|
||||
{
|
||||
if (!error)
|
||||
{
|
||||
table->file->print_error(my_errno,MYF(0));
|
||||
error=1;
|
||||
}
|
||||
}
|
||||
table->file->print_error(my_errno,MYF(0));
|
||||
error=1;
|
||||
}
|
||||
if (id && values_list.elements != 1)
|
||||
thd->insert_id(id); // For update log
|
||||
@ -387,7 +364,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
transactional_table= table->file->has_transactions();
|
||||
|
||||
log_delayed= (transactional_table || table->tmp_table);
|
||||
if ((info.copied || info.deleted || info.updated) &&
|
||||
if ((info.copied || info.deleted || info.updated) &&
|
||||
(error <= 0 || !transactional_table))
|
||||
{
|
||||
mysql_update_log.write(thd, thd->query, thd->query_length);
|
||||
@ -1439,8 +1416,6 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
||||
table->next_number_field=table->found_next_number_field;
|
||||
thd->count_cuted_fields= CHECK_FIELD_WARN; // calc cuted fields
|
||||
thd->cuted_fields=0;
|
||||
if (info.handle_duplicates != DUP_REPLACE)
|
||||
table->file->extra(HA_EXTRA_WRITE_CACHE);
|
||||
if (info.handle_duplicates == DUP_IGNORE ||
|
||||
info.handle_duplicates == DUP_REPLACE)
|
||||
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
|
||||
@ -1497,7 +1472,6 @@ void select_insert::send_error(uint errcode,const char *err)
|
||||
*/
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
table->file->extra(HA_EXTRA_NO_CACHE);
|
||||
table->file->end_bulk_insert();
|
||||
/*
|
||||
If at least one row has been inserted/modified and will stay in the table
|
||||
@ -1505,7 +1479,7 @@ void select_insert::send_error(uint errcode,const char *err)
|
||||
error while inserting into a MyISAM table) we must write to the binlog (and
|
||||
the error code will make the slave stop).
|
||||
*/
|
||||
if ((info.copied || info.deleted || info.updated) &&
|
||||
if ((info.copied || info.deleted || info.updated) &&
|
||||
!table->file->has_transactions())
|
||||
{
|
||||
if (last_insert_id)
|
||||
@ -1518,7 +1492,7 @@ void select_insert::send_error(uint errcode,const char *err)
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
if (!table->tmp_table)
|
||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
||||
}
|
||||
if (info.copied || info.deleted || info.updated)
|
||||
query_cache_invalidate3(thd, table, 1);
|
||||
@ -1532,8 +1506,7 @@ bool select_insert::send_eof()
|
||||
int error,error2;
|
||||
DBUG_ENTER("select_insert::send_eof");
|
||||
|
||||
if (!(error=table->file->extra(HA_EXTRA_NO_CACHE)))
|
||||
error=table->file->end_bulk_insert();
|
||||
error=table->file->end_bulk_insert();
|
||||
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
|
||||
|
||||
/*
|
||||
@ -1609,7 +1582,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
||||
|
||||
/* Don't set timestamp if used */
|
||||
table->timestamp_default_now= table->timestamp_on_update_now= 0;
|
||||
|
||||
|
||||
table->next_number_field=table->found_next_number_field;
|
||||
|
||||
restore_record(table,default_values); // Get empty record
|
||||
|
Reference in New Issue
Block a user