Commit c678a231 authored by unknown's avatar unknown

Merge work:/home/bk/mysql into donna.mysql.com:/home/my/bk/mysql


sql/sql_parse.cc:
  Auto merged
parents 449df0ff 9a6de748
This diff is collapsed.
......@@ -187,7 +187,7 @@ extern char *get_charsets_dir(char *buf);
extern ulong _my_cache_w_requests,_my_cache_write,_my_cache_r_requests,
_my_cache_read;
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;
/* Point to current my_message() */
......
......@@ -684,8 +684,8 @@ mysql_free_result(MYSQL_RES *result)
static const char *default_options[]=
{"port","socket","compress","password","pipe", "timeout", "user",
"init-command", "host", "database", "debug", "return-found-rows",
"ssl_key" ,"ssl_cert" ,"ssl_ca" ,"ssl_capath",
"character-set-dir", "default-character-set",
"ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath",
"character-set-dir", "default-character-set", "interactive-timeout",
NullS
};
......@@ -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));
options->charset_name = my_strdup(opt_arg, MYF(MY_WME));
break;
case 19: /* Interactive-timeout */
options->client_flag|=CLIENT_INTERACTIVE;
break;
default:
DBUG_PRINT("warning",("unknown option: %s",option[0]));
}
......
......@@ -170,5 +170,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
}
}
#endif
if (file >= 0)
thread_safe_increment(my_tmp_file_created,&THR_LOCK_open);
DBUG_RETURN(file);
}
......@@ -30,7 +30,7 @@
my_string home_dir=0,my_progname=0;
char NEAR curr_dir[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;
#ifndef THREAD
int NEAR my_errno=0;
......
......@@ -292,7 +292,7 @@ $dbh->do("drop table crash_q");
report("truncate","truncate_table",
"create table crash_q (a integer, b integer,c CHAR(10))",
"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))") &&
$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
Need_cast_for_null=no # Need to cast NULL for arithmetic
......@@ -31,12 +31,12 @@ comment_--=yes # -- as comment (ANSI)
comment_/**/=yes # /* */ as comment
comment_//=no # // as comment (ANSI)
compute=no # Compute
connections=30 # Simultaneous connections (installation default)
connections=101 # Simultaneous connections (installation default)
constraint_check=no # Column constraints
constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style)
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_func=no # default value function for column
create_if_not_exists=yes # create table if not exists
......@@ -315,7 +315,7 @@ intersect=no # intersect
intersect_all=no # intersect all
intersect_all_incompat=no # intersect all (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_using=yes # left outer join using
like_with_column=yes # column LIKE column
......@@ -327,7 +327,7 @@ max_char_size=255 # max char() size
max_column_name=64 # column name length
max_columns=3398 # Columns in table
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_length=500 # index length
max_index_name=64 # index name 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_with_null=65502 # table row length with nulls (without blobs)
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_name=64 # table name length
max_text_size=1048543 # max text or blob size
......@@ -361,7 +361,7 @@ null_in_index=yes # null in index
null_in_unique=yes # null in unique index
null_num_expr=yes # Is 1+NULL = NULL
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_alias=yes # Order by alias
order_by_function=yes # Order by function
......@@ -380,7 +380,7 @@ quote_with_"=yes # Allows ' and " as string markers
remember_end_space=no # Remembers end space in char()
remember_end_space_varchar=no # Remembers end space in varchar()
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
rowid=auto_increment # Type for row id
select_constants=yes # Select constants
......@@ -389,7 +389,7 @@ select_limit2=yes # SELECT with LIMIT #,#
select_string_size=1048565 # constant string size in SELECT
select_table_update=no # Update with sub select
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
storage_of_float=round # Storage of float values
subqueries=no # subqueries
......@@ -398,6 +398,7 @@ table_name_case=no # case independent table names
table_wildcard=yes # Select table_name.*
tempoary_table=yes # temporary tables
transactions=no # transactions
truncate_table=yes # truncate
type_extra_abstime=no # Type abstime
type_extra_bfile=no # Type bfile
type_extra_blob=yes # Type blob
......@@ -512,5 +513,6 @@ union_all_incompat=no # union all (incompatible lists)
union_incompat=no # union (incompatible lists)
unique_in_create=yes # unique in create table
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
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
Need_cast_for_null=no # Need to cast NULL for arithmetic
......@@ -31,12 +31,12 @@ comment_--=yes # -- as comment (ANSI)
comment_/**/=yes # /* */ as comment
comment_//=no # // as comment (ANSI)
compute=no # Compute
connections=30 # Simultaneous connections (installation default)
connections=101 # Simultaneous connections (installation default)
constraint_check=no # Column constraints
constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style)
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_func=no # default value function for column
create_if_not_exists=yes # create table if not exists
......@@ -315,7 +315,7 @@ intersect=no # intersect
intersect_all=no # intersect all
intersect_all_incompat=no # intersect all (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_using=yes # left outer join using
like_with_column=yes # column LIKE column
......@@ -327,7 +327,7 @@ max_char_size=255 # max char() size
max_column_name=64 # column name length
max_columns=3398 # Columns in table
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_length=500 # index length
max_index_name=64 # index name 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_with_null=65502 # table row length with nulls (without blobs)
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_name=64 # table name length
max_text_size=1048543 # max text or blob size
......@@ -361,7 +361,7 @@ null_in_index=yes # null in index
null_in_unique=yes # null in unique index
null_num_expr=yes # Is 1+NULL = NULL
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_alias=yes # Order by alias
order_by_function=yes # Order by function
......@@ -380,7 +380,7 @@ quote_with_"=yes # Allows ' and " as string markers
remember_end_space=no # Remembers end space in char()
remember_end_space_varchar=no # Remembers end space in varchar()
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
rowid=auto_increment # Type for row id
select_constants=yes # Select constants
......@@ -389,7 +389,7 @@ select_limit2=yes # SELECT with LIMIT #,#
select_string_size=1048565 # constant string size in SELECT
select_table_update=no # Update with sub select
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
storage_of_float=round # Storage of float values
subqueries=no # subqueries
......@@ -398,6 +398,7 @@ table_name_case=no # case independent table names
table_wildcard=yes # Select table_name.*
tempoary_table=yes # temporary tables
transactions=no # transactions
truncate_table=yes # truncate
type_extra_abstime=no # Type abstime
type_extra_bfile=no # Type bfile
type_extra_blob=yes # Type blob
......@@ -512,5 +513,6 @@ union_all_incompat=no # union all (incompatible lists)
union_incompat=no # union (incompatible lists)
unique_in_create=yes # unique in create table
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
where_string_size=1048540 # constant string size in where
......@@ -716,6 +716,8 @@ static int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
volatile bool *killed= &current_thd->killed;
DBUG_ENTER("merge_buffers");
statistic_increment(filesort_merge_passes, &LOCK_status);
count=error=0;
offset=param->sort_length-param->ref_length;
maxcount=(ulong) (param->keys/((uint) (Tb-Fb) +1));
......
......@@ -160,6 +160,10 @@ void kill_one_thread(THD *thd, ulong id);
#define OPTION_QUICK OPTION_BEGIN*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
/* BINLOG_DUMP options */
......@@ -445,6 +449,7 @@ extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables,
delayed_insert_threads, delayed_insert_writes,
delayed_rows_in_use,delayed_insert_errors;
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_full_range_join_count,select_full_join_count;
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)
inline void mark_as_null_row(TABLE *table)
{
table->null_row=1;
table->status|=STATUS_NULL_ROW;
bfill(table->null_flags,table->null_bytes,255);
}
......
......@@ -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_rows_in_use,delayed_insert_errors,flush_time;
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_full_range_join_count,select_full_join_count;
ulong specialflag=0,opened_tables=0,created_tmp_tables=0,
......@@ -2517,6 +2518,7 @@ struct show_var_st status_vars[]= {
{"Connections", (char*) &thread_id, SHOW_LONG_CONST},
{"Created_tmp_disk_tables", (char*) &created_tmp_disk_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_writes", (char*) &delayed_insert_writes, SHOW_LONG},
{"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG},
......@@ -2551,6 +2553,7 @@ struct show_var_st status_vars[]= {
{"Slave_running", (char*) &slave_running, SHOW_BOOL},
{"Slow_launch_threads", (char*) &slow_launch_threads, 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_rows", (char*) &filesort_rows, SHOW_LONG},
{"Sort_scan", (char*) &filesort_scan_count, SHOW_LONG},
......
......@@ -1783,6 +1783,8 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
DBUG_RETURN(1);
tmp->fix_length_and_dec(); // Update cmp_type
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);
if ((tmp_map=t1->field[i]->part_of_key))
{
......
......@@ -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 ((thd->options & OPTION_SAFE_UPDATES) && !table->quick_keys &&
limit == HA_POS_ERROR)
if (!table->quick_keys)
{
thd->options|=OPTION_NO_INDEX_USED;
if ((thd->options & OPTION_SAFE_UPDATES) && limit == HA_POS_ERROR)
{
delete select;
send_error(&thd->net,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
DBUG_RETURN(1);
}
}
(void) table->file->extra(HA_EXTRA_NO_READCHECK);
if (options & OPTION_QUICK)
(void) table->file->extra(HA_EXTRA_QUICK);
......
......@@ -825,7 +825,9 @@ bool do_command(THD *thd)
/* If not reading from backup and if the query took too long */
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++;
mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query);
......
......@@ -2420,6 +2420,7 @@ make_join_readinfo(JOIN *join,uint options)
/* These init changes read_record */
if (tab->use_quick == 2)
{
join->thd->options|=OPTION_NO_GOOD_INDEX_USED;
tab->read_first_record= join_init_quick_read_record;
statistic_increment(select_range_check_count, &LOCK_status);
}
......@@ -2434,6 +2435,7 @@ make_join_readinfo(JOIN *join,uint options)
}
else
{
join->thd->options|=OPTION_NO_INDEX_USED;
statistic_increment(select_scan_count, &LOCK_status);
}
}
......@@ -2445,6 +2447,7 @@ make_join_readinfo(JOIN *join,uint options)
}
else
{
join->thd->options|=OPTION_NO_INDEX_USED;
statistic_increment(select_full_join_count, &LOCK_status);
}
}
......@@ -4234,7 +4237,7 @@ join_read_key(JOIN_TAB *tab)
TABLE *table= tab->table;
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)
{
......@@ -4252,6 +4255,7 @@ join_read_key(JOIN_TAB *tab)
return 1;
}
}
table->null_row=0;
return table->status ? -1 : 0;
}
......
......@@ -100,15 +100,17 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields,
DBUG_RETURN(0);
}
/* If running in safe sql mode, don't allow updates without keys */
if ((thd->options & OPTION_SAFE_UPDATES) && !table->quick_keys &&
limit == HA_POS_ERROR)
if (!table->quick_keys)
{
thd->options|=OPTION_NO_INDEX_USED;
if ((thd->options & OPTION_SAFE_UPDATES) && limit == HA_POS_ERROR)
{
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 */
if (select && select->quick)
used_key_is_modified= (!select->quick->unique_key_range() &&
......
......@@ -161,3 +161,4 @@ typedef struct st_lex_user {
#define STATUS_NO_PARENT 4 /* Parent record wasn't found */
#define STATUS_NOT_READ 8 /* Record isn't read */
#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
set-variable = sort_buffer=256M
set-variable = read_buffer=2M
set-variable = write_buffer=2M
[mysqlhotcopy]
interactive-timeout
......@@ -62,3 +62,6 @@ set-variable = key_buffer=128M
set-variable = sort_buffer=128M
set-variable = read_buffer=2M
set-variable = write_buffer=2M
[mysqlhotcopy]
interactive-timeout
......@@ -61,3 +61,6 @@ set-variable = key_buffer=20M
set-variable = sort_buffer=20M
set-variable = read_buffer=2M
set-variable = write_buffer=2M
[mysqlhotcopy]
interactive-timeout
......@@ -55,3 +55,6 @@ set-variable = sort_buffer=8M
[myisamchk]
set-variable = key_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