diff options
33 files changed, 646 insertions, 361 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 4b8d40474a4..dff4cec203c 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -22,6 +22,7 @@ carsten@tsort.bitbybit.dk davida@isil.mysql.com dlenev@build.mysql.com dlenev@mysql.com +gerberb@ou800.zenez.com gluh@gluh.(none) gluh@gluh.mysql.r18.ru greg@gcw.ath.cx diff --git a/client/mysqldump.c b/client/mysqldump.c index e482136ffc9..5e57f6480db 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -297,7 +297,7 @@ static int dump_all_tables_in_db(char *db); static int init_dumping(char *); static int dump_databases(char **); static int dump_all_databases(); -static char *quote_name(char *name, char *buff); +static char *quote_name(const char *name, char *buff, my_bool force); static void print_quoted_xml(FILE *output, char *fname, char *str, uint len); static void print_version(void) @@ -347,7 +347,7 @@ static void write_header(FILE *sql_file, char *db_name) fprintf(sql_file, "-- MySQL dump %s\n--\n", DUMP_VERSION); fprintf(sql_file, "-- Host: %s Database: %s\n", current_host ? current_host : "localhost", db_name ? db_name : ""); - fputs("---------------------------------------------------------\n", + fputs("-- ------------------------------------------------------\n", sql_file); fprintf(sql_file, "-- Server version\t%s\n", mysql_get_server_info(&mysql_connection)); @@ -631,33 +631,43 @@ static my_bool test_if_special_chars(const char *str) return 0; } /* test_if_special_chars */ -static char *quote_name(char *name, char *buff) + +static char *quote_name(const char *name, char *buff, my_bool force) { - char *end; - if (!opt_quoted && !test_if_special_chars(name)) - return name; - buff[0]=QUOTE_CHAR; - end=strmov(buff+1,name); - end[0]=QUOTE_CHAR; - end[1]=0; + char *to= buff; + if (!force && !opt_quoted && !test_if_special_chars(name)) + return (char*) name; + *to++= QUOTE_CHAR; + while (*name) + { + if (*name == QUOTE_CHAR) + *to= QUOTE_CHAR; + *to++= *name++; + } + to[0]=QUOTE_CHAR; + to[1]=0; return buff; } /* quote_name */ /* -** getStructure -- retrievs database structure, prints out corresponding -** CREATE statement and fills out insert_pat. -** Return values: number of fields in table, 0 if error + getStructure -- retrievs database structure, prints out corresponding + CREATE statement and fills out insert_pat. + + RETURN + number of fields in table, 0 if error */ + static uint getTableStructure(char *table, char* db) { MYSQL_RES *tableRes; MYSQL_ROW row; my_bool init=0; uint numFields; - char *strpos, *table_name; + char *strpos, *result_table, *opt_quoted_table; const char *delayed; - char name_buff[NAME_LEN+3],table_buff[NAME_LEN+3]; + char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3]; + char table_buff2[NAME_LEN*2+3]; FILE *sql_file = md_result_file; DBUG_ENTER("getTableStructure"); @@ -667,7 +677,8 @@ static uint getTableStructure(char *table, char* db) fprintf(stderr, "-- Retrieving table structure for table %s...\n", table); sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d", (opt_quoted || opt_keywords)); - table_name=quote_name(table,table_buff); + result_table= quote_name(table, table_buff, 1); + opt_quoted_table= quote_name(table, table_buff2, 0); if (!mysql_query(sock,insert_pat)) { /* using SHOW CREATE statement */ @@ -691,7 +702,7 @@ static uint getTableStructure(char *table, char* db) end= strmov(end, ","); } } - end= strmov(--end, "\" */"); + end= strmov(end-1, "\" */"); if (mysql_query(sock, buff)) { fprintf(stderr, "%s: Can't set the compatible mode '%s' (%s)\n", @@ -701,11 +712,11 @@ static uint getTableStructure(char *table, char* db) } } - sprintf(buff,"show create table `%s`",table); + sprintf(buff,"show create table %s", result_table); if (mysql_query(sock, buff)) { - fprintf(stderr, "%s: Can't get CREATE TABLE for table '%s' (%s)\n", - my_progname, table, mysql_error(sock)); + fprintf(stderr, "%s: Can't get CREATE TABLE for table %s (%s)\n", + my_progname, result_table, mysql_error(sock)); safe_exit(EX_MYSQLERR); DBUG_RETURN(0); } @@ -724,10 +735,10 @@ static uint getTableStructure(char *table, char* db) write_header(sql_file, db); } if (!opt_xml) - fprintf(sql_file, "\n--\n-- Table structure for table '%s'\n--\n\n", - table); + fprintf(sql_file, "\n--\n-- Table structure for table %s\n--\n\n", + result_table); if (opt_drop) - fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",table_name); + fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", opt_quoted_table); tableRes=mysql_store_result(sock); row=mysql_fetch_row(tableRes); @@ -735,11 +746,11 @@ static uint getTableStructure(char *table, char* db) fprintf(sql_file, "%s;\n", row[1]); mysql_free_result(tableRes); } - sprintf(insert_pat,"show fields from %s",table_name); + sprintf(insert_pat,"show fields from %s", result_table); if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock))) { - fprintf(stderr, "%s: Can't get info about table: '%s'\nerror: %s\n", - my_progname, table, mysql_error(sock)); + fprintf(stderr, "%s: Can't get info about table: %s\nerror: %s\n", + my_progname, result_table, mysql_error(sock)); if (path) my_fclose(sql_file, MYF(MY_WME)); safe_exit(EX_MYSQLERR); @@ -747,10 +758,11 @@ static uint getTableStructure(char *table, char* db) } if (cFlag) - sprintf(insert_pat, "INSERT %sINTO %s (", delayed, table_name); + sprintf(insert_pat, "INSERT %sINTO %s (", delayed, opt_quoted_table); else { - sprintf(insert_pat, "INSERT %sINTO %s VALUES ", delayed, table_name); + sprintf(insert_pat, "INSERT %sINTO %s VALUES ", delayed, + opt_quoted_table); if (!extended_insert) strcat(insert_pat,"("); } @@ -765,7 +777,7 @@ static uint getTableStructure(char *table, char* db) } init=1; if (cFlag) - strpos=strmov(strpos,quote_name(row[SHOW_FIELDNAME],name_buff)); + strpos=strmov(strpos,quote_name(row[SHOW_FIELDNAME], name_buff, 0)); } numFields = (uint) mysql_num_rows(tableRes); mysql_free_result(tableRes); @@ -775,11 +787,11 @@ static uint getTableStructure(char *table, char* db) /* fprintf(stderr, "%s: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n", my_progname, mysql_error(sock)); */ - sprintf(insert_pat,"show fields from %s",table_name); + sprintf(insert_pat,"show fields from %s", result_table); if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock))) { - fprintf(stderr, "%s: Can't get info about table: '%s'\nerror: %s\n", - my_progname, table, mysql_error(sock)); + fprintf(stderr, "%s: Can't get info about table: %s\nerror: %s\n", + my_progname, result_table, mysql_error(sock)); safe_exit(EX_MYSQLERR); DBUG_RETURN(0); } @@ -801,17 +813,17 @@ static uint getTableStructure(char *table, char* db) write_header(sql_file, db); } if (!opt_xml) - fprintf(sql_file, "\n--\n-- Table structure for table '%s'\n--\n\n", - table); + fprintf(sql_file, "\n--\n-- Table structure for table %s\n--\n\n", + result_table); if (opt_drop) - fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",table_name); - fprintf(sql_file, "CREATE TABLE %s (\n", table_name); + fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",result_table); + fprintf(sql_file, "CREATE TABLE %s (\n", result_table); } if (cFlag) - sprintf(insert_pat, "INSERT %sINTO %s (", delayed, table_name); + sprintf(insert_pat, "INSERT %sINTO %s (", delayed, result_table); else { - sprintf(insert_pat, "INSERT %sINTO %s VALUES ", delayed, table_name); + sprintf(insert_pat, "INSERT %sINTO %s VALUES ", delayed, result_table); if (!extended_insert) strcat(insert_pat,"("); } @@ -829,15 +841,17 @@ static uint getTableStructure(char *table, char* db) } init=1; if (cFlag) - strpos=strmov(strpos,quote_name(row[SHOW_FIELDNAME],name_buff)); + strpos=strmov(strpos,quote_name(row[SHOW_FIELDNAME], name_buff, 0)); if (!tFlag) { if (opt_keywords) - fprintf(sql_file, " %s.%s %s", table_name, - quote_name(row[SHOW_FIELDNAME],name_buff), row[SHOW_TYPE]); + fprintf(sql_file, " %s.%s %s", result_table, + quote_name(row[SHOW_FIELDNAME],name_buff, 0), + row[SHOW_TYPE]); else fprintf(sql_file, " %s %s", quote_name(row[SHOW_FIELDNAME], - name_buff), row[SHOW_TYPE]); + name_buff, 0), + row[SHOW_TYPE]); if (row[SHOW_DEFAULT]) { fputs(" DEFAULT ", sql_file); @@ -856,11 +870,11 @@ static uint getTableStructure(char *table, char* db) /* Make an sql-file, if path was given iow. option -T was given */ char buff[20+FN_REFLEN]; uint keynr,primary_key; - sprintf(buff,"show keys from %s",table_name); + sprintf(buff,"show keys from %s", result_table); if (mysql_query(sock, buff)) { - fprintf(stderr, "%s: Can't get keys for table '%s' (%s)\n", - my_progname, table, mysql_error(sock)); + fprintf(stderr, "%s: Can't get keys for table %s (%s)\n", + my_progname, result_table, mysql_error(sock)); if (path) my_fclose(sql_file, MYF(MY_WME)); safe_exit(EX_MYSQLERR); @@ -897,15 +911,15 @@ static uint getTableStructure(char *table, char* db) putc(')', sql_file); if (atoi(row[1])) /* Test if duplicate key */ /* Duplicate allowed */ - fprintf(sql_file, ",\n KEY %s (",quote_name(row[2],name_buff)); + fprintf(sql_file, ",\n KEY %s (",quote_name(row[2],name_buff,0)); else if (keynr == primary_key) fputs(",\n PRIMARY KEY (",sql_file); /* First UNIQUE is primary */ else - fprintf(sql_file, ",\n UNIQUE %s (",quote_name(row[2],name_buff)); + fprintf(sql_file, ",\n UNIQUE %s (",quote_name(row[2],name_buff,0)); } else putc(',', sql_file); - fputs(quote_name(row[4],name_buff), sql_file); + fputs(quote_name(row[4], name_buff, 0), sql_file); if (row[7]) fprintf(sql_file, " (%s)",row[7]); /* Sub key */ } @@ -916,23 +930,23 @@ static uint getTableStructure(char *table, char* db) /* Get MySQL specific create options */ if (create_options) { - sprintf(buff,"show table status like '%s'",table); + sprintf(buff,"show table status like %s",result_table); if (mysql_query(sock, buff)) { if (mysql_errno(sock) != ER_PARSE_ERROR) { /* If old MySQL version */ if (verbose) fprintf(stderr, - "-- Warning: Couldn't get status information for table '%s' (%s)\n", - table,mysql_error(sock)); + "-- Warning: Couldn't get status information for table %s (%s)\n", + result_table,mysql_error(sock)); } } else if (!(tableRes=mysql_store_result(sock)) || !(row=mysql_fetch_row(tableRes))) { fprintf(stderr, - "Error: Couldn't read status information for table '%s' (%s)\n", - table,mysql_error(sock)); + "Error: Couldn't read status information for table %s (%s)\n", + result_table,mysql_error(sock)); } else { @@ -1016,6 +1030,7 @@ static char *field_escape(char *to,const char *from,uint length) static void dumpTable(uint numFields, char *table) { char query[QUERY_LENGTH], *end, buff[256],table_buff[NAME_LEN+3]; + char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table; MYSQL_RES *res; MYSQL_FIELD *field; MYSQL_ROW row; @@ -1023,6 +1038,8 @@ static void dumpTable(uint numFields, char *table) if (verbose) fprintf(stderr, "-- Sending SELECT query...\n"); + result_table= quote_name(table,table_buff, 1); + opt_quoted_table= quote_name(table, table_buff2, 0); if (path) { char filename[FN_REFLEN], tmp_path[FN_REFLEN]; @@ -1049,7 +1066,7 @@ static void dumpTable(uint numFields, char *table) end= add_load_option(end, lines_terminated, " LINES TERMINATED BY"); *end= '\0'; - sprintf(buff," FROM %s",quote_name(table,table_buff)); + sprintf(buff," FROM %s", result_table); end= strmov(end,buff); if (where) end= strxmov(end, " WHERE ",where,NullS); @@ -1062,10 +1079,10 @@ static void dumpTable(uint numFields, char *table) else { if (!opt_xml) - fprintf(md_result_file,"\n--\n-- Dumping data for table '%s'\n--\n", - table); + fprintf(md_result_file,"\n--\n-- Dumping data for table %s\n--\n", + result_table); sprintf(query, "SELECT /*!40001 SQL_NO_CACHE */ * FROM %s", - quote_name(table,table_buff)); + result_table); if (where) { if (!opt_xml) @@ -1092,18 +1109,17 @@ static void dumpTable(uint numFields, char *table) fprintf(stderr, "-- Retrieving rows...\n"); if (mysql_num_fields(res) != numFields) { - fprintf(stderr,"%s: Error in field count for table: '%s' ! Aborting.\n", - my_progname,table); + fprintf(stderr,"%s: Error in field count for table: %s ! Aborting.\n", + my_progname, result_table); safe_exit(EX_CONSCHECK); return; } if (opt_disable_keys) - fprintf(md_result_file,"/*!40000 ALTER TABLE %s DISABLE KEYS */;\n", - quote_name(table, table_buff)); + fprintf(md_result_file, "\n/*!40000 ALTER TABLE %s DISABLE KEYS */;\n", + opt_quoted_table); if (opt_lock) - fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", - quote_name(table,table_buff)); + fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table); total_length=net_buffer_length; /* Force row break */ row_break=0; @@ -1131,8 +1147,8 @@ static void dumpTable(uint numFields, char *table) { if (!(field = mysql_fetch_field(res))) { - sprintf(query,"%s: Not enough fields from table '%s'! Aborting.\n", - my_progname,table); + sprintf(query,"%s: Not enough fields from table %s! Aborting.\n", + my_progname, result_table); fputs(query,stderr); safe_exit(EX_CONSCHECK); return; @@ -1259,11 +1275,11 @@ static void dumpTable(uint numFields, char *table) fflush(md_result_file); if (mysql_errno(sock)) { - sprintf(query,"%s: Error %d: %s when dumping table '%s' at row: %ld\n", + sprintf(query,"%s: Error %d: %s when dumping table %s at row: %ld\n", my_progname, mysql_errno(sock), mysql_error(sock), - table, + result_table, rownr); fputs(query,stderr); safe_exit(EX_CONSCHECK); @@ -1273,7 +1289,7 @@ static void dumpTable(uint numFields, char *table) fputs("UNLOCK TABLES;\n", md_result_file); if (opt_disable_keys) fprintf(md_result_file,"/*!40000 ALTER TABLE %s ENABLE KEYS */;\n", - quote_name(table,table_buff)); + opt_quoted_table); if (opt_autocommit) fprintf(md_result_file, "commit;\n"); mysql_free_result(res); @@ -1415,7 +1431,7 @@ static int dump_all_tables_in_db(char *database) { char *table; uint numrows; - char table_buff[NAME_LEN+3]; + char table_buff[NAME_LEN*2+3]; if (init_dumping(database)) return 1; @@ -1427,7 +1443,7 @@ static int dump_all_tables_in_db(char *database) init_dynamic_string(&query, "LOCK TABLES ", 256, 1024); for (numrows=0 ; (table = getTableName(1)) ; numrows++) { - dynstr_append(&query, quote_name(table, table_buff)); + dynstr_append(&query, quote_name(table, table_buff, 1)); dynstr_append(&query, " READ /*!32311 LOCAL */,"); } if (numrows && mysql_real_query(sock, query.str, query.length-1)) @@ -1459,7 +1475,7 @@ static int dump_all_tables_in_db(char *database) static int dump_selected_tables(char *db, char **table_names, int tables) { uint numrows; - char table_buff[NAME_LEN+3]; + char table_buff[NAME_LEN*+3]; if (init_dumping(db)) return 1; @@ -1471,7 +1487,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables) init_dynamic_string(&query, "LOCK TABLES ", 256, 1024); for (i=0 ; i < tables ; i++) { - dynstr_append(&query, quote_name(table_names[i], table_buff)); + dynstr_append(&query, quote_name(table_names[i], table_buff, 1)); dynstr_append(&query, " READ /*!32311 LOCAL */,"); } if (mysql_real_query(sock, query.str, query.length-1)) diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 4cff5fdfcc7..5ad6d1dc429 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -45,16 +45,15 @@ static char *opt_password=0, *current_user=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0, *opt_columns=0, *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; -static uint opt_mysql_port=0; +static uint opt_mysql_port= 0, opt_protocol= 0; static my_string opt_mysql_unix_port=0; -static my_string opt_ignore_lines=0; +static longlong opt_ignore_lines= -1; static CHARSET_INFO *charset_info= &my_charset_latin1; #include <sslopt-vars.h> #ifdef HAVE_SMEM static char *shared_memory_base_name=0; #endif -static uint opt_protocol=0; static struct my_option my_long_options[] = { @@ -97,7 +96,7 @@ static struct my_option my_long_options[] = {"ignore", 'i', "If duplicate unique key was found, keep old row.", (gptr*) &ignore, (gptr*) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.", - (gptr*) &opt_ignore_lines, (gptr*) &opt_ignore_lines, 0, GET_STR, + (gptr*) &opt_ignore_lines, (gptr*) &opt_ignore_lines, 0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...", (gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR, @@ -311,8 +310,9 @@ static int write_to_table(char *filename, MYSQL *sock) " OPTIONALLY ENCLOSED BY"); end= add_load_option(end, escaped, " ESCAPED BY"); end= add_load_option(end, lines_terminated, " LINES TERMINATED BY"); - if (opt_ignore_lines) - end= strmov(strmov(strmov(end, " IGNORE "), opt_ignore_lines), " LINES"); + if (opt_ignore_lines >= 0) + end= strmov(longlong10_to_str(opt_ignore_lines, + strmov(end, " IGNORE "),10), " LINES"); if (opt_columns) end= strmov(strmov(strmov(end, " ("), opt_columns), ")"); *end= '\0'; diff --git a/configure.in b/configure.in index d2d9f5086f2..59b81e8a709 100644 --- a/configure.in +++ b/configure.in @@ -1337,7 +1337,12 @@ then if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so then MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK - with_named_thread="-Kthread -lsocket -lnsl" + if expr "$CC" : ".*gcc.*" + then + with_named_thread="-pthread -lsocket -lnsl" + else + with_named_thread="-Kthread -lsocket -lnsl" + fi if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null then AC_DEFINE(HAVE_UNIXWARE7_THREADS) @@ -1373,7 +1378,12 @@ then if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so then MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK - with_named_thread="-Kthread -lsocket -lnsl" + if expr "$CC" : ".*gcc.*" + then + with_named_thread="-pthread -lsocket -lnsl" + else + with_named_thread="-Kthread -lsocket -lnsl" + fi if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null then AC_DEFINE(HAVE_UNIXWARE7_THREADS) diff --git a/include/mysql.h b/include/mysql.h index 55fe4107d0c..24afa9a29ba 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -619,6 +619,8 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); unsigned long net_safe_read(MYSQL* mysql); void mysql_once_init(void); +extern my_bool server_inited; + #ifdef __NETWARE__ #pragma pack(pop) /* restore alignment */ #endif diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c index 20bf4972f64..8727c5156e4 100644 --- a/innobase/fsp/fsp0fsp.c +++ b/innobase/fsp/fsp0fsp.c @@ -2656,7 +2656,13 @@ fseg_free_page_low( ulint not_full_n_used; ulint state; ulint i; - char errbuf[200]; + char errbuf[200]; + +#ifdef __WIN__ + dulint desm; + dulint segm; +#endif + ut_ad(seg_inode && mtr); ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) == @@ -2736,7 +2742,10 @@ fseg_free_page_low( fprintf(stderr, "InnoDB: Dump of the segment inode: %s\n", errbuf); - fprintf(stderr, + +#ifndef __WIN__ + + fprintf(stderr, "InnoDB: Serious error: InnoDB is trying to free space %lu page %lu,\n" "InnoDB: which does not belong to segment %lu %lu but belongs\n" "InnoDB: to segment %lu %lu.\n", @@ -2750,6 +2759,26 @@ fseg_free_page_low( ut_dulint_get_low( mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr))); +#else + +/* More pedantic usage to avoid VC++ 6.0 compiler errors due to inline + function expansion issues */ + + desm = mtr_read_dulint(descr + XDES_ID, MLOG_8BYTES, mtr); + segm = mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr); + + fprintf(stderr, +"InnoDB: Serious error: InnoDB is trying to free space %lu page %lu,\n" +"InnoDB: which does not belong to segment %lu %lu but belongs\n" +"InnoDB: to segment %lu %lu.\n", + space, page, + ut_dulint_get_high(desm), + ut_dulint_get_low(desm), + ut_dulint_get_high(segm), + ut_dulint_get_low(segm)); + +#endif + fprintf(stderr, "InnoDB: If the InnoDB recovery crashes here, see section 6.1\n" "InnoDB: of http://www.innodb.com/ibman.html about forcing recovery.\n"); diff --git a/libmysql/get_password.c b/libmysql/get_password.c index e6221ea556e..0e3b2dcb0ae 100644 --- a/libmysql/get_password.c +++ b/libmysql/get_password.c @@ -78,7 +78,7 @@ char *get_tty_password(char *opt_message) char *pos=to,*end=to+sizeof(to)-1; int i=0; DBUG_ENTER("get_tty_password"); - fprintf(stdout,opt_message ? opt_message : "Enter password: "); + _cputs(opt_message ? opt_message : "Enter password: "); for (;;) { char tmp; diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 00ec550273c..892a21ed08b 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -26,7 +26,8 @@ static int fake_argc= 1; static char *fake_argv[]= {(char *)"", 0}; static const char *fake_groups[] = { "server", "embedded", 0 }; -static char inited, org_my_init_done; +static my_bool org_my_init_done; +my_bool server_inited; #if defined (__WIN__) #include "../sql/mysqld.cpp" @@ -181,9 +182,9 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups) /* Only call MY_INIT() if it hasn't been called before */ - if (!inited) + if (!server_inited) { - inited=1; + server_inited=1; org_my_init_done=my_init_done; } if (!org_my_init_done) diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 48b3397ee7c..05e5ff59b55 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -210,11 +210,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, db ? db : "(Null)", user ? user : "(Null)")); - if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION) - cli_mysql_real_connect(mysql, host, user, - passwd, db, port, unix_socket, client_flag); - if ((mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION) && - host && strcmp(host,LOCAL_HOST)) + if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION || + (mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION && + host && strcmp(host,LOCAL_HOST))) cli_mysql_real_connect(mysql, host, user, passwd, db, port, unix_socket, client_flag); @@ -277,7 +275,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, DBUG_RETURN(mysql); error: - DBUG_PRINT("error",("message: %u (%s)",mysql->net.last_errno,mysql->net.last_error)); + DBUG_PRINT("error",("message: %u (%s)", mysql->net.last_errno, + mysql->net.last_error)); { /* Free alloced memory */ my_bool free_me=mysql->free_me; @@ -289,6 +288,7 @@ error: DBUG_RETURN(0); } + /************************************************************************* ** Send a QUIT to the server and close the connection ** If handle is alloced by mysql connect free it. diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c index 18daebffa85..a707eb294a9 100644 --- a/myisam/mi_locking.c +++ b/myisam/mi_locking.c @@ -76,6 +76,8 @@ int mi_lock_database(MI_INFO *info, int lock_type) } if (!count) { + DBUG_PRINT("info",("changed: %u w_locks: %u", + (uint) share->changed, share->w_locks)); if (share->changed && !share->w_locks) { share->state.process= share->last_process=share->this_process; @@ -352,6 +354,8 @@ int _mi_writeinfo(register MI_INFO *info, uint operation) int error,olderror; MYISAM_SHARE *share=info->s; DBUG_ENTER("_mi_writeinfo"); + DBUG_PRINT("info",("operation: %u tot_locks: %u", operation, + share->tot_locks)); error=0; if (share->tot_locks == 0) @@ -379,9 +383,7 @@ int _mi_writeinfo(register MI_INFO *info, uint operation) my_errno=olderror; } else if (operation) - { share->changed= 1; /* Mark keyfile changed */ - } DBUG_RETURN(error); } /* _mi_writeinfo */ diff --git a/myisam/mi_open.c b/myisam/mi_open.c index e2f0d023ff4..c4b24acdb77 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -778,6 +778,7 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite) uchar *ptr=buff; uint i, keys= (uint) state->header.keys, key_blocks=state->header.max_block_size; + DBUG_ENTER("mi_state_info_write"); memcpy_fixed(ptr,&state->header,sizeof(state->header)); ptr+=sizeof(state->header); @@ -828,10 +829,10 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite) } if (pWrite & 1) - return my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L, - MYF(MY_NABP | MY_THREADSAFE)); - else - return my_write(file, (char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + DBUG_RETURN(my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L, + MYF(MY_NABP | MY_THREADSAFE))); + DBUG_RETURN(my_write(file, (char*) buff, (uint) (ptr-buff), + MYF(MY_NABP))); } diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index 7557bb8749f..1bd39aa900b 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -743,6 +743,12 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, { ulong length=get_bits(bit_buff,rec->space_length_bits); uint pack_length=(uint) (end-to)-mi_portable_sizeof_char_ptr; + if (bit_buff->blob_pos+length > bit_buff->end) + { + bit_buff->error=1; + bzero((byte*) to,(end-to)); + return; + } decode_bytes(rec,bit_buff,bit_buff->blob_pos,bit_buff->blob_pos+length); _my_store_blob_length((byte*) to,pack_length,length); memcpy_fixed((char*) to+pack_length,(char*) &bit_buff->blob_pos, diff --git a/myisam/mi_update.c b/myisam/mi_update.c index 53c09a1d35c..d1d41ac351a 100644 --- a/myisam/mi_update.c +++ b/myisam/mi_update.c @@ -96,7 +96,14 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec) if (_mi_ft_cmp(info,i,oldrec, newrec)) { if ((int) i == info->lastinx) + { + /* + We are changeing the index we are reading on. Mark that + the index data has changed and we need to do a full search + when doing read-next + */ key_changed|=HA_STATE_WRITTEN; + } changed|=((ulonglong) 1 << i); if (_mi_ft_update(info,i,(char*) old_key,oldrec,newrec,pos)) goto err; @@ -123,25 +130,36 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec) } /* If we are running with external locking, we must update the index file - that something has changed + that something has changed. */ if (changed || !my_disable_locking) - key_changed|= HA_STATE_KEY_CHANGED; + key_changed|= HA_STATE_CHANGED; if (share->calc_checksum) { info->checksum=(*share->calc_checksum)(info,newrec); - key_changed|= HA_STATE_KEY_CHANGED; /* Must update index file */ + /* Store new checksum in index file header */ + key_changed|= HA_STATE_CHANGED; } { - /* Don't update index file if data file is not extended */ + /* + Don't update index file if data file is not extended and no status + information changed + */ MI_STATUS_INFO state; + ha_rows org_split; + my_off_t org_delete_link; + memcpy((char*) &state, (char*) info->state, sizeof(state)); + org_split= share->state.split; + org_delete_link= share->state.dellink; if ((*share->update_record)(info,pos,newrec)) goto err; if (!key_changed && - memcmp((char*) &state, (char*) info->state, sizeof(state))) - key_changed|= HA_STATE_KEY_CHANGED; /* Must update index file */ + (memcmp((char*) &state, (char*) info->state, sizeof(state)) || + org_split != share->state.split || + org_delete_link != share->state.dellink)) + key_changed|= HA_STATE_CHANGED; /* Must update index file */ } if (auto_key_changed) update_auto_increment(info,newrec); @@ -165,7 +183,7 @@ err: DBUG_PRINT("error",("key: %d errno: %d",i,my_errno)); save_errno=my_errno; if (changed) - key_changed|= HA_STATE_KEY_CHANGED; + key_changed|= HA_STATE_CHANGED; if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL) { info->errkey= (int) i; diff --git a/myisam/myisampack.c b/myisam/myisampack.c index 21b73ce244d..5ca57248204 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -243,7 +243,7 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', - "Force packing of table even if it gets bigger or if tempfile exists.", + "Force packing of table even if it gets bigger or if tempfile exists.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"join", 'j', "Join all given tables into 'new_table_name'. All tables MUST have identical layouts.", diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index fd2f7b7e49b..f619775aa97 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -1114,3 +1114,34 @@ a b select * from t2; a b drop table t1,t2; +create table t1 (x int not null, index(x)) type=bdb; +insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +select * from t1 where x <= 10 and x >= 7; +x +7 +8 +9 +10 +select * from t1 where x <= 10 and x >= 7 order by x; +x +7 +8 +9 +10 +select * from t1 where x <= 10 and x >= 7 order by x desc; +x +10 +9 +8 +7 +select * from t1 where x <= 8 and x >= 5 order by x desc; +x +8 +7 +6 +5 +select * from t1 where x < 8 and x > 5 order by x desc; +x +7 +6 +drop table t1; diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index df6f8fe3615..0a54072d260 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -91,39 +91,39 @@ show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' GRANT SELECT, INSERT, INSERT (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost' -REVOKE insert,insert (a) on t1 from mysqltest_1@localhost; -GRANT references on t1 to mysqltest_1@localhost; +REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost; show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' -GRANT SELECT, REFERENCES, REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost' +GRANT REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost' +GRANT select,references on t1 to mysqltest_1@localhost; select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1"; table_priv column_priv Select,References References -grant all on test.* to user1@localhost with grant option; -revoke all on test.* from user1@localhost; -show grants for user1@localhost; -Grants for user1@localhost -GRANT USAGE ON *.* TO 'user1'@'localhost' -GRANT USAGE ON `test`.* TO 'user1'@'localhost' WITH GRANT OPTION -revoke grant option on test.* from user1@localhost; -show grants for user1@localhost; -Grants for user1@localhost -GRANT USAGE ON *.* TO 'user1'@'localhost' -grant all on test.t1 to user2@localhost with grant option; -revoke all on test.t1 from user2@localhost; -show grants for user2@localhost; -Grants for user2@localhost -GRANT USAGE ON *.* TO 'user2'@'localhost' -GRANT USAGE ON `test`.`t1` TO 'user2'@'localhost' WITH GRANT OPTION -revoke grant option on test.t1 from user2@localhost; -show grants for user2@localhost; -Grants for user2@localhost -GRANT USAGE ON *.* TO 'user2'@'localhost' -delete from mysql.user where user='mysqltest_1'; -delete from mysql.db where user='mysqltest_1'; -delete from mysql.tables_priv where user='mysqltest_1'; -delete from mysql.columns_priv where user='mysqltest_1'; +grant all on test.* to mysqltest_3@localhost with grant option; +revoke all on test.* from mysqltest_3@localhost; +show grants for mysqltest_3@localhost; +Grants for mysqltest_3@localhost +GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost' +GRANT USAGE ON `test`.* TO 'mysqltest_3'@'localhost' WITH GRANT OPTION +revoke grant option on test.* from mysqltest_3@localhost; +show grants for mysqltest_3@localhost; +Grants for mysqltest_3@localhost +GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost' +grant all on test.t1 to mysqltest_2@localhost with grant option; +revoke all on test.t1 from mysqltest_2@localhost; +show grants for mysqltest_2@localhost; +Grants for mysqltest_2@localhost +GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost' +GRANT USAGE ON `test`.`t1` TO 'mysqltest_2'@'localhost' WITH GRANT OPTION +revoke grant option on test.t1 from mysqltest_2@localhost; +show grants for mysqltest_2@localhost; +Grants for mysqltest_2@localhost +GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost' +delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3"; +delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3"; +delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3"; +delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3"; flush privileges; drop table t1; GRANT FILE on mysqltest.* to mysqltest_1@localhost; diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index dd9876b4f90..85e92037ada 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -1,180 +1,180 @@ -drop table if exists ti, tm; -create table ti (a int) type=innodb; -create table tm (a int) type=myisam; +drop table if exists t1, t2; +create table t1 (a int) type=innodb; +create table t2 (a int) type=myisam; reset master; begin; -insert into ti values(1); -insert into tm select * from ti; +insert into t1 values(1); +insert into t2 select * from t1; commit; show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use ; BEGIN -master-bin.000001 119 Query 1 79 use ; insert into ti values(1) -master-bin.000001 178 Query 1 79 use ; insert into tm select * from ti -master-bin.000001 244 Query 1 244 use ; COMMIT -delete from ti; -delete from tm; +master-bin.000001 79 Query 1 79 use `test`; BEGIN +master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(1) +master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1 +master-bin.000001 244 Query 1 244 use `test`; COMMIT +delete from t1; +delete from t2; reset master; begin; -insert into ti values(2); -insert into tm select * from ti; +insert into t1 values(2); +insert into t2 select * from t1; rollback; Warning: Some non-transactional changed tables couldn't be rolled back show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use ; BEGIN -master-bin.000001 119 Query 1 79 use ; insert into ti values(2) -master-bin.000001 178 Query 1 79 use ; insert into tm select * from ti -master-bin.000001 244 Query 1 244 use ; ROLLBACK -delete from ti; -delete from tm; +master-bin.000001 79 Query 1 79 use `test`; BEGIN +master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(2) +master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1 +master-bin.000001 244 Query 1 244 use `test`; ROLLBACK +delete from t1; +delete from t2; reset master; begin; -insert into ti values(3); +insert into t1 values(3); savepoint my_savepoint; -insert into ti values(4); -insert into tm select * from ti; +insert into t1 values(4); +insert into t2 select * from t1; rollback to savepoint my_savepoint; Warning: Some non-transactional changed tables couldn't be rolled back commit; show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use ; BEGIN -master-bin.000001 119 Query 1 79 use ; insert into ti values(3) -master-bin.000001 178 Query 1 79 use ; savepoint my_savepoint -master-bin.000001 235 Query 1 79 use ; insert into ti values(4) -master-bin.000001 294 Query 1 79 use ; insert into tm select * from ti -master-bin.000001 360 Query 1 79 use ; rollback to savepoint my_savepoint -master-bin.000001 429 Query 1 429 use ; COMMIT -delete from ti; -delete from tm; +master-bin.000001 79 Query 1 79 use `test`; BEGIN +master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(3) +master-bin.000001 178 Query 1 79 use `test`; savepoint my_savepoint +master-bin.000001 235 Query 1 79 use `test`; insert into t1 values(4) +master-bin.000001 294 Query 1 79 use `test`; insert into t2 select * from t1 +master-bin.000001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint +master-bin.000001 429 Query 1 429 use `test`; COMMIT +delete from t1; +delete from t2; reset master; begin; -insert into ti values(5); +insert into t1 values(5); savepoint my_savepoint; -insert into ti values(6); -insert into tm select * from ti; +insert into t1 values(6); +insert into t2 select * from t1; rollback to savepoint my_savepoint; Warning: Some non-transactional changed tables couldn't be rolled back -insert into ti values(7); +insert into t1 values(7); commit; -select a from ti order by a; +select a from t1 order by a; a 5 7 show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use ; BEGIN -master-bin.000001 119 Query 1 79 use ; insert into ti values(5) -master-bin.000001 178 Query 1 79 use ; savepoint my_savepoint -master-bin.000001 235 Query 1 79 use ; insert into ti values(6) -master-bin.000001 294 Query 1 79 use ; insert into tm select * from ti -master-bin.000001 360 Query 1 79 use ; rollback to savepoint my_savepoint -master-bin.000001 429 Query 1 79 use ; insert into ti values(7) -master-bin.000001 488 Query 1 488 use ; COMMIT -delete from ti; -delete from tm; +master-bin.000001 79 Query 1 79 use `test`; BEGIN +master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(5) +master-bin.000001 178 Query 1 79 use `test`; savepoint my_savepoint +master-bin.000001 235 Query 1 79 use `test`; insert into t1 values(6) +master-bin.000001 294 Query 1 79 use `test`; insert into t2 select * from t1 +master-bin.000001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint +master-bin.000001 429 Query 1 79 use `test`; insert into t1 values(7) +master-bin.000001 488 Query 1 488 use `test`; COMMIT +delete from t1; +delete from t2; reset master; select get_lock("a",10); get_lock("a",10) 1 begin; -insert into ti values(8); -insert into tm select * from ti; +insert into t1 values(8); +insert into t2 select * from t1; select get_lock("a",10); get_lock("a",10) 1 show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use ; BEGIN -master-bin.000001 119 Query 1 79 use ; insert into ti values(8) -master-bin.000001 178 Query 1 79 use ; insert into tm select * from ti -master-bin.000001 244 Query 1 244 use ; ROLLBACK -delete from ti; -delete from tm; +master-bin.000001 79 Query 1 79 use `test`; BEGIN +master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(8) +master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1 +master-bin.000001 244 Query 1 244 use `test`; ROLLBACK +delete from t1; +delete from t2; reset master; -insert into ti values(9); -insert into tm select * from ti; +insert into t1 values(9); +insert into t2 select * from t1; show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use ; insert into ti values(9) -master-bin.000001 138 Query 1 138 use ; insert into tm select * from ti -delete from ti; -delete from tm; +master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(9) +master-bin.000001 138 Query 1 138 use `test`; insert into t2 select * from t1 +delete from t1; +delete from t2; reset master; -insert into ti values(10); +insert into t1 values(10); begin; -insert into tm select * from ti; +insert into t2 select * from t1; show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use ; insert into ti values(10) -master-bin.000001 139 Query 1 139 use ; insert into tm select * from ti -insert into ti values(11); +master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(10) +master-bin.000001 139 Query 1 139 use `test`; insert into t2 select * from t1 +insert into t1 values(11); commit; show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use ; insert into ti values(10) -master-bin.000001 139 Query 1 139 use ; insert into tm select * from ti -master-bin.000001 205 Query 1 205 use ; BEGIN -master-bin.000001 245 Query 1 205 use ; insert into ti values(11) -master-bin.000001 305 Query 1 305 use ; COMMIT -alter table tm type=INNODB; -delete from ti; -delete from tm; +master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(10) +master-bin.000001 139 Query 1 139 use `test`; insert into t2 select * from t1 +master-bin.000001 205 Query 1 205 use `test`; BEGIN +master-bin.000001 245 Query 1 205 use `test`; insert into t1 values(11) +master-bin.000001 305 Query 1 305 use `test`; COMMIT +alter table t2 type=INNODB; +delete from t1; +delete from t2; reset master; begin; -insert into ti values(12); -insert into tm select * from ti; +insert into t1 values(12); +insert into t2 select * from t1; commit; show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use ; BEGIN -master-bin.000001 119 Query 1 79 use ; insert into ti values(12) -master-bin.000001 179 Query 1 79 use ; insert into tm select * from ti -master-bin.000001 245 Query 1 245 use ; COMMIT -delete from ti; -delete from tm; +master-bin.000001 79 Query 1 79 use `test`; BEGIN +master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(12) +master-bin.000001 179 Query 1 79 use `test`; insert into t2 select * from t1 +master-bin.000001 245 Query 1 245 use `test`; COMMIT +delete from t1; +delete from t2; reset master; begin; -insert into ti values(13); -insert into tm select * from ti; +insert into t1 values(13); +insert into t2 select * from t1; rollback; show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -delete from ti; -delete from tm; +delete from t1; +delete from t2; reset master; begin; -insert into ti values(14); +insert into t1 values(14); savepoint my_savepoint; -insert into ti values(15); -insert into tm select * from ti; +insert into t1 values(15); +insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use ; BEGIN -master-bin.000001 119 Query 1 79 use ; insert into ti values(14) -master-bin.000001 179 Query 1 179 use ; COMMIT -delete from ti; -delete from tm; +master-bin.000001 79 Query 1 79 use `test`; BEGIN +master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(14) +master-bin.000001 179 Query 1 179 use `test`; COMMIT +delete from t1; +delete from t2; reset master; begin; -insert into ti values(16); +insert into t1 values(16); savepoint my_savepoint; -insert into ti values(17); -insert into tm select * from ti; +insert into t1 values(17); +insert into t2 select * from t1; rollback to savepoint my_savepoint; -insert into ti values(18); +insert into t1 values(18); commit; -select a from ti order by a; +select a from t1 order by a; a 16 18 show binlog events from 79; Log_name Pos Event_type Server_id Orig_log_pos Info -master-bin.000001 79 Query 1 79 use ; BEGIN -master-bin.000001 119 Query 1 79 use ; insert into ti values(16) -master-bin.000001 179 Query 1 79 use ; insert into ti values(18) -master-bin.000001 239 Query 1 239 use ; COMMIT -drop table ti,tm; +master-bin.000001 79 Query 1 79 use `test`; BEGIN +master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(16) +master-bin.000001 179 Query 1 79 use `test`; insert into t1 values(18) +master-bin.000001 239 Query 1 239 use `test`; COMMIT +drop table t1,t2; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 4fa71dbaecc..49475c9cbec 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -376,6 +376,28 @@ explain select * from t1 use index() where c=1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where drop table t1,t2; +create table t1 (a int not null auto_increment primary key, b varchar(255)); +insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100)); +update t1 set b=repeat(left(b,1),200) where a=1; +delete from t1 where (a & 1)= 0; +update t1 set b=repeat('e',200) where a=1; +flush tables; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +update t1 set b=repeat(left(b,1),255) where a between 1 and 5; +update t1 set b=repeat(left(b,1),10) where a between 32 and 43; +update t1 set b=repeat(left(b,1),2) where a between 64 and 66; +update t1 set b=repeat(left(b,1),65) where a between 67 and 70; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +insert into t1 (b) values (repeat('z',100)); +update t1 set b="test" where left(b,1) > 'n'; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) TYPE=MyISAM; ERROR 42000: This version of MySQL doesn't yet support 'RTREE INDEX' create table t1 (a int, b varchar(200), c text not null) checksum=1; diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index df84dd55d04..ec090cf4b94 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -253,4 +253,23 @@ explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 Using where 1 SIMPLE t2 range x x 5 NULL 2 Using where +explain select count(*) from t1 where x in (1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range x x 5 NULL 1 Using where; Using index +explain select count(*) from t1 where x in (1,2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range x x 5 NULL 2 Using where; Using index drop table t1; +CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1), KEY i2 (key1)); +INSERT INTO t1 VALUES (0),(0),(1),(1); +CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya)); +INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2); +explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3; +table type possible_keys key key_len ref rows Extra +t2 ref j1 j1 4 const 1 Using where; Using index +t1 ALL i1,i2 NULL NULL NULL 4 Range checked for each record (index map: 3) +explain select * from t1 force index(i2), t2 where (t1.key1 <t2.keya + 1) and t2.keya=3; +table type possible_keys key key_len ref rows Extra +t2 ref j1 j1 4 const 1 Using where; Using index +t1 ALL i2 NULL NULL NULL 4 Range checked for each record (index map: 2) +DROP TABLE t1,t2; diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test index 27755e51b7f..a0fbc56a9da 100644 --- a/mysql-test/t/bdb.test +++ b/mysql-test/t/bdb.test @@ -776,3 +776,16 @@ select * from t1; select * from t2; select * from t2; drop table t1,t2; + +# +# The bug #971 +# + +create table t1 (x int not null, index(x)) type=bdb; +insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +select * from t1 where x <= 10 and x >= 7; +select * from t1 where x <= 10 and x >= 7 order by x; +select * from t1 where x <= 10 and x >= 7 order by x desc; +select * from t1 where x <= 8 and x >= 5 order by x desc; +select * from t1 where x < 8 and x > 5 order by x desc; +drop table t1; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 55d2d9f3848..78221fa4e40 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -65,24 +65,24 @@ show grants for mysqltest_1@localhost; select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1"; REVOKE select (a), update on t1 from mysqltest_1@localhost; show grants for mysqltest_1@localhost; -REVOKE insert,insert (a) on t1 from mysqltest_1@localhost; -GRANT references on t1 to mysqltest_1@localhost; +REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost; show grants for mysqltest_1@localhost; +GRANT select,references on t1 to mysqltest_1@localhost; select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1"; -grant all on test.* to user1@localhost with grant option; -revoke all on test.* from user1@localhost; -show grants for user1@localhost; -revoke grant option on test.* from user1@localhost; -show grants for user1@localhost; -grant all on test.t1 to user2@localhost with grant option; -revoke all on test.t1 from user2@localhost; -show grants for user2@localhost; -revoke grant option on test.t1 from user2@localhost; -show grants for user2@localhost; -delete from mysql.user where user='mysqltest_1'; -delete from mysql.db where user='mysqltest_1'; -delete from mysql.tables_priv where user='mysqltest_1'; -delete from mysql.columns_priv where user='mysqltest_1'; +grant all on test.* to mysqltest_3@localhost with grant option; +revoke all on test.* from mysqltest_3@localhost; +show grants for mysqltest_3@localhost; +revoke grant option on test.* from mysqltest_3@localhost; +show grants for mysqltest_3@localhost; +grant all on test.t1 to mysqltest_2@localhost with grant option; +revoke all on test.t1 from mysqltest_2@localhost; +show grants for mysqltest_2@localhost; +revoke grant option on test.t1 from mysqltest_2@localhost; +show grants for mysqltest_2@localhost; +delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3"; +delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3"; +delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3"; +delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3"; flush privileges; drop table t1; diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index 240aaefb349..be45c2c3133 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -1,83 +1,86 @@ # Check that binlog is ok when a transaction mixes updates to InnoDB and -# MyISAM. It would be nice to make this a replication test, but in 4.0 the slave -# is always with --skip-innodb in the testsuite. I (Guilhem) however did some -# tests manually on a slave; tables are replicated fine and Exec_master_log_pos -# advances as expected. +# MyISAM. +# It would be nice to make this a replication test, but in 4.0 the +# slave is always with --skip-innodb in the testsuite. I (Guilhem) however +# did some tests manually on a slave; tables are replicated fine and +# Exec_master_log_pos advances as expected. -- source include/have_innodb.inc +--disable_warnings +drop table if exists t1, t2; +--enable_warnings + connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; - -drop table if exists ti, tm; -create table ti (a int) type=innodb; -create table tm (a int) type=myisam; +create table t1 (a int) type=innodb; +create table t2 (a int) type=myisam; reset master; begin; -insert into ti values(1); -insert into tm select * from ti; +insert into t1 values(1); +insert into t2 select * from t1; commit; show binlog events from 79; -delete from ti; -delete from tm; +delete from t1; +delete from t2; reset master; begin; -insert into ti values(2); -insert into tm select * from ti; -# should say some changes to non-transactional tables couldn't be rolled back +insert into t1 values(2); +insert into t2 select * from t1; +# should say some changes to non-transact1onal tables couldn't be rolled back --error 1196 rollback; show binlog events from 79; -delete from ti; -delete from tm; +delete from t1; +delete from t2; reset master; begin; -insert into ti values(3); +insert into t1 values(3); savepoint my_savepoint; -insert into ti values(4); -insert into tm select * from ti; +insert into t1 values(4); +insert into t2 select * from t1; --error 1196 rollback to savepoint my_savepoint; commit; show binlog events from 79; -delete from ti; -delete from tm; +delete from t1; +delete from t2; reset master; begin; -insert into ti values(5); +insert into t1 values(5); savepoint my_savepoint; -insert into ti values(6); -insert into tm select * from ti; +insert into t1 values(6); +insert into t2 select * from t1; --error 1196 rollback to savepoint my_savepoint; -insert into ti values(7); +insert into t1 values(7); commit; -select a from ti order by a; # check that savepoints work :) +select a from t1 order by a; # check that savepoints work :) show binlog events from 79; # and when ROLLBACK is not explicit? -delete from ti; -delete from tm; +delete from t1; +delete from t2; reset master; select get_lock("a",10); begin; -insert into ti values(8); -insert into tm select * from ti; +insert into t1 values(8); +insert into t2 select * from t1; disconnect con1; connection con2; @@ -89,87 +92,87 @@ connection con2; select get_lock("a",10); show binlog events from 79; -# and when not in a transaction? -delete from ti; -delete from tm; +# and when not in a transact1on? +delete from t1; +delete from t2; reset master; -insert into ti values(9); -insert into tm select * from ti; +insert into t1 values(9); +insert into t2 select * from t1; show binlog events from 79; -# Check that when the query updating the MyISAM table is the first in the -# transaction, we log it immediately. -delete from ti; -delete from tm; +# Check that when the query updat1ng the MyISAM table is the first in the +# transact1on, we log it immediately. +delete from t1; +delete from t2; reset master; -insert into ti values(10); # first make ti non-empty +insert into t1 values(10); # first make t1 non-empty begin; -insert into tm select * from ti; +insert into t2 select * from t1; show binlog events from 79; -insert into ti values(11); +insert into t1 values(11); commit; show binlog events from 79; -# Check that things work like before this BEGIN/ROLLBACK code was added, when tm -# is INNODB +# Check that things work like before this BEGIN/ROLLBACK code was added, +# when t2 is INNODB -alter table tm type=INNODB; +alter table t2 type=INNODB; -delete from ti; -delete from tm; +delete from t1; +delete from t2; reset master; begin; -insert into ti values(12); -insert into tm select * from ti; +insert into t1 values(12); +insert into t2 select * from t1; commit; show binlog events from 79; -delete from ti; -delete from tm; +delete from t1; +delete from t2; reset master; begin; -insert into ti values(13); -insert into tm select * from ti; +insert into t1 values(13); +insert into t2 select * from t1; rollback; show binlog events from 79; -delete from ti; -delete from tm; +delete from t1; +delete from t2; reset master; begin; -insert into ti values(14); +insert into t1 values(14); savepoint my_savepoint; -insert into ti values(15); -insert into tm select * from ti; +insert into t1 values(15); +insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; show binlog events from 79; -delete from ti; -delete from tm; +delete from t1; +delete from t2; reset master; begin; -insert into ti values(16); +insert into t1 values(16); savepoint my_savepoint; -insert into ti values(17); -insert into tm select * from ti; +insert into t1 values(17); +insert into t2 select * from t1; rollback to savepoint my_savepoint; -insert into ti values(18); +insert into t1 values(18); commit; -select a from ti order by a; # check that savepoints work :) +select a from t1 order by a; # check that savepoints work :) show binlog events from 79; -drop table ti,tm; +drop table t1,t2; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 541f2be65d5..8c43ce1937f 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -363,6 +363,40 @@ explain select * from t1 use index() where c=1; drop table t1,t2; # +# Test bug when updating a split dynamic row where keys are not changed +# + +create table t1 (a int not null auto_increment primary key, b varchar(255)); +insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100)); +update t1 set b=repeat(left(b,1),200) where a=1; +delete from t1 where (a & 1)= 0; +update t1 set b=repeat('e',200) where a=1; +flush tables; +check table t1; + +# +# check updating with keys +# + +disable_query_log; +let $1 = 100; +while ($1) +{ + eval insert into t1 (b) values (repeat(char(($1 & 32)+65), $1)); + dec $1; +} +enable_query_log; +update t1 set b=repeat(left(b,1),255) where a between 1 and 5; +update t1 set b=repeat(left(b,1),10) where a between 32 and 43; +update t1 set b=repeat(left(b,1),2) where a between 64 and 66; +update t1 set b=repeat(left(b,1),65) where a between 67 and 70; +check table t1; +insert into t1 (b) values (repeat('z',100)); +update t1 set b="test" where left(b,1) > 'n'; +check table t1; +drop table t1; + +# # Test RTREE index # --error 1235 @@ -380,4 +414,3 @@ checksum table t1, t2, t3; checksum table t1, t2, t3 extended; #show table status; drop table t1,t2; - diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 70780a0676a..e8f51344ce1 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -201,5 +201,19 @@ explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1 # equation propagation explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y; explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y; +# testing IN +explain select count(*) from t1 where x in (1); +explain select count(*) from t1 where x in (1,2); drop table t1; +# +# bug #1172 +# +CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1), KEY i2 (key1)); +INSERT INTO t1 VALUES (0),(0),(1),(1); +CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya)); +INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2); +explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3; +explain select * from t1 force index(i2), t2 where (t1.key1 <t2.keya + 1) and t2.keya=3; +DROP TABLE t1,t2; + diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index c6b9a41e08e..02eb5366b01 100755 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -13,8 +13,8 @@ DEBUG=0 SILENT=0 SUFFIX="" DIRNAME="" -OUTTAR=0 -OUTZIP=0 +OUTTAR="0" +OUTZIP="0" # # This script must run from MySQL top directory @@ -114,16 +114,37 @@ done # Convert argument file from unix to DOS text # -unix_to_dos() -{ - for arg do - print_debug "Replacing LF -> CRLF from '$arg'" +if [ `which recode` ] +then - sed -e 's/$/\r/' $arg > $arg.tmp - rm -f $arg - mv $arg.tmp $arg - done -} + print_debug "Using 'recode' to convert from unix to dos text" + + unix_to_dos() + { + for arg do + print_debug "Replacing LF -> CRLF from '$arg'" + + chmod u+w $arg + recode lat1..ibmpc $arg + done + } + +else + + print_debug "Using 'sed' to convert from unix to dos text" + + unix_to_dos() + { + for arg do + print_debug "Replacing LF -> CRLF from '$arg'" + + sed -e 's/$/\r/' $arg > $arg.tmp + rm -f $arg + mv $arg.tmp $arg + done + } + +fi # @@ -363,8 +384,10 @@ which_1 () # Create the result zip/tar file # -if [ [ "$OUTTAR" = "0" ] && [ "$OUTZIP" = "0" ] ]; then - OUTZIP=1 +if [ "$OUTTAR" = "0" ]; then + if [ "$OUTZIP" = "0" ]; then + OUTZIP=1 + fi fi set_tarzip_options() diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index d95c13698ae..09a720f273d 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -33,6 +33,7 @@ parse_arguments() { --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --ldata=*|--datadir=*) ldata=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; + --skip-name-resolve) ip_only=1 ;; --verbose) verbose=1 ;; --rpm) in_rpm=1 ;; --windows) windows=1 ;; @@ -166,6 +167,12 @@ then fi fi +if test "$ip_only" -eq 1 +then + ip=`echo "$resolved" | awk '/ /{print $6}'` + hostname=$ip +fi + # Create database directories mysql & test if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index dbed955c0a9..ee1b54e5745 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -1433,6 +1433,8 @@ int ha_berkeley::index_read(byte * buf, const byte * key, } if (key_len == key_info->key_length) { + if (find_flag == HA_READ_AFTER_KEY) + key_info->handler.bdb_return_if_eq= 1; error=read_row(cursor->c_get(cursor, pack_key(&last_key, active_index, key_buff, @@ -1441,6 +1443,7 @@ int ha_berkeley::index_read(byte * buf, const byte * key, (find_flag == HA_READ_KEY_EXACT ? DB_SET : DB_SET_RANGE)), (char*) buf, active_index, &row, (DBT*) 0, 0); + key_info->handler.bdb_return_if_eq= 0; } else { diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ef4966405bf..99e59ab3d63 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3821,7 +3821,7 @@ master-ssl", (gptr*) &master_ssl_cipher, (gptr*) &master_ssl_capath, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"myisam-recover", OPT_MYISAM_RECOVER, - "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP or FORCE.", + "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.", (gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (gptr*) &locked_in_memory, diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 5a883ce8b2c..5b1e2c98001 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -692,7 +692,7 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables, uint keynr= param.real_keynr[idx]; if ((*key)->type == SEL_ARG::MAYBE_KEY || (*key)->maybe_flag) - needed_reg|= (key_map) 1 << keynr; + needed_reg|= (key_map) 1 << keynr; found_records=check_quick_select(¶m, idx, *key); if (found_records != HA_POS_ERROR && found_records > 2 && @@ -716,7 +716,7 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables, param.range_count, found_records)+ (double) found_records / TIME_FOR_COMPARE); - if (read_time > found_read_time) + if (read_time > found_read_time && found_records != HA_POS_ERROR) { read_time=found_read_time; records=found_records; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 6f588427ede..7889a583fde 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1690,6 +1690,7 @@ class GRANT_TABLE :public Sql_alloc public: char *host,*db,*user,*tname, *hash_key; ulong privs, cols; + ulong sort; uint key_length; HASH hash_columns; GRANT_TABLE (const char *h, const char *d,const char *u, const char *t, @@ -1699,6 +1700,7 @@ public: host = strdup_root(&memex,h); db = strdup_root(&memex,d); user = strdup_root(&memex,u); + sort= get_sort(3,host,db,user); tname= strdup_root(&memex,t); if (lower_case_table_names) { @@ -1721,7 +1723,8 @@ public: user = get_field(&memex,form->field[2]); if (!user) user=(char*) ""; - tname = get_field(&memex,form->field[3]); + sort= get_sort(3,host,db,user); + tname= get_field(&memex,form->field[3]); if (!host || !db || !tname) { /* Wrong table row; Ignore it */ @@ -1830,10 +1833,11 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip, } else { - if ((host && !wild_case_compare(&my_charset_latin1, - host,grant_table->host)) || - (ip && !wild_case_compare(&my_charset_latin1, - ip,grant_table->host))) + if (((host && !wild_case_compare(&my_charset_latin1, + host,grant_table->host)) || + (ip && !wild_case_compare(&my_charset_latin1, + ip,grant_table->host))) && + (!found || found->sort < grant_table->sort)) found=grant_table; // Host ok } } @@ -3174,17 +3178,19 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) if ((table_access | grant_table->cols) != 0) { String global(buff,sizeof(buff),&my_charset_latin1); + ulong test_access= (table_access | grant_table->cols) & ~GRANT_ACL; + global.length(0); global.append("GRANT ",6); if (test_all_bits(table_access, (TABLE_ACLS & ~GRANT_ACL))) global.append("ALL PRIVILEGES",14); - else if (!(table_access & ~GRANT_ACL)) + else if (!test_access) global.append("USAGE",5); else { int found= 0; - ulong j,test_access= (table_access | grant_table->cols) & ~GRANT_ACL; + ulong j; for (counter= 0, j= SELECT_ACL; j <= TABLE_ACLS; counter++, j<<= 1) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ad650202dd9..62abef41dde 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -623,7 +623,6 @@ check_connection(THD *thd) thd->ip= 0; bzero((char*) &thd->remote, sizeof(struct sockaddr)); } - /* Ensure that wrong hostnames doesn't cause buffer overflows */ vio_keepalive(net->vio, TRUE); ulong pkt_len= 0; @@ -1882,9 +1881,7 @@ mysql_execute_command(THD *thd) res = mysql_preload_keys(thd, tables); break; } - - -#ifndef EMBEDDED_LIBRARY +#ifdef HAVE_REPLICATION case SQLCOM_CHANGE_MASTER: { if (check_global_access(thd, SUPER_ACL)) @@ -1921,8 +1918,7 @@ mysql_execute_command(THD *thd) else res = load_master_data(thd); break; -#endif /* EMBEDDED_LIBRARY */ - +#endif /* HAVE_REPLICATION */ #ifdef HAVE_INNOBASE_DB case SQLCOM_SHOW_INNODB_STATUS: { @@ -1932,8 +1928,7 @@ mysql_execute_command(THD *thd) break; } #endif - -#ifndef EMBEDDED_LIBRARY +#ifdef HAVE_REPLICATION case SQLCOM_LOAD_MASTER_TABLE: { if (!tables->db) @@ -1965,7 +1960,7 @@ mysql_execute_command(THD *thd) UNLOCK_ACTIVE_MI; break; } -#endif /* EMBEDDED_LIBRARY */ +#endif /* HAVE_REPLICATION */ case SQLCOM_CREATE_TABLE: { @@ -2082,7 +2077,7 @@ mysql_execute_command(THD *thd) res = mysql_create_index(thd, tables, lex->key_list); break; -#ifndef EMBEDDED_LIBRARY +#ifdef HAVE_REPLICATION case SQLCOM_SLAVE_START: { LOCK_ACTIVE_MI; @@ -2115,7 +2110,7 @@ mysql_execute_command(THD *thd) UNLOCK_ACTIVE_MI; break; } -#endif +#endif /* HAVE_REPLICATION */ case SQLCOM_ALTER_TABLE: #if defined(DONT_ALLOW_SHOW_COMMANDS) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index eac4007d9fc..47ee4784aa0 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -158,7 +158,7 @@ static void copy_sum_funcs(Item_sum **func_ptr); static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab); static bool init_sum_functions(Item_sum **func, Item_sum **end); static bool update_sum_func(Item_sum **func); -static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, +static void select_describe(JOIN *join, bool need_tmp_table,bool need_order, bool distinct, const char *message=NullS); @@ -2178,6 +2178,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level, add_key_field(key_fields,*and_level, ((Item_field*) (cond_func->key_item()->real_item()))->field, 0, cond_func->arguments()+1, cond_func->argument_count()-1, +#endif usable_tables); break; case Item_func::OPTIMIZE_OP: @@ -3337,13 +3338,30 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) join->best_positions[i].records_read && !(join->select_options & OPTION_FOUND_ROWS))) { + /* Join with outer join condition */ + COND *orig_cond=sel->cond; + sel->cond=and_conds(sel->cond,tab->on_expr); if (sel->test_quick_select(tab->keys, used_tables & ~ current_map, (join->select_options & OPTION_FOUND_ROWS ? HA_POS_ERROR : join->unit->select_limit_cnt)) < 0) - DBUG_RETURN(1); // Impossible range + { /* before reporting "Impossible WHERE" for the whole query + we have to check isn't it only "impossible ON" instead */ + sel->cond=orig_cond; + if (!tab->on_expr || + sel->test_quick_select(tab->keys, + used_tables & ~ current_map, + (join->select_options & + OPTION_FOUND_ROWS ? + HA_POS_ERROR : + join->thd->select_limit)) < 0) + DBUG_RETURN(1); // Impossible WHERE + } + else + sel->cond=orig_cond; + /* Fix for EXPLAIN */ if (sel->quick) join->best_positions[i].records_read= sel->quick->records; diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 4afdac9914a..661748adab9 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -3,6 +3,10 @@ %define mysqld_user mysql %define server_suffix -standard +# We don't package all files installed into the build root by intention - +# See BUG#998 for details. +%define _unpackaged_files_terminate_build 0 + %define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com Name: MySQL @@ -562,18 +566,26 @@ fi %files embedded %attr(644, root, root) %{_libdir}/mysql/libmysqld.a +# The spec file changelog only includes changes made to the spec file +# itself %changelog +* Fri Aug 29 2003 Lenz Grimmer <lenz@mysql.com> + +- Fixed BUG 1162 (removed macro names from the changelog) +- Really fixed BUG 998 (disable the checking for installed but + unpackaged files) + * Tue Aug 05 2003 Lenz Grimmer <lenz@mysql.com> -- Fixed BUG#959 (libmysqld not being compiled properly) -- Fixed BUG#998 (RPM build errors): added missing files to the +- Fixed BUG 959 (libmysqld not being compiled properly) +- Fixed BUG 998 (RPM build errors): added missing files to the distribution (mysql_fix_extensions, mysql_tableinfo, mysqldumpslow, - mysql_fix_privilege_tables.1), removed "-n" from %install section. + mysql_fix_privilege_tables.1), removed "-n" from install section. * Wed Jul 09 2003 Lenz Grimmer <lenz@mysql.com> - removed the GIF Icon (file was not included in the sources anyway) -- removed unused variable %shared_lib_version +- removed unused variable shared_lib_version - do not run automake before building the standard binary (should not be necessary) - add server suffix '-standard' to standard binary (to be in line @@ -594,7 +606,7 @@ fi * Mon Mar 10 2003 Lenz Grimmer <lenz@mysql.com> - added missing file mysql_secure_installation to server subpackage - (bug #141) + (BUG 141) * Tue Feb 11 2003 Lenz Grimmer <lenz@mysql.com> |