summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-04-08 20:41:00 +0200
committerunknown <serg@serg.mylan>2004-04-08 20:41:00 +0200
commite51447b1430e854fa0df1f37821e722cdb65d2bb (patch)
tree39dfdb44a3e709e59b9420faa6786345754a0ff5 /sql
parent10e15762b8e38ae09d89e6489de6f2fe68cfd85e (diff)
downloadmariadb-git-e51447b1430e854fa0df1f37821e722cdb65d2bb.tar.gz
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
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_myisam.cc2
-rw-r--r--sql/sql_insert.cc10
2 files changed, 10 insertions, 2 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index ca264f500a6..b9d6cec38aa 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -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 ==
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 6333beb5cb8..cc2ba29dbd8 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -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++))