Commit f01a7fce authored by monty@donna.mysql.fi's avatar monty@donna.mysql.fi

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

parents 7fb48d91 21e7c668
This diff is collapsed.
......@@ -199,7 +199,7 @@ fi
AC_DEFUN(MYSQL_PTHREAD_YIELD,
[AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg,
[AC_TRY_COMPILE([#define _GNU_SOURCE
[AC_TRY_LINK([#define _GNU_SOURCE
#include <pthread.h>
#ifdef __cplusplus
extern "C"
......@@ -214,7 +214,7 @@ then
fi
]
[AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg,
[AC_TRY_COMPILE([#define _GNU_SOURCE
[AC_TRY_LINK([#define _GNU_SOURCE
#include <pthread.h>
#ifdef __cplusplus
extern "C"
......@@ -550,7 +550,8 @@ AC_DEFUN(MYSQL_STACK_DIRECTION,
AC_DEFUN(MYSQL_FUNC_ALLOCA,
[
# Since we have heard that alloca fails on IRIX never define it on a SGI machine
# Since we have heard that alloca fails on IRIX never define it on a
# SGI machine
if test ! "$host_vendor" = "sgi"
then
AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
......
......@@ -36,14 +36,16 @@ const char *client_errors[]=
"MySQL client got out of memory",
"Wrong host info",
"Localhost via UNIX socket",
"%s via TCP/IP",
"%-.64s via TCP/IP",
"Error in server handshake",
"Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now",
"Verbindung ueber Named Pipe; Host: %-.64s",
"Kann nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)",
"Kann Named Pipe nicht oeffnen. Host: %-.64s pipe: %-.32s (%lu)",
"Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)"
"Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)",
"Can't initialize character set %-.64s (path: %-.64s)",
"Got packet bigger than 'max_allowed_packet'"
};
#else /* ENGLISH */
......@@ -60,19 +62,21 @@ const char *client_errors[]=
"MySQL client run out of memory",
"Wrong host info",
"Localhost via UNIX socket",
"%s via TCP/IP",
"%-.64s via TCP/IP",
"Error in server handshake",
"Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now",
"%s via named pipe",
"%-.64s via named pipe",
"Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't initialize character set %-.64s (path: %-.64s)",
"Got packet bigger than 'max_allowed_packet'"
};
#endif
void init_client_errs(void)
{
errmsg[CLIENT_ERRMAP] = &client_errors[0];
my_errmsg[CLIENT_ERRMAP] = &client_errors[0];
}
......@@ -28,7 +28,7 @@
#include <my_pthread.h> /* because of signal() */
#endif
#define ADMIN_VERSION "8.19"
#define ADMIN_VERSION "8.20"
#define MAX_MYSQL_VAR 64
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
......@@ -423,13 +423,8 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
my_printf_error(0,"Too few arguments to drop",MYF(ME_BELL));
return 1;
}
sprintf(buff,"drop database `%.*s`",FN_REFLEN,argv[1]);
if (mysql_query(mysql,buff))
{
my_printf_error(0,"DROP DATABASE failed; error: '%-.200s'",
MYF(ME_BELL), mysql_error(mysql));
if (drop_db(mysql,argv[1]))
return 1;
}
argc--; argv++;
break;
}
......@@ -867,7 +862,8 @@ static int drop_db(MYSQL *mysql, const char *db)
{
puts("Dropping the database is potentially a very bad thing to do.");
puts("Any data stored in the database will be destroyed.\n");
printf("Do you really want to drop the '%s' database [y/N]\n",db);
printf("Do you really want to drop the '%s' database [y/N] ",db);
fflush(stdout);
VOID(fgets(buf,sizeof(buf)-1,stdin));
if ((*buf != 'y') && (*buf != 'Y'))
{
......@@ -878,7 +874,7 @@ static int drop_db(MYSQL *mysql, const char *db)
sprintf(name_buff,"drop database %.*s",FN_REFLEN,db);
if (mysql_query(mysql,name_buff))
{
my_printf_error(0,"drop of '%s' failed;\nerror: '%s'",MYF(ME_BELL),
my_printf_error(0,"DROP DATABASE %s failed;\nerror: '%s'",MYF(ME_BELL),
db,mysql_error(mysql));
return 1;
}
......
......@@ -569,7 +569,7 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
else
{
v->str_val = (char*)p;
v->str_val_len = (p_end && *p_end) ? *p_end - p : strlen(p);
v->str_val_len = (p_end && *p_end) ? (int) (*p_end - p) : (int) strlen(p);
v->int_val=atoi(p);
v->int_dirty=0;
return 0;
......
......@@ -119,6 +119,17 @@ AC_PROG_AWK
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
# Fix for sgi gcc / sgiCC which tries to emulate gcc
if test "$CC" = "sgicc"
then
ac_cv_prog_gcc="no"
fi
if test "$CXX" = "sgi++"
then
GXX="no"
fi
if test "$ac_cv_prog_gcc" = "yes"
then
AS="$CC -c"
......@@ -390,7 +401,7 @@ AM_PROG_CC_STDC
if test "$am_cv_prog_cc_stdc" = "no"
then
AC_MSG_ERROR([MySQL requiers a ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
AC_MSG_ERROR([MySQL requires a ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
fi
NOINST_LDFLAGS=
......@@ -1215,7 +1226,7 @@ fi
AC_SUBST(COMPILATION_COMMENT)
AC_MSG_CHECKING("need of special linking flags")
if test "$IS_LINUX" = "true" -a "$all_is_static" != "yes"
if test "$IS_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
then
LDFLAGS="$LDFLAGS -rdynamic"
AC_MSG_RESULT("-rdynamic")
......
......@@ -303,7 +303,7 @@ static void do_resolve()
uchar* addr = (uchar*)read_addr(&p);
if(resolve_addr(addr, &se))
fprintf(fp_out, "%p %s + %d\n", addr, se.symbol,
addr - se.addr);
(int) (addr - se.addr));
else
fprintf(fp_out, "%p (?)\n", addr);
......
......@@ -332,7 +332,8 @@ typedef int File; /* File descriptor */
typedef int my_socket; /* File descriptor for sockets */
#define INVALID_SOCKET -1
#endif
typedef RETSIGTYPE sig_handler; /* Function to handle signals */
/* Type for fuctions that handles signals */
#define sig_handler RETSIGTYPE
typedef void (*sig_return)();/* Returns type from signal */
#if defined(__GNUC__) && !defined(_lint)
typedef char pchar; /* Mixed prototypes can take char */
......
......@@ -85,7 +85,7 @@ void _nisam_print_key(FILE *stream, register N_KEYSEG *keyseg, const uchar *key)
key=end;
break;
case HA_KEYTYPE_INT24:
VOID(fprintf(stream,"%ld",sint3korr(key)));
VOID(fprintf(stream,"%ld",(long) sint3korr(key)));
key=end;
break;
case HA_KEYTYPE_UINT24:
......
......@@ -369,6 +369,8 @@ mysql_install_db () {
error "Could not install slave test DBs"
exit 1
fi
# Give mysqld some time to die.
sleep $SLEEP_TIME
return 0
}
......
......@@ -67,3 +67,16 @@ t1 0 PRIMARY 1 f1 A 1 NULL NULL
t1 0 PRIMARY 2 f2 A 3 NULL NULL
t1 0 PRIMARY 3 f3 A 9 NULL NULL
t1 0 PRIMARY 4 f4 A 18 NULL NULL
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) NOT NULL default '0'
) TYPE=MyISAM
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) NOT NULL default '0'
) TYPE=MyISAM
Table Create Table
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien'
) TYPE=MyISAM COMMENT='it''s a table'
Table Create Table
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien'
) TYPE=MyISAM COMMENT='it''s a table'
......@@ -48,3 +48,20 @@ show index from t1;
repair table t1;
show index from t1;
drop table t1;
#
# Test of SHOW CREATE
#
create temporary table t1 (a int not null);
show create table t1;
alter table t1 rename t2;
show create table t2;
drop table t2;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
name char(20) default 'O''Brien'
) comment = 'it\'s a table' ;
show create table t1 ;
drop table t1;
use test;
drop table if exists t1;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
name char(20) default 'O''Brien'
) comment = 'it\'s a table' ;
show create table t1 ;
drop table t1;
......@@ -62,9 +62,10 @@ do
done
for i in extra/comp_err extra/replace extra/perror extra/resolveip \
extra/my_print_defaults isam/isamchk isam/pack_isam myisam/myisamchk \
extra/my_print_defaults extra/resolve_stack_dump \
isam/isamchk isam/pack_isam myisam/myisamchk \
myisam/myisampack sql/mysqld sql/mysqlbinlog \
client/mysql sql/mysqld client/mysqlshow \
client/mysql sql/mysqld client/mysqlshow client/mysqlcheck \
client/mysqladmin client/mysqldump client/mysqlimport client/mysqltest \
client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \
client/.libs/mysqldump client/.libs/mysqlimport client/.libs/mysqltest
......
......@@ -49,7 +49,7 @@ typedef struct st_sort_param {
uint sort_length; /* Length of sortarg */
uint keys; /* Max antal nycklar / buffert */
uint ref_length; /* Length of record ref. */
ha_rows max_rows;
ha_rows max_rows,examined_rows;
TABLE *sort_form; /* For quicker make_sortkey */
SORT_FIELD *local_sortorder;
SORT_FIELD *end;
......@@ -91,7 +91,8 @@ static uint sortlength(SORT_FIELD *sortorder,uint length);
open a new file is opened */
ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
SQL_SELECT *select, ha_rows special, ha_rows max_rows)
SQL_SELECT *select, ha_rows special, ha_rows max_rows,
ha_rows *examined_rows)
{
int error;
uint memavl,old_memavl,maxbuffer,skr;
......@@ -113,6 +114,7 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
param.ref_length= table[0]->file->ref_length;
param.sort_length=sortlength(sortorder,s_length)+ param.ref_length;
param.max_rows= max_rows;
param.examined_rows=0;
if (select && select->quick)
{
......@@ -259,7 +261,7 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
my_error(ER_FILSORT_ABORT,MYF(ME_ERROR+ME_WAITTANG));
else
statistic_add(filesort_rows, records, &LOCK_status);
*examined_rows= param.examined_rows;
#ifdef SKIPP_DBUG_IN_FILESORT
DBUG_POP(); /* Ok to DBUG */
#endif
......@@ -367,6 +369,8 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
file->rnd_end();
DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
}
if (error == 0)
param->examined_rows++;
if (error == 0 && (!select || select->skipp_record() == 0))
{
if (idx == param->keys)
......
......@@ -841,10 +841,11 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
{
/* For slow query log */
if (my_b_printf(&log_file,
"# Time: %lu Lock_time: %lu Rows_sent: %lu\n",
"# Time: %lu Lock_time: %lu Rows_sent: %lu Rows_examined: %lu\n",
(ulong) (current_time - query_start),
(ulong) (thd->time_after_lock - query_start),
(ulong) thd->sent_row_count) == (uint) -1)
(ulong) thd->sent_row_count,
(ulong) thd->examined_row_count) == (uint) -1)
tmp_errno=errno;
}
if (thd->db && strcmp(thd->db,db))
......
......@@ -602,7 +602,8 @@ void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
int use_record_cache, bool print_errors);
void end_read_record(READ_RECORD *info);
ha_rows filesort(TABLE **form,struct st_sort_field *sortorder, uint s_length,
SQL_SELECT *select, ha_rows special,ha_rows max_rows);
SQL_SELECT *select, ha_rows special,ha_rows max_rows,
ha_rows *examined_rows);
void change_double_for_sort(double nr,byte *to);
int get_quick_record(SQL_SELECT *select);
int calc_weekday(long daynr,bool sunday_first_day_of_week);
......
......@@ -58,6 +58,7 @@ static struct option long_options[] =
{"table", required_argument, 0, 't'},
{"user", required_argument, 0, 'u'},
{"version", no_argument, 0, 'V'},
{0, 0, 0, 0}
};
void sql_print_error(const char *format,...);
......
......@@ -1388,7 +1388,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
if (!(opt_specialflag & SPECIAL_NO_PRIOR))
my_pthread_attr_setprio(&connection_attrib,INTERRUPT_PRIOR);
if (pthread_create(&tmp,&connection_attrib, kill_server_thread,
(void*) sig))
(void*) 0))
sql_print_error("Error: Can't create thread to kill server");
#else
kill_server((void*) sig); // MIT THREAD has a alarm thread
......
......@@ -1508,8 +1508,9 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
tmp_table->reginfo.lock_type=TL_WRITE; // Simulate locked
tmp_table->tmp_table = 1;
tmp_table->table_cache_key=(char*) (tmp_table+1);
tmp_table->key_length= (uint) (strmov(strmov(tmp_table->table_cache_key,db)
+1, table_name)
tmp_table->key_length= (uint) (strmov((tmp_table->real_name=
strmov(tmp_table->table_cache_key,db)
+1), table_name)
- tmp_table->table_cache_key)+1;
int4store(tmp_table->table_cache_key + tmp_table->key_length,
thd->slave_proxy_id);
......
......@@ -268,7 +268,7 @@ public:
#endif
ulonglong next_insert_id,last_insert_id,current_insert_id;
ha_rows select_limit,offset_limit,default_select_limit,cuted_fields,
max_join_size,sent_row_count;
max_join_size, sent_row_count, examined_row_count;
table_map used_tables;
ulong query_id,version, inactive_timeout,options,thread_id;
ulong gemini_spin_retries;
......
......@@ -2266,7 +2266,7 @@ mysql_init_query(THD *thd)
thd->lex.table_list.next= (byte**) &thd->lex.table_list.first;
thd->fatal_error=0; // Safety
thd->last_insert_id_used=thd->query_start_used=thd->insert_id_used=0;
thd->sent_row_count=0;
thd->sent_row_count=thd->examined_row_count=0;
DBUG_VOID_RETURN;
}
......
......@@ -265,7 +265,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
join.join_tab=0;
join.tmp_table_param.copy_field=0;
join.sum_funcs=0;
join.send_records=join.found_records=0;
join.send_records=join.found_records=join.examined_rows=0;
join.tmp_table_param.end_write_records= HA_POS_ERROR;
join.first_record=join.sort_and_group=0;
join.select_options=select_options;
......@@ -784,6 +784,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
error=do_select(&join,&fields,NULL,procedure);
err:
thd->examined_row_count=join.examined_rows;
thd->proc_info="end";
join.lock=0; // It's faster to unlock later
join_free(&join);
......@@ -867,6 +868,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
table->reginfo.not_exists_optimize=0;
bzero((char*) table->const_key_parts, sizeof(key_part_map)*table->keys);
all_table_map|= table->map;
s->join=join;
if ((s->on_expr=tables->on_expr))
{
// table->maybe_null=table->outer_join=1; // Mark for send fields
......@@ -2219,6 +2221,7 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
join_tab->ref.key = -1;
join_tab->not_used_in_distinct=0;
join_tab->read_first_record= join_init_read_record;
join_tab->join=join;
bzero((char*) &join_tab->read_record,sizeof(join_tab->read_record));
tmp_table->status=0;
tmp_table->null_row=0;
......@@ -3915,8 +3918,8 @@ bool create_myisam_from_heap(TABLE *table, TMP_TABLE_PARAM *param, int error,
table->file=0;
*table =new_table;
table->file->change_table_ptr(table);
thd->proc_info=save_proc_info;
thd->proc_info= (!strcmp(save_proc_info,"Copying to tmp table") ?
"Copying to tmp table on disk" : save_proc_info);
DBUG_RETURN(0);
err:
......@@ -4096,6 +4099,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
bool not_used_in_distinct=join_tab->not_used_in_distinct;
ha_rows found_records=join->found_records;
READ_RECORD *info= &join_tab->read_record;
join->examined_rows++;
do
{
......@@ -4483,6 +4487,7 @@ join_init_read_next_with_key(READ_RECORD *info)
return 0;
}
static int
join_init_read_last_with_key(JOIN_TAB *tab)
{
......@@ -5204,6 +5209,7 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit)
{
SORT_FIELD *sortorder;
uint length;
ha_rows examined_rows;
TABLE *table=tab->table;
SQL_SELECT *select=tab->select;
DBUG_ENTER("create_sort_index");
......@@ -5242,12 +5248,13 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit)
}
}
table->found_records=filesort(&table,sortorder,length,
select, 0L, select_limit);
select, 0L, select_limit, &examined_rows);
delete select; // filesort did select
tab->select=0;
tab->select_cond=0;
tab->type=JT_ALL; // Read with normal read_record
tab->read_first_record= join_init_read_record;
tab->join->examined_rows+=examined_rows;
if (table->key_read) // Restore if we used indexes
{
table->key_read=0;
......
......@@ -102,6 +102,7 @@ typedef struct st_join_table {
bool cached_eq_ref_table,eq_ref_table,not_used_in_distinct;
TABLE_REF ref;
JOIN_CACHE cache;
JOIN *join;
} JOIN_TAB;
......@@ -151,7 +152,7 @@ class JOIN {
uint send_group_parts;
bool sort_and_group,first_record,full_join,group, no_field_update;
table_map const_table_map,outer_join;
ha_rows send_records,found_records;
ha_rows send_records,found_records,examined_rows,row_limit;
POSITION positions[MAX_TABLES+1],best_positions[MAX_TABLES+1];
double best_read;
List<Item> *fields;
......
......@@ -781,6 +781,9 @@ store_create_info(THD *thd, TABLE *table, String *packet)
List<Item> field_list;
char tmp[MAX_FIELD_WIDTH];
String type(tmp, sizeof(tmp));
if (table->tmp_table)
packet->append("CREATE TEMPORARY TABLE ", 23);
else
packet->append("CREATE TABLE ", 13);
append_identifier(thd,packet,table->real_name);
packet->append(" (\n", 3);
......
......@@ -1633,6 +1633,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
TABLE_LIST tables;
List<Item> fields;
List<Item> all_fields;
ha_rows examined_rows;
DBUG_ENTER("copy_data_between_tables");
if (!(copy= new Copy_field[to->fields]))
......@@ -1668,7 +1669,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
if (setup_order(thd, &tables, fields, all_fields, order) ||
!(sortorder=make_unireg_sortorder(order, &length)) ||
(from->found_records = filesort(&from, sortorder, length,
(SQL_SELECT *) 0, 0L, HA_POS_ERROR))
(SQL_SELECT *) 0, 0L, HA_POS_ERROR,
&examined_rows))
== HA_POS_ERROR)
goto err;
};
......
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