diff --git a/Docs/manual.texi b/Docs/manual.texi index d1eb1021fbf..f446b0ff925 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -13637,7 +13637,6 @@ connection between a MySQL server and a MySQL client. If you are using MySQL 4.0, you can also use internal openssl support. @xref{Secure connections}. - To make a MySQL system secure, you should strongly consider the following suggestions: @@ -13653,8 +13652,7 @@ this: @example shell> mysql -u root mysql -mysql> UPDATE user SET Password=PASSWORD('new_password') - WHERE user='root'; +mysql> UPDATE user SET Password=PASSWORD('new_password') WHERE user='root'; mysql> FLUSH PRIVILEGES; @end example @@ -15396,17 +15394,17 @@ password using the @code{PASSWORD()} function): @example shell> mysql -u root mysql -mysql> UPDATE user SET Password=PASSWORD('new_password') - WHERE user='root'; -mysql> FLUSH PRIVILEGES; +mysql> SET PASSWORD FOR root@@localhost=PASSWORD('new_password'); @end example -You can, in MySQL Version 3.22 and above, use the @code{SET PASSWORD} -statement: +If you know what you are doing, you can also directly manipulate the +privilege tables: @example shell> mysql -u root mysql -mysql> SET PASSWORD FOR root=PASSWORD('new_password'); +mysql> UPDATE user SET Password=PASSWORD('new_password') + WHERE user='root'; +mysql> FLUSH PRIVILEGES; @end example Another way to set the password is by using the @code{mysqladmin} command: @@ -46287,6 +46285,9 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @item +Changed @code{SELECT ... IN SHARE MODE} to +@code{SELECT .. LOCK IN SHARE MODE} (as in MySQL 3.23). +@item A new query cache to cache results from identical @code{SELECT} queries. @item Fixed core dump bug on 64 bit machines when it got a wrong communication @@ -46540,6 +46541,8 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.47 @itemize @bullet @item +Fixed that @code{GROUP BY expr DESC} works. +@item Fixed bug when using @code{t1 LEFT JOIN t2 ON t2.key=constant}. @item @code{mysqlconfig} now also work with binary (relocated) distributions. diff --git a/client/mysqltest.c b/client/mysqltest.c index d17d2730229..fc2dbef6fbb 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -75,17 +75,21 @@ #define MAX_EXPECTED_ERRORS 10 #define QUERY_SEND 1 #define QUERY_REAP 2 -#define CON_RETRY_SLEEP 1 /* how long to sleep before trying to connect again*/ -#define MAX_CON_TRIES 2 /* sometimes in a test the client starts before - * the server - to solve the problem, we try again - * after some sleep if connection fails the first - * time */ #ifndef MYSQL_MANAGER_PORT #define MYSQL_MANAGER_PORT 23546 #endif +/* + Sometimes in a test the client starts before + the server - to solve the problem, we try again + after some sleep if connection fails the first + time +*/ +#define CON_RETRY_SLEEP 2 +#define MAX_CON_TRIES 5 + enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD, - OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT}; + OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT}; static int record = 0, verbose = 0, silent = 0, opt_sleep=0; static char *db = 0, *pass=0; diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index 9fecf2c04fd..a7cd31af2ee 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -457,14 +457,13 @@ os_file_get_size( offs = lseek(file, 0, SEEK_END); - if (sizeof(off_t) > 4) { - *size = (ulint)(offs & 0xFFFFFFFF); - *size_high = (ulint)(offs >> 32); - } else { - *size = (ulint) offs; - *size_high = 0; - } - +#if SIZEOF_OFF_T > 4 + *size = (ulint)(offs & 0xFFFFFFFF); + *size_high = (ulint)(offs >> 32); +#else + *size = (ulint) offs; + *size_high = 0; +#endif return(TRUE); #endif } @@ -614,18 +613,16 @@ os_file_pread( /* If off_t is > 4 bytes in size, then we assume we can pass a 64-bit address */ - if (sizeof(off_t) > 4) { - offs = (off_t)offset + (((off_t)offset_high) << 32); - - } else { - offs = (off_t)offset; +#if SIZEOF_OFF_T > 4 + offs = (off_t)offset + (((off_t)offset_high) << 32); +#else + offs = (off_t)offset; - if (offset_high > 0) { - fprintf(stderr, - "InnoDB: Error: file read at offset > 4 GB\n"); - } + if (offset_high > 0) { + fprintf(stderr, + "InnoDB: Error: file read at offset > 4 GB\n"); } - +#endif os_n_file_reads++; #ifdef HAVE_PREAD diff --git a/myisam/mi_check.c b/myisam/mi_check.c index ad095c8e546..7839de20bb8 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -1288,8 +1288,6 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, my_close(info->dfile,MYF(0)); info->dfile=new_file; info->state->data_file_length=sort_info->filepos; - /* Only whole records */ - share->state.split=info->state->records+info->state->del; share->state.version=(ulong) time((time_t*) 0); /* Force reopen */ } else @@ -1962,7 +1960,6 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, share->state.state.data_file_length = info->state->data_file_length = sort_info->filepos; /* Only whole records */ - share->state.split=info->state->records+info->state->del; share->state.version=(ulong) time((time_t*) 0); my_close(info->dfile,MYF(0)); info->dfile=new_file; @@ -2183,9 +2180,11 @@ static int sort_get_next_record(SORT_INFO *sort_info) } sort_info->start_recpos=sort_info->pos; if (!sort_info->fix_datafile) + { sort_info->filepos=sort_info->pos; + share->state.split++; + } sort_info->max_pos=(sort_info->pos+=share->base.pack_reclength); - share->state.split++; if (*sort_info->record) { if (param->calc_checksum) @@ -2356,7 +2355,8 @@ static int sort_get_next_record(SORT_INFO *sort_info) continue; } - share->state.split++; + if (!sort_info->fix_datafile && (b_type & BLOCK_DELETED)) + share->state.split++; if (! found_record++) { sort_info->find_length=left_length=block_info.rec_len; @@ -2494,10 +2494,12 @@ static int sort_get_next_record(SORT_INFO *sort_info) } info->checksum=mi_checksum(info,sort_info->record); if (!sort_info->fix_datafile) + { sort_info->filepos=sort_info->pos; + share->state.split++; + } sort_info->max_pos=(sort_info->pos=block_info.filepos+ block_info.rec_len); - share->state.split++; info->packed_length=block_info.rec_len; if (param->calc_checksum) param->glob_crc+= info->checksum; @@ -2535,6 +2537,7 @@ int sort_write_record(SORT_INFO *sort_info) DBUG_RETURN(1); } sort_info->filepos+=share->base.pack_reclength; + info->s->state.split++; /* sort_info->param->glob_crc+=mi_static_checksum(info, sort_info->record); */ break; case DYNAMIC_RECORD: @@ -2559,20 +2562,28 @@ int sort_write_record(SORT_INFO *sort_info) } info->checksum=mi_checksum(info,sort_info->record); reclength=_mi_rec_pack(info,from,sort_info->record); - /* sort_info->param->glob_crc+=info->checksum; */ - block_length=reclength+ 3 + test(reclength >= (65520-3)); - if (block_length < share->base.min_block_length) - block_length=share->base.min_block_length; flag=0; - info->update|=HA_STATE_WRITE_AT_END; - block_length=MY_ALIGN(block_length,MI_DYN_ALIGN_SIZE); - if (_mi_write_part_record(info,0L,block_length,HA_OFFSET_ERROR, - &from,&reclength,&flag)) + /* sort_info->param->glob_crc+=info->checksum; */ + + do { - mi_check_print_error(param,"%d when writing to datafile",my_errno); - DBUG_RETURN(1); - } - sort_info->filepos+=block_length; + block_length=reclength+ 3 + test(reclength >= (65520-3)); + if (block_length < share->base.min_block_length) + block_length=share->base.min_block_length; + info->update|=HA_STATE_WRITE_AT_END; + block_length=MY_ALIGN(block_length,MI_DYN_ALIGN_SIZE); + if (block_length > MI_MAX_BLOCK_LENGTH) + block_length=MI_MAX_BLOCK_LENGTH; + if (_mi_write_part_record(info,0L,block_length, + sort_info->filepos+block_length, + &from,&reclength,&flag)) + { + mi_check_print_error(param,"%d when writing to datafile",my_errno); + DBUG_RETURN(1); + } + sort_info->filepos+=block_length; + info->s->state.split++; + } while (reclength); /* sort_info->param->glob_crc+=info->checksum; */ break; case COMPRESSED_RECORD: @@ -2588,6 +2599,7 @@ int sort_write_record(SORT_INFO *sort_info) } /* sort_info->param->glob_crc+=info->checksum; */ sort_info->filepos+=reclength+length; + info->s->state.split++; break; } } diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c index dfe1b7053de..b5f5ca7fd33 100644 --- a/myisam/mi_dynrec.c +++ b/myisam/mi_dynrec.c @@ -64,11 +64,13 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) MI_DYN_DELETE_BLOCK_HEADER+1; reclength=info->s->base.pack_reclength+ _my_calc_total_blob_length(info,record)+ extra; +#ifdef NOT_USED /* We now support big rows */ if (reclength > MI_DYN_MAX_ROW_LENGTH) { my_errno=HA_ERR_TO_BIG_ROW; return -1; } +#endif if (!(rec_buff=(byte*) my_alloca(reclength))) { my_errno=ENOMEM; @@ -93,11 +95,13 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record) MI_DYN_DELETE_BLOCK_HEADER; reclength=info->s->base.pack_reclength+ _my_calc_total_blob_length(info,record)+ extra; +#ifdef NOT_USED /* We now support big rows */ if (reclength > MI_DYN_MAX_ROW_LENGTH) { my_errno=HA_ERR_TO_BIG_ROW; return -1; } +#endif if (!(rec_buff=(byte*) my_alloca(reclength))) { my_errno=ENOMEM; @@ -130,14 +134,14 @@ static int write_dynamic_record(MI_INFO *info, const byte *record, DBUG_ENTER("write_dynamic_record"); flag=0; - while (reclength) + do { if (_mi_find_writepos(info,reclength,&filepos,&length)) goto err; if (_mi_write_part_record(info,filepos,length,info->s->state.dellink, (byte**) &record,&reclength,&flag)) goto err; - } + } while (reclength); DBUG_RETURN(0); err: @@ -377,7 +381,7 @@ int _mi_write_part_record(MI_INFO *info, head_length= 16; temp[0]=13; mi_int4store(temp+1,*reclength); - mi_int3store(temp+4,length-head_length); + mi_int3store(temp+5,length-head_length); mi_sizestore((byte*) temp+8,next_filepos); } else @@ -1441,7 +1445,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos) DBUG_DUMP("header",(byte*) header,MI_BLOCK_INFO_HEADER_LENGTH); if (info->second_read) { - if (info->header[0] <= 6) + if (info->header[0] <= 6 || info->header[0] == 13) return_val=BLOCK_SYNC_ERROR; } else diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h index 203101a2f48..e9d3461fe9a 100644 --- a/myisam/myisamdef.h +++ b/myisam/myisamdef.h @@ -359,7 +359,7 @@ struct st_myisam_info { #define MI_DYN_MAX_ROW_LENGTH (MI_DYN_MAX_BLOCK_LENGTH - MI_SPLIT_LENGTH) #define MI_DYN_ALIGN_SIZE 4 /* Align blocks on this */ #define MI_MAX_DYN_HEADER_BYTE 13 /* max header byte for dynamic rows */ -#define MI_MAX_BLOCK_LENGTH (((ulong) 1 << 24)-1) +#define MI_MAX_BLOCK_LENGTH ((((ulong) 1 << 24)-1) & (~ (ulong) (MI_DYN_ALIGN_SIZE-1))) #define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for file */ diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 13548be834c..3a1fed143d1 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -43,6 +43,39 @@ which () } +sleep_until_file_deleted () +{ + file=$1 + loop=$SLEEP_TIME + while (test $loop -gt 0) + do + sleep 1 + if [ ! -f $file ] + then + return + fi + loop=`expr $loop - 1` + done +} + +sleep_until_file_exists () +{ + file=$1 + loop=60 # Should be long enough enough for all cases + while (test $loop -gt 0) + do + sleep 1 + if [ -f $file ] + then + return + fi + loop=`expr $loop - 1` + done + echo "ERROR: $file was not created in 60 seconds; Aborting" + exit 1; +} + + # No paths below as we can't be sure where the program is! BASENAME=`which basename | head -1` @@ -91,7 +124,7 @@ else BINARY_DIST=1 fi -#BASEDIR is always one above mysql-test directory +#BASEDIR is always one above mysql-test directory CWD=`pwd` cd .. BASEDIR=`pwd` @@ -101,7 +134,7 @@ export MYSQL_TEST_DIR STD_DATA=$MYSQL_TEST_DIR/std_data hostname=`hostname` # Installed in the mysql privilege table -MANAGER_QUIET_OPT="-q" +MANAGER_QUIET_OPT="-q" TESTDIR="$MYSQL_TEST_DIR/t" TESTSUFFIX=test TOT_SKIP=0 @@ -139,7 +172,7 @@ DO_GCOV="" DO_GDB="" DO_DDD="" DO_CLIENT_GDB="" -SLEEP_TIME=2 +SLEEP_TIME=10 CHARACTER_SET=latin1 DBUSER="" START_WAIT_TIMEOUT=3 @@ -176,7 +209,7 @@ while test $# -gt 0; do ;; --start-and-exit) START_AND_EXIT=1 - ;; + ;; --skip-innobase) EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-innobase" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-innobase" ;; @@ -195,7 +228,7 @@ while test $# -gt 0; do --bench) DO_BENCH=1 NO_SLAVE=1 - ;; + ;; --big*) # Actually --big-test EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; --compress) @@ -218,7 +251,7 @@ while test $# -gt 0; do ;; --gprof ) DO_GPROF=1 - ;; + ;; --gdb ) START_WAIT_TIMEOUT=300 STOP_WAIT_TIMEOUT=300 @@ -249,7 +282,7 @@ while test $# -gt 0; do ;; --strace-client ) STRACE_CLIENT=1 - ;; + ;; --debug) EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \ --debug=d:t:i:O,$MYSQL_TEST_DIR/var/log/master.trace" @@ -292,7 +325,7 @@ if [ x$SOURCE_DIST = x1 ] ; then MY_BASEDIR=$MYSQL_TEST_DIR else MY_BASEDIR=$BASEDIR -fi +fi # Create the directories @@ -321,7 +354,7 @@ if [ x$SOURCE_DIST = x1 ] ; then if [ -n "$STRACE_CLIENT" ]; then MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST" fi - + MYSQLADMIN="$BASEDIR/client/mysqladmin" MYSQL_MANAGER_CLIENT="$BASEDIR/client/mysqlmanagerc" MYSQL_MANAGER="$BASEDIR/tools/mysqlmanager" @@ -339,7 +372,7 @@ else MYSQL_MANAGER_PWGEN="$BASEDIR/bin/mysqlmanager-pwgen" MYSQL="$BASEDIR/bin/mysql" INSTALL_DB="./install_test_db -bin" - if test -d "$BASEDIR/share/mysql/english" + if test -d "$BASEDIR/share/mysql/english" then LANGUAGE="$BASEDIR/share/mysql/english/" CHARSETSDIR="$BASEDIR/share/mysql/charsets" @@ -409,12 +442,12 @@ show_failed_diff () reject_file=r/$1.reject result_file=r/$1.result eval_file=r/$1.eval - + if [ -f $eval_file ] then result_file=$eval_file fi - + if [ -x "$DIFF" ] && [ -f $reject_file ] then echo "Below are the diffs between actual and expected results:" @@ -424,7 +457,7 @@ show_failed_diff () echo "Please follow the instructions outlined at" echo "http://www.mysql.com/doc/R/e/Reporting_mysqltest_bugs.html" echo "to find the reason to this problem and how to report this." - fi + fi } do_gdb_test () @@ -469,12 +502,12 @@ report_stats () { if [ $TOT_FAIL = 0 ]; then $ECHO "All $TOT_TEST tests were successful." else - xten=`$EXPR $TOT_PASS \* 10000` - raw=`$EXPR $xten / $TOT_TEST` - raw=`$PRINTF %.4d $raw` - whole=`$PRINTF %.2s $raw` - xwhole=`$EXPR $whole \* 100` - deci=`$EXPR $raw - $xwhole` + xten=`$EXPR $TOT_PASS \* 10000` + raw=`$EXPR $xten / $TOT_TEST` + raw=`$PRINTF %.4d $raw` + whole=`$PRINTF %.2s $raw` + xwhole=`$EXPR $whole \* 100` + deci=`$EXPR $raw - $xwhole` $ECHO "Failed ${TOT_FAIL}/${TOT_TEST} tests, ${whole}.${deci}% successful." $ECHO "" $ECHO "The log files in $MYSQL_TEST_DIR/var/log may give you some hint" @@ -500,23 +533,21 @@ mysql_install_db () { error "Could not install slave test DBs" exit 1 fi - + for slave_num in 1 2 ; do - rm -rf var/slave$slave_num-data/ + $RM -rf var/slave$slave_num-data/ mkdir -p var/slave$slave_num-data/mysql mkdir -p var/slave$slave_num-data/test cp var/slave-data/mysql/* var/slave$slave_num-data/mysql done - # Give mysqld some time to die. - sleep $SLEEP_TIME return 0 } gprof_prepare () { - rm -rf $GPROF_DIR - mkdir -p $GPROF_DIR + $RM -rf $GPROF_DIR + mkdir -p $GPROF_DIR } gprof_collect () @@ -556,7 +587,7 @@ abort_if_failed() if [ ! $? = 0 ] ; then echo $1 exit 1 - fi + fi } start_manager() @@ -575,7 +606,7 @@ start_manager() fi fi - rm -f $MANAGER_PID_FILE + $RM -f $MANAGER_PID_FILE MYSQL_MANAGER_PW=`$MYSQL_MANAGER_PWGEN -u $MYSQL_MANAGER_USER \ -o $MYSQL_MANAGER_PW_FILE` $MYSQL_MANAGER --log=$MYSQL_MANAGER_LOG --port=$MYSQL_MANAGER_PORT \ @@ -613,7 +644,7 @@ manager_launch() shift if [ $USE_MANAGER = 0 ] ; then $@ >$CUR_MYERR 2>&1 & - sleep 2 #hack + sleep 2 #hack return fi $MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \ @@ -646,181 +677,186 @@ EOF start_master() { - if [ x$MASTER_RUNNING = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then - return - fi - # Remove old berkeley db log files that can confuse the server - $RM -f $MASTER_MYDDIR/log.* - # Remove stale binary logs - $RM -f $MYSQL_TEST_DIR/var/log/master-bin.* - #run master initialization shell script if one exists - if [ -f "$master_init_script" ] ; - then - /bin/sh $master_init_script - fi - cd $BASEDIR # for gcov - #start master - if [ -z "$DO_BENCH" ] - then - master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \ - --server-id=1 --rpl-recovery-rank=1 \ - --basedir=$MY_BASEDIR --init-rpl-role=master \ - --port=$MASTER_MYPORT \ - --exit-info=256 \ - --core \ - --datadir=$MASTER_MYDDIR \ - --pid-file=$MASTER_MYPID \ - --socket=$MASTER_MYSOCK \ - --log=$MASTER_MYLOG \ - --character-sets-dir=$CHARSETSDIR \ - --default-character-set=$CHARACTER_SET \ - --tmpdir=$MYSQL_TMP_DIR \ - --language=$LANGUAGE \ - --innodb_data_file_path=ibdata1:50M \ - $SMALL_SERVER \ - $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT" - else - master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \ - --server-id=1 --rpl-recovery-rank=1 \ - --basedir=$MY_BASEDIR --init-rpl-role=master \ - --port=$MASTER_MYPORT \ - --datadir=$MASTER_MYDDIR \ - --pid-file=$MASTER_MYPID \ - --socket=$MASTER_MYSOCK \ - --character-sets-dir=$CHARSETSDIR \ - --default-character-set=$CHARACTER_SET \ - --core \ - --tmpdir=$MYSQL_TMP_DIR \ - --language=$LANGUAGE \ - --innodb_data_file_path=ibdata1:50M \ - $SMALL_SERVER \ - $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT" - fi - - CUR_MYERR=$MASTER_MYERR - CUR_MYSOCK=$MASTER_MYSOCK - - if [ x$DO_DDD = x1 ] - then - $ECHO "set args $master_args" > $GDB_MASTER_INIT - manager_launch master ddd -display $DISPLAY --debugger \ - "gdb -x $GDB_MASTER_INIT" $MYSQLD - elif [ x$DO_GDB = x1 ] - then - ( echo set args $master_args; - if [ $USE_MANAGER = 0 ] ; then - cat < $GDB_MASTER_INIT + manager_launch master ddd -display $DISPLAY --debugger \ + "gdb -x $GDB_MASTER_INIT" $MYSQLD + elif [ x$DO_GDB = x1 ] + then + ( echo set args $master_args; + if [ $USE_MANAGER = 0 ] ; then + cat < $GDB_MASTER_INIT - manager_launch master $XTERM -display $DISPLAY \ - -title "Master" -e gdb -x $GDB_MASTER_INIT $MYSQLD - else - manager_launch master $MYSQLD $master_args - fi + fi ) > $GDB_MASTER_INIT + manager_launch master $XTERM -display $DISPLAY \ + -title "Master" -e gdb -x $GDB_MASTER_INIT $MYSQLD + else + manager_launch master $MYSQLD $master_args + fi + sleep_until_file_exists $MASTER_MYPID MASTER_RUNNING=1 } start_slave() { - [ x$SKIP_SLAVE = x1 ] && return - eval "this_slave_running=\$SLAVE$1_RUNNING" - [ x$this_slave_running = 1 ] && return - #when testing fail-safe replication, we will have more than one slave - #in this case, we start secondary slaves with an argument - slave_ident="slave$1" - if [ -n "$1" ] ; - then - slave_server_id=`$EXPR 2 + $1` - slave_rpl_rank=$slave_server_id - slave_port=`expr $SLAVE_MYPORT + $1` - slave_log="$SLAVE_MYLOG.$1" - slave_err="$SLAVE_MYERR.$1" - slave_datadir="var/$slave_ident-data/" - slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid" - slave_sock="$SLAVE_MYSOCK-$1" - else - slave_server_id=2 - slave_rpl_rank=2 - slave_port=$SLAVE_MYPORT - slave_log=$SLAVE_MYLOG - slave_err=$SLAVE_MYERR - slave_datadir=$SLAVE_MYDDIR - slave_pid=$SLAVE_MYPID - slave_sock="$SLAVE_MYSOCK" - fi - # Remove stale binary logs - $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-bin.* - - #run slave initialization shell script if one exists - if [ -f "$slave_init_script" ] ; - then - /bin/sh $slave_init_script - fi - - if [ -z "$SLAVE_MASTER_INFO" ] ; then - master_info="--master-user=root \ - --master-connect-retry=1 \ - --master-host=127.0.0.1 \ - --master-password= \ - --master-port=$MASTER_MYPORT \ - --server-id=$slave_server_id --rpl-recovery-rank=$slave_rpl_rank" - else - master_info=$SLAVE_MASTER_INFO - fi - - $RM -f $slave_datadir/log.* - slave_args="--no-defaults $master_info \ - --exit-info=256 \ - --log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin \ - --log-slave-updates \ - --log=$slave_log \ - --basedir=$MY_BASEDIR \ - --datadir=$slave_datadir \ - --pid-file=$slave_pid \ - --port=$slave_port \ - --socket=$slave_sock \ - --character-sets-dir=$CHARSETSDIR \ - --default-character-set=$CHARACTER_SET \ - --core --init-rpl-role=slave \ - --tmpdir=$MYSQL_TMP_DIR \ - --language=$LANGUAGE \ - --skip-innodb --skip-slave-start \ - --slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \ - --report-host=127.0.0.1 --report-user=root \ - --report-port=$slave_port \ - --master-retry-count=5 \ - $SMALL_SERVER \ - $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT" - CUR_MYERR=$slave_err - CUR_MYSOCK=$slave_sock - - if [ x$DO_DDD = x1 ] - then - $ECHO "set args $master_args" > $GDB_SLAVE_INIT - manager_launch $slave_ident ddd -display $DISPLAY --debugger \ - "gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD - elif [ x$DO_GDB = x1 ] - then - $ECHO "set args $slave_args" > $GDB_SLAVE_INIT - manager_launch $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \ - gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD - else - manager_launch $slave_ident $SLAVE_MYSQLD $slave_args - fi - eval "SLAVE$1_RUNNING=1" + [ x$SKIP_SLAVE = x1 ] && return + eval "this_slave_running=\$SLAVE$1_RUNNING" + [ x$this_slave_running = 1 ] && return + #when testing fail-safe replication, we will have more than one slave + #in this case, we start secondary slaves with an argument + slave_ident="slave$1" + if [ -n "$1" ] ; + then + slave_server_id=`$EXPR 2 + $1` + slave_rpl_rank=$slave_server_id + slave_port=`expr $SLAVE_MYPORT + $1` + slave_log="$SLAVE_MYLOG.$1" + slave_err="$SLAVE_MYERR.$1" + slave_datadir="var/$slave_ident-data/" + slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid" + slave_sock="$SLAVE_MYSOCK-$1" + else + slave_server_id=2 + slave_rpl_rank=2 + slave_port=$SLAVE_MYPORT + slave_log=$SLAVE_MYLOG + slave_err=$SLAVE_MYERR + slave_datadir=$SLAVE_MYDDIR + slave_pid=$SLAVE_MYPID + slave_sock="$SLAVE_MYSOCK" + fi + # Remove stale binary logs + $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-bin.* + + #run slave initialization shell script if one exists + if [ -f "$slave_init_script" ] ; + then + /bin/sh $slave_init_script + fi + + if [ -z "$SLAVE_MASTER_INFO" ] ; then + master_info="--master-user=root \ + --master-connect-retry=1 \ + --master-host=127.0.0.1 \ + --master-password= \ + --master-port=$MASTER_MYPORT \ + --server-id=$slave_server_id --rpl-recovery-rank=$slave_rpl_rank" + else + master_info=$SLAVE_MASTER_INFO + fi + + $RM -f $slave_datadir/log.* + slave_args="--no-defaults $master_info \ + --exit-info=256 \ + --log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin \ + --log-slave-updates \ + --log=$slave_log \ + --basedir=$MY_BASEDIR \ + --datadir=$slave_datadir \ + --pid-file=$slave_pid \ + --port=$slave_port \ + --socket=$slave_sock \ + --character-sets-dir=$CHARSETSDIR \ + --default-character-set=$CHARACTER_SET \ + --core --init-rpl-role=slave \ + --tmpdir=$MYSQL_TMP_DIR \ + --language=$LANGUAGE \ + --skip-innodb --skip-slave-start \ + --slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \ + --report-host=127.0.0.1 --report-user=root \ + --report-port=$slave_port \ + --master-retry-count=5 \ + $SMALL_SERVER \ + $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT" + CUR_MYERR=$slave_err + CUR_MYSOCK=$slave_sock + + if [ x$DO_DDD = x1 ] + then + $ECHO "set args $master_args" > $GDB_SLAVE_INIT + manager_launch $slave_ident ddd -display $DISPLAY --debugger \ + "gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD + elif [ x$DO_GDB = x1 ] + then + $ECHO "set args $slave_args" > $GDB_SLAVE_INIT + manager_launch $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \ + gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD + else + manager_launch $slave_ident $SLAVE_MYSQLD $slave_args + fi + eval "SLAVE$1_RUNNING=1" + sleep_until_file_exists $slave_pid } -mysql_start () { - $ECHO "Starting MySQL daemon" - start_master - start_slave - cd $MYSQL_TEST_DIR - return 1 +mysql_start () +{ + $ECHO "Starting MySQL daemon" + start_master + start_slave + cd $MYSQL_TEST_DIR + return 1 } stop_slave () @@ -832,7 +868,7 @@ stop_slave () slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid" else slave_pid=$SLAVE_MYPID - fi + fi if [ x$this_slave_running = x1 ] then manager_term $slave_ident @@ -840,17 +876,17 @@ stop_slave () then # try harder! $ECHO "slave not cooperating with mysqladmin, will try manual kill" kill `$CAT $slave_pid` - sleep $SLEEP_TIME - if [ -f $SLAVE_MYPID ] ; then + sleep_until_file_deleted $slave_pid + if [ -f $slave_pid ] ; then $ECHO "slave refused to die. Sending SIGKILL" kill -9 `$CAT $slave_pid` $RM -f $slave_pid else - $ECHO "slave responded to SIGTERM " + $ECHO "slave responded to SIGTERM " fi fi eval "SLAVE$1_RUNNING=0" - fi + fi } stop_master () @@ -862,13 +898,13 @@ stop_master () then # try harder! $ECHO "master not cooperating with mysqladmin, will try manual kill" kill `$CAT $MASTER_MYPID` - sleep $SLEEP_TIME + sleep_until_file_deleted $MASTER_MYPID if [ -f $MASTER_MYPID ] ; then $ECHO "master refused to die. Sending SIGKILL" kill -9 `$CAT $MASTER_MYPID` $RM -f $MASTER_MYPID else - $ECHO "master responded to SIGTERM " + $ECHO "master responded to SIGTERM " fi fi MASTER_RUNNING=0 @@ -886,21 +922,20 @@ mysql_stop () stop_slave 1 stop_slave 2 $ECHO "Slave shutdown finished" - + return 1 } -mysql_restart () { - - mysql_stop - mysql_start - - return 1 +mysql_restart () +{ + mysql_stop + mysql_start + return 1 } mysql_loadstd () { - - # cp $STD_DATA/*.frm $STD_DATA/*.MRG $MASTER_MYDDIR/test + + # cp $STD_DATA/*.frm $STD_DATA/*.MRG $MASTER_MYDDIR/test return 1 } @@ -916,9 +951,9 @@ run_testcase () SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0` if [ $USE_MANAGER = 1 ] ; then many_slaves=`$EXPR \( $tname : rpl_failsafe \) != 0` - fi - - if [ -n "$SKIP_TEST" ] ; then + fi + + if [ -n "$SKIP_TEST" ] ; then SKIP_THIS_TEST=`$EXPR \( $tname : "$SKIP_TEST" \) != 0` if [ x$SKIP_THIS_TEST = x1 ] ; then @@ -926,7 +961,7 @@ run_testcase () fi fi - if [ -n "$DO_TEST" ] ; then + if [ -n "$DO_TEST" ] ; then DO_THIS_TEST=`$EXPR \( $tname : "$DO_TEST" \) != 0` if [ x$DO_THIS_TEST = x0 ] ; then @@ -961,10 +996,10 @@ run_testcase () EXTRA_MASTER_OPT="" stop_master start_master - fi + fi fi do_slave_restart=0 - + if [ -f $slave_opt_file ] ; then EXTRA_SLAVE_OPT=`$CAT $slave_opt_file` @@ -973,8 +1008,8 @@ run_testcase () if [ ! -z "$EXTRA_SLAVE_OPT" ] || [ x$SLAVE_RUNNING != x1 ] ; then EXTRA_SLAVE_OPT="" - do_slave_restart=1 - fi + do_slave_restart=1 + fi fi if [ -f $slave_master_info_file ] ; then @@ -984,8 +1019,8 @@ run_testcase () if [ ! -z "$SLAVE_MASTER_INFO" ] || [ x$SLAVE_RUNNING != x1 ] ; then SLAVE_MASTER_INFO="" - do_slave_restart=1 - fi + do_slave_restart=1 + fi fi if [ x$do_slave_restart = x1 ] ; then @@ -998,7 +1033,7 @@ run_testcase () fi fi cd $MYSQL_TEST_DIR - + if [ -f $tf ] ; then $RM -f r/$tname.*reject mysql_test_args="-R r/$tname.result $EXTRA_MYSQL_TEST_OPT" @@ -1007,7 +1042,7 @@ run_testcase () else do_gdb_test "$mysql_test_args" "$tf" fi - + res=$? if [ $res = 0 ]; then @@ -1028,12 +1063,12 @@ run_testcase () timestr="$USERT $SYST $REALT" pname=`$ECHO "$tname "|$CUT -c 1-24` RES="$pname $timestr" - + if [ x$many_slaves = x1 ] ; then stop_slave 1 stop_slave 2 fi - + if [ $res = 0 ]; then total_inc pass_inc @@ -1061,7 +1096,7 @@ run_testcase () fi exit 1 fi - + if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ] then mysql_restart @@ -1073,26 +1108,47 @@ run_testcase () fi } - ###################################################################### # Main script starts here ###################################################################### [ "$DO_GCOV" -a ! -x "$GCOV" ] && error "No gcov found" -[ "$DO_GCOV" ] && gcov_prepare -[ "$DO_GPROF" ] && gprof_prepare +[ "$DO_GCOV" ] && gcov_prepare +[ "$DO_GPROF" ] && gprof_prepare -# Ensure that no old mysqld test servers are running if [ -z "$USE_RUNNING_SERVER" ] then + # Ensure that no old mysqld test servers are running $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 + $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 + $MYSQLADMIN --no-defaults --host=$hostname --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 + $MYSQLADMIN --no-defaults --host=$hostname --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 + sleep_until_file_deleted $MASTER_MYPID + sleep_until_file_deleted $SLAVE_MYPID + + # Kill any running managers + if [ -f "$MANAGER_PID_FILE" ] + then + kill `cat $MANAGER_PID_FILE` + sleep 1 + if [ -f "$MANAGER_PID_FILE" ] + then + kill -9 `cat $MANAGER_PID_FILE` + sleep 1 + fi + fi + + # Remove files that can cause problems + $RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/* + $ECHO "Installing Test Databases" mysql_install_db start_manager -#do not automagically start deamons if we are in gdb or running only one test -#case + +# Do not automagically start deamons if we are in gdb or running only one test +# case if [ -z "$DO_GDB" ] && [ -z "$DO_DDD" ] then mysql_start @@ -1110,24 +1166,24 @@ $ECHO "Starting Tests" if [ "$DO_BENCH" = 1 ] then - BENCHDIR=$BASEDIR/sql-bench/ - savedir=`pwd` - cd $BENCHDIR - if [ -z "$1" ] - then - ./run-all-tests --socket=$MASTER_MYSOCK --user=root - else - if [ -x "./$1" ] + BENCHDIR=$BASEDIR/sql-bench/ + savedir=`pwd` + cd $BENCHDIR + if [ -z "$1" ] then - ./$1 --socket=$MASTER_MYSOCK --user=root + ./run-all-tests --socket=$MASTER_MYSOCK --user=root else - echo "benchmark $1 not found" + if [ -x "./$1" ] + then + ./$1 --socket=$MASTER_MYSOCK --user=root + else + echo "benchmark $1 not found" + fi fi - fi - cd $savedir - mysql_stop - stop_manager - exit + cd $savedir + mysql_stop + stop_manager + exit fi $ECHO @@ -1145,7 +1201,7 @@ then done $RM -f $TIMEFILE # Remove for full test fi -else +else while [ ! -z "$1" ]; do tname=`$BASENAME $1 .test` tf=$TESTDIR/$tname.$TESTSUFFIX diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index f16c72d148a..e6ba5fa83de 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -291,10 +291,4 @@ show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 reset query cache; -show variables like "query_cache_size"; -Variable_name Value -query_cache_size 1039700 -show status like "Qcache_free_memory"; -Variable_name Value -Qcache_free_memory 1039700 drop table t1; diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index e75841dc6d0..efa1744feee 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -38,7 +38,6 @@ INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1'); SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; - drop table test.t1,test.t2; # @@ -220,3 +219,27 @@ select 1+1, "a",count(*) from t1 where foo in (2); insert into t1 values (1); select 1+1,"a",count(*) from t1 where foo in (2); drop table t1; + +# +# Test GROUP BY DESC + +CREATE TABLE t1 ( + spID int(10) unsigned, + userID int(10) unsigned, + score smallint(5) unsigned, + key (spid), + key (score) +); + +INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3); +explain select userid,count(*) from t1 group by userid desc; +select userid,count(*) from t1 group by userid desc; +explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; +explain select spid,count(*) from t1 where spid between 1 and 2 group by spid; +select spid,count(*) from t1 where spid between 1 and 2 group by spid; +select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; +explain select sql_big_result spid,sum(userid) from t1 group by spid desc; +select sql_big_result spid,sum(userid) from t1 group by spid desc; +explain select sql_big_result score,count(*) from t1 group by score desc; +select sql_big_result score,count(*) from t1 group by score desc; +drop table t1; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index e9e138c9b61..59ea6d8777b 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -178,6 +178,9 @@ enable_result_log; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; reset query cache; -show variables like "query_cache_size"; -show status like "Qcache_free_memory"; drop table t1; + +# The following tests can't be done as the values differen on 32 and 64 bit +# machines :( +#show variables like "query_cache_size"; +#show status like "Qcache_free_memory"; diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 5e07a3529ea..4417af44907 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -2672,6 +2672,7 @@ uint Query_cache::filename_2_table_key (char *key, const char *path) void Query_cache::wreck(uint line, const char *message) { + THD *thd=current_thd; DBUG_ENTER("Query_cache::wreck"); query_cache_size = 0; if (*message) @@ -2679,7 +2680,8 @@ void Query_cache::wreck(uint line, const char *message) DBUG_PRINT("warning", ("==================================")); DBUG_PRINT("warning", ("%5d QUERY CACHE WRECK => DISABLED",line)); DBUG_PRINT("warning", ("==================================")); - current_thd->killed = 1; + if (thd) + thd->killed = 1; bins_dump(); cache_dump(); DBUG_VOID_RETURN; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index cfc40bdfdc3..c168ce775fc 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -480,7 +480,9 @@ mysql_select(THD *thd,TABLE_LIST *tables,List &fields,COND *conds, (thd->select_limit == HA_POS_ERROR || (join.select_options & OPTION_FOUND_ROWS) || order && - !(skip_sort_order=test_if_skip_sort_order(&join.join_tab[join.const_tables], order, thd->select_limit,1)))) + !(skip_sort_order= + test_if_skip_sort_order(&join.join_tab[join.const_tables], + order, thd->select_limit,1)))) { if ((group=create_distinct_group(order,fields))) { @@ -5272,13 +5274,6 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys) } -/***************************************************************************** -** If not selecting by given key, create an index how records should be read -** return: 0 ok -** -1 some fatal error -** 1 no records -*****************************************************************************/ - /* Return 1 if we don't have to do file sorting */ static bool @@ -5391,6 +5386,14 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, DBUG_RETURN(0); // Can't use index. } + +/***************************************************************************** + If not selecting by given key, create an index how records should be read + return: 0 ok + -1 some fatal error + 1 no records +*****************************************************************************/ + static int create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c03cd3677c9..1d4c39823ca 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -509,7 +509,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ulonglong_num %type - literal text_literal insert_ident group_ident order_ident + literal text_literal insert_ident order_ident simple_ident select_item2 expr opt_expr opt_else sum_expr in_sum_expr table_wild opt_pad no_in_expr expr_expr simple_expr no_and_expr using_list @@ -1394,7 +1394,7 @@ select_lock_type: /* empty */ | FOR_SYM UPDATE_SYM { Lex->lock_option= TL_WRITE; current_thd->safe_to_cache_query=0; } - | IN_SYM SHARE_SYM MODE_SYM + | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM { Lex->lock_option= TL_READ_WITH_SHARED_LOCKS; current_thd->safe_to_cache_query=0; } select_item_list: @@ -2069,10 +2069,10 @@ group_clause: | GROUP BY group_list group_list: - group_list ',' group_ident - { if (add_group_to_list($3,(bool) 1)) YYABORT; } - | group_ident - { if (add_group_to_list($1,(bool) 1)) YYABORT; } + group_list ',' order_ident order_dir + { if (add_group_to_list($3,(bool) $4)) YYABORT; } + | order_ident order_dir + { if (add_group_to_list($1,(bool) $2)) YYABORT; } /* ** Order by statement in select @@ -2083,7 +2083,7 @@ opt_order_clause: | order_clause order_clause: - ORDER_SYM BY { Select->sort_default=1; } order_list + ORDER_SYM BY order_list order_list: order_list ',' order_ident order_dir @@ -2093,8 +2093,8 @@ order_list: order_dir: /* empty */ { $$ = 1; } - | ASC { $$ = Select->sort_default=1; } - | DESC { $$ = Select->sort_default=0; } + | ASC { $$ =1; } + | DESC { $$ =0; } limit_clause: @@ -2813,9 +2813,6 @@ table_wild: | ident '.' ident '.' '*' { $$ = new Item_field((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS : $1.str),$3.str,"*"); } -group_ident: - order_ident order_dir - order_ident: expr { $$=$1; } diff --git a/tests/myisam-big-rows.tst b/tests/myisam-big-rows.tst new file mode 100644 index 00000000000..56c06f4820f --- /dev/null +++ b/tests/myisam-big-rows.tst @@ -0,0 +1,72 @@ +# +# Test rows with length above > 16M +# Note that for this to work, you should start mysqld with +# -O max_allowed_packet=32M +# + +drop table if exists t1; +create table t1 (a tinyint not null auto_increment, b longblob not null, primary key (a)) checksum=1; + +insert into t1 (b) values(repeat(char(65),10)); +insert into t1 (b) values(repeat(char(66),10)); +insert into t1 (b) values(repeat(char(67),10)); +update t1 set b=repeat(char(68),16777216) where a=1; +check table t1; +update t1 set b=repeat(char(69),16777000) where a=2; +update t1 set b=repeat(char(70),167) where a=3; +update t1 set b=repeat(char(71),16778000) where a=1; +update t1 set b=repeat(char(72),16778000) where a=3; +select a,length(b) from t1; +set @a=1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +update t1 set b=('A') where a=5; +delete from t1 where a=7; +set @a=@a+1; +insert into t1 (b) values (repeat(char(73+@a),16777200+@a)); +update t1 set b=repeat(char(73+@a+1),17000000+@a) where a=last_insert_id(); + +select a,mid(b,1,5),length(b) from t1; +check table t1; +repair table t1; +check table t1; +select a from table where b<>repeat(mid(b,1,1),length(b)); +delete from t1 where (a & 1); +select a from table where b<>repeat(mid(b,1,1),length(b)); +check table t1; +repair table t1; +check table t1; +drop table t1;