diff options
author | unknown <monty@mashka.mysql.fi> | 2002-09-18 21:04:49 +0300 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2002-09-18 21:04:49 +0300 |
commit | 83fc12f21653f1e6fc12c61791f4e6f2dd87be96 (patch) | |
tree | 83f34b98c4e43e4f23f9b941d93676b65ef1b657 /sql/ha_myisam.cc | |
parent | aef675029f198c61a1a1c46dbb68890f705d40db (diff) | |
download | mariadb-git-83fc12f21653f1e6fc12c61791f4e6f2dd87be96.tar.gz |
Added code to flush a bulk_insert index.
This fixes a bug when doing multi-row inserts on table with an auto_increment key that is not in the first key segment.
Docs/manual.texi:
Changelog
include/my_base.h:
Added code to flush a bulk_insert index
myisam/mi_extra.c:
Added code to flush a bulk_insert index
mysql-test/r/insert.result:
test of auto_increment and bulk_insert
mysql-test/t/insert.test:
test of auto_increment and bulk_insert
sql/ha_myisam.cc:
Added code to flush a bulk_insert index
sql/sql_insert.cc:
Mark that bulk_insert is used
sql/sql_load.cc:
Mark that bulk_insert is used
Remove duplicated call to initialize bulk insert
sql/table.h:
Mark that bulk_insert is used
vio/viosslfactories.c:
Remove compiler warning
Diffstat (limited to 'sql/ha_myisam.cc')
-rw-r--r-- | sql/ha_myisam.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index bae455cbb3c..cc1e4c3f45c 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -657,7 +657,15 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) } -/* Deactive all not unique index that can be recreated fast */ +/* + Deactive all not unique index that can be recreated fast + + SYNOPSIS + deactivate_non_unique_index() + rows Rows to be inserted + 0 if we don't know + HA_POS_ERROR if we want to disable all keys +*/ void ha_myisam::deactivate_non_unique_index(ha_rows rows) { @@ -670,9 +678,12 @@ void ha_myisam::deactivate_non_unique_index(ha_rows rows) mi_extra(file, HA_EXTRA_NO_KEYS, 0); else { - mi_disable_non_unique_index(file,rows); + /* Only disable old index if the table was empty */ + if (file->state->records == 0) + mi_disable_non_unique_index(file,rows); ha_myisam::extra_opt(HA_EXTRA_BULK_INSERT_BEGIN, current_thd->variables.bulk_insert_buff_size); + table->bulk_insert= 1; } } enable_activate_all_index=1; @@ -690,6 +701,7 @@ bool ha_myisam::activate_all_index(THD *thd) DBUG_ENTER("activate_all_index"); mi_extra(file, HA_EXTRA_BULK_INSERT_END, 0); + table->bulk_insert= 0; if (enable_activate_all_index && share->state.key_map != set_bits(ulonglong, share->base.keys)) { @@ -1194,6 +1206,10 @@ longlong ha_myisam::get_auto_increment() return auto_increment_value; } + if (table->bulk_insert) + mi_extra(file, HA_EXTRA_BULK_INSERT_FLUSH, + (void*) &table->next_number_index); + longlong nr; int error; byte key[MI_MAX_KEY_LENGTH]; |