diff --git a/client/mysql.cc b/client/mysql.cc index bbba5be1cdf..046cba536be 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -44,7 +44,7 @@ #include #endif -const char *VER= "14.7"; +const char *VER= "14.8"; /* Don't try to make a nice table if the data is too big */ #define MAX_COLUMN_LENGTH 1024 @@ -144,6 +144,7 @@ static char *current_host,*current_db,*current_user=0,*opt_password=0, *current_prompt=0, *delimiter_str= 0, *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; static char *histfile; +static char *histfile_tmp; static String glob_buffer,old_buffer; static String processed_prompt; static char *full_username=0,*part_username=0,*default_prompt=0; @@ -442,6 +443,13 @@ int main(int argc,char *argv[]) if (verbose) tee_fprintf(stdout, "Reading history-file %s\n",histfile); read_history(histfile); + if (!(histfile_tmp= (char*) my_malloc((uint) strlen(histfile) + 5, + MYF(MY_WME)))) + { + fprintf(stderr, "Couldn't allocate memory for temp histfile!\n"); + exit(1); + } + sprintf(histfile_tmp, "%s.TMP", histfile); } } #endif @@ -470,7 +478,8 @@ sig_handler mysql_end(int sig) /* write-history */ if (verbose) tee_fprintf(stdout, "Writing history-file %s\n",histfile); - write_history(histfile); + if (!write_history(histfile_tmp)) + my_rename(histfile_tmp, histfile, MYF(MY_WME)); } batch_readline_end(status.line_buff); completion_hash_free(&ht); @@ -485,6 +494,7 @@ sig_handler mysql_end(int sig) my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR)); my_free(histfile,MYF(MY_ALLOW_ZERO_PTR)); + my_free(histfile_tmp,MYF(MY_ALLOW_ZERO_PTR)); my_free(current_db,MYF(MY_ALLOW_ZERO_PTR)); my_free(current_host,MYF(MY_ALLOW_ZERO_PTR)); my_free(current_user,MYF(MY_ALLOW_ZERO_PTR)); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 6917797c03c..45daa64705a 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -780,7 +780,13 @@ static int check_master_version(MYSQL* mysql, if (mysql_query(mysql, "SELECT VERSION()") || !(res = mysql_store_result(mysql))) - die("Error checking master version: %s", mysql_error(mysql)); + { + char errmsg[FN_REFLEN]; + + strmake(errmsg, mysql_error(mysql), sizeof(errmsg) - 1); + mysql_close(mysql); + die("Error checking master version: %s", errmsg); + } if (!(row = mysql_fetch_row(res))) { mysql_free_result(res); diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index 4c2a501a08a..8559df16d08 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -1022,7 +1022,8 @@ calculate_sizes_again: /* Now, try the insert */ - *rec = page_cur_insert_rec_low(page_cursor, entry, index, NULL, mtr); + *rec = page_cur_insert_rec_low(page_cursor, entry, index, + NULL, NULL, mtr); if (!(*rec)) { /* If the record did not fit, reorganize */ btr_page_reorganize(page, index, mtr); diff --git a/innobase/include/page0cur.h b/innobase/include/page0cur.h index a693931968e..7c6ff081c6d 100644 --- a/innobase/include/page0cur.h +++ b/innobase/include/page0cur.h @@ -144,6 +144,7 @@ page_cur_rec_insert( page_cur_t* cursor, /* in: a page cursor */ rec_t* rec, /* in: record to insert */ dict_index_t* index, /* in: record descriptor */ + ulint* offsets,/* in: rec_get_offsets(rec, index) */ mtr_t* mtr); /* in: mini-transaction handle */ /*************************************************************** Inserts a record next to page cursor. Returns pointer to inserted record if @@ -160,6 +161,7 @@ page_cur_insert_rec_low( dtuple_t* tuple, /* in: pointer to a data tuple or NULL */ dict_index_t* index, /* in: record descriptor */ rec_t* rec, /* in: pointer to a physical record or NULL */ + ulint* offsets,/* in: rec_get_offsets(rec, index) or NULL */ mtr_t* mtr); /* in: mini-transaction handle */ /***************************************************************** Copies records from page to a newly created page, from a given record onward, diff --git a/innobase/include/page0cur.ic b/innobase/include/page0cur.ic index 03010fbd766..e99d799b372 100644 --- a/innobase/include/page0cur.ic +++ b/innobase/include/page0cur.ic @@ -195,7 +195,7 @@ page_cur_tuple_insert( dict_index_t* index, /* in: record descriptor */ mtr_t* mtr) /* in: mini-transaction handle */ { - return(page_cur_insert_rec_low(cursor, tuple, index, NULL, mtr)); + return(page_cur_insert_rec_low(cursor, tuple, index, NULL, NULL, mtr)); } /*************************************************************** @@ -211,8 +211,10 @@ page_cur_rec_insert( page_cur_t* cursor, /* in: a page cursor */ rec_t* rec, /* in: record to insert */ dict_index_t* index, /* in: record descriptor */ + ulint* offsets,/* in: rec_get_offsets(rec, index) */ mtr_t* mtr) /* in: mini-transaction handle */ { - return(page_cur_insert_rec_low(cursor, NULL, index, rec, mtr)); + return(page_cur_insert_rec_low(cursor, NULL, index, rec, + offsets, mtr)); } diff --git a/innobase/include/rem0rec.h b/innobase/include/rem0rec.h index ab89b912523..2cc87a34f27 100644 --- a/innobase/include/rem0rec.h +++ b/innobase/include/rem0rec.h @@ -133,6 +133,27 @@ rec_set_status( rec_t* rec, /* in: physical record */ ulint bits); /* in: info bits */ +/********************************************************** +The following function is used to retrieve the info and status +bits of a record. (Only compact records have status bits.) */ +UNIV_INLINE +ulint +rec_get_info_and_status_bits( +/*==============*/ + /* out: info bits */ + rec_t* rec, /* in: physical record */ + ibool comp); /* in: TRUE=compact page format */ +/********************************************************** +The following function is used to set the info and status +bits of a record. (Only compact records have status bits.) */ +UNIV_INLINE +void +rec_set_info_and_status_bits( +/*==============*/ + rec_t* rec, /* in: physical record */ + ibool comp, /* in: TRUE=compact page format */ + ulint bits); /* in: info bits */ + /********************************************************** The following function tells if record is delete marked. */ UNIV_INLINE diff --git a/innobase/include/rem0rec.ic b/innobase/include/rem0rec.ic index 7d35e8e4110..f15e0fdffef 100644 --- a/innobase/include/rem0rec.ic +++ b/innobase/include/rem0rec.ic @@ -520,6 +520,53 @@ rec_set_status( REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT); } +/********************************************************** +The following function is used to retrieve the info and status +bits of a record. (Only compact records have status bits.) */ +UNIV_INLINE +ulint +rec_get_info_and_status_bits( +/*==============*/ + /* out: info bits */ + rec_t* rec, /* in: physical record */ + ibool comp) /* in: TRUE=compact page format */ +{ + ulint bits; +#if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \ +& (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT) +# error "REC_NEW_STATUS_MASK and REC_INFO_BITS_MASK overlap" +#endif + if (comp) { + bits = rec_get_info_bits(rec, TRUE) | rec_get_status(rec); + } else { + bits = rec_get_info_bits(rec, FALSE); + ut_ad(!(bits & ~(REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT))); + } + return(bits); +} +/********************************************************** +The following function is used to set the info and status +bits of a record. (Only compact records have status bits.) */ +UNIV_INLINE +void +rec_set_info_and_status_bits( +/*==============*/ + rec_t* rec, /* in: physical record */ + ibool comp, /* in: TRUE=compact page format */ + ulint bits) /* in: info bits */ +{ +#if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \ +& (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT) +# error "REC_NEW_STATUS_MASK and REC_INFO_BITS_MASK overlap" +#endif + if (comp) { + rec_set_status(rec, bits & REC_NEW_STATUS_MASK); + } else { + ut_ad(!(bits & ~(REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT))); + } + rec_set_info_bits(rec, bits & ~REC_NEW_STATUS_MASK, comp); +} + /********************************************************** The following function tells if record is delete marked. */ UNIV_INLINE diff --git a/innobase/include/univ.i b/innobase/include/univ.i index 80024f71992..c413c3bc67e 100644 --- a/innobase/include/univ.i +++ b/innobase/include/univ.i @@ -80,8 +80,10 @@ memory is read outside the allocated blocks. */ /* Make a non-inline debug version */ +#ifdef DBUG_ON +# define UNIV_DEBUG +#endif /* DBUG_ON */ /* -#define UNIV_DEBUG #define UNIV_MEM_DEBUG #define UNIV_IBUF_DEBUG #define UNIV_SYNC_DEBUG diff --git a/innobase/page/page0cur.c b/innobase/page/page0cur.c index 53c3c573b8e..fc94fc4b1e0 100644 --- a/innobase/page/page0cur.c +++ b/innobase/page/page0cur.c @@ -605,8 +605,8 @@ page_cur_insert_rec_write_log( log_end = &log_ptr[5 + 1 + 5 + 5 + MLOG_BUF_MARGIN]; } - if ((rec_get_info_bits(insert_rec, index->table->comp) != - rec_get_info_bits(cursor_rec, index->table->comp)) + if ((rec_get_info_and_status_bits(insert_rec, index->table->comp) != + rec_get_info_and_status_bits(cursor_rec, index->table->comp)) || (extra_size != cur_extra_size) || (rec_size != cur_rec_size)) { @@ -622,7 +622,8 @@ page_cur_insert_rec_write_log( if (extra_info_yes) { /* Write the info bits */ mach_write_to_1(log_ptr, - rec_get_info_bits(insert_rec, index->table->comp)); + rec_get_info_and_status_bits(insert_rec, + index->table->comp)); log_ptr++; /* Write the record origin offset */ @@ -673,7 +674,7 @@ page_cur_parse_insert_rec( byte buf1[1024]; byte* buf; byte* ptr2 = ptr; - ulint info_bits = 0; /* remove warning */ + ulint info_and_status_bits = 0; /* remove warning */ page_cur_t cursor; mem_heap_t* heap = NULL; ulint offsets_[100] = { 100, }; @@ -723,7 +724,7 @@ page_cur_parse_insert_rec( return(NULL); } - info_bits = mach_read_from_1(ptr); + info_and_status_bits = mach_read_from_1(ptr); ptr++; ptr = mach_parse_compressed(ptr, end_ptr, &origin_offset); @@ -768,7 +769,8 @@ page_cur_parse_insert_rec( ULINT_UNDEFINED, &heap); if (extra_info_yes == 0) { - info_bits = rec_get_info_bits(cursor_rec, index->table->comp); + info_and_status_bits = rec_get_info_and_status_bits( + cursor_rec, index->table->comp); origin_offset = rec_offs_extra_size(offsets); mismatch_index = rec_offs_size(offsets) - end_seg_len; } @@ -783,11 +785,12 @@ page_cur_parse_insert_rec( if (mismatch_index >= UNIV_PAGE_SIZE) { fprintf(stderr, - "Is short %lu, info_bits %lu, offset %lu, " + "Is short %lu, info_and_status_bits %lu, offset %lu, " "o_offset %lu\n" "mismatch index %lu, end_seg_len %lu\n" "parsed len %lu\n", - (ulong) is_short, (ulong) info_bits, (ulong) offset, + (ulong) is_short, (ulong) info_and_status_bits, + (ulong) offset, (ulong) origin_offset, (ulong) mismatch_index, (ulong) end_seg_len, (ulong) (ptr - ptr2)); @@ -803,21 +806,14 @@ page_cur_parse_insert_rec( ut_memcpy(buf, rec_get_start(cursor_rec, offsets), mismatch_index); ut_memcpy(buf + mismatch_index, ptr, end_seg_len); - rec_set_info_bits(buf + origin_offset, index->table->comp, info_bits); - - /* Set the status bits for new-style records. */ - if (index->table->comp) { - /* Leaf pages (level 0) contain ordinary records; - non-leaf pages contain node pointer records. */ - ulint level = page_header_get_field( - buf_frame_align(cursor_rec), PAGE_LEVEL); - rec_set_status(buf + origin_offset, - level ? REC_STATUS_NODE_PTR : REC_STATUS_ORDINARY); - } + rec_set_info_and_status_bits(buf + origin_offset, index->table->comp, + info_and_status_bits); page_cur_position(cursor_rec, &cursor); - page_cur_rec_insert(&cursor, buf + origin_offset, index, mtr); + offsets = rec_get_offsets(buf + origin_offset, index, offsets, + ULINT_UNDEFINED, &heap); + page_cur_rec_insert(&cursor, buf + origin_offset, index, offsets, mtr); if (buf != buf1) { @@ -846,6 +842,7 @@ page_cur_insert_rec_low( dtuple_t* tuple, /* in: pointer to a data tuple or NULL */ dict_index_t* index, /* in: record descriptor */ rec_t* rec, /* in: pointer to a physical record or NULL */ + ulint* offsets,/* in: rec_get_offsets(rec, index) or NULL */ mtr_t* mtr) /* in: mini-transaction handle */ { byte* insert_buf = NULL; @@ -863,8 +860,6 @@ page_cur_insert_rec_low( rec_t* owner_rec; ulint n_owned; mem_heap_t* heap = NULL; - ulint offsets_[100] = { 100, }; - ulint* offsets = offsets_; ibool comp = index->table->comp; ut_ad(cursor && mtr); @@ -882,8 +877,11 @@ page_cur_insert_rec_low( if (tuple != NULL) { rec_size = rec_get_converted_size(index, tuple); } else { - offsets = rec_get_offsets(rec, index, offsets, + if (!offsets) { + offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); + } + ut_ad(rec_offs_validate(rec, index, offsets)); rec_size = rec_offs_size(offsets); } @@ -1131,8 +1129,6 @@ page_copy_rec_list_end_to_created_page( slot_index = 0; n_recs = 0; - heap = mem_heap_create(100); - /* should be do ... until, comment by Jani */ while (rec != page_get_supremum_rec(page)) { offsets = rec_get_offsets(rec, index, offsets, diff --git a/innobase/page/page0page.c b/innobase/page/page0page.c index d71c243e7c5..901c8cd0831 100644 --- a/innobase/page/page0page.c +++ b/innobase/page/page0page.c @@ -463,6 +463,9 @@ page_copy_rec_list_end_no_locks( page_cur_t cur1; page_cur_t cur2; rec_t* sup; + mem_heap_t* heap = NULL; + ulint offsets_[100] = { 100, }; + ulint* offsets = offsets_; page_cur_position(rec, &cur1); @@ -483,8 +486,11 @@ page_copy_rec_list_end_no_locks( sup = page_get_supremum_rec(page); while (sup != page_cur_get_rec(&cur1)) { - if (!page_cur_rec_insert(&cur2, - page_cur_get_rec(&cur1), index, mtr)) { + rec_t* cur1_rec = page_cur_get_rec(&cur1); + offsets = rec_get_offsets(cur1_rec, index, offsets, + ULINT_UNDEFINED, &heap); + if (!page_cur_rec_insert(&cur2, cur1_rec, index, + offsets, mtr)) { /* Track an assertion failure reported on the mailing list on June 18th, 2003 */ @@ -503,7 +509,11 @@ page_copy_rec_list_end_no_locks( page_cur_move_to_next(&cur1); page_cur_move_to_next(&cur2); } -} + + if (heap) { + mem_heap_free(heap); + } +} /***************************************************************** Copies records from page to new_page, from a given record onward, @@ -553,6 +563,9 @@ page_copy_rec_list_start( page_cur_t cur1; page_cur_t cur2; rec_t* old_end; + mem_heap_t* heap = NULL; + ulint offsets_[100] = { 100, }; + ulint* offsets = offsets_; page_cur_set_before_first(page, &cur1); @@ -570,8 +583,13 @@ page_copy_rec_list_start( /* Copy records from the original page to the new page */ while (page_cur_get_rec(&cur1) != rec) { - ut_a(page_cur_rec_insert(&cur2, - page_cur_get_rec(&cur1), index, mtr)); + rec_t* ins_rec; + rec_t* cur1_rec = page_cur_get_rec(&cur1); + offsets = rec_get_offsets(cur1_rec, index, offsets, + ULINT_UNDEFINED, &heap); + ins_rec = page_cur_rec_insert(&cur2, cur1_rec, index, + offsets, mtr); + ut_a(ins_rec); page_cur_move_to_next(&cur1); page_cur_move_to_next(&cur2); @@ -584,7 +602,11 @@ page_copy_rec_list_start( page_update_max_trx_id(new_page, page_get_max_trx_id(page)); btr_search_move_or_delete_hash_entries(new_page, page, index); -} + + if (heap) { + mem_heap_free(heap); + } +} /************************************************************** Writes a log record of a record list end or start deletion. */ diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index 4650db7abad..aab0f5affa7 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -1120,7 +1120,6 @@ row_ins_check_foreign_constraint( dict_table_t* check_table; dict_index_t* check_index; ulint n_fields_cmp; - ibool unique_search; rec_t* rec; btr_pcur_t pcur; ibool moved; @@ -1240,14 +1239,6 @@ run_again: dtuple_set_n_fields_cmp(entry, foreign->n_fields); - if (dict_index_get_n_unique(check_index) <= foreign->n_fields) { - /* We can just set a LOCK_REC_NOT_GAP type lock */ - - unique_search = TRUE; - } else { - unique_search = FALSE; - } - btr_pcur_open(check_index, entry, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); @@ -1289,18 +1280,14 @@ run_again: break; } } else { - /* Found a matching record */ - ulint lock_type; + /* Found a matching record. Lock only + a record because we can allow inserts + into gaps */ - if (unique_search) { - lock_type = LOCK_REC_NOT_GAP; - } else { - lock_type = LOCK_ORDINARY; - } + err = row_ins_set_shared_rec_lock( + LOCK_REC_NOT_GAP, rec, + check_index, offsets, thr); - err = row_ins_set_shared_rec_lock(lock_type, - rec, check_index, offsets, thr); - if (err != DB_SUCCESS) { break; diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index c5dc1de0c5a..50dedebe119 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -65,8 +65,9 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \ charset.lo charset-def.lo hash.lo mf_iocache.lo \ mf_iocache2.lo my_seek.lo my_sleep.lo \ - my_pread.lo mf_cache.lo md5.lo sha1.lo\ - my_getopt.lo my_gethostbyname.lo my_port.lo + my_pread.lo mf_cache.lo md5.lo sha1.lo \ + my_getopt.lo my_gethostbyname.lo my_port.lo \ + my_rename.lo sqlobjects = net.lo sql_cmn_objects = pack.lo client.lo my_time.lo diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 1e10ee97e40..1e3052de8e8 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -198,6 +198,13 @@ LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$LD_LIBRARY_PATH" DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$DYLD_LIBRARY_PATH" export LD_LIBRARY_PATH DYLD_LIBRARY_PATH +# +# Allow anyone in the group to see the generated database files +# +UMASK=0660 +UMASK_DIR=0770 +export UMASK UMASK_DIR + MASTER_RUNNING=0 MASTER1_RUNNING=0 MASTER_MYPORT=9306 @@ -765,6 +772,17 @@ skip_test() { $ECHO "$RES$RES_SPACE [ skipped ]" } + +disable_test() { + USERT=" ...." + SYST=" ...." + REALT=" ...." + pname=`$ECHO "$1 "|$CUT -c 1-24` + RES="$pname" + skip_inc + $ECHO "$RES$RES_SPACE [ disabled ] $2" +} + report_stats () { if [ $TOT_FAIL = 0 ]; then $ECHO "All $TOT_TEST tests were successful." @@ -1411,6 +1429,12 @@ run_testcase () if [ -n "$RESULT_EXT" -a \( x$RECORD = x1 -o -f "$result_file$RESULT_EXT" \) ] ; then result_file="$result_file$RESULT_EXT" fi + if [ -e "$TESTDIR/$tname.disabled" ] + then + comment=`$CAT $TESTDIR/$tname.disabled`; + disable_test $tname "$comment" + return + fi if [ "$USE_MANAGER" = 1 ] ; then many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)` fi diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result index 3be73f6cc6a..cfd8f78a77c 100644 --- a/mysql-test/r/lowercase_table2.result +++ b/mysql-test/r/lowercase_table2.result @@ -1,4 +1,4 @@ -DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3; +DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3,tT; DROP DATABASE IF EXISTS `TEST_$1`; DROP DATABASE IF EXISTS `test_$1`; CREATE TABLE T1 (a int); @@ -131,3 +131,13 @@ show tables like 't1%'; Tables_in_test (t1%) t1 drop table t1; +create temporary table tT(a int(11), b varchar(8)); +insert into tT values (1, 'abc'); +select * from tT; +a b +1 abc +alter table tT add index (a); +select * from tT; +a b +1 abc +drop table tT; diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index cfd296fd44b..b1847636790 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -1,7 +1,7 @@ drop table if exists t1, t2, t3, t4; drop table if exists t1, t2, t3, t4; start slave; -ERROR HY000: File 'TESTDIR/var/slave-data/master.info' not found (Errcode: 13) +Got one of the listed errors start slave; ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; diff --git a/mysql-test/t/federated.disabled b/mysql-test/t/federated.disabled new file mode 100644 index 00000000000..5ad728b6f10 --- /dev/null +++ b/mysql-test/t/federated.disabled @@ -0,0 +1 @@ +Patrick Galbraith should fix this diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test index a4eaeac4ef4..237dcd29950 100644 --- a/mysql-test/t/lowercase_table2.test +++ b/mysql-test/t/lowercase_table2.test @@ -10,7 +10,7 @@ show variables like "lower_case_table_names"; enable_query_log; --disable_warnings -DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3; +DROP TABLE IF EXISTS t1,t2,T1,T2,t3,T3,tT; DROP DATABASE IF EXISTS `TEST_$1`; DROP DATABASE IF EXISTS `test_$1`; --enable_warnings @@ -100,3 +100,14 @@ show tables like 'T1%'; alter table t1 add index (A); show tables like 't1%'; drop table t1; + +# +# Bug #7261: Alter table loses temp table +# + +create temporary table tT(a int(11), b varchar(8)); +insert into tT values (1, 'abc'); +select * from tT; +alter table tT add index (a); +select * from tT; +drop table tT; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index 63ddf495347..2b5c72d16d2 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -24,7 +24,7 @@ drop table if exists t1, t2, t3, t4; # START SLAVE will fail because it can't read the file (mode 000) # (system error 13) --replace_result $MYSQL_TEST_DIR TESTDIR ---error 1105 +--error 1105,1105 start slave; system chmod 600 var/slave-data/master.info; # It will fail again because the file is empty so the slave cannot get valuable diff --git a/ndb/test/run-test/atrt-mysql-test-run b/ndb/test/run-test/atrt-mysql-test-run index c30a4defc7f..2ebc11b0070 100755 --- a/ndb/test/run-test/atrt-mysql-test-run +++ b/ndb/test/run-test/atrt-mysql-test-run @@ -5,8 +5,8 @@ p=`pwd` cd $MYSQL_BASE_DIR/mysql-test ./mysql-test-run --with-ndbcluster --ndb-connectstring=$NDB_CONNECTSTRING $* | tee $p/output.txt -f=`grep -c '[ fail ]' $p/output.txt` -o=`grep -c '[ pass ]' $p/output.txt` +f=`grep -c '\[ fail \]' $p/output.txt` +o=`grep -c '\[ pass \]' $p/output.txt` if [ $o -gt 0 -a $f -eq 0 ] then diff --git a/ndb/test/run-test/daily-basic-tests.txt b/ndb/test/run-test/daily-basic-tests.txt index ae195cc0c0c..89675acb59f 100644 --- a/ndb/test/run-test/daily-basic-tests.txt +++ b/ndb/test/run-test/daily-basic-tests.txt @@ -1,3 +1,11 @@ +max-time: 25000 +cmd: atrt-mysql-test-run +args: --force + +max-time: 600 +cmd: atrt-testBackup +args: -n BackupOne T1 T6 T3 I3 + # BASIC FUNCTIONALITY max-time: 500 cmd: testBasic diff --git a/ndb/test/run-test/daily-devel-tests.txt b/ndb/test/run-test/daily-devel-tests.txt index 9527df600f0..5c9b36fb836 100644 --- a/ndb/test/run-test/daily-devel-tests.txt +++ b/ndb/test/run-test/daily-devel-tests.txt @@ -1,7 +1,3 @@ -max-time: 25000 -cmd: atrt-mysql-test-run -args: --force - # # INDEX # @@ -22,10 +18,6 @@ args: -n CreateLoadDrop T1 T10 # # BACKUP # -max-time: 600 -cmd: atrt-testBackup -args: -n BackupOne T1 T6 T3 I3 - max-time: 1000 cmd: atrt-testBackup args: -n BackupBank T6 diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4bd6acce499..c0bcaf771a5 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5377,7 +5377,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, Initialize a new table list for a nested join SYNOPSIS - init_table_list() + init_nested_join() thd current thread DESCRIPTION diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 801b9d5d021..f097bbd740d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12963,7 +12963,7 @@ static void print_join(THD *thd, String *str, List *tables) { TABLE_LIST *curr= *tbl; if (curr->outer_join) - str->append(" left join ", 11); // MySQL converg right to left joins + str->append(" left join ", 11); // MySQL converts right to left joins else if (curr->straight) str->append(" straight_join ", 15); else diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9b2fb4a9c6a..88e840d1c4e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3375,7 +3375,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, } /* Remove link to old table and rename the new one */ close_temporary_table(thd, table->s->db, table_name); - if (rename_temporary_table(thd, new_table, new_db, new_alias)) + /* Should pass the 'new_name' as we store table name in the cache */ + if (rename_temporary_table(thd, new_table, new_db, new_name)) { // Fatal error close_temporary_table(thd,new_db,tmp_name); my_free((gptr) new_table,MYF(0)); diff --git a/tests/Makefile.am b/tests/Makefile.am index e66637de0aa..b4dda0ab6e8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -36,9 +36,9 @@ INCLUDES = -I$(top_srcdir)/include $(openssl_includes) LIBS = @CLIENT_LIBS@ LDADD = @CLIENT_EXTRA_LDFLAGS@ \ $(top_builddir)/libmysql/libmysqlclient.la -client_test_LDADD= $(LDADD) $(CXXLDFLAGS) \ +mysql_client_test_LDADD= $(LDADD) $(CXXLDFLAGS) \ $(top_builddir)/mysys/libmysys.a -client_test_SOURCES= mysql_client_test.c +mysql_client_test_SOURCES= mysql_client_test.c insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)