diff options
author | unknown <monty@donna.mysql.com> | 2000-08-17 01:05:02 +0300 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2000-08-17 01:05:02 +0300 |
commit | 7496ec3173ed1ad87f07ff87058a40e1748ae64c (patch) | |
tree | eff8fc8b2beebf362d7ac8de2cad48821df97d02 /sql | |
parent | e318f3a607f609c28636a9ac29cd67662166f01a (diff) | |
download | mariadb-git-7496ec3173ed1ad87f07ff87058a40e1748ae64c.tar.gz |
Additions for CHECK table + update of benchmarks
Docs/manual.texi:
Updated for 3.23.23
myisam/mi_check.c:
Fix for CHECK table
sql-bench/bench-init.pl.sh:
Fix of benchmarks for PostgreSQL 7.0.2
sql-bench/server-cfg.sh:
Fix of benchmarks for PostgreSQL 7.0.2
sql-bench/test-insert.sh:
Fix of benchmarks for PostgreSQL 7.0.2
sql-bench/test-select.sh:
Fix of benchmarks for PostgreSQL 7.0.2
sql/ha_myisam.cc:
Fix for CHECK table
sql/handler.h:
Fix for CHECK table
sql/lex.h:
Fix for CHECK table
sql/sql_load.cc:
Fix bug in delayed keys
sql/sql_table.cc:
Fix for CHECK table
sql/sql_yacc.yy:
Fix for CHECK table
sql/structs.h:
Fix wrong type
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_myisam.cc | 47 | ||||
-rw-r--r-- | sql/handler.h | 1 | ||||
-rw-r--r-- | sql/lex.h | 2 | ||||
-rw-r--r-- | sql/sql_load.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 5 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 11 | ||||
-rw-r--r-- | sql/structs.h | 2 |
7 files changed, 45 insertions, 25 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 187cf703ce8..9c68d1bb4b6 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -238,38 +238,38 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt) param.thd = thd; param.op_name = (char*)"check"; param.table_name = table->table_name; - param.testflag = check_opt->flags | T_CHECK | T_SILENT; - if (check_opt->quick) - param.testflag |= T_FAST; + param.testflag = check_opt->flags | T_CHECK | T_SILENT | T_MEDIUM; if (!(table->db_stat & HA_READ_ONLY)) param.testflag|= T_STATISTICS; param.using_global_keycache = 1; + if (!mi_is_crashed(file) && + (((param.testflag & T_CHECK_ONLY_CHANGED) && + !share->state.changed && share->state.open_count == 0) || + ((param.testflag & T_FAST) && share->state.open_count == 0))) + return HA_CHECK_ALREADY_CHECKED; + error = chk_size(¶m, file); - if (!((param.testflag & T_FAST) && share->state.open_count == 1 && - !share->state.changed)) + if (!error) + error |= chk_del(¶m, file, param.testflag); + if (!error) + error = chk_key(¶m, file); + if (!error) { - if (!error) - error |= chk_del(¶m, file, param.testflag); - if (!error) - error = chk_key(¶m, file); - if (!error) + if (!check_opt->quick && + (share->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD))) { - if (!(param.testflag & T_FAST) || - (share->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD))) - { - init_io_cache(¶m.read_cache, file->dfile, - my_default_record_cache_size, READ_CACHE, - share->pack.header_length, 1, MYF(MY_WME)); - error |= chk_data_link(¶m, file, param.testflag & T_EXTEND); - end_io_cache(&(param.read_cache)); - } + init_io_cache(¶m.read_cache, file->dfile, + my_default_record_cache_size, READ_CACHE, + share->pack.header_length, 1, MYF(MY_WME)); + error |= chk_data_link(¶m, file, param.testflag & T_EXTEND); + end_io_cache(&(param.read_cache)); } } if (!error) { - if (share->state.changed) + if (share->state.changed || (param.testflag & T_STATISTICS)) { file->update|=HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; pthread_mutex_lock(&share->intern_lock); @@ -278,11 +278,14 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt) #endif share->state.changed=0; if (!(table->db_stat & HA_READ_ONLY)) - error=update_state_info(¶m,file,UPDATE_TIME | UPDATE_OPEN_COUNT); + error=update_state_info(¶m,file,UPDATE_TIME | UPDATE_OPEN_COUNT | + UPDATE_STAT); #ifndef HAVE_PREAD pthread_mutex_unlock(&THR_LOCK_keycache);// QQ; Has to be removed! #endif pthread_mutex_unlock(&share->intern_lock); + info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE | + HA_STATUS_CONST); } } else if (!mi_is_crashed(file)) @@ -379,6 +382,8 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m) if (file->s->base.auto_key) update_auto_increment_key(¶m, file, 1); error = update_state_info(¶m, file, UPDATE_TIME|UPDATE_STAT); + info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE | + HA_STATUS_CONST); } else if (!mi_is_crashed(file)) { diff --git a/sql/handler.h b/sql/handler.h index 208ae989218..b4cb5bcac37 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -27,6 +27,7 @@ // the following is for checking tables +#define HA_CHECK_ALREADY_CHECKED 1 #define HA_CHECK_OK 0 #define HA_CHECK_NOT_IMPLEMENTED -1 #define HA_CHECK_CORRUPT -2 diff --git a/sql/lex.h b/sql/lex.h index 75c11a52273..08fc4d5d2e5 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -78,6 +78,7 @@ static SYMBOL symbols[] = { { "CHAR", SYM(CHAR_SYM),0,0}, { "CHARACTER", SYM(CHAR_SYM),0,0}, { "CHANGE", SYM(CHANGE),0,0}, + { "CHANGED", SYM(CHANGED),0,0}, { "CHECK", SYM(CHECK_SYM),0,0}, { "CHECKSUM", SYM(CHECKSUM_SYM),0,0}, { "COLLECTION", SYM(COLLECTION),0,0}, @@ -124,6 +125,7 @@ static SYMBOL symbols[] = { { "EXPLAIN", SYM(DESCRIBE),0,0}, { "EXISTS", SYM(EXISTS),0,0}, { "EXTENDED", SYM(EXTENDED_SYM),0,0}, + { "FAST", SYM(FAST_SYM),0,0}, { "FIELDS", SYM(COLUMNS),0,0}, { "FILE", SYM(FILE_SYM),0,0}, { "FIRST", SYM(FIRST_SYM),0,0}, diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 8f6af5a811b..145bbec4d88 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -224,7 +224,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, else error=read_sep_field(thd,info,table,fields,read_info,*enclosed); if (table->file->extra(HA_EXTRA_NO_CACHE) || - table->file->activate_all_index((ha_rows) 0)) + table->file->activate_all_index(thd)) error=1; /* purecov: inspected */ table->time_stamp=save_time_stamp; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 57ba100ef96..d9e14014189 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -954,6 +954,11 @@ int mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt) net_store_data(packet, "OK"); break; + case HA_CHECK_ALREADY_CHECKED: + net_store_data(packet, "status"); + net_store_data(packet, "Not checked"); + break; + case HA_CHECK_CORRUPT: net_store_data(packet, "status"); net_store_data(packet, "Corrupt"); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 006d829005f..41d4e32cfd4 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -276,12 +276,14 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token BIGINT %token BLOB_SYM %token CHAR_SYM +%token CHANGED %token COALESCE %token DATETIME %token DATE_SYM %token DECIMAL_SYM %token DOUBLE_SYM %token ENUM +%token FAST_SYM %token FLOAT_SYM %token INT_SYM %token LIMIT @@ -1104,8 +1106,10 @@ opt_mi_check_type: | TYPE_SYM EQ mi_check_types {} mi_check_types: - QUICK { Lex->check_opt.quick = 1; } - | EXTENDED_SYM { Lex->check_opt.flags = T_EXTEND; } + QUICK { Lex->check_opt.quick = 1; } + | FAST_SYM { Lex->check_opt.flags|= T_FAST; } + | EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; } + | CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; } analyze: ANALYZE_SYM table_or_tables table_list @@ -2332,6 +2336,7 @@ keyword: | BEGIN_SYM {} | BIT_SYM {} | BOOL_SYM {} + | CHANGED {} | CHECKSUM_SYM {} | CHECK_SYM {} | COMMENT_SYM {} @@ -2348,6 +2353,7 @@ keyword: | ENUM {} | ESCAPE_SYM {} | EXTENDED_SYM {} + | FAST_SYM {} | FILE_SYM {} | FIRST_SYM {} | FIXED_SYM {} @@ -2383,6 +2389,7 @@ keyword: | PASSWORD {} | PROCESS {} | PROCESSLIST_SYM {} + | QUICK {} | RAID_0_SYM {} | RAID_CHUNKS {} | RAID_CHUNKSIZE {} diff --git a/sql/structs.h b/sql/structs.h index edd1a2a68c4..aa28a2b41fb 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -71,7 +71,7 @@ typedef struct st_key { char *name; /* Name of key */ ulong *rec_per_key; /* Key part distribution */ union { - uint bdb_return_if_eq; + int bdb_return_if_eq; } handler; } KEY; |