Commit e51447b1 authored by unknown's avatar unknown

always call start_bulk_insert, clarify this behaviour in comment block

change 10 to a #define'd constant


myisam/myisamdef.h:
  use a constant with a difficult-to-type name instead of two-digit number :)
sql/ha_myisam.cc:
  use a constant with a difficult-to-type name instead of two-digit number :)
sql/sql_insert.cc:
  always call start_bulk_insert (it performs all checks itself)
  removed spurious semicolon at the end of the "if" :)
  added a clarifying comment
parent 10e15762
......@@ -417,6 +417,7 @@ typedef struct st_mi_sort_param
#define MI_MIN_SIZE_BULK_INSERT_TREE 16384 /* this is per key */
#define MI_MIN_ROWS_TO_USE_BULK_INSERT 100
#define MI_MIN_ROWS_TO_DISABLE_INDEXES 100
#define MI_MIN_ROWS_TO_USE_WRITE_CACHE 10
/* The UNIQUE check is done with a hashed long key */
......
......@@ -868,7 +868,7 @@ void ha_myisam::start_bulk_insert(ha_rows rows)
ulong size= min(thd->variables.read_buff_size, table->avg_row_length*rows);
/* don't enable row cache if too few rows */
if (!rows && rows > 10)
if (!rows && rows > MI_MIN_ROWS_TO_USE_WRITE_CACHE)
mi_extra(file, HA_EXTRA_WRITE_CACHE, (void*) &size);
can_enable_indexes= (file->s->state.key_map ==
......
......@@ -260,7 +260,15 @@ 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 && values_list.elements != 1);
/*
let's *try* to start bulk inserts. It won't necessary
start them as values_list.elements should be greater than
some - handler dependent - threshold.
So we call start_bulk_insert to perform nesessary checks on
values_list.elements, and - if nothing else - to initialize
the code to make the call of end_bulk_insert() below safe.
*/
if (lock_type != TL_WRITE_DELAYED)
table->file->start_bulk_insert(values_list.elements);
while ((values= its++))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment