Commit 61fd6baf authored by monty@donna.mysql.com's avatar monty@donna.mysql.com

Bug fix for NATURAL JOIN, Split manual sections and more statistic variables

parent b31d0768
This diff is collapsed.
...@@ -187,7 +187,7 @@ extern char *get_charsets_dir(char *buf); ...@@ -187,7 +187,7 @@ extern char *get_charsets_dir(char *buf);
extern ulong _my_cache_w_requests,_my_cache_write,_my_cache_r_requests, extern ulong _my_cache_w_requests,_my_cache_write,_my_cache_r_requests,
_my_cache_read; _my_cache_read;
extern ulong _my_blocks_used,_my_blocks_changed; extern ulong _my_blocks_used,_my_blocks_changed;
extern uint my_file_opened,my_stream_opened; extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
extern my_bool key_cache_inited; extern my_bool key_cache_inited;
/* Point to current my_message() */ /* Point to current my_message() */
......
...@@ -684,8 +684,8 @@ mysql_free_result(MYSQL_RES *result) ...@@ -684,8 +684,8 @@ mysql_free_result(MYSQL_RES *result)
static const char *default_options[]= static const char *default_options[]=
{"port","socket","compress","password","pipe", "timeout", "user", {"port","socket","compress","password","pipe", "timeout", "user",
"init-command", "host", "database", "debug", "return-found-rows", "init-command", "host", "database", "debug", "return-found-rows",
"ssl_key" ,"ssl_cert" ,"ssl_ca" ,"ssl_capath", "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath",
"character-set-dir", "default-character-set", "character-set-dir", "default-character-set", "interactive-timeout",
NullS NullS
}; };
...@@ -815,6 +815,9 @@ static void mysql_read_default_options(struct st_mysql_options *options, ...@@ -815,6 +815,9 @@ static void mysql_read_default_options(struct st_mysql_options *options,
my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR)); my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR));
options->charset_name = my_strdup(opt_arg, MYF(MY_WME)); options->charset_name = my_strdup(opt_arg, MYF(MY_WME));
break; break;
case 19: /* Interactive-timeout */
options->client_flag|=CLIENT_INTERACTIVE;
break;
default: default:
DBUG_PRINT("warning",("unknown option: %s",option[0])); DBUG_PRINT("warning",("unknown option: %s",option[0]));
} }
......
...@@ -170,5 +170,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, ...@@ -170,5 +170,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
} }
} }
#endif #endif
if (file >= 0)
thread_safe_increment(my_tmp_file_created,&THR_LOCK_open);
DBUG_RETURN(file); DBUG_RETURN(file);
} }
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
my_string home_dir=0,my_progname=0; my_string home_dir=0,my_progname=0;
char NEAR curr_dir[FN_REFLEN]= {0}, char NEAR curr_dir[FN_REFLEN]= {0},
NEAR home_dir_buff[FN_REFLEN]= {0}; NEAR home_dir_buff[FN_REFLEN]= {0};
uint my_stream_opened=0,my_file_opened=0; ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0;
int NEAR my_umask=0664, NEAR my_umask_dir=0777; int NEAR my_umask=0664, NEAR my_umask_dir=0777;
#ifndef THREAD #ifndef THREAD
int NEAR my_errno=0; int NEAR my_errno=0;
......
...@@ -292,7 +292,7 @@ $dbh->do("drop table crash_q"); ...@@ -292,7 +292,7 @@ $dbh->do("drop table crash_q");
report("truncate","truncate_table", report("truncate","truncate_table",
"create table crash_q (a integer, b integer,c CHAR(10))", "create table crash_q (a integer, b integer,c CHAR(10))",
"truncate crash_q", "truncate crash_q",
"drop table crash_q1"); "drop table crash_q");
if ($dbh->do("create table crash_q (a integer, b integer,c CHAR(10))") && if ($dbh->do("create table crash_q (a integer, b integer,c CHAR(10))") &&
$dbh->do("create table crash_q1 (a integer, b integer,c CHAR(10) not null)")) $dbh->do("create table crash_q1 (a integer, b integer,c CHAR(10) not null)"))
......
#This file is automaticly generated by crash-me 1.50 #This file is automaticly generated by crash-me 1.51
NEG=yes # update of column= -column NEG=yes # update of column= -column
Need_cast_for_null=no # Need to cast NULL for arithmetic Need_cast_for_null=no # Need to cast NULL for arithmetic
...@@ -31,12 +31,12 @@ comment_--=yes # -- as comment (ANSI) ...@@ -31,12 +31,12 @@ comment_--=yes # -- as comment (ANSI)
comment_/**/=yes # /* */ as comment comment_/**/=yes # /* */ as comment
comment_//=no # // as comment (ANSI) comment_//=no # // as comment (ANSI)
compute=no # Compute compute=no # Compute
connections=30 # Simultaneous connections (installation default) connections=101 # Simultaneous connections (installation default)
constraint_check=no # Column constraints constraint_check=no # Column constraints
constraint_check_table=no # Table constraints constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style) constraint_null=yes # NULL constraint (SyBase style)
crash_me_safe=yes # crash me safe crash_me_safe=yes # crash me safe
crash_me_version=1.50 # crash me version crash_me_version=1.51 # crash me version
create_default=yes # default value for column create_default=yes # default value for column
create_default_func=no # default value function for column create_default_func=no # default value function for column
create_if_not_exists=yes # create table if not exists create_if_not_exists=yes # create table if not exists
...@@ -315,7 +315,7 @@ intersect=no # intersect ...@@ -315,7 +315,7 @@ intersect=no # intersect
intersect_all=no # intersect all intersect_all=no # intersect all
intersect_all_incompat=no # intersect all (incompatible lists) intersect_all_incompat=no # intersect all (incompatible lists)
intersect_incompat=no # intersect (incompatible lists) intersect_incompat=no # intersect (incompatible lists)
join_tables=31 # tables in join join_tables=63 # tables in join
left_outer_join=yes # left outer join left_outer_join=yes # left outer join
left_outer_join_using=yes # left outer join using left_outer_join_using=yes # left outer join using
like_with_column=yes # column LIKE column like_with_column=yes # column LIKE column
...@@ -327,7 +327,7 @@ max_char_size=255 # max char() size ...@@ -327,7 +327,7 @@ max_char_size=255 # max char() size
max_column_name=64 # column name length max_column_name=64 # column name length
max_columns=3398 # Columns in table max_columns=3398 # Columns in table
max_conditions=85660 # OR and AND in WHERE max_conditions=85660 # OR and AND in WHERE
max_expressions=859 # simple expressions max_expressions=1837 # simple expressions
max_index=32 # max index max_index=32 # max index
max_index_length=500 # index length max_index_length=500 # index length
max_index_name=64 # index name length max_index_name=64 # index name length
...@@ -337,7 +337,7 @@ max_index_varchar_part_length=255 # index varchar part length ...@@ -337,7 +337,7 @@ max_index_varchar_part_length=255 # index varchar part length
max_row_length=65534 # max table row length (without blobs) max_row_length=65534 # max table row length (without blobs)
max_row_length_with_null=65502 # table row length with nulls (without blobs) max_row_length_with_null=65502 # table row length with nulls (without blobs)
max_select_alias_name=+512 # select alias name length max_select_alias_name=+512 # select alias name length
max_stack_expression=859 # stacked expressions max_stack_expression=1837 # stacked expressions
max_table_alias_name=+512 # table alias name length max_table_alias_name=+512 # table alias name length
max_table_name=64 # table name length max_table_name=64 # table name length
max_text_size=1048543 # max text or blob size max_text_size=1048543 # max text or blob size
...@@ -361,7 +361,7 @@ null_in_index=yes # null in index ...@@ -361,7 +361,7 @@ null_in_index=yes # null in index
null_in_unique=yes # null in unique index null_in_unique=yes # null in unique index
null_num_expr=yes # Is 1+NULL = NULL null_num_expr=yes # Is 1+NULL = NULL
odbc_left_outer_join=yes # left outer join odbc style odbc_left_outer_join=yes # left outer join odbc style
operating_system=Linux 2.2.14-my-SMP i686 # crash-me tested on operating_system=Linux 2.2.13-SMP alpha # crash-me tested on
order_by=yes # Order by order_by=yes # Order by
order_by_alias=yes # Order by alias order_by_alias=yes # Order by alias
order_by_function=yes # Order by function order_by_function=yes # Order by function
...@@ -380,7 +380,7 @@ quote_with_"=yes # Allows ' and " as string markers ...@@ -380,7 +380,7 @@ quote_with_"=yes # Allows ' and " as string markers
remember_end_space=no # Remembers end space in char() remember_end_space=no # Remembers end space in char()
remember_end_space_varchar=no # Remembers end space in varchar() remember_end_space_varchar=no # Remembers end space in varchar()
rename_table=yes # rename table rename_table=yes # rename table
repeat_string_size=1048576 # return string size from function repeat_string_size=1047552 # return string size from function
right_outer_join=yes # right outer join right_outer_join=yes # right outer join
rowid=auto_increment # Type for row id rowid=auto_increment # Type for row id
select_constants=yes # Select constants select_constants=yes # Select constants
...@@ -389,7 +389,7 @@ select_limit2=yes # SELECT with LIMIT #,# ...@@ -389,7 +389,7 @@ select_limit2=yes # SELECT with LIMIT #,#
select_string_size=1048565 # constant string size in SELECT select_string_size=1048565 # constant string size in SELECT
select_table_update=no # Update with sub select select_table_update=no # Update with sub select
select_without_from=yes # SELECT without FROM select_without_from=yes # SELECT without FROM
server_version=MySQL 3.23.25 beta debug # server version server_version=MySQL 3.23.28 gamma # server version
simple_joins=yes # ANSI SQL simple joins simple_joins=yes # ANSI SQL simple joins
storage_of_float=round # Storage of float values storage_of_float=round # Storage of float values
subqueries=no # subqueries subqueries=no # subqueries
...@@ -398,6 +398,7 @@ table_name_case=no # case independent table names ...@@ -398,6 +398,7 @@ table_name_case=no # case independent table names
table_wildcard=yes # Select table_name.* table_wildcard=yes # Select table_name.*
tempoary_table=yes # temporary tables tempoary_table=yes # temporary tables
transactions=no # transactions transactions=no # transactions
truncate_table=yes # truncate
type_extra_abstime=no # Type abstime type_extra_abstime=no # Type abstime
type_extra_bfile=no # Type bfile type_extra_bfile=no # Type bfile
type_extra_blob=yes # Type blob type_extra_blob=yes # Type blob
...@@ -512,5 +513,6 @@ union_all_incompat=no # union all (incompatible lists) ...@@ -512,5 +513,6 @@ union_all_incompat=no # union all (incompatible lists)
union_incompat=no # union (incompatible lists) union_incompat=no # union (incompatible lists)
unique_in_create=yes # unique in create table unique_in_create=yes # unique in create table
unique_null_in_create=yes # unique null in create unique_null_in_create=yes # unique null in create
user_comment=Alpha DS20 2x500 MHz, 2G memory, key_buffer=16M; ccc + cxx # comment
views=no # views views=no # views
where_string_size=1048540 # constant string size in where where_string_size=1048540 # constant string size in where
#This file is automaticly generated by crash-me 1.50 #This file is automaticly generated by crash-me 1.51
NEG=yes # update of column= -column NEG=yes # update of column= -column
Need_cast_for_null=no # Need to cast NULL for arithmetic Need_cast_for_null=no # Need to cast NULL for arithmetic
...@@ -31,12 +31,12 @@ comment_--=yes # -- as comment (ANSI) ...@@ -31,12 +31,12 @@ comment_--=yes # -- as comment (ANSI)
comment_/**/=yes # /* */ as comment comment_/**/=yes # /* */ as comment
comment_//=no # // as comment (ANSI) comment_//=no # // as comment (ANSI)
compute=no # Compute compute=no # Compute
connections=30 # Simultaneous connections (installation default) connections=101 # Simultaneous connections (installation default)
constraint_check=no # Column constraints constraint_check=no # Column constraints
constraint_check_table=no # Table constraints constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style) constraint_null=yes # NULL constraint (SyBase style)
crash_me_safe=yes # crash me safe crash_me_safe=yes # crash me safe
crash_me_version=1.50 # crash me version crash_me_version=1.51 # crash me version
create_default=yes # default value for column create_default=yes # default value for column
create_default_func=no # default value function for column create_default_func=no # default value function for column
create_if_not_exists=yes # create table if not exists create_if_not_exists=yes # create table if not exists
...@@ -315,7 +315,7 @@ intersect=no # intersect ...@@ -315,7 +315,7 @@ intersect=no # intersect
intersect_all=no # intersect all intersect_all=no # intersect all
intersect_all_incompat=no # intersect all (incompatible lists) intersect_all_incompat=no # intersect all (incompatible lists)
intersect_incompat=no # intersect (incompatible lists) intersect_incompat=no # intersect (incompatible lists)
join_tables=31 # tables in join join_tables=63 # tables in join
left_outer_join=yes # left outer join left_outer_join=yes # left outer join
left_outer_join_using=yes # left outer join using left_outer_join_using=yes # left outer join using
like_with_column=yes # column LIKE column like_with_column=yes # column LIKE column
...@@ -327,7 +327,7 @@ max_char_size=255 # max char() size ...@@ -327,7 +327,7 @@ max_char_size=255 # max char() size
max_column_name=64 # column name length max_column_name=64 # column name length
max_columns=3398 # Columns in table max_columns=3398 # Columns in table
max_conditions=85660 # OR and AND in WHERE max_conditions=85660 # OR and AND in WHERE
max_expressions=859 # simple expressions max_expressions=1837 # simple expressions
max_index=32 # max index max_index=32 # max index
max_index_length=500 # index length max_index_length=500 # index length
max_index_name=64 # index name length max_index_name=64 # index name length
...@@ -337,7 +337,7 @@ max_index_varchar_part_length=255 # index varchar part length ...@@ -337,7 +337,7 @@ max_index_varchar_part_length=255 # index varchar part length
max_row_length=65534 # max table row length (without blobs) max_row_length=65534 # max table row length (without blobs)
max_row_length_with_null=65502 # table row length with nulls (without blobs) max_row_length_with_null=65502 # table row length with nulls (without blobs)
max_select_alias_name=+512 # select alias name length max_select_alias_name=+512 # select alias name length
max_stack_expression=859 # stacked expressions max_stack_expression=1837 # stacked expressions
max_table_alias_name=+512 # table alias name length max_table_alias_name=+512 # table alias name length
max_table_name=64 # table name length max_table_name=64 # table name length
max_text_size=1048543 # max text or blob size max_text_size=1048543 # max text or blob size
...@@ -361,7 +361,7 @@ null_in_index=yes # null in index ...@@ -361,7 +361,7 @@ null_in_index=yes # null in index
null_in_unique=yes # null in unique index null_in_unique=yes # null in unique index
null_num_expr=yes # Is 1+NULL = NULL null_num_expr=yes # Is 1+NULL = NULL
odbc_left_outer_join=yes # left outer join odbc style odbc_left_outer_join=yes # left outer join odbc style
operating_system=Linux 2.2.14-my-SMP i686 # crash-me tested on operating_system=Linux 2.2.13-SMP alpha # crash-me tested on
order_by=yes # Order by order_by=yes # Order by
order_by_alias=yes # Order by alias order_by_alias=yes # Order by alias
order_by_function=yes # Order by function order_by_function=yes # Order by function
...@@ -380,7 +380,7 @@ quote_with_"=yes # Allows ' and " as string markers ...@@ -380,7 +380,7 @@ quote_with_"=yes # Allows ' and " as string markers
remember_end_space=no # Remembers end space in char() remember_end_space=no # Remembers end space in char()
remember_end_space_varchar=no # Remembers end space in varchar() remember_end_space_varchar=no # Remembers end space in varchar()
rename_table=yes # rename table rename_table=yes # rename table
repeat_string_size=1048576 # return string size from function repeat_string_size=1047552 # return string size from function
right_outer_join=yes # right outer join right_outer_join=yes # right outer join
rowid=auto_increment # Type for row id rowid=auto_increment # Type for row id
select_constants=yes # Select constants select_constants=yes # Select constants
...@@ -389,7 +389,7 @@ select_limit2=yes # SELECT with LIMIT #,# ...@@ -389,7 +389,7 @@ select_limit2=yes # SELECT with LIMIT #,#
select_string_size=1048565 # constant string size in SELECT select_string_size=1048565 # constant string size in SELECT
select_table_update=no # Update with sub select select_table_update=no # Update with sub select
select_without_from=yes # SELECT without FROM select_without_from=yes # SELECT without FROM
server_version=MySQL 3.23.25 beta debug # server version server_version=MySQL 3.23.28 gamma # server version
simple_joins=yes # ANSI SQL simple joins simple_joins=yes # ANSI SQL simple joins
storage_of_float=round # Storage of float values storage_of_float=round # Storage of float values
subqueries=no # subqueries subqueries=no # subqueries
...@@ -398,6 +398,7 @@ table_name_case=no # case independent table names ...@@ -398,6 +398,7 @@ table_name_case=no # case independent table names
table_wildcard=yes # Select table_name.* table_wildcard=yes # Select table_name.*
tempoary_table=yes # temporary tables tempoary_table=yes # temporary tables
transactions=no # transactions transactions=no # transactions
truncate_table=yes # truncate
type_extra_abstime=no # Type abstime type_extra_abstime=no # Type abstime
type_extra_bfile=no # Type bfile type_extra_bfile=no # Type bfile
type_extra_blob=yes # Type blob type_extra_blob=yes # Type blob
...@@ -512,5 +513,6 @@ union_all_incompat=no # union all (incompatible lists) ...@@ -512,5 +513,6 @@ union_all_incompat=no # union all (incompatible lists)
union_incompat=no # union (incompatible lists) union_incompat=no # union (incompatible lists)
unique_in_create=yes # unique in create table unique_in_create=yes # unique in create table
unique_null_in_create=yes # unique null in create unique_null_in_create=yes # unique null in create
user_comment=Alpha DS20 2x500 MHz, 2G memory, key_buffer=16M; ccc + cxx # comment
views=no # views views=no # views
where_string_size=1048540 # constant string size in where where_string_size=1048540 # constant string size in where
...@@ -716,6 +716,8 @@ static int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, ...@@ -716,6 +716,8 @@ static int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
volatile bool *killed= &current_thd->killed; volatile bool *killed= &current_thd->killed;
DBUG_ENTER("merge_buffers"); DBUG_ENTER("merge_buffers");
statistic_increment(filesort_merge_passes, &LOCK_status);
count=error=0; count=error=0;
offset=param->sort_length-param->ref_length; offset=param->sort_length-param->ref_length;
maxcount=(ulong) (param->keys/((uint) (Tb-Fb) +1)); maxcount=(ulong) (param->keys/((uint) (Tb-Fb) +1));
......
...@@ -160,6 +160,10 @@ void kill_one_thread(THD *thd, ulong id); ...@@ -160,6 +160,10 @@ void kill_one_thread(THD *thd, ulong id);
#define OPTION_QUICK OPTION_BEGIN*2 #define OPTION_QUICK OPTION_BEGIN*2
#define OPTION_QUOTE_SHOW_CREATE OPTION_QUICK*2 #define OPTION_QUOTE_SHOW_CREATE OPTION_QUICK*2
/* The following is set when parsing the query */
#define OPTION_NO_INDEX_USED OPTION_QUOTE_SHOW_CREATE*2
#define OPTION_NO_GOOD_INDEX_USED OPTION_NO_INDEX_USED*2
#define RAID_BLOCK_SIZE 1024 #define RAID_BLOCK_SIZE 1024
/* BINLOG_DUMP options */ /* BINLOG_DUMP options */
...@@ -445,6 +449,7 @@ extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables, ...@@ -445,6 +449,7 @@ extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables,
delayed_insert_threads, delayed_insert_writes, delayed_insert_threads, delayed_insert_writes,
delayed_rows_in_use,delayed_insert_errors; delayed_rows_in_use,delayed_insert_errors;
extern ulong filesort_rows, filesort_range_count, filesort_scan_count; extern ulong filesort_rows, filesort_range_count, filesort_scan_count;
extern ulong filesort_merge_passes;
extern ulong select_range_check_count, select_range_count, select_scan_count; extern ulong select_range_check_count, select_range_count, select_scan_count;
extern ulong select_full_range_join_count,select_full_join_count; extern ulong select_full_range_join_count,select_full_join_count;
extern uint test_flags,select_errors,mysql_port,ha_open_options; extern uint test_flags,select_errors,mysql_port,ha_open_options;
...@@ -615,6 +620,7 @@ inline bool add_group_to_list(Item *item,bool asc) ...@@ -615,6 +620,7 @@ inline bool add_group_to_list(Item *item,bool asc)
inline void mark_as_null_row(TABLE *table) inline void mark_as_null_row(TABLE *table)
{ {
table->null_row=1; table->null_row=1;
table->status|=STATUS_NULL_ROW;
bfill(table->null_flags,table->null_bytes,255); bfill(table->null_flags,table->null_bytes,255);
} }
......
...@@ -222,6 +222,7 @@ ulong query_id=1L,long_query_count,long_query_time,aborted_threads, ...@@ -222,6 +222,7 @@ ulong query_id=1L,long_query_count,long_query_time,aborted_threads,
delayed_queue_size,delayed_insert_threads,delayed_insert_writes, delayed_queue_size,delayed_insert_threads,delayed_insert_writes,
delayed_rows_in_use,delayed_insert_errors,flush_time; delayed_rows_in_use,delayed_insert_errors,flush_time;
ulong filesort_rows, filesort_range_count, filesort_scan_count; ulong filesort_rows, filesort_range_count, filesort_scan_count;
ulong filesort_merge_passes;
ulong select_range_check_count, select_range_count, select_scan_count; ulong select_range_check_count, select_range_count, select_scan_count;
ulong select_full_range_join_count,select_full_join_count; ulong select_full_range_join_count,select_full_join_count;
ulong specialflag=0,opened_tables=0,created_tmp_tables=0, ulong specialflag=0,opened_tables=0,created_tmp_tables=0,
...@@ -2517,6 +2518,7 @@ struct show_var_st status_vars[]= { ...@@ -2517,6 +2518,7 @@ struct show_var_st status_vars[]= {
{"Connections", (char*) &thread_id, SHOW_LONG_CONST}, {"Connections", (char*) &thread_id, SHOW_LONG_CONST},
{"Created_tmp_disk_tables", (char*) &created_tmp_disk_tables,SHOW_LONG}, {"Created_tmp_disk_tables", (char*) &created_tmp_disk_tables,SHOW_LONG},
{"Created_tmp_tables", (char*) &created_tmp_tables, SHOW_LONG}, {"Created_tmp_tables", (char*) &created_tmp_tables, SHOW_LONG},
{"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG},
{"Delayed_insert_threads", (char*) &delayed_insert_threads, SHOW_LONG}, {"Delayed_insert_threads", (char*) &delayed_insert_threads, SHOW_LONG},
{"Delayed_writes", (char*) &delayed_insert_writes, SHOW_LONG}, {"Delayed_writes", (char*) &delayed_insert_writes, SHOW_LONG},
{"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG}, {"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG},
...@@ -2551,6 +2553,7 @@ struct show_var_st status_vars[]= { ...@@ -2551,6 +2553,7 @@ struct show_var_st status_vars[]= {
{"Slave_running", (char*) &slave_running, SHOW_BOOL}, {"Slave_running", (char*) &slave_running, SHOW_BOOL},
{"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG}, {"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG},
{"Slow_queries", (char*) &long_query_count, SHOW_LONG}, {"Slow_queries", (char*) &long_query_count, SHOW_LONG},
{"Sort_merge_passes", (char*) &filesort_merge_passes, SHOW_LONG},
{"Sort_range", (char*) &filesort_range_count, SHOW_LONG}, {"Sort_range", (char*) &filesort_range_count, SHOW_LONG},
{"Sort_rows", (char*) &filesort_rows, SHOW_LONG}, {"Sort_rows", (char*) &filesort_rows, SHOW_LONG},
{"Sort_scan", (char*) &filesort_scan_count, SHOW_LONG}, {"Sort_scan", (char*) &filesort_scan_count, SHOW_LONG},
......
...@@ -1783,6 +1783,8 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) ...@@ -1783,6 +1783,8 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
DBUG_RETURN(1); DBUG_RETURN(1);
tmp->fix_length_and_dec(); // Update cmp_type tmp->fix_length_and_dec(); // Update cmp_type
tmp->const_item_cache=0; tmp->const_item_cache=0;
/* Mark field used for table cache */
t1->field[i]->query_id=t2->field[j]->query_id=thd->query_id;
cond_and->list.push_back(tmp); cond_and->list.push_back(tmp);
if ((tmp_map=t1->field[i]->part_of_key)) if ((tmp_map=t1->field[i]->part_of_key))
{ {
......
...@@ -35,21 +35,21 @@ int generate_table(THD *thd, TABLE_LIST *table_list, ...@@ -35,21 +35,21 @@ int generate_table(THD *thd, TABLE_LIST *table_list,
thd->proc_info="generate_table"; thd->proc_info="generate_table";
if(global_read_lock) if(global_read_lock)
{
if(thd->global_read_lock)
{ {
if(thd->global_read_lock) my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,MYF(0),
{ table_list->real_name);
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,MYF(0), DBUG_RETURN(-1);
table_list->real_name); }
DBUG_RETURN(-1); pthread_mutex_lock(&LOCK_open);
} while (global_read_lock && ! thd->killed ||
pthread_mutex_lock(&LOCK_open); thd->version != refresh_version)
while (global_read_lock && ! thd->killed || {
thd->version != refresh_version) (void) pthread_cond_wait(&COND_refresh,&LOCK_open);
{
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
}
pthread_mutex_unlock(&LOCK_open);
} }
pthread_mutex_unlock(&LOCK_open);
}
/* If it is a temporary table, close and regenerate it */ /* If it is a temporary table, close and regenerate it */
...@@ -173,14 +173,16 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit, ...@@ -173,14 +173,16 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
} }
/* If running in safe sql mode, don't allow updates without keys */ /* If running in safe sql mode, don't allow updates without keys */
if ((thd->options & OPTION_SAFE_UPDATES) && !table->quick_keys && if (!table->quick_keys)
limit == HA_POS_ERROR)
{ {
delete select; thd->options|=OPTION_NO_INDEX_USED;
send_error(&thd->net,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE); if ((thd->options & OPTION_SAFE_UPDATES) && limit == HA_POS_ERROR)
DBUG_RETURN(1); {
delete select;
send_error(&thd->net,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
DBUG_RETURN(1);
}
} }
(void) table->file->extra(HA_EXTRA_NO_READCHECK); (void) table->file->extra(HA_EXTRA_NO_READCHECK);
if (options & OPTION_QUICK) if (options & OPTION_QUICK)
(void) table->file->extra(HA_EXTRA_QUICK); (void) table->file->extra(HA_EXTRA_QUICK);
......
...@@ -825,7 +825,9 @@ bool do_command(THD *thd) ...@@ -825,7 +825,9 @@ bool do_command(THD *thd)
/* If not reading from backup and if the query took too long */ /* If not reading from backup and if the query took too long */
if (!thd->user_time) if (!thd->user_time)
{ {
if ((ulong) (thd->start_time - thd->time_after_lock) > long_query_time) if ((ulong) (thd->start_time - thd->time_after_lock) > long_query_time ||
((thd->options & (OPTION_NO_INDEX_USED | OPTION_NO_GOOD_INDEX_USED)) &&
(specialflag & SPECIAL_LONG_LOG_FORMAT)))
{ {
long_query_count++; long_query_count++;
mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query); mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query);
......
...@@ -2420,6 +2420,7 @@ make_join_readinfo(JOIN *join,uint options) ...@@ -2420,6 +2420,7 @@ make_join_readinfo(JOIN *join,uint options)
/* These init changes read_record */ /* These init changes read_record */
if (tab->use_quick == 2) if (tab->use_quick == 2)
{ {
join->thd->options|=OPTION_NO_GOOD_INDEX_USED;
tab->read_first_record= join_init_quick_read_record; tab->read_first_record= join_init_quick_read_record;
statistic_increment(select_range_check_count, &LOCK_status); statistic_increment(select_range_check_count, &LOCK_status);
} }
...@@ -2434,6 +2435,7 @@ make_join_readinfo(JOIN *join,uint options) ...@@ -2434,6 +2435,7 @@ make_join_readinfo(JOIN *join,uint options)
} }
else else
{ {
join->thd->options|=OPTION_NO_INDEX_USED;
statistic_increment(select_scan_count, &LOCK_status); statistic_increment(select_scan_count, &LOCK_status);
} }
} }
...@@ -2445,6 +2447,7 @@ make_join_readinfo(JOIN *join,uint options) ...@@ -2445,6 +2447,7 @@ make_join_readinfo(JOIN *join,uint options)
} }
else else
{ {
join->thd->options|=OPTION_NO_INDEX_USED;
statistic_increment(select_full_join_count, &LOCK_status); statistic_increment(select_full_join_count, &LOCK_status);
} }
} }
...@@ -4234,7 +4237,7 @@ join_read_key(JOIN_TAB *tab) ...@@ -4234,7 +4237,7 @@ join_read_key(JOIN_TAB *tab)
TABLE *table= tab->table; TABLE *table= tab->table;
if (cmp_buffer_with_ref(tab) || if (cmp_buffer_with_ref(tab) ||
(table->status & (STATUS_GARBAGE | STATUS_NO_PARENT))) (table->status & (STATUS_GARBAGE | STATUS_NO_PARENT | STATUS_NULL_ROW)))
{ {
if (tab->ref.key_err) if (tab->ref.key_err)
{ {
...@@ -4252,6 +4255,7 @@ join_read_key(JOIN_TAB *tab) ...@@ -4252,6 +4255,7 @@ join_read_key(JOIN_TAB *tab)
return 1; return 1;
} }
} }
table->null_row=0;
return table->status ? -1 : 0; return table->status ? -1 : 0;
} }
......
...@@ -100,15 +100,17 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields, ...@@ -100,15 +100,17 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/* If running in safe sql mode, don't allow updates without keys */ /* If running in safe sql mode, don't allow updates without keys */
if ((thd->options & OPTION_SAFE_UPDATES) && !table->quick_keys && if (!table->quick_keys)
limit == HA_POS_ERROR)
{ {
delete select; thd->options|=OPTION_NO_INDEX_USED;
table->time_stamp=save_time_stamp; if ((thd->options & OPTION_SAFE_UPDATES) && limit == HA_POS_ERROR)
send_error(&thd->net,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE); {
DBUG_RETURN(1); delete select;
table->time_stamp=save_time_stamp;
send_error(&thd->net,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
DBUG_RETURN(1);
}
} }
/* Check if we are modifying a key that we are used to search with */ /* Check if we are modifying a key that we are used to search with */
if (select && select->quick) if (select && select->quick)
used_key_is_modified= (!select->quick->unique_key_range() && used_key_is_modified= (!select->quick->unique_key_range() &&
......
...@@ -161,3 +161,4 @@ typedef struct st_lex_user { ...@@ -161,3 +161,4 @@ typedef struct st_lex_user {
#define STATUS_NO_PARENT 4 /* Parent record wasn't found */ #define STATUS_NO_PARENT 4 /* Parent record wasn't found */
#define STATUS_NOT_READ 8 /* Record isn't read */ #define STATUS_NOT_READ 8 /* Record isn't read */
#define STATUS_UPDATED 16 /* Record is updated by formula */ #define STATUS_UPDATED 16 /* Record is updated by formula */
#define STATUS_NULL_ROW 32 /* table->null_row is set */
...@@ -62,3 +62,6 @@ set-variable = key_buffer=256M ...@@ -62,3 +62,6 @@ set-variable = key_buffer=256M
set-variable = sort_buffer=256M set-variable = sort_buffer=256M
set-variable = read_buffer=2M set-variable = read_buffer=2M
set-variable = write_buffer=2M set-variable = write_buffer=2M
[mysqlhotcopy]
interactive-timeout
...@@ -62,3 +62,6 @@ set-variable = key_buffer=128M ...@@ -62,3 +62,6 @@ set-variable = key_buffer=128M
set-variable = sort_buffer=128M set-variable = sort_buffer=128M
set-variable = read_buffer=2M set-variable = read_buffer=2M
set-variable = write_buffer=2M set-variable = write_buffer=2M
[mysqlhotcopy]
interactive-timeout
...@@ -61,3 +61,6 @@ set-variable = key_buffer=20M ...@@ -61,3 +61,6 @@ set-variable = key_buffer=20M
set-variable = sort_buffer=20M set-variable = sort_buffer=20M
set-variable = read_buffer=2M set-variable = read_buffer=2M
set-variable = write_buffer=2M set-variable = write_buffer=2M
[mysqlhotcopy]
interactive-timeout
...@@ -55,3 +55,6 @@ set-variable = sort_buffer=8M ...@@ -55,3 +55,6 @@ set-variable = sort_buffer=8M
[myisamchk] [myisamchk]
set-variable = key_buffer=8M set-variable = key_buffer=8M
set-variable = sort_buffer=8M set-variable = sort_buffer=8M
[mysqlhotcopy]
interactive-timeout
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