diff options
author | unknown <serg@serg.mylan> | 2004-04-07 16:04:28 +0200 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2004-04-07 16:04:28 +0200 |
commit | a9a5517a1c861754529c003e9ebdbc001f84f647 (patch) | |
tree | 468a8a5c24e34ef26c95a8deb8a952e75ddb5ca1 | |
parent | 6ca2c764c22cf533b9f15ca86f24ebba42ebba33 (diff) | |
download | mariadb-git-a9a5517a1c861754529c003e9ebdbc001f84f647.tar.gz |
post-review fixes
HA_EXTRA_WRITE_CACHE now part of start_bulk_insert()
test cleanups
BitKeeper/deleted/.del-repair_part2-master.sh~f44a8c15d6c36585:
Delete: mysql-test/t/repair_part2-master.sh
BitKeeper/deleted/.del-repair_part2.test~c20f60783b04d001:
Delete: mysql-test/t/repair_part2.test
BitKeeper/deleted/.del-repair_part2.result~72ca166fb248b566:
Delete: mysql-test/r/repair_part2.result
mysql-test/r/myisam.result:
updated
mysql-test/t/lowercase_table2.test:
typo fixed
mysql-test/r/repair.result:
single repair.test from repair_part[12].test
mysql-test/t/lowercase_table3.test:
typo fixed
mysql-test/t/lowercase_table_qcache.test:
newline added
mysql-test/t/myisam.test:
updated
mysql-test/t/repair.test:
single repair.test from repair_part[12].test
sql/field.cc:
reverted
sql/field.h:
style fix
sql/ha_myisam.cc:
add HA_EXTRA_WRITE_CACHE to start_bulk_insert
sql/sql_insert.cc:
add HA_EXTRA_WRITE_CACHE to start_bulk_insert
sql/sql_load.cc:
add HA_EXTRA_WRITE_CACHE to start_bulk_insert
sql/sql_table.cc:
add HA_EXTRA_WRITE_CACHE to start_bulk_insert
-rw-r--r-- | mysql-test/r/myisam.result | 3 | ||||
-rw-r--r-- | mysql-test/r/repair.result (renamed from mysql-test/r/repair_part1.result) | 8 | ||||
-rw-r--r-- | mysql-test/r/repair_part2.result | 8 | ||||
-rw-r--r-- | mysql-test/t/lowercase_table2.test | 2 | ||||
-rw-r--r-- | mysql-test/t/lowercase_table3.test | 2 | ||||
-rw-r--r-- | mysql-test/t/lowercase_table_qcache.test | 2 | ||||
-rw-r--r-- | mysql-test/t/myisam.test | 1 | ||||
-rw-r--r-- | mysql-test/t/repair.test (renamed from mysql-test/t/repair_part1.test) | 8 | ||||
-rw-r--r-- | mysql-test/t/repair_part2-master.sh | 1 | ||||
-rw-r--r-- | mysql-test/t/repair_part2.test | 7 | ||||
-rw-r--r-- | sql/field.cc | 7 | ||||
-rw-r--r-- | sql/field.h | 5 | ||||
-rw-r--r-- | sql/ha_myisam.cc | 22 | ||||
-rw-r--r-- | sql/sql_insert.cc | 45 | ||||
-rw-r--r-- | sql/sql_load.cc | 6 | ||||
-rw-r--r-- | sql/sql_table.cc | 18 |
16 files changed, 57 insertions, 88 deletions
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 340db24cb44..9a123729c4b 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -523,7 +523,8 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par t1 1 a 1 a A 1000 NULL NULL YES BTREE alter table t1 engine=heap; alter table t1 disable keys; -ERROR HY000: Table storage engine for 't1' doesn't have this option +Warnings: +Note 1031 Table storage engine for 't1' doesn't have this option show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 a 1 a NULL NULL NULL NULL YES HASH diff --git a/mysql-test/r/repair_part1.result b/mysql-test/r/repair.result index 6dcec409ea6..2398e13b8e3 100644 --- a/mysql-test/r/repair_part1.result +++ b/mysql-test/r/repair.result @@ -28,3 +28,11 @@ repair table t1 use_frm; Table Op Msg_type Msg_text test.t1 repair error Table 'test.t1' doesn't exist create table t1 engine=myisam SELECT 1,"table 1"; +repair table t1; +Table Op Msg_type Msg_text +test.t1 repair error Can't open file: 't1.MYI' (errno: 130) +repair table t1 use_frm; +Table Op Msg_type Msg_text +test.t1 repair warning Number of rows changed from 0 to 1 +test.t1 repair status OK +drop table t1; diff --git a/mysql-test/r/repair_part2.result b/mysql-test/r/repair_part2.result deleted file mode 100644 index c9cf6c019f7..00000000000 --- a/mysql-test/r/repair_part2.result +++ /dev/null @@ -1,8 +0,0 @@ -repair table t1; -Table Op Msg_type Msg_text -test.t1 repair error Can't open file: 't1.MYI' (errno: 130) -repair table t1 use_frm; -Table Op Msg_type Msg_text -test.t1 repair warning Number of rows changed from 0 to 1 -test.t1 repair status OK -drop table t1; diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test index 8f542a7af78..5c479391916 100644 --- a/mysql-test/t/lowercase_table2.test +++ b/mysql-test/t/lowercase_table2.test @@ -1,6 +1,6 @@ # # Test of --lower-case-table-names=2 -# (User has case insensitive file system and want's to preserve case of +# (User has case insensitive file system and wants to preserve case of # table names) # --source include/have_innodb.inc diff --git a/mysql-test/t/lowercase_table3.test b/mysql-test/t/lowercase_table3.test index 735a0b390f9..1753772ecc3 100644 --- a/mysql-test/t/lowercase_table3.test +++ b/mysql-test/t/lowercase_table3.test @@ -1,6 +1,6 @@ # # Test of force of lower-case-table-names=0 -# (User has case insensitive file system and want's to preserve case of +# (User has case insensitive file system and wants to preserve case of # table names) # diff --git a/mysql-test/t/lowercase_table_qcache.test b/mysql-test/t/lowercase_table_qcache.test index 7416de25e1d..5077a41402a 100644 --- a/mysql-test/t/lowercase_table_qcache.test +++ b/mysql-test/t/lowercase_table_qcache.test @@ -26,4 +26,4 @@ select * from MySQL.db; enable_result_log; show status like "Qcache_queries_in_cache"; -set GLOBAL query_cache_size=0;
\ No newline at end of file +set GLOBAL query_cache_size=0; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index ea5895b8ea1..298a8b1b61b 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -498,7 +498,6 @@ show keys from t1; alter table t1 enable keys; show keys from t1; alter table t1 engine=heap; ---error 1031 alter table t1 disable keys; show keys from t1; drop table t1,t2; diff --git a/mysql-test/t/repair_part1.test b/mysql-test/t/repair.test index a2e186fd385..83a302e6f29 100644 --- a/mysql-test/t/repair_part1.test +++ b/mysql-test/t/repair.test @@ -27,8 +27,8 @@ drop table t1; # non-existent table repair table t1 use_frm; -# -# Create test table for repair2 -# The following must be last in this file - create table t1 engine=myisam SELECT 1,"table 1"; +system echo 1 > $MYSQL_TEST_DIR/var/master-data/test/t1.MYI ; +repair table t1; +repair table t1 use_frm; +drop table t1; diff --git a/mysql-test/t/repair_part2-master.sh b/mysql-test/t/repair_part2-master.sh deleted file mode 100644 index 964bde06c18..00000000000 --- a/mysql-test/t/repair_part2-master.sh +++ /dev/null @@ -1 +0,0 @@ -echo "1" > $MYSQL_TEST_DIR/var/master-data/test/t1.MYI diff --git a/mysql-test/t/repair_part2.test b/mysql-test/t/repair_part2.test deleted file mode 100644 index 8c27e382dff..00000000000 --- a/mysql-test/t/repair_part2.test +++ /dev/null @@ -1,7 +0,0 @@ -# -# This test starts with a crashed t1.MYI file left over from repair.test -# - -repair table t1; -repair table t1 use_frm; -drop table t1; diff --git a/sql/field.cc b/sql/field.cc index 774c4bb651d..6f49b73cb33 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -3098,8 +3098,7 @@ longlong Field_timestamp::val_int(void) } -String *Field_timestamp::val_str(String *val_buffer, - String *val_ptr __attribute__((unused))) +String *Field_timestamp::val_str(String *val_buffer, String *val_ptr) { uint32 temp, temp2; time_t time_arg; @@ -3119,8 +3118,8 @@ String *Field_timestamp::val_str(String *val_buffer, if (temp == 0L) { /* Zero time is "000000" */ - val_buffer->set("0000-00-00 00:00:00", 19, &my_charset_bin); - return val_buffer; + val_ptr->set("0000-00-00 00:00:00", 19, &my_charset_bin); + return val_ptr; } val_buffer->set_charset(&my_charset_bin); // Safety time_arg=(time_t) temp; diff --git a/sql/field.h b/sql/field.h index e6188d43f57..8ebc7412c35 100644 --- a/sql/field.h +++ b/sql/field.h @@ -98,8 +98,9 @@ public: virtual void store_time(TIME *ltime,timestamp_type t_type); virtual double val_real(void)=0; virtual longlong val_int(void)=0; - String *val_str(String *str) { return val_str(str, str); } - /* val_str(buf1, buf2) gets two buffers and should use them as follows: + inline String *val_str(String *str) { return val_str(str, str); } + /* + val_str(buf1, buf2) gets two buffers and should use them as follows: if it needs a temp buffer to convert result to string - use buf1 example Field_tiny::val_str() if the value exists as a string already - use buf2 diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index e78d2193c4b..c56009dc0aa 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -810,7 +810,8 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) } } -/* disable indexes, making it persistent if requested +/* + disable indexes, making it persistent if requested SYNOPSIS disable_indexes(all, save) all disable all indexes @@ -863,11 +864,16 @@ int ha_myisam::enable_indexes() void ha_myisam::start_bulk_insert(ha_rows rows) { + THD *thd=current_thd; + ulong size= min(thd->variables.read_buff_size, table->avg_row_length*rows); + + mi_extra(file, HA_EXTRA_WRITE_CACHE, (void*)&size); + + can_enable_indexes= (file->s->state.key_map == + set_bits(ulonglong, file->s->base.keys)); + if (!(specialflag & SPECIAL_SAFE_MODE)) { - can_enable_indexes= (file->s->state.key_map == - set_bits(ulonglong, file->s->base.keys)); - /* Only disable old index if the table was empty and we are inserting a lot of rows. @@ -881,18 +887,16 @@ void ha_myisam::start_bulk_insert(ha_rows rows) if (!file->bulk_insert && (!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT)) { - mi_init_bulk_insert(file, - current_thd->variables.bulk_insert_buff_size, - rows); + mi_init_bulk_insert(file, thd->variables.bulk_insert_buff_size, rows); } } } - int ha_myisam::end_bulk_insert() { mi_end_bulk_insert(file); - return can_enable_indexes ? enable_indexes() : 0; + int err=mi_extra(file, HA_EXTRA_NO_CACHE, 0); + return err ? err : can_enable_indexes ? enable_indexes() : 0; } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index e002e82f369..83eb5db6392 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -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 diff --git a/sql/sql_load.cc b/sql/sql_load.cc index f0b6b90dc84..3d9299ca05c 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -276,10 +276,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, { if (use_timestamp) table->timestamp_default_now= table->timestamp_on_update_now= 0; - + table->next_number_field=table->found_next_number_field; - VOID(table->file->extra_opt(HA_EXTRA_WRITE_CACHE, - thd->variables.read_buff_size)); if (handle_duplicates == DUP_IGNORE || handle_duplicates == DUP_REPLACE) table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); @@ -291,8 +289,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, else error=read_sep_field(thd,info,table,fields,read_info,*enclosed, skip_lines); - if (table->file->extra(HA_EXTRA_NO_CACHE)) - error=1; /* purecov: inspected */ if (table->file->end_bulk_insert()) error=1; /* purecov: inspected */ table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 42df8f5885b..a5e027344dc 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2271,6 +2271,13 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, break; } } + if (error==HA_ERR_WRONG_COMMAND) + { + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), + table->table_name); + error=0; + } if (!error) { mysql_update_log.write(thd, thd->query, thd->query_length); @@ -2866,7 +2873,6 @@ copy_data_between_tables(TABLE *from,TABLE *to, DBUG_RETURN(-1); /* purecov: inspected */ to->file->external_lock(thd,F_WRLCK); - to->file->extra(HA_EXTRA_WRITE_CACHE); from->file->info(HA_STATUS_VARIABLE); to->file->start_bulk_insert(from->file->records); @@ -2951,17 +2957,15 @@ copy_data_between_tables(TABLE *from,TABLE *to, end_read_record(&info); free_io_cache(from); delete [] copy; // This is never 0 - uint tmp_error; - if ((tmp_error=to->file->extra(HA_EXTRA_NO_CACHE))) + + if (to->file->end_bulk_insert() && !error) { - to->file->print_error(tmp_error,MYF(0)); + to->file->print_error(my_errno,MYF(0)); error=1; } to->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); - if (to->file->end_bulk_insert()) - error=1; - tmp_error = ha_recovery_logging(thd,TRUE); + ha_recovery_logging(thd,TRUE); /* Ensure that the new table is saved properly to disk so that we can do a rename |