Merge maint2.mysql.com:/data/localhome/tsmith/bk/mrg/g51

into  maint2.mysql.com:/data/localhome/tsmith/bk/mrg/51
This commit is contained in:
tsmith@maint2.mysql.com 2006-09-12 19:40:00 +02:00
commit a1c4a48b7e
221 changed files with 11572 additions and 9808 deletions

View File

@ -692,6 +692,7 @@ mysql-test/*.ds?
mysql-test/*.vcproj mysql-test/*.vcproj
mysql-test/gmon.out mysql-test/gmon.out
mysql-test/install_test_db mysql-test/install_test_db
mysql-test/mtr
mysql-test/mysql-test-run mysql-test/mysql-test-run
mysql-test/mysql-test-run.log mysql-test/mysql-test-run.log
mysql-test/mysql_test_run_new mysql-test/mysql_test_run_new
@ -1170,6 +1171,7 @@ sql/*.ds?
sql/*.vcproj sql/*.vcproj
sql/.gdbinit sql/.gdbinit
sql/client.c sql/client.c
sql/f.c
sql/gen_lex_hash sql/gen_lex_hash
sql/gmon.out sql/gmon.out
sql/handlerton.cc sql/handlerton.cc

View File

@ -51,7 +51,7 @@ parse_options()
######################################################################## ########################################################################
if ! test -f sql/mysqld.cc if test ! -f sql/mysqld.cc
then then
echo "You must run this script from the MySQL top-level directory" echo "You must run this script from the MySQL top-level directory"
exit 1 exit 1
@ -185,12 +185,6 @@ fi
# (returns 0 if finds lines) # (returns 0 if finds lines)
if ccache -V > /dev/null 2>&1 if ccache -V > /dev/null 2>&1
then then
if ! (echo "$CC" | grep "ccache" > /dev/null) echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
then echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
CC="ccache $CC"
fi
if ! (echo "$CXX" | grep "ccache" > /dev/null)
then
CXX="ccache $CXX"
fi
fi fi

View File

@ -3,8 +3,8 @@
# Check cpu of current machine and find the # Check cpu of current machine and find the
# best compiler optimization flags for gcc # best compiler optimization flags for gcc
# #
#
check_cpu () {
if test -r /proc/cpuinfo ; then if test -r /proc/cpuinfo ; then
# on Linux (and others?) we can get detailed CPU information out of /proc # on Linux (and others?) we can get detailed CPU information out of /proc
cpuinfo="cat /proc/cpuinfo" cpuinfo="cat /proc/cpuinfo"
@ -121,7 +121,7 @@ esac
if test -z "$cpu_arg"; then if test -z "$cpu_arg"; then
echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using." echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using." >&2
check_cpu_cflags="" check_cpu_cflags=""
return return
fi fi
@ -177,16 +177,17 @@ esac
touch __test.c touch __test.c
while [ "$cpu_arg" ] ; do while [ "$cpu_arg" ] ; do
echo -n testing $cpu_arg "... " # FIXME: echo -n isn't portable - see contortions autoconf goes through
echo -n testing $cpu_arg "... " >&2
# compile check # compile check
check_cpu_cflags=`eval echo $check_cpu_args` check_cpu_cflags=`eval echo $check_cpu_args`
if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then
echo ok echo ok >&2
break; break;
fi fi
echo failed echo failed >&2
check_cpu_cflags="" check_cpu_cflags=""
# if compile failed: check whether it supports a predecessor of this CPU # if compile failed: check whether it supports a predecessor of this CPU
@ -212,4 +213,6 @@ while [ "$cpu_arg" ] ; do
done done
rm __test.* rm __test.*
}
check_cpu

44
bdb/CMakeLists.txt Executable file
View File

@ -0,0 +1,44 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/bdb/build_win32
${CMAKE_SOURCE_DIR}/bdb/dbinc
${CMAKE_SOURCE_DIR}/bdb)
# BDB needs a number of source files that are auto-generated by the unix
# configure. So to build BDB, it is necessary to copy these over to the Windows
# bitkeeper tree, or to use a source .tar.gz package which already has these
# files.
ADD_LIBRARY(bdb btree/bt_compare.c btree/bt_conv.c btree/bt_curadj.c btree/bt_cursor.c
btree/bt_delete.c btree/bt_method.c btree/bt_open.c btree/bt_put.c btree/bt_rec.c
btree/bt_reclaim.c btree/bt_recno.c btree/bt_rsearch.c btree/bt_search.c
btree/bt_split.c btree/bt_stat.c btree/bt_upgrade.c btree/bt_verify.c btree/btree_auto.c
db/crdel_auto.c db/crdel_rec.c db/db.c db/db_am.c db/db_auto.c common/db_byteorder.c
db/db_cam.c db/db_conv.c db/db_dispatch.c db/db_dup.c common/db_err.c common/db_getlong.c
common/db_idspace.c db/db_iface.c db/db_join.c common/db_log2.c db/db_meta.c
db/db_method.c db/db_open.c db/db_overflow.c db/db_pr.c db/db_rec.c db/db_reclaim.c
db/db_remove.c db/db_rename.c db/db_ret.c env/db_salloc.c env/db_shash.c db/db_truncate.c
db/db_upg.c db/db_upg_opd.c db/db_vrfy.c db/db_vrfyutil.c dbm/dbm.c dbreg/dbreg.c
dbreg/dbreg_auto.c dbreg/dbreg_rec.c dbreg/dbreg_util.c env/env_file.c env/env_method.c
env/env_open.c env/env_recover.c env/env_region.c fileops/fileops_auto.c fileops/fop_basic.c
fileops/fop_rec.c fileops/fop_util.c hash/hash.c hash/hash_auto.c hash/hash_conv.c
hash/hash_dup.c hash/hash_func.c hash/hash_meta.c hash/hash_method.c hash/hash_open.c
hash/hash_page.c hash/hash_rec.c hash/hash_reclaim.c hash/hash_stat.c hash/hash_upgrade.c
hash/hash_verify.c hmac/hmac.c hsearch/hsearch.c lock/lock.c lock/lock_deadlock.c
lock/lock_method.c lock/lock_region.c lock/lock_stat.c lock/lock_util.c log/log.c
log/log_archive.c log/log_compare.c log/log_get.c log/log_method.c log/log_put.c
mp/mp_alloc.c mp/mp_bh.c mp/mp_fget.c mp/mp_fopen.c mp/mp_fput.c
mp/mp_fset.c mp/mp_method.c mp/mp_region.c mp/mp_register.c mp/mp_stat.c mp/mp_sync.c
mp/mp_trickle.c mutex/mut_tas.c mutex/mut_win32.c mutex/mutex.c os_win32/os_abs.c
os/os_alloc.c os_win32/os_clock.c os_win32/os_config.c os_win32/os_dir.c os_win32/os_errno.c
os_win32/os_fid.c os_win32/os_fsync.c os_win32/os_handle.c os/os_id.c os_win32/os_map.c
os/os_method.c os/os_oflags.c os_win32/os_open.c os/os_region.c os_win32/os_rename.c
os/os_root.c os/os_rpath.c os_win32/os_rw.c os_win32/os_seek.c os_win32/os_sleep.c
os_win32/os_spin.c os_win32/os_stat.c os/os_tmpdir.c os_win32/os_type.c os/os_unlink.c
qam/qam.c qam/qam_auto.c qam/qam_conv.c qam/qam_files.c qam/qam_method.c qam/qam_open.c
qam/qam_rec.c qam/qam_stat.c qam/qam_upgrade.c qam/qam_verify.c rep/rep_method.c
rep/rep_record.c rep/rep_region.c rep/rep_util.c hmac/sha1.c
clib/strcasecmp.c txn/txn.c txn/txn_auto.c txn/txn_method.c txn/txn_rec.c
txn/txn_recover.c txn/txn_region.c txn/txn_stat.c txn/txn_util.c common/util_log.c
common/util_sig.c xa/xa.c xa/xa_db.c xa/xa_map.c)

View File

@ -338,7 +338,7 @@ static void end_timer(ulong start_time,char *buff);
static void mysql_end_timer(ulong start_time,char *buff); static void mysql_end_timer(ulong start_time,char *buff);
static void nice_time(double sec,char *buff,bool part_second); static void nice_time(double sec,char *buff,bool part_second);
static sig_handler mysql_end(int sig); static sig_handler mysql_end(int sig);
static sig_handler mysql_sigint(int sig); static sig_handler handle_sigint(int sig);
int main(int argc,char *argv[]) int main(int argc,char *argv[])
{ {
@ -420,8 +420,7 @@ int main(int argc,char *argv[])
if (opt_sigint_ignore) if (opt_sigint_ignore)
signal(SIGINT, SIG_IGN); signal(SIGINT, SIG_IGN);
else else
signal(SIGINT, mysql_sigint); // Catch SIGINT to clean up signal(SIGINT, handle_sigint); // Catch SIGINT to clean up
signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up
/* /*
@ -489,28 +488,6 @@ int main(int argc,char *argv[])
#endif #endif
} }
sig_handler mysql_sigint(int sig)
{
char kill_buffer[40];
MYSQL *kill_mysql= NULL;
signal(SIGINT, mysql_sigint);
/* terminate if no query being executed, or we already tried interrupting */
if (!executing_query || interrupted_query++)
mysql_end(sig);
kill_mysql= mysql_init(kill_mysql);
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
"", opt_mysql_port, opt_mysql_unix_port,0))
mysql_end(sig);
/* kill_buffer is always big enough because max length of %lu is 15 */
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
mysql_close(kill_mysql);
tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
}
sig_handler mysql_end(int sig) sig_handler mysql_end(int sig)
{ {
mysql_close(&mysql); mysql_close(&mysql);
@ -1058,8 +1035,6 @@ static int read_and_execute(bool interactive)
if (opt_outfile && glob_buffer.is_empty()) if (opt_outfile && glob_buffer.is_empty())
fflush(OUTFILE); fflush(OUTFILE);
interrupted_query= 0;
#if defined( __WIN__) || defined(__NETWARE__) #if defined( __WIN__) || defined(__NETWARE__)
tee_fputs(prompt, stdout); tee_fputs(prompt, stdout);
#if defined(__NETWARE__) #if defined(__NETWARE__)
@ -1982,6 +1957,9 @@ com_charset(String *buffer __attribute__((unused)), char *line)
if (new_cs) if (new_cs)
{ {
charset_info= new_cs; charset_info= new_cs;
mysql_set_character_set(&mysql, charset_info->csname);
default_charset= (char *)charset_info->csname;
default_charset_used= 1;
put_info("Charset changed", INFO_INFO); put_info("Charset changed", INFO_INFO);
} }
else put_info("Charset is not found", INFO_INFO); else put_info("Charset is not found", INFO_INFO);
@ -2041,9 +2019,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
} }
timer=start_timer(); timer=start_timer();
executing_query= 1; executing_query= 1;
error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length()); error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length());
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
@ -2059,7 +2035,6 @@ com_go(String *buffer,char *line __attribute__((unused)))
{ {
executing_query= 0; executing_query= 0;
buffer->length(0); // Remove query on error buffer->length(0); // Remove query on error
executing_query= 0;
return error; return error;
} }
error=0; error=0;
@ -2143,9 +2118,6 @@ com_go(String *buffer,char *line __attribute__((unused)))
fflush(stdout); fflush(stdout);
mysql_free_result(result); mysql_free_result(result);
} while (!(err= mysql_next_result(&mysql))); } while (!(err= mysql_next_result(&mysql)));
executing_query= 0;
if (err >= 1) if (err >= 1)
error= put_error(&mysql); error= put_error(&mysql);
@ -2362,7 +2334,12 @@ print_table_data(MYSQL_RES *result)
(void) tee_fputs("|", PAGER); (void) tee_fputs("|", PAGER);
for (uint off=0; (field = mysql_fetch_field(result)) ; off++) for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
{ {
tee_fprintf(PAGER, " %-*s |",(int) min(field->max_length, uint name_length= (uint) strlen(field->name);
uint numcells= charset_info->cset->numcells(charset_info,
field->name,
field->name + name_length);
uint display_length= field->max_length + name_length - numcells;
tee_fprintf(PAGER, " %-*s |",(int) min(display_length,
MAX_COLUMN_LENGTH), MAX_COLUMN_LENGTH),
field->name); field->name);
num_flag[off]= IS_NUM(field->type); num_flag[off]= IS_NUM(field->type);

View File

@ -157,17 +157,29 @@ static int create_defaults_file(const char *path, const char *our_defaults_path)
File our_defaults_file, defaults_file; File our_defaults_file, defaults_file;
char buffer[512]; char buffer[512];
char *buffer_end; char *buffer_end;
int failed_to_open_count= 0;
int error; int error;
/* check if the defaults file is needed at all */ /* check if the defaults file is needed at all */
if (!opt_password) if (!opt_password)
return 0; return 0;
defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY, retry_open:
defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY | O_EXCL,
MYF(MY_FAE | MY_WME)); MYF(MY_FAE | MY_WME));
if (defaults_file < 0) if (defaults_file < 0)
{
if (failed_to_open_count == 0)
{
remove(path);
failed_to_open_count+= 1;
goto retry_open;
}
else
return 1; return 1;
}
upgrade_defaults_created= 1; upgrade_defaults_created= 1;
if (our_defaults_path) if (our_defaults_path)
{ {

View File

@ -430,7 +430,9 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
int string_value); int string_value);
static int dump_selected_tables(char *db, char **table_names, int tables); static int dump_selected_tables(char *db, char **table_names, int tables);
static int dump_all_tables_in_db(char *db); static int dump_all_tables_in_db(char *db);
static int init_dumping(char *); static int init_dumping_views(char *);
static int init_dumping_tables(char *);
static int init_dumping(char *, int init_func(char*));
static int dump_databases(char **); static int dump_databases(char **);
static int dump_all_databases(); static int dump_all_databases();
static char *quote_name(const char *name, char *buff, my_bool force); static char *quote_name(const char *name, char *buff, my_bool force);
@ -861,8 +863,9 @@ static int get_options(int *argc, char ***argv)
static void DB_error(MYSQL *mysql, const char *when) static void DB_error(MYSQL *mysql, const char *when)
{ {
DBUG_ENTER("DB_error"); DBUG_ENTER("DB_error");
my_printf_error(0,"Got error: %d: %s %s", MYF(0), fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
mysql_errno(mysql), mysql_error(mysql), when); mysql_errno(mysql), mysql_error(mysql), when);
fflush(stderr);
safe_exit(EX_MYSQLERR); safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} /* DB_error */ } /* DB_error */
@ -890,8 +893,9 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
if (mysql_query(mysql_con, query) || if (mysql_query(mysql_con, query) ||
(res && !((*res)= mysql_store_result(mysql_con)))) (res && !((*res)= mysql_store_result(mysql_con))))
{ {
my_printf_error(0, "Couldn't execute '%s': %s (%d)", MYF(0), fprintf(stderr, "%s: Couldn't execute '%s': %s (%d)\n",
query, mysql_error(mysql_con), mysql_errno(mysql_con)); my_progname, query,
mysql_error(mysql_con), mysql_errno(mysql_con));
safe_exit(EX_MYSQLERR); safe_exit(EX_MYSQLERR);
return 1; return 1;
} }
@ -2378,7 +2382,10 @@ static void dump_table(char *table, char *db)
check_io(md_result_file); check_io(md_result_file);
} }
if (mysql_query_with_error_report(mysql, 0, query)) if (mysql_query_with_error_report(mysql, 0, query))
{
DB_error(mysql, "when retrieving data from server"); DB_error(mysql, "when retrieving data from server");
goto err;
}
if (quick) if (quick)
res=mysql_use_result(mysql); res=mysql_use_result(mysql);
else else
@ -2905,31 +2912,36 @@ static int dump_databases(char **db_names)
} /* dump_databases */ } /* dump_databases */
static int init_dumping(char *database)
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
return 1;
if (mysql_select_db(mysql, database))
{
DB_error(mysql, "when selecting the database");
return 1; /* If --force */
}
if (!path && !opt_xml)
{
if (opt_databases || opt_alldbs)
{
/* /*
length of table name * 2 (if name contains quotes), 2 quotes and 0 View Specific database initalization.
SYNOPSIS
init_dumping_views
qdatabase quoted name of the database
RETURN VALUES
0 Success.
1 Failure.
*/ */
char quoted_database_buf[NAME_LEN*2+3]; int init_dumping_views(char *qdatabase)
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted); {
if (opt_comments) return 0;
} /* init_dumping_views */
/*
Table Specific database initalization.
SYNOPSIS
init_dumping_tables
qdatabase quoted name of the database
RETURN VALUES
0 Success.
1 Failure.
*/
int init_dumping_tables(char *qdatabase)
{ {
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
if (!opt_create_db) if (!opt_create_db)
{ {
char qbuf[256]; char qbuf[256];
@ -2964,6 +2976,40 @@ static int init_dumping(char *database)
} }
} }
} }
return 0;
} /* init_dumping_tables */
static int init_dumping(char *database, int init_func(char*))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
return 1;
if (mysql_select_db(mysql, database))
{
DB_error(mysql, "when selecting the database");
return 1; /* If --force */
}
if (!path && !opt_xml)
{
if (opt_databases || opt_alldbs)
{
/*
length of table name * 2 (if name contains quotes), 2 quotes and 0
*/
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
if (opt_comments)
{
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
/* Call the view or table specific function */
init_func(qdatabase);
fprintf(md_result_file,"\nUSE %s;\n", qdatabase); fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
check_io(md_result_file); check_io(md_result_file);
} }
@ -2997,7 +3043,7 @@ static int dump_all_tables_in_db(char *database)
if (!strcmp(database, NDB_REP_DB)) /* Skip cluster internal database */ if (!strcmp(database, NDB_REP_DB)) /* Skip cluster internal database */
return 0; return 0;
if (init_dumping(database)) if (init_dumping(database, init_dumping_tables))
return 1; return 1;
if (opt_xml) if (opt_xml)
print_xml_tag1(md_result_file, "", "database name=", database, "\n"); print_xml_tag1(md_result_file, "", "database name=", database, "\n");
@ -3075,23 +3121,8 @@ static my_bool dump_all_views_in_db(char *database)
uint numrows; uint numrows;
char table_buff[NAME_LEN*2+3]; char table_buff[NAME_LEN*2+3];
if (mysql_select_db(mysql, database)) if (init_dumping(database, init_dumping_views))
{
DB_error(mysql, "when selecting the database");
return 1; return 1;
}
if (opt_databases || opt_alldbs)
{
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
if (opt_comments)
{
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
check_io(md_result_file);
}
if (opt_xml) if (opt_xml)
print_xml_tag1(md_result_file, "", "database name=", database, "\n"); print_xml_tag1(md_result_file, "", "database name=", database, "\n");
if (lock_tables) if (lock_tables)
@ -3186,7 +3217,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
char **dump_tables, **pos, **end; char **dump_tables, **pos, **end;
DBUG_ENTER("dump_selected_tables"); DBUG_ENTER("dump_selected_tables");
if (init_dumping(db)) if (init_dumping(db, init_dumping_tables))
DBUG_RETURN(1); DBUG_RETURN(1);
init_alloc_root(&root, 8192, 0); init_alloc_root(&root, 8192, 0);

View File

@ -5527,6 +5527,9 @@ int main(int argc, char **argv)
if ( opt_mark_progress ) if ( opt_mark_progress )
dump_progress(result_file); dump_progress(result_file);
dynstr_free(&ds_progress); dynstr_free(&ds_progress);
dynstr_free(&ds_res);
if (!got_end_timer) if (!got_end_timer)
timer_output(); /* No end_timer cmd, end it */ timer_output(); /* No end_timer cmd, end it */
free_used_memory(); free_used_memory();

View File

@ -71,19 +71,18 @@
* *
*/ */
#include <my_global.h> #include <my_global.h>
/* This file won't compile unless DBUG_OFF is undefined locally */
#ifdef DBUG_OFF
#undef DBUG_OFF
#endif
#include <m_string.h> #include <m_string.h>
#include <errno.h> #include <errno.h>
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
#include <process.h> #include <process.h>
#endif #endif
#ifndef DBUG_OFF
/* /*
* Manifest constants which may be "tuned" if desired. * Manifest constants which may be "tuned" if desired.
*/ */
@ -316,6 +315,7 @@ static unsigned long Clock(void);
#define ChangeOwner(cs,name) #define ChangeOwner(cs,name)
#endif #endif
/* /*
** Macros to allow dbugging with threads ** Macros to allow dbugging with threads
*/ */
@ -2354,3 +2354,5 @@ va_list ap;
} }
#endif /* NO_VARARGS */ #endif /* NO_VARARGS */
#endif

View File

@ -30,7 +30,7 @@ sub generate_prefix($$)
next; next;
} }
if ( /^\s*[a-zA-Z0-9*_ ]+\s+([_a-zA-Z0-9]+)\s*\(/ ) if ( /^\s*[a-zA-Z0-9*_ ]+\s+\*?([_a-zA-Z0-9]+)\s*\(/ )
{ {
print OUT "#define $1 ya$1\n"; print OUT "#define $1 ya$1\n";
} }

View File

@ -1,5 +1,6 @@
#define Copyright yaCopyright #define Copyright yaCopyright
#define yaSSL_CleanUp yayaSSL_CleanUp #define yaSSL_CleanUp yayaSSL_CleanUp
#define BN_bin2bn yaBN_bin2bn
#define DH_new yaDH_new #define DH_new yaDH_new
#define DH_free yaDH_free #define DH_free yaDH_free
#define RSA_free yaRSA_free #define RSA_free yaRSA_free
@ -92,6 +93,12 @@
#define SSL_want_read yaSSL_want_read #define SSL_want_read yaSSL_want_read
#define SSL_want_write yaSSL_want_write #define SSL_want_write yaSSL_want_write
#define SSL_pending yaSSL_pending #define SSL_pending yaSSL_pending
#define SSLv3_method yaSSLv3_method
#define SSLv3_server_method yaSSLv3_server_method
#define SSLv3_client_method yaSSLv3_client_method
#define TLSv1_server_method yaTLSv1_server_method
#define TLSv1_client_method yaTLSv1_client_method
#define SSLv23_server_method yaSSLv23_server_method
#define SSL_CTX_use_certificate_file yaSSL_CTX_use_certificate_file #define SSL_CTX_use_certificate_file yaSSL_CTX_use_certificate_file
#define SSL_CTX_use_PrivateKey_file yaSSL_CTX_use_PrivateKey_file #define SSL_CTX_use_PrivateKey_file yaSSL_CTX_use_PrivateKey_file
#define SSL_CTX_set_cipher_list yaSSL_CTX_set_cipher_list #define SSL_CTX_set_cipher_list yaSSL_CTX_set_cipher_list
@ -115,11 +122,13 @@
#define RAND_write_file yaRAND_write_file #define RAND_write_file yaRAND_write_file
#define RAND_load_file yaRAND_load_file #define RAND_load_file yaRAND_load_file
#define RAND_status yaRAND_status #define RAND_status yaRAND_status
#define RAND_bytes yaRAND_bytes
#define DES_set_key yaDES_set_key #define DES_set_key yaDES_set_key
#define DES_set_odd_parity yaDES_set_odd_parity #define DES_set_odd_parity yaDES_set_odd_parity
#define DES_ecb_encrypt yaDES_ecb_encrypt #define DES_ecb_encrypt yaDES_ecb_encrypt
#define SSL_CTX_set_default_passwd_cb_userdata yaSSL_CTX_set_default_passwd_cb_userdata #define SSL_CTX_set_default_passwd_cb_userdata yaSSL_CTX_set_default_passwd_cb_userdata
#define SSL_SESSION_free yaSSL_SESSION_free #define SSL_SESSION_free yaSSL_SESSION_free
#define SSL_peek yaSSL_peek
#define SSL_get_certificate yaSSL_get_certificate #define SSL_get_certificate yaSSL_get_certificate
#define SSL_get_privatekey yaSSL_get_privatekey #define SSL_get_privatekey yaSSL_get_privatekey
#define X509_get_pubkey yaX509_get_pubkey #define X509_get_pubkey yaX509_get_pubkey

View File

@ -29,7 +29,7 @@
#include "runtime.hpp" #include "runtime.hpp"
#include "misc.hpp" #include "misc.hpp"
#if !defined(YASSL_MYSQL_COMPATIBLE)
extern "C" { extern "C" {
// for libcurl configure test, these are the signatures they use // for libcurl configure test, these are the signatures they use
@ -37,6 +37,7 @@ extern "C" {
char CRYPTO_lock() { return 0;} char CRYPTO_lock() { return 0;}
char CRYPTO_add_lock() { return 0;} char CRYPTO_add_lock() { return 0;}
} // extern "C" } // extern "C"
#endif
#ifdef YASSL_PURE_C #ifdef YASSL_PURE_C

8
heap/CMakeLists.txt Executable file
View File

@ -0,0 +1,8 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(heap _check.c _rectest.c hp_block.c hp_clear.c hp_close.c hp_create.c
hp_delete.c hp_extra.c hp_hash.c hp_info.c hp_open.c hp_panic.c
hp_rename.c hp_rfirst.c hp_rkey.c hp_rlast.c hp_rnext.c hp_rprev.c
hp_rrnd.c hp_rsame.c hp_scan.c hp_static.c hp_update.c hp_write.c)

View File

@ -165,7 +165,6 @@ struct st_mysql_options {
char *ssl_ca; /* PEM CA file */ char *ssl_ca; /* PEM CA file */
char *ssl_capath; /* PEM directory of CA-s? */ char *ssl_capath; /* PEM directory of CA-s? */
char *ssl_cipher; /* cipher to use */ char *ssl_cipher; /* cipher to use */
my_bool ssl_verify_server_cert; /* if to verify server cert */
char *shared_memory_base_name; char *shared_memory_base_name;
unsigned long max_allowed_packet; unsigned long max_allowed_packet;
my_bool use_ssl; /* if to use SSL or not */ my_bool use_ssl; /* if to use SSL or not */

View File

@ -138,8 +138,10 @@ enum enum_server_command
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */ #define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */ #define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */ #define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */ #define CLIENT_MULTI_STATEMENTS (((ulong) 1) << 16) /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */ #define CLIENT_MULTI_RESULTS (((ulong) 1) << 17) /* Enable/disable multi-results */
#define CLIENT_SSL_VERIFY_SERVER_CERT (((ulong) 1) << 30)
#define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31) #define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31)
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ #define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */

35
innobase/CMakeLists.txt Executable file
View File

@ -0,0 +1,35 @@
#SET(CMAKE_CXX_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
#SET(CMAKE_C_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS(-DMYSQL_SERVER -D_WIN32 -DWIN32 -D_LIB)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include include)
ADD_LIBRARY(innobase btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
buf/buf0buf.c buf/buf0flu.c buf/buf0lru.c buf/buf0rea.c
data/data0data.c data/data0type.c
dict/dict0boot.c dict/dict0crea.c dict/dict0dict.c dict/dict0load.c dict/dict0mem.c
dyn/dyn0dyn.c
eval/eval0eval.c eval/eval0proc.c
fil/fil0fil.c
fsp/fsp0fsp.c
fut/fut0fut.c fut/fut0lst.c
ha/ha0ha.c ha/hash0hash.c
ibuf/ibuf0ibuf.c
pars/lexyy.c pars/pars0grm.c pars/pars0opt.c pars/pars0pars.c pars/pars0sym.c
lock/lock0lock.c
log/log0log.c log/log0recv.c
mach/mach0data.c
mem/mem0mem.c mem/mem0pool.c
mtr/mtr0log.c mtr/mtr0mtr.c
os/os0file.c os/os0proc.c os/os0sync.c os/os0thread.c
page/page0cur.c page/page0page.c
que/que0que.c
read/read0read.c
rem/rem0cmp.c rem/rem0rec.c
row/row0ins.c row/row0mysql.c row/row0purge.c row/row0row.c row/row0sel.c row/row0uins.c
row/row0umod.c row/row0undo.c row/row0upd.c row/row0vers.c
srv/srv0que.c srv/srv0srv.c srv/srv0start.c
sync/sync0arr.c sync/sync0rw.c sync/sync0sync.c
thr/thr0loc.c
trx/trx0purge.c trx/trx0rec.c trx/trx0roll.c trx/trx0rseg.c trx/trx0sys.c trx/trx0trx.c trx/trx0undo.c
usr/usr0sess.c
ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c )

26
myisam/CMakeLists.txt Executable file
View File

@ -0,0 +1,26 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(myisam ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c ft_stem.c
ft_stopwords.c ft_update.c mi_cache.c mi_changed.c mi_check.c
mi_checksum.c mi_close.c mi_create.c mi_dbug.c mi_delete.c
mi_delete_all.c mi_delete_table.c mi_dynrec.c mi_extra.c mi_info.c
mi_key.c mi_keycache.c mi_locking.c mi_log.c mi_open.c
mi_packrec.c mi_page.c mi_panic.c mi_preload.c mi_range.c mi_rename.c
mi_rfirst.c mi_rlast.c mi_rnext.c mi_rnext_same.c mi_rprev.c mi_rrnd.c
mi_rsame.c mi_rsamepos.c mi_scan.c mi_search.c mi_static.c mi_statrec.c
mi_unique.c mi_update.c mi_write.c rt_index.c rt_key.c rt_mbr.c
rt_split.c sort.c sp_key.c ft_eval.h myisamdef.h rt_index.h mi_rkey.c)
ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c)
TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(myisamchk myisamchk.c)
TARGET_LINK_LIBRARIES(myisamchk myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(myisamlog myisamlog.c)
TARGET_LINK_LIBRARIES(myisamlog myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(myisampack myisampack.c)
TARGET_LINK_LIBRARIES(myisampack myisam mysys dbug strings zlib wsock32)

9
myisammrg/CMakeLists.txt Executable file
View File

@ -0,0 +1,9 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(myisammrg myrg_close.c myrg_create.c myrg_delete.c myrg_extra.c myrg_info.c
myrg_locking.c myrg_open.c myrg_panic.c myrg_queue.c myrg_range.c
myrg_rfirst.c myrg_rkey.c myrg_rlast.c myrg_rnext.c myrg_rnext_same.c
myrg_rprev.c myrg_rrnd.c myrg_rsame.c myrg_static.c myrg_update.c
myrg_write.c)

View File

@ -24,7 +24,7 @@ benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh valgrind.supp $(PRESCRIPTS) EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh valgrind.supp $(PRESCRIPTS)
EXTRA_DIST = $(EXTRA_SCRIPTS) EXTRA_DIST = $(EXTRA_SCRIPTS)
GENSCRIPTS = mysql-test-run install_test_db GENSCRIPTS = mysql-test-run install_test_db mtr
PRESCRIPTS = mysql-test-run.pl PRESCRIPTS = mysql-test-run.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS) test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
test_DATA = std_data/client-key.pem std_data/client-cert.pem \ test_DATA = std_data/client-key.pem std_data/client-cert.pem \
@ -113,6 +113,10 @@ install-data-local:
uninstall-local: uninstall-local:
@RM@ -f -r $(DESTDIR)$(testdir) @RM@ -f -r $(DESTDIR)$(testdir)
# mtr - a shortcut for executing mysql-test-run.pl
mtr:
$(RM) -f mtr
$(LN_S) mysql-test-run.pl mtr
SUFFIXES = .sh SUFFIXES = .sh

View File

@ -102,7 +102,7 @@ sub collect_test_cases ($) {
if ( $mysqld_test_exists and $im_test_exists ) if ( $mysqld_test_exists and $im_test_exists )
{ {
mtr_error("Ambiguos test case name ($tname)"); mtr_error("Ambiguous test case name ($tname)");
} }
elsif ( ! $mysqld_test_exists and ! $im_test_exists ) elsif ( ! $mysqld_test_exists and ! $im_test_exists )
{ {
@ -157,34 +157,38 @@ sub collect_test_cases ($) {
if ( $::opt_reorder ) if ( $::opt_reorder )
{ {
@$cases = sort {
if ( ! $a->{'master_restart'} and ! $b->{'master_restart'} ) my %sort_criteria;
my $tinfo;
# Make a mapping of test name to a string that represents how that test
# should be sorted among the other tests. Put the most important criterion
# first, then a sub-criterion, then sub-sub-criterion, et c.
foreach $tinfo (@$cases)
{ {
return $a->{'name'} cmp $b->{'name'}; my @this_criteria = ();
# Append the criteria for sorting, in order of importance.
push(@this_criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~"); # Ending with "~" makes empty sort later than filled
push(@this_criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0"));
push(@this_criteria, "restart=" . ($tinfo->{'master_restart'} ? "1" : "0"));
push(@this_criteria, "big_test=" . ($tinfo->{'big_test'} ? "1" : "0"));
push(@this_criteria, join("|", sort keys %{$tinfo})); # Group similar things together. The values may differ substantially. FIXME?
push(@this_criteria, $tinfo->{'name'}); # Finally, order by the name
$sort_criteria{$tinfo->{"name"}} = join(" ", @this_criteria);
} }
if ( $a->{'master_restart'} and $b->{'master_restart'} ) @$cases = sort { $sort_criteria{$a->{"name"}} cmp $sort_criteria{$b->{"name"}}; } @$cases;
{
my $cmp= mtr_cmp_opts($a->{'master_opt'}, $b->{'master_opt'});
if ( $cmp == 0 )
{
return $a->{'name'} cmp $b->{'name'};
}
else
{
return $cmp;
}
}
if ( $a->{'master_restart'} ) ### For debugging the sort-order
{ # foreach $tinfo (@$cases)
return 1; # Is greater # {
} # print $sort_criteria{$tinfo->{"name"}};
else # print " -> \t";
{ # print $tinfo->{"name"};
return -1; # Is less # print "\n";
} # }
} @$cases;
} }
return $cases; return $cases;
@ -469,14 +473,6 @@ sub collect_one_test_case($$$$$$$) {
{ {
mtr_options_from_test_file($tinfo,"$testdir/${tname}.test"); mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
if ( ! $tinfo->{'innodb_test'} )
{
# mtr_verbose("Adding '--skip-innodb' to $tinfo->{'name'}");
# FIXME activate the --skip-innodb only when running with
# selected test cases
# push(@{$tinfo->{'master_opt'}}, "--skip-innodb");
}
if ( $tinfo->{'big_test'} and ! $::opt_big_test ) if ( $tinfo->{'big_test'} and ! $::opt_big_test )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;

View File

@ -139,6 +139,8 @@ sub mtr_copy_dir($$) {
my $from_dir= shift; my $from_dir= shift;
my $to_dir= shift; my $to_dir= shift;
# mtr_verbose("Copying from $from_dir to $to_dir");
mkpath("$to_dir"); mkpath("$to_dir");
opendir(DIR, "$from_dir") opendir(DIR, "$from_dir")
or mtr_error("Can't find $from_dir$!"); or mtr_error("Can't find $from_dir$!");

View File

@ -115,6 +115,8 @@ sub spawn_impl ($$$$$$$$) {
my $pid_file= shift; # FIXME my $pid_file= shift; # FIXME
my $spawn_opts= shift; my $spawn_opts= shift;
mtr_error("Can't spawn with empty \"path\"") unless defined $path;
if ( $::opt_script_debug ) if ( $::opt_script_debug )
{ {
print STDERR "\n"; print STDERR "\n";
@ -702,7 +704,7 @@ sub mtr_check_stop_servers ($) {
} }
else else
{ {
mtr_verbose("All ports where free, continuing"); mtr_verbose("All ports were free, continuing");
} }
} }
} }
@ -975,6 +977,7 @@ sub check_expected_crash_and_restart($)
sub mtr_record_dead_children () { sub mtr_record_dead_children () {
my $process_died= 0;
my $ret_pid; my $ret_pid;
# Wait without blockinng to see if any processes had died # Wait without blockinng to see if any processes had died
@ -983,7 +986,9 @@ sub mtr_record_dead_children () {
{ {
mtr_warning("mtr_record_dead_children: $ret_pid"); mtr_warning("mtr_record_dead_children: $ret_pid");
mark_process_dead($ret_pid); mark_process_dead($ret_pid);
$process_died= 1;
} }
return $process_died;
} }
sub start_reap_all { sub start_reap_all {

File diff suppressed because it is too large Load Diff

View File

@ -446,52 +446,6 @@ INSERT INTO t1 VALUES(1, 1);
ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment; ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY' ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY'
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
`a` int(11) default NULL,
`c` int(11) default NULL,
PRIMARY KEY (`k`),
UNIQUE KEY `idx_1` (`a`)
) ENGINE=InnoDB;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
2
select * from t2;
k a c
1 6 NULL
2 7 NULL
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
1
select * from t2;
k a c
1 6 1
2 7 NULL
insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id();
last_insert_id()
1
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
last_insert_id()
11
select * from t2;
k a c
1 6 1
2 7 NULL
10 8 1
11 15 1
12 20 1
drop table t2;
create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c)); create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));
insert into t1 values(null,1,1,now()); insert into t1 values(null,1,1,now());
insert into t1 values(null,0,0,null); insert into t1 values(null,0,0,null);

View File

@ -248,3 +248,14 @@ select rpad(c1,3,'
rpad(c1,3,'ö') rpad('ö',3,c1) rpad(c1,3,'ö') rpad('ö',3,c1)
ßöö ößß ßöö ößß
drop table t1; drop table t1;
set names koi8r;
create table t1(a char character set cp1251 default _koi8r 0xFF);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) CHARACTER SET cp1251 DEFAULT '˙'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(a char character set latin1 default _cp1251 0xFF);
ERROR 42000: Invalid default value for 'a'
End of 4.1 tests

View File

@ -730,6 +730,45 @@ id MIN(s)
1 ZZZ 1 ZZZ
2 ZZZ 2 ZZZ
DROP TABLE t1; DROP TABLE t1;
drop table if exists bug20536;
set names latin1;
create table bug20536 (id bigint not null auto_increment primary key, name
varchar(255) character set ucs2 not null);
insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
select md5(name) from bug20536;
md5(name)
f4b7ce8b45a20e3c4e84bef515d1525c
48d95db0d8305c2fe11548a3635c9385
select sha1(name) from bug20536;
sha1(name)
e0b52f38deddb9f9e8d5336b153592794cb49baf
677d4d505355eb5b0549b865fcae4b7f0c28aef5
select make_set(3, name, upper(name)) from bug20536;
make_set(3, name, upper(name))
test1,TEST1
'test\_2','TEST\_2'
select export_set(5, name, upper(name)) from bug20536;
export_set(5, name, upper(name))
test1,TEST1,test1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1
'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2'
select export_set(5, name, upper(name), ",", 5) from bug20536;
export_set(5, name, upper(name), ",", 5)
test1,TEST1,test1,TEST1,TEST1
'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2'
select password(name) from bug20536;
password(name)
????????????????????
????????????????????
select old_password(name) from bug20536;
old_password(name)
????????
????????
select quote(name) from bug20536;
quote(name)
????????
????????????????
drop table bug20536;
End of 4.1 tests
CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3)); CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0); INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
update t1 set b=a; update t1 set b=a;
@ -765,3 +804,4 @@ blob 65535 65535
text 65535 65535 text 65535 65535
text 65535 32767 text 65535 32767
drop table t1; drop table t1;
End of 5.0 tests

View File

@ -924,6 +924,37 @@ NULL
select ifnull(NULL, _utf8'string'); select ifnull(NULL, _utf8'string');
ifnull(NULL, _utf8'string') ifnull(NULL, _utf8'string')
string string
set names utf8;
create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
insert into t1 values ('I'),('K'),('Y');
select * from t1 where s1 < 'K' and s1 = 'Y';
s1
I
Y
select * from t1 where 'K' > s1 and s1 = 'Y';
s1
I
Y
drop table t1;
create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
select * from t1 where s1 > 'd' and s1 = 'CH';
s1
ch
CH
Ch
select * from t1 where 'd' < s1 and s1 = 'CH';
s1
ch
CH
Ch
select * from t1 where s1 = 'cH' and s1 <> 'ch';
s1
cH
select * from t1 where 'cH' = s1 and s1 <> 'ch';
s1
cH
drop table t1;
create table t1 (a varchar(255)) default character set utf8; create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0); insert into t1 values (1.0);
drop table t1; drop table t1;

View File

@ -87,6 +87,10 @@ SELECT IS_USED_LOCK('bug16501');
IS_USED_LOCK('bug16501') IS_USED_LOCK('bug16501')
NULL NULL
DROP TABLE t1; DROP TABLE t1;
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
export_set(3, _latin1'foo', _utf8'bar', ',', 4)
foo,foo,bar,bar
End of 4.1 tests
create table t1 as select uuid(), length(uuid()); create table t1 as select uuid(), length(uuid());
show create table t1; show create table t1;
Table Create Table Table Create Table
@ -130,3 +134,4 @@ timediff(b, a) >= '00:00:03'
drop table t2; drop table t2;
drop table t1; drop table t1;
set global query_cache_size=default; set global query_cache_size=default;
End of 5.0 tests

View File

@ -911,6 +911,18 @@ union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H); (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
H H
5 5
SET NAMES latin1;
SET character_set_results = NULL;
SHOW VARIABLES LIKE 'character_set_results';
Variable_name Value
character_set_results
CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
fmtddate field2
Sep-4 12:00AM abcd
DROP TABLE testBug8868;
SET NAMES DEFAULT;
End of 4.1 tests End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1, explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2; timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;

View File

@ -294,3 +294,4 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY; CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL); INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests

View File

@ -1295,24 +1295,16 @@ insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2; insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1; insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2; insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
select count(*) from t1; select count(*) from t1;
count(*) count(*)
29267 623
explain select * from t1 where c between 1 and 2500; explain select * from t1 where c between 1 and 2500;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 5 NULL # Using where 1 SIMPLE t1 range c c 5 NULL # Using where
update t1 set c=a; update t1 set c=a;
explain select * from t1 where c between 1 and 2500; explain select * from t1 where c between 1 and 2500;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 5 NULL # Using where 1 SIMPLE t1 ALL c NULL NULL NULL # Using where
drop table t1,t2; drop table t1,t2;
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb; create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
insert into t1 (id) values (null),(null),(null),(null),(null); insert into t1 (id) values (null),(null),(null),(null),(null);
@ -1786,10 +1778,10 @@ Variable_name Value
Innodb_rows_deleted 2070 Innodb_rows_deleted 2070
show status like "Innodb_rows_inserted"; show status like "Innodb_rows_inserted";
Variable_name Value Variable_name Value
Innodb_rows_inserted 31727 Innodb_rows_inserted 3083
show status like "Innodb_rows_updated"; show status like "Innodb_rows_updated";
Variable_name Value Variable_name Value
Innodb_rows_updated 29530 Innodb_rows_updated 886
show status like "Innodb_row_lock_waits"; show status like "Innodb_row_lock_waits";
Variable_name Value Variable_name Value
Innodb_row_lock_waits 0 Innodb_row_lock_waits 0

View File

@ -407,3 +407,71 @@ Warnings:
Warning 1071 Specified key was too long; max key length is 765 bytes Warning 1071 Specified key was too long; max key length is 765 bytes
insert into t1 values('aaa'); insert into t1 values('aaa');
drop table t1; drop table t1;
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
`a` int(11) default NULL,
`c` int(11) default NULL,
PRIMARY KEY (`k`),
UNIQUE KEY `idx_1` (`a`)
) ENGINE=InnoDB;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
2
select * from t2;
k a c
1 6 NULL
2 7 NULL
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
2
select last_insert_id(0);
last_insert_id(0)
0
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
0
select * from t2;
k a c
1 6 2
2 7 NULL
insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id();
last_insert_id()
0
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
last_insert_id()
11
select * from t2;
k a c
1 6 2
2 7 NULL
10 8 1
11 15 1
12 20 1
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1, k=last_insert_id(k);
select last_insert_id();
last_insert_id()
1
select * from t2;
k a c
1 6 3
2 7 NULL
10 8 1
11 15 1
12 20 1
drop table t2;

View File

@ -59,16 +59,16 @@ database()
test test
unlock tables; unlock tables;
drop table t1; drop table t1;
c_cp932 c_cp932
+----------------------+------------+--------+ +----------------------+------------+--------+
| concat('>',col1,'<') | col2 | col3 | | concat('>',col1,'<') | col2 | col3 |
+----------------------+------------+--------+ +----------------------+------------+--------+

View File

@ -1404,92 +1404,6 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1; DROP TABLE t1;
create database db1;
use db1;
CREATE TABLE t2 (
a varchar(30) default NULL,
KEY a (a(5))
);
INSERT INTO t2 VALUES ('alfred');
INSERT INTO t2 VALUES ('angie');
INSERT INTO t2 VALUES ('bingo');
INSERT INTO t2 VALUES ('waffle');
INSERT INTO t2 VALUES ('lemon');
create view v2 as select * from t2 where a like 'a%' with check option;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
`a` varchar(30) DEFAULT NULL,
KEY `a` (`a`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` varchar(30)
) */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t2;
drop view v2;
drop database db1;
create database db2;
use db2;
create table t1 (a int);
create table t2 (a int, b varchar(10), primary key(a));
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
insert into t1 values (289), (298), (234), (456), (789);
create view v1 as select * from t2;
create view v2 as select * from t1;
drop table t1, t2;
drop view v1, v2;
drop database db2;
create database db1;
use db1;
show tables;
Tables_in_db1
t1
t2
v1
v2
select * from t2 order by a;
a b
1 on
2 off
10 pol
12 meg
drop table t1, t2;
drop database db1;
--fields-optionally-enclosed-by="
CREATE DATABASE mysqldump_test_db; CREATE DATABASE mysqldump_test_db;
USE mysqldump_test_db; USE mysqldump_test_db;
CREATE TABLE t1 ( a INT ); CREATE TABLE t1 ( a INT );
@ -1682,6 +1596,7 @@ select * from t1;
a b a b
Osnabrück Köln Osnabrück Köln
drop table t1; drop table t1;
--fields-optionally-enclosed-by="
create table `t1` ( create table `t1` (
t1_name varchar(255) default null, t1_name varchar(255) default null,
t1_id int(10) unsigned not null auto_increment, t1_id int(10) unsigned not null auto_increment,
@ -1756,8 +1671,9 @@ CREATE TABLE `t2` (
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (a binary(1), b blob); create table t1 (a int);
insert into t1 values ('',''); mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064)
mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@ -1771,47 +1687,9 @@ insert into t1 values ('','');
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`; DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`a` binary(1) DEFAULT NULL, `a` int(11) DEFAULT NULL
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES (0x00,'');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` binary(1) DEFAULT NULL,
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES (0x00,'');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@ -1823,6 +1701,95 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1; drop table t1;
End of 4.1 tests
create database db1;
use db1;
CREATE TABLE t2 (
a varchar(30) default NULL,
KEY a (a(5))
);
INSERT INTO t2 VALUES ('alfred');
INSERT INTO t2 VALUES ('angie');
INSERT INTO t2 VALUES ('bingo');
INSERT INTO t2 VALUES ('waffle');
INSERT INTO t2 VALUES ('lemon');
create view v2 as select * from t2 where a like 'a%' with check option;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
`a` varchar(30) DEFAULT NULL,
KEY `a` (`a`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` varchar(30)
) */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t2;
drop view v2;
drop database db1;
use test;
create database db2;
use db2;
create table t1 (a int);
create table t2 (a int, b varchar(10), primary key(a));
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
insert into t1 values (289), (298), (234), (456), (789);
create view v1 as select * from t2;
create view v2 as select * from t1;
drop table t1, t2;
drop view v1, v2;
drop database db2;
use test;
create database db1;
use db1;
show tables;
Tables_in_db1
t1
t2
v1
v2
select * from t2 order by a;
a b
1 on
2 off
10 pol
12 meg
drop table t1, t2;
drop database db1;
use test;
create table t1(a int); create table t1(a int);
create view v1 as select * from t1; create view v1 as select * from t1;
@ -2605,44 +2572,6 @@ drop view v2;
drop view v0; drop view v0;
drop view v1; drop view v1;
drop table t1; drop table t1;
drop table if exists t1;
CREATE TABLE t1(a int, b int);
INSERT INTO t1 VALUES (1,1);
INSERT INTO t1 VALUES (2,3);
INSERT INTO t1 VALUES (3,4), (4,5);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
SET @old_sql_mode = @@SQL_MODE; SET @old_sql_mode = @@SQL_MODE;
SET SQL_MODE = IGNORE_SPACE; SET SQL_MODE = IGNORE_SPACE;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -2698,7 +2627,73 @@ DELIMITER ;
DROP TRIGGER tr1; DROP TRIGGER tr1;
DROP TABLE t1; DROP TABLE t1;
End of 4.1 tests create table t1 (a binary(1), b blob);
insert into t1 values ('','');
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` binary(1) DEFAULT NULL,
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES (0x00,'');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` binary(1) DEFAULT NULL,
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES (0x00,'');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1;
create table t1 (a int); create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789); insert into t1 values (289), (298), (234), (456), (789);
create definer = CURRENT_USER view v1 as select * from t1; create definer = CURRENT_USER view v1 as select * from t1;
@ -2925,7 +2920,60 @@ mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SU
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1; drop table t1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
create database mysqldump_myDB;
use mysqldump_myDB;
create user myDB_User;
grant create view, select on mysqldump_myDB.* to myDB_User@localhost;
create table t1 (c1 int);
insert into t1 values (3);
use mysqldump_myDB;
create view v1 (c1) as select * from t1;
use mysqldump_myDB;
drop view v1;
drop table t1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User;
drop database mysqldump_myDB;
use test;
End of 5.0 tests End of 5.0 tests
drop table if exists t1;
CREATE TABLE t1(a int, b int);
INSERT INTO t1 VALUES (1,1);
INSERT INTO t1 VALUES (2,3);
INSERT INTO t1 VALUES (3,4), (4,5);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
create table t1 (a text , b text); create table t1 (a text , b text);
create table t2 (a text , b text); create table t2 (a text , b text);
insert t1 values ("Duck, Duck", "goose"); insert t1 values ("Duck, Duck", "goose");

View File

@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL, `b` int(11) NOT NULL,
`c` int(11) NOT NULL, `c` int(11) NOT NULL,
PRIMARY KEY (`pk1`) PRIMARY KEY (`pk1`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
ENGINE=NDB; ENGINE=NDB;
SHOW CREATE TABLE test.t2; SHOW CREATE TABLE test.t2;
@ -236,7 +236,7 @@ t2 CREATE TABLE `t2` (
`b2` int(11) NOT NULL, `b2` int(11) NOT NULL,
`c2` int(11) NOT NULL, `c2` int(11) NOT NULL,
PRIMARY KEY (`pk2`) PRIMARY KEY (`pk2`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=NDBCLUSTER; ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
SHOW CREATE TABLE test.t1; SHOW CREATE TABLE test.t1;
Table Create Table Table Create Table
@ -331,7 +331,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL, `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
@ -931,7 +931,7 @@ t1 CREATE TABLE `t1` (
`a1` int(11) DEFAULT NULL, `a1` int(11) DEFAULT NULL,
`a2` blob, `a2` blob,
`a3` text `a3` text
) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
DROP TABLE test.t1; DROP TABLE test.t1;
CREATE TABLE test.t1 (a1 INT, a2 BLOB, a3 TEXT) ENGINE=MyISAM; CREATE TABLE test.t1 (a1 INT, a2 BLOB, a3 TEXT) ENGINE=MyISAM;
SHOW CREATE TABLE test.t1; SHOW CREATE TABLE test.t1;
@ -950,7 +950,7 @@ t1 CREATE TABLE `t1` (
`a1` int(11) DEFAULT NULL, `a1` int(11) DEFAULT NULL,
`a2` blob, `a2` blob,
`a3` text `a3` text
) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
DROP TABLE test.t1; DROP TABLE test.t1;
CREATE TABLE test.t1 (a1 INT PRIMARY KEY, a2 BLOB, a3 TEXT) TABLESPACE ts STORAGE DISK ENGINE=NDB; CREATE TABLE test.t1 (a1 INT PRIMARY KEY, a2 BLOB, a3 TEXT) TABLESPACE ts STORAGE DISK ENGINE=NDB;
SHOW CREATE TABLE test.t1; SHOW CREATE TABLE test.t1;
@ -960,7 +960,7 @@ t1 CREATE TABLE `t1` (
`a2` blob, `a2` blob,
`a3` text, `a3` text,
PRIMARY KEY (`a1`) PRIMARY KEY (`a1`)
) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=InnoDB; ALTER TABLE test.t1 ENGINE=InnoDB;
SHOW CREATE TABLE test.t1; SHOW CREATE TABLE test.t1;
Table Create Table Table Create Table
@ -980,7 +980,7 @@ t1 CREATE TABLE `t1` (
`a1` int(11) DEFAULT NULL, `a1` int(11) DEFAULT NULL,
`a2` blob, `a2` blob,
`a3` text `a3` text
) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=MyISAM; ALTER TABLE test.t1 ENGINE=MyISAM;
SHOW CREATE TABLE test.t1; SHOW CREATE TABLE test.t1;
Table Create Table Table Create Table

View File

@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` (
`a2` varchar(256) DEFAULT NULL, `a2` varchar(256) DEFAULT NULL,
`a3` blob, `a3` blob,
PRIMARY KEY (`a1`) PRIMARY KEY (`a1`)
) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW CREATE TABLE test.t2; SHOW CREATE TABLE test.t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
@ -38,7 +38,7 @@ t2 CREATE TABLE `t2` (
`a2` varchar(256) DEFAULT NULL, `a2` varchar(256) DEFAULT NULL,
`a3` blob, `a3` blob,
PRIMARY KEY (`a1`) PRIMARY KEY (`a1`)
) TABLESPACE ts2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
INSERT INTO test.t1 VALUES (1,'111111','aaaaaaaa'); INSERT INTO test.t1 VALUES (1,'111111','aaaaaaaa');
INSERT INTO test.t1 VALUES (2,'222222','bbbbbbbb'); INSERT INTO test.t1 VALUES (2,'222222','bbbbbbbb');
SELECT * FROM test.t1 ORDER BY a1; SELECT * FROM test.t1 ORDER BY a1;
@ -93,7 +93,7 @@ t1 CREATE TABLE `t1` (
`a2` varchar(5000) DEFAULT NULL, `a2` varchar(5000) DEFAULT NULL,
`a3` blob, `a3` blob,
PRIMARY KEY (`a1`) PRIMARY KEY (`a1`)
) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW CREATE TABLE test.t2; SHOW CREATE TABLE test.t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
@ -101,7 +101,7 @@ t2 CREATE TABLE `t2` (
`a2` varchar(5000) DEFAULT NULL, `a2` varchar(5000) DEFAULT NULL,
`a3` blob, `a3` blob,
PRIMARY KEY (`a1`) PRIMARY KEY (`a1`)
) TABLESPACE ts2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
INSERT INTO test.t1 VALUES (1,@vc1,@d1); INSERT INTO test.t1 VALUES (1,@vc1,@d1);
INSERT INTO test.t1 VALUES (2,@vc2,@b1); INSERT INTO test.t1 VALUES (2,@vc2,@b1);
INSERT INTO test.t1 VALUES (3,@vc3,@d2); INSERT INTO test.t1 VALUES (3,@vc3,@d2);

View File

@ -175,7 +175,7 @@ t1 CREATE TABLE `t1` (
`c3` int(11) NOT NULL, `c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL, `c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`) PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */ ) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
SHOW CREATE TABLE test.t2; SHOW CREATE TABLE test.t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
@ -184,7 +184,7 @@ t2 CREATE TABLE `t2` (
`c3` int(11) NOT NULL, `c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL, `c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`) PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */ ) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t3; SHOW CREATE TABLE test.t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
@ -193,7 +193,7 @@ t3 CREATE TABLE `t3` (
`c3` int(11) NOT NULL, `c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL, `c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`) PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */ ) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t4; SHOW CREATE TABLE test.t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
@ -341,7 +341,7 @@ t1 CREATE TABLE `t1` (
`c3` int(11) NOT NULL, `c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL, `c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`) PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */ ) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
SHOW CREATE TABLE test.t2; SHOW CREATE TABLE test.t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
@ -350,7 +350,7 @@ t2 CREATE TABLE `t2` (
`c3` int(11) NOT NULL, `c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL, `c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`) PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */ ) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t3; SHOW CREATE TABLE test.t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
@ -359,7 +359,7 @@ t3 CREATE TABLE `t3` (
`c3` int(11) NOT NULL, `c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL, `c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`) PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */ ) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t4; SHOW CREATE TABLE test.t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (

View File

@ -49,7 +49,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL, `b` int(11) NOT NULL,
`c` int(11) NOT NULL, `c` int(11) NOT NULL,
PRIMARY KEY (`pk1`) PRIMARY KEY (`pk1`)
) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (0, 0, 0); INSERT INTO t1 VALUES (0, 0, 0);
SELECT * FROM t1; SELECT * FROM t1;
pk1 b c pk1 b c

View File

@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL, `b` int(11) NOT NULL,
`c` int(11) NOT NULL, `c` int(11) NOT NULL,
PRIMARY KEY (`pk1`) PRIMARY KEY (`pk1`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
ENGINE=NDB; ENGINE=NDB;
SHOW CREATE TABLE test.t2; SHOW CREATE TABLE test.t2;
@ -236,7 +236,7 @@ t2 CREATE TABLE `t2` (
`b2` int(11) NOT NULL, `b2` int(11) NOT NULL,
`c2` int(11) NOT NULL, `c2` int(11) NOT NULL,
PRIMARY KEY (`pk2`) PRIMARY KEY (`pk2`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 ) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=NDBCLUSTER; ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
SHOW CREATE TABLE test.t1; SHOW CREATE TABLE test.t1;
Table Create Table Table Create Table

View File

@ -1134,12 +1134,12 @@ partition by range (a)
subpartition by hash (a) subpartition by hash (a)
(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx' (partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx'
(SUBPARTITION subpart00, SUBPARTITION subpart01)); (SUBPARTITION subpart00, SUBPARTITION subpart01));
hello/master-data/test/t1.frm
hello/master-data/test/t1.par
hello/master-data/test/t1#P#p0#SP#subpart00.MYD hello/master-data/test/t1#P#p0#SP#subpart00.MYD
hello/master-data/test/t1#P#p0#SP#subpart00.MYI hello/master-data/test/t1#P#p0#SP#subpart00.MYI
hello/master-data/test/t1#P#p0#SP#subpart01.MYD hello/master-data/test/t1#P#p0#SP#subpart01.MYD
hello/master-data/test/t1#P#p0#SP#subpart01.MYI hello/master-data/test/t1#P#p0#SP#subpart01.MYI
hello/master-data/test/t1.frm
hello/master-data/test/t1.par
hello/master-data/tmpdata/t1#P#p0#SP#subpart00.MYD hello/master-data/tmpdata/t1#P#p0#SP#subpart00.MYD
hello/master-data/tmpdata/t1#P#p0#SP#subpart01.MYD hello/master-data/tmpdata/t1#P#p0#SP#subpart01.MYD
hello/master-data/tmpinx/t1#P#p0#SP#subpart00.MYI hello/master-data/tmpinx/t1#P#p0#SP#subpart00.MYI
@ -1149,6 +1149,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(SUBPARTITION subpart10, SUBPARTITION subpart11), (SUBPARTITION subpart10, SUBPARTITION subpart11),
partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx' partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx'
(SUBPARTITION subpart20, SUBPARTITION subpart21)); (SUBPARTITION subpart20, SUBPARTITION subpart21));
hello/master-data/test/t1.frm
hello/master-data/test/t1.par
hello/master-data/test/t1#P#p1#SP#subpart10.MYD hello/master-data/test/t1#P#p1#SP#subpart10.MYD
hello/master-data/test/t1#P#p1#SP#subpart10.MYI hello/master-data/test/t1#P#p1#SP#subpart10.MYI
hello/master-data/test/t1#P#p1#SP#subpart11.MYD hello/master-data/test/t1#P#p1#SP#subpart11.MYD
@ -1157,8 +1159,6 @@ hello/master-data/test/t1#P#p2#SP#subpart20.MYD
hello/master-data/test/t1#P#p2#SP#subpart20.MYI hello/master-data/test/t1#P#p2#SP#subpart20.MYI
hello/master-data/test/t1#P#p2#SP#subpart21.MYD hello/master-data/test/t1#P#p2#SP#subpart21.MYD
hello/master-data/test/t1#P#p2#SP#subpart21.MYI hello/master-data/test/t1#P#p2#SP#subpart21.MYI
hello/master-data/test/t1.frm
hello/master-data/test/t1.par
hello/master-data/tmpdata/t1#P#p1#SP#subpart10.MYD hello/master-data/tmpdata/t1#P#p1#SP#subpart10.MYD
hello/master-data/tmpdata/t1#P#p1#SP#subpart11.MYD hello/master-data/tmpdata/t1#P#p1#SP#subpart11.MYD
hello/master-data/tmpdata/t1#P#p2#SP#subpart20.MYD hello/master-data/tmpdata/t1#P#p2#SP#subpart20.MYD

View File

@ -695,4 +695,19 @@ Level Code Message
Warning 1541 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW PLUGINS' instead Warning 1541 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW PLUGINS' instead
show plugin; show plugin;
show plugins; show plugins;
create database `mysqlttest\1`;
create table `mysqlttest\1`.`a\b` (a int);
show tables from `mysqlttest\1`;
Tables_in_mysqlttest\1
a\b
show fields from `mysqlttest\1`.`a\b`;
Field Type Null Key Default Extra
a int(11) YES NULL
show columns from `a\b` from `mysqlttest\1`;
Field Type Null Key Default Extra
a int(11) YES NULL
show keys from `mysqlttest\1`.`a\b`;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
drop table `mysqlttest\1`.`a\b`;
drop database `mysqlttest\1`;
End of 5.1 tests End of 5.1 tests

View File

@ -689,6 +689,12 @@ select @@log_queries_not_using_indexes;
show variables like 'log_queries_not_using_indexes'; show variables like 'log_queries_not_using_indexes';
Variable_name Value Variable_name Value
log_queries_not_using_indexes OFF log_queries_not_using_indexes OFF
select @@"";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '""' at line 1
select @@&;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&' at line 1
select @@@;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@' at line 1
End of 5.0 tests End of 5.0 tests
set global binlog_cache_size =@my_binlog_cache_size; set global binlog_cache_size =@my_binlog_cache_size;
set global connect_timeout =@my_connect_timeout; set global connect_timeout =@my_connect_timeout;

View File

@ -2849,6 +2849,36 @@ SHOW TABLES;
Tables_in_test Tables_in_test
t1 t1
DROP TABLE t1; DROP TABLE t1;
DROP VIEW IF EXISTS v1;
CREATE DATABASE bug21261DB;
USE bug21261DB;
CREATE TABLE t1 (x INT);
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
CREATE TABLE t2 (y INT);
GRANT SELECT ON t2 TO 'user21261'@'localhost';
INSERT INTO v1 (x) VALUES (5);
UPDATE v1 SET x=1;
GRANT SELECT ON v1 TO 'user21261'@'localhost';
GRANT SELECT ON t1 TO 'user21261'@'localhost';
UPDATE v1,t2 SET x=1 WHERE x=y;
SELECT * FROM t1;
x
1
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
DROP USER 'user21261'@'localhost';
DROP VIEW v1;
DROP TABLE t1;
DROP DATABASE bug21261DB;
USE test;
create table t1 (f1 datetime);
create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
show create view v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute))
drop view v1;
drop table t1;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v2; DROP VIEW IF EXISTS v2;
@ -2887,32 +2917,3 @@ DROP FUNCTION f2;
DROP VIEW v1, v2; DROP VIEW v1, v2;
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests. End of 5.0 tests.
CREATE DATABASE bug21261DB;
USE bug21261DB;
CREATE TABLE t1 (x INT);
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
CREATE TABLE t2 (y INT);
GRANT SELECT ON t2 TO 'user21261'@'localhost';
INSERT INTO v1 (x) VALUES (5);
UPDATE v1 SET x=1;
GRANT SELECT ON v1 TO 'user21261'@'localhost';
GRANT SELECT ON t1 TO 'user21261'@'localhost';
UPDATE v1,t2 SET x=1 WHERE x=y;
SELECT * FROM t1;
x
1
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
DROP USER 'user21261'@'localhost';
DROP VIEW v1;
DROP TABLE t1;
DROP DATABASE bug21261DB;
USE test;
create table t1 (f1 datetime);
create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
show create view v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute))
drop view v1;
drop table t1;

View File

@ -6,3 +6,31 @@ use prn;
ERROR 42000: Unknown database 'prn' ERROR 42000: Unknown database 'prn'
create table nu (a int); create table nu (a int);
drop table nu; drop table nu;
CREATE TABLE `t1` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `t2` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `mt` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST
UNION=(`t1`,`t2`);
INSERT INTO mt VALUES ('2006-01-01',0);
ALTER TABLE `t2` RENAME TO `t`;
INSERT INTO mt VALUES ('2006-01-01',0);
ERROR HY000: Can't lock file (errno: 155)
select * from mt;
ERROR HY000: Can't lock file (errno: 155)
FLUSH TABLES;
select * from mt;
ERROR HY000: Can't find file: 'mt' (errno: 2)
ALTER TABLE `t` RENAME TO `t2`;
INSERT INTO mt VALUES ('2006-01-01',0);
select * from mt;
TIM VAL
2006-01-01 00:00:00 0
2006-01-01 00:00:00 0

View File

@ -304,42 +304,6 @@ INSERT INTO t1 VALUES(1, 1);
ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment; ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
DROP TABLE t1; DROP TABLE t1;
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
# UPDATE": now LAST_INSERT_ID() will return the id of the updated
# row.
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
`a` int(11) default NULL,
`c` int(11) default NULL,
PRIMARY KEY (`k`),
UNIQUE KEY `idx_1` (`a`)
) ENGINE=InnoDB;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
select * from t2;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
select * from t2;
# Test of LAST_INSERT_ID() when autogenerated will fail:
# last_insert_id() should not change
insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id();
# First and second autogenerated will fail, last_insert_id() should
# point to third
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
select * from t2;
drop table t2;
# Test of REPLACE when it does INSERT+DELETE and not UPDATE: # Test of REPLACE when it does INSERT+DELETE and not UPDATE:
# see if it sets LAST_INSERT_ID() ok # see if it sets LAST_INSERT_ID() ok
create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c)); create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));

View File

@ -1,4 +1,5 @@
--source include/have_debug.inc --source include/have_debug.inc
--source include/have_innodb.inc
CREATE TABLE t1(a int) engine=innodb; CREATE TABLE t1(a int) engine=innodb;
START TRANSACTION; START TRANSACTION;

View File

@ -187,4 +187,16 @@ select rpad(c1,3,'
#select case c1 when 'ß' then 'ß' when 'ö' then 'ö' else 'c' end from t1; #select case c1 when 'ß' then 'ß' when 'ö' then 'ö' else 'c' end from t1;
#select export_set(5,c1,'ö'), export_set(5,'ö',c1) from t1; #select export_set(5,c1,'ö'), export_set(5,'ö',c1) from t1;
drop table t1; drop table t1;
# End of 4.1 tests
#
# Bug 20695: problem with field default value's character set
#
set names koi8r;
create table t1(a char character set cp1251 default _koi8r 0xFF);
show create table t1;
drop table t1;
--error 1067
create table t1(a char character set latin1 default _cp1251 0xFF);
--echo End of 4.1 tests

View File

@ -465,7 +465,51 @@ INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
SELECT id, MIN(s) FROM t1 GROUP BY id; SELECT id, MIN(s) FROM t1 GROUP BY id;
DROP TABLE t1; DROP TABLE t1;
# End of 4.1 tests
#
# Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
#
--disable_warnings
drop table if exists bug20536;
--enable_warnings
set names latin1;
create table bug20536 (id bigint not null auto_increment primary key, name
varchar(255) character set ucs2 not null);
insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
select md5(name) from bug20536;
select sha1(name) from bug20536;
select make_set(3, name, upper(name)) from bug20536;
select export_set(5, name, upper(name)) from bug20536;
select export_set(5, name, upper(name), ",", 5) from bug20536;
# Some broken functions: add these tests just to document current behavior.
# PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would
# not be backwards compatible in all cases, so it's best to leave it alone
select password(name) from bug20536;
select old_password(name) from bug20536;
# Disable test case as encrypt relies on 'crypt' function.
# "decrypt" is noramlly tested in func_crypt.test which have a
# "have_crypt.inc" test
--disable_parsing
# ENCRYPT relies on OS function crypt() which takes a NUL-terminated string; it
# doesn't return good results for strings with embedded 0 bytes. It won't be
# fixed unless we choose to re-implement the crypt() function ourselves to take
# an extra size_t string_length argument.
select encrypt(name, 'SALT') from bug20536;
--enable_parsing
# QUOTE doesn't work with UCS2 data. It would require a total rewrite
# of Item_func_quote::val_str(), which isn't worthwhile until UCS2 is
# supported fully as a client character set.
select quote(name) from bug20536;
drop table bug20536;
--echo End of 4.1 tests
# #
# Conversion from an UCS2 string to a decimal column # Conversion from an UCS2 string to a decimal column
@ -497,3 +541,5 @@ create table t1(a blob, b text charset utf8, c text charset ucs2);
select data_type, character_octet_length, character_maximum_length select data_type, character_octet_length, character_maximum_length
from information_schema.columns where table_name='t1'; from information_schema.columns where table_name='t1';
drop table t1; drop table t1;
--echo End of 5.0 tests

View File

@ -727,6 +727,24 @@ drop table t1;
select repeat(_utf8'+',3) as h union select NULL; select repeat(_utf8'+',3) as h union select NULL;
select ifnull(NULL, _utf8'string'); select ifnull(NULL, _utf8'string');
#
# Bug#9509 Optimizer: wrong result after AND with comparisons
#
set names utf8;
create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
insert into t1 values ('I'),('K'),('Y');
select * from t1 where s1 < 'K' and s1 = 'Y';
select * from t1 where 'K' > s1 and s1 = 'Y';
drop table t1;
create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
select * from t1 where s1 > 'd' and s1 = 'CH';
select * from t1 where 'd' < s1 and s1 = 'CH';
select * from t1 where s1 = 'cH' and s1 <> 'ch';
select * from t1 where 'cH' = s1 and s1 <> 'ch';
drop table t1;
# #
# Bug#10714: Inserting double value into utf8 column crashes server # Bug#10714: Inserting double value into utf8 column crashes server
# #

View File

@ -31,7 +31,6 @@ rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fa
#rpl_ndb_log : BUG#18947 2006-03-21 tomas CRBR: order in binlog of create table and insert (on different table) not determ #rpl_ndb_log : BUG#18947 2006-03-21 tomas CRBR: order in binlog of create table and insert (on different table) not determ
rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
rpl_row_func003 : BUG#19074 2006-13-04 andrei test failed
rpl_sp : BUG#16456 2006-02-16 jmiller rpl_sp : BUG#16456 2006-02-16 jmiller
rpl_sp_effects : BUG#19862 2006-06-15 mkindahl rpl_sp_effects : BUG#19862 2006-06-15 mkindahl

View File

@ -78,7 +78,13 @@ connection default;
DROP TABLE t1; DROP TABLE t1;
# End of 4.1 tests #
# Bug #21531: EXPORT_SET() doesn't accept args with coercible character sets
#
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
--echo End of 4.1 tests
# #
# Test for BUG#9535 # Test for BUG#9535
@ -87,7 +93,9 @@ create table t1 as select uuid(), length(uuid());
show create table t1; show create table t1;
drop table t1; drop table t1;
#
# Bug #6760: Add SLEEP() function # Bug #6760: Add SLEEP() function
#
create table t1 (a timestamp default '2005-05-05 01:01:01', create table t1 (a timestamp default '2005-05-05 01:01:01',
b timestamp default '2005-05-05 01:01:01'); b timestamp default '2005-05-05 01:01:01');
insert into t1 set a = now(); insert into t1 set a = now();
@ -117,4 +125,4 @@ drop table t2;
drop table t1; drop table t1;
set global query_cache_size=default; set global query_cache_size=default;
# End of 5.0 tests --echo End of 5.0 tests

View File

@ -464,6 +464,24 @@ union
union union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H); (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
#
# 21913: DATE_FORMAT() Crashes mysql server if I use it through
# mysql-connector-j driver.
#
SET NAMES latin1;
SET character_set_results = NULL;
SHOW VARIABLES LIKE 'character_set_results';
CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
DROP TABLE testBug8868;
SET NAMES DEFAULT;
--echo End of 4.1 tests --echo End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1, explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,

View File

@ -682,8 +682,6 @@ drop table t2;
drop table t1; drop table t1;
# #
# Bug#20214: Incorrect error when user calls SHOW CREATE VIEW on non # Bug#20214: Incorrect error when user calls SHOW CREATE VIEW on non
# privileged view # privileged view

View File

@ -204,3 +204,4 @@ CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL); INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1; DROP TABLE t1;
--echo End of 5.0 tests

View File

@ -904,14 +904,6 @@ insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2; insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1; insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2; insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
select count(*) from t1; select count(*) from t1;
--replace_column 9 # --replace_column 9 #
explain select * from t1 where c between 1 and 2500; explain select * from t1 where c between 1 and 2500;

View File

@ -367,3 +367,55 @@ create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
character set utf8 collate utf8_general_ci; character set utf8 collate utf8_general_ci;
insert into t1 values('aaa'); insert into t1 values('aaa');
drop table t1; drop table t1;
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
# UPDATE": if the row is updated, it's like a regular UPDATE:
# LAST_INSERT_ID() is not affected.
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
`a` int(11) default NULL,
`c` int(11) default NULL,
PRIMARY KEY (`k`),
UNIQUE KEY `idx_1` (`a`)
) ENGINE=InnoDB;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
select * from t2;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
# test again when last_insert_id() is 0 initially
select last_insert_id(0);
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
select * from t2;
# Test of LAST_INSERT_ID() when autogenerated will fail:
# last_insert_id() should not change
insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id();
# First and second autogenerated will fail, last_insert_id() should
# point to third
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
select * from t2;
# Test of the workaround which enables people to know the id of the
# updated row in INSERT ON DUPLICATE KEY UPDATE, by using
# LAST_INSERT_ID(autoinc_col) in the UPDATE clause.
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1, k=last_insert_id(k);
select last_insert_id();
select * from t2;
drop table t2;

View File

@ -52,8 +52,8 @@ drop table t1;
--exec $MYSQL --default-character-set=cp932 test -e "charset utf8;" --exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
# its usage to switch internally in mysql to requested charset # its usage to switch internally in mysql to requested charset
--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; set @@session.character_set_client= cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;" --exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;"
--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; set character_set_client= cp932; select 'ƒ\'" --exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'"
--exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ƒ\'" --exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ƒ\'"
--exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ƒ\'" --exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ƒ\'"

View File

@ -548,71 +548,6 @@ INSERT INTO t1 VALUES (1),(2),(3);
--exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test --exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test
DROP TABLE t1; DROP TABLE t1;
#
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
#
create database db1;
use db1;
CREATE TABLE t2 (
a varchar(30) default NULL,
KEY a (a(5))
);
INSERT INTO t2 VALUES ('alfred');
INSERT INTO t2 VALUES ('angie');
INSERT INTO t2 VALUES ('bingo');
INSERT INTO t2 VALUES ('waffle');
INSERT INTO t2 VALUES ('lemon');
create view v2 as select * from t2 where a like 'a%' with check option;
--exec $MYSQL_DUMP --skip-comments db1
drop table t2;
drop view v2;
drop database db1;
#
# Bug 10713 mysqldump includes database in create view and referenced tables
#
# create table and views in db2
create database db2;
use db2;
create table t1 (a int);
create table t2 (a int, b varchar(10), primary key(a));
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
insert into t1 values (289), (298), (234), (456), (789);
create view v1 as select * from t2;
create view v2 as select * from t1;
# dump tables and view from db2
--exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql
# drop the db, tables and views
drop table t1, t2;
drop view v1, v2;
drop database db2;
# create db1 and reload dump
create database db1;
use db1;
--exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql
# check that all tables and views could be created
show tables;
select * from t2 order by a;
drop table t1, t2;
drop database db1;
#
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
#
--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
# #
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data # Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
# #
@ -719,6 +654,12 @@ select * from t1;
drop table t1; drop table t1;
#
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
#
--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
# #
# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]" # BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
# #
@ -760,14 +701,74 @@ create table t3(a int);
drop table t1, t2, t3; drop table t1, t2, t3;
# #
# Bug #13318: Bad result with empty field and --hex-blob # Bug #21288: mysqldump segmentation fault when using --where
# #
create table t1 (a binary(1), b blob); create table t1 (a int);
insert into t1 values ('',''); --error 2
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1 --exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
drop table t1; drop table t1;
--echo End of 4.1 tests
#
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
#
create database db1;
use db1;
CREATE TABLE t2 (
a varchar(30) default NULL,
KEY a (a(5))
);
INSERT INTO t2 VALUES ('alfred');
INSERT INTO t2 VALUES ('angie');
INSERT INTO t2 VALUES ('bingo');
INSERT INTO t2 VALUES ('waffle');
INSERT INTO t2 VALUES ('lemon');
create view v2 as select * from t2 where a like 'a%' with check option;
--exec $MYSQL_DUMP --skip-comments db1
drop table t2;
drop view v2;
drop database db1;
use test;
#
# Bug 10713 mysqldump includes database in create view and referenced tables
#
# create table and views in db2
create database db2;
use db2;
create table t1 (a int);
create table t2 (a int, b varchar(10), primary key(a));
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
insert into t1 values (289), (298), (234), (456), (789);
create view v1 as select * from t2;
create view v2 as select * from t1;
# dump tables and view from db2
--exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql
# drop the db, tables and views
drop table t1, t2;
drop view v1, v2;
drop database db2;
use test;
# create db1 and reload dump
create database db1;
use db1;
--exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql
# check that all tables and views could be created
show tables;
select * from t2 order by a;
drop table t1, t2;
drop database db1;
use test;
# #
# dump of view # dump of view
@ -832,6 +833,7 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
drop view v1, v2, v3; drop view v1, v2, v3;
drop table t1; drop table t1;
# #
# Test for dumping triggers # Test for dumping triggers
# #
@ -1057,20 +1059,6 @@ drop view v0;
drop view v1; drop view v1;
drop table t1; drop table t1;
# Check new --replace option
--disable_warnings
drop table if exists t1;
--enable_warnings
CREATE TABLE t1(a int, b int);
INSERT INTO t1 VALUES (1,1);
INSERT INTO t1 VALUES (2,3);
INSERT INTO t1 VALUES (3,4), (4,5);
--exec $MYSQL_DUMP --replace --skip-comments test t1
DROP TABLE t1;
# #
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN" # BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
# for tables with trigger created in the IGNORE_SPACE sql mode. # for tables with trigger created in the IGNORE_SPACE sql mode.
@ -1095,7 +1083,14 @@ SET SQL_MODE = @old_sql_mode;
DROP TRIGGER tr1; DROP TRIGGER tr1;
DROP TABLE t1; DROP TABLE t1;
--echo End of 4.1 tests #
# Bug #13318: Bad result with empty field and --hex-blob
#
create table t1 (a binary(1), b blob);
insert into t1 values ('','');
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
drop table t1;
# #
# Bug 14871 Invalid view dump output # Bug 14871 Invalid view dump output
@ -1126,7 +1121,6 @@ select * from v3 order by a;
drop table t1; drop table t1;
drop view v1, v2, v3, v4, v5; drop view v1, v2, v3, v4, v5;
# #
# Bug #16878 dump of trigger # Bug #16878 dump of trigger
# #
@ -1281,10 +1275,11 @@ use mysqldump_dbb;
drop view v1; drop view v1;
drop table t1; drop table t1;
drop database mysqldump_dbb; drop database mysqldump_dbb;
use test;
# #
# Bug#21215 mysqldump creating incomplete backups without warning # Bug#21215 mysqldump creating incomplete backups without warning
# #
use test;
# Create user without sufficient privs to perform the requested operation # Create user without sufficient privs to perform the requested operation
create user mysqltest_1@localhost; create user mysqltest_1@localhost;
@ -1326,8 +1321,52 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1; drop table t1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
#
# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
# information_schema database.
#
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
create database mysqldump_myDB;
use mysqldump_myDB;
create user myDB_User;
grant create view, select on mysqldump_myDB.* to myDB_User@localhost;
create table t1 (c1 int);
insert into t1 values (3);
connect (user1,localhost,myDB_User,,mysqldump_myDB,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1;
use mysqldump_myDB;
create view v1 (c1) as select * from t1;
# Backup should not fail.
--exec $MYSQL_DUMP --all-databases --add-drop-table > $MYSQLTEST_VARDIR/tmp/bug21527.sql
# Clean up
connection root;
use mysqldump_myDB;
drop view v1;
drop table t1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User;
drop database mysqldump_myDB;
use test;
--echo End of 5.0 tests --echo End of 5.0 tests
# Check new --replace option
--disable_warnings
drop table if exists t1;
--enable_warnings
CREATE TABLE t1(a int, b int);
INSERT INTO t1 VALUES (1,1);
INSERT INTO t1 VALUES (2,3);
INSERT INTO t1 VALUES (3,4), (4,5);
--exec $MYSQL_DUMP --replace --skip-comments test t1
DROP TABLE t1;
# #
# Added for use-thread option # Added for use-thread option
# #

View File

@ -1340,11 +1340,13 @@ subpartition by hash (a)
(SUBPARTITION subpart00, SUBPARTITION subpart01)); (SUBPARTITION subpart00, SUBPARTITION subpart01));
--replace_result $MYSQLTEST_VARDIR "hello" --replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* || true --exec ls $MYSQLTEST_VARDIR/master-data/test/t1.* || true
--replace_result $MYSQLTEST_VARDIR "hello" --replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1* || true --exec ls $MYSQLTEST_VARDIR/master-data/test/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello" --replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1* || true --exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello" --replace_result $MYSQLTEST_VARDIR "hello"
eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
@ -1354,11 +1356,13 @@ eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(SUBPARTITION subpart20, SUBPARTITION subpart21)); (SUBPARTITION subpart20, SUBPARTITION subpart21));
--replace_result $MYSQLTEST_VARDIR "hello" --replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* || true --exec ls $MYSQLTEST_VARDIR/master-data/test/t1.* || true
--replace_result $MYSQLTEST_VARDIR "hello" --replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1* || true --exec ls $MYSQLTEST_VARDIR/master-data/test/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello" --replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1* || true --exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1#* || true
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1#* || true
drop table t1; drop table t1;
--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpdata || true --exec rmdir $MYSQLTEST_VARDIR/master-data/tmpdata || true

View File

@ -24,11 +24,15 @@ PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--replace_result $MYSQLTEST_VARDIR "hello" --replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* --exec ls $MYSQLTEST_VARDIR/master-data/test/t1#*
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.*
ALTER TABLE t1 COALESCE PARTITION 1; ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--replace_result $MYSQLTEST_VARDIR "hello" --replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* --exec ls $MYSQLTEST_VARDIR/master-data/test/t1#*
--replace_result $MYSQLTEST_VARDIR "hello"
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.*
drop table t1; drop table t1;
# #
# Bug 20767: REORGANIZE partition crashes # Bug 20767: REORGANIZE partition crashes

View File

@ -539,4 +539,17 @@ show plugin;
show plugins; show plugins;
--enable_result_log --enable_result_log
#
# Bug #19874: SHOW COLUMNS and SHOW KEYS handle identifiers containing
# \ incorrectly
#
create database `mysqlttest\1`;
create table `mysqlttest\1`.`a\b` (a int);
show tables from `mysqlttest\1`;
show fields from `mysqlttest\1`.`a\b`;
show columns from `a\b` from `mysqlttest\1`;
show keys from `mysqlttest\1`.`a\b`;
drop table `mysqlttest\1`.`a\b`;
drop database `mysqlttest\1`;
--echo End of 5.1 tests --echo End of 5.1 tests

View File

@ -1,6 +1,9 @@
# Embedded server doesn't support external clients # Embedded server doesn't support external clients
--source include/not_embedded.inc --source include/not_embedded.inc
# Windows doesn't support execution of shell scripts (to fix!!)
--source include/not_windows.inc
# check that CSV engine was compiled in, as the test relies on the presence # check that CSV engine was compiled in, as the test relies on the presence
# of the log tables (which are CSV-based) # of the log tables (which are CSV-based)
--source include/have_csv.inc --source include/have_csv.inc

View File

@ -585,6 +585,16 @@ show variables like 'ssl%';
select @@log_queries_not_using_indexes; select @@log_queries_not_using_indexes;
show variables like 'log_queries_not_using_indexes'; show variables like 'log_queries_not_using_indexes';
#
# Bug#20908: Crash if select @@""
#
--error ER_PARSE_ERROR
select @@"";
--error ER_PARSE_ERROR
select @@&;
--error ER_PARSE_ERROR
select @@@;
--echo End of 5.0 tests --echo End of 5.0 tests
# This is at the very after the versioned tests, since it involves doing # This is at the very after the versioned tests, since it involves doing
@ -620,3 +630,4 @@ set global server_id =@my_server_id;
set global slow_launch_time =@my_slow_launch_time; set global slow_launch_time =@my_slow_launch_time;
set global storage_engine =@my_storage_engine; set global storage_engine =@my_storage_engine;
set global thread_cache_size =@my_thread_cache_size; set global thread_cache_size =@my_thread_cache_size;

View File

@ -2720,8 +2720,51 @@ DROP VIEW t1,v1;
SHOW TABLES; SHOW TABLES;
DROP TABLE t1; DROP TABLE t1;
--disable_warnings
DROP VIEW IF EXISTS v1;
--enable_warnings
#
# Bug #21261: Wrong access rights was required for an insert to a view
#
CREATE DATABASE bug21261DB;
USE bug21261DB;
CONNECT (root,localhost,root,,bug21261DB);
CONNECTION root;
CREATE TABLE t1 (x INT);
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
CREATE TABLE t2 (y INT);
GRANT SELECT ON t2 TO 'user21261'@'localhost';
CONNECT (user21261, localhost, user21261,, bug21261DB);
CONNECTION user21261;
INSERT INTO v1 (x) VALUES (5);
UPDATE v1 SET x=1;
CONNECTION root;
GRANT SELECT ON v1 TO 'user21261'@'localhost';
GRANT SELECT ON t1 TO 'user21261'@'localhost';
CONNECTION user21261;
UPDATE v1,t2 SET x=1 WHERE x=y;
CONNECTION root;
SELECT * FROM t1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
DROP USER 'user21261'@'localhost';
DROP VIEW v1;
DROP TABLE t1;
DROP DATABASE bug21261DB;
USE test;
#
# Bug #15950: NOW() optimized away in VIEWs
#
create table t1 (f1 datetime);
create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
show create view v1;
drop view v1;
drop table t1;
# #
# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause. # Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause.
# #
@ -2797,45 +2840,3 @@ DROP TABLE t1;
--echo End of 5.0 tests. --echo End of 5.0 tests.
#
# Bug #21261: Wrong access rights was required for an insert to a view
#
CREATE DATABASE bug21261DB;
USE bug21261DB;
CONNECT (root,localhost,root,,bug21261DB);
CONNECTION root;
CREATE TABLE t1 (x INT);
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
CREATE TABLE t2 (y INT);
GRANT SELECT ON t2 TO 'user21261'@'localhost';
CONNECT (user21261, localhost, user21261,, bug21261DB);
CONNECTION user21261;
INSERT INTO v1 (x) VALUES (5);
UPDATE v1 SET x=1;
CONNECTION root;
GRANT SELECT ON v1 TO 'user21261'@'localhost';
GRANT SELECT ON t1 TO 'user21261'@'localhost';
CONNECTION user21261;
UPDATE v1,t2 SET x=1 WHERE x=y;
CONNECTION root;
SELECT * FROM t1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
DROP USER 'user21261'@'localhost';
DROP VIEW v1;
DROP TABLE t1;
DROP DATABASE bug21261DB;
USE test;
#
# Bug #15950: NOW() optimized away in VIEWs
#
create table t1 (f1 datetime);
create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
show create view v1;
drop view v1;
drop table t1;

View File

@ -18,3 +18,42 @@ create table nu (a int);
drop table nu; drop table nu;
# End of 4.1 tests # End of 4.1 tests
#
# Bug #20789: Merge Subtable Rename Causes Crash
#
CREATE TABLE `t1` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `t2` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `mt` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST
UNION=(`t1`,`t2`);
# insert into the merge table and thus open it.
INSERT INTO mt VALUES ('2006-01-01',0);
# Alter one of the tables that are part of the merge table
ALTER TABLE `t2` RENAME TO `t`;
# Insert into the merge table that has just been altered
--error 1015
INSERT INTO mt VALUES ('2006-01-01',0);
--error 1015
select * from mt;
FLUSH TABLES;
--error 1017
select * from mt;
# Alter one of the tables that are part of the merge table
ALTER TABLE `t` RENAME TO `t2`;
INSERT INTO mt VALUES ('2006-01-01',0);
select * from mt;

View File

@ -51,8 +51,11 @@ uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d", DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
readbytes, Count, Filedes, my_errno)); readbytes, Count, Filedes, my_errno));
#ifdef THREAD #ifdef THREAD
if (readbytes == 0 && errno == EINTR) if ((int) readbytes <= 0 && errno == EINTR)
{
DBUG_PRINT("debug", ("my_read() was interrupted and returned %d", (int) readbytes));
continue; /* Interrupted */ continue; /* Interrupted */
}
#endif #endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{ {

18
server-tools/CMakeLists.txt Executable file
View File

@ -0,0 +1,18 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS(-DMYSQL_SERVER -DMYSQL_INSTANCE_MANAGER)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/sql
${PROJECT_SOURCE_DIR}/extra/yassl/include)
ADD_EXECUTABLE(mysqlmanager buffer.cc command.cc commands.cc guardian.cc instance.cc instance_map.cc
instance_options.cc listener.cc log.cc manager.cc messages.cc mysql_connection.cc
mysqlmanager.cc options.cc parse.cc parse_output.cc priv.cc protocol.cc
thread_registry.cc user_map.cc imservice.cpp windowsservice.cpp
user_management_commands.cc
../../sql/net_serv.cc ../../sql-common/pack.c ../../sql/password.c
../../sql/sql_state.c ../../sql-common/client.c ../../libmysql/get_password.c
../../libmysql/errmsg.c)
ADD_DEPENDENCIES(mysqlmanager GenError)
TARGET_LINK_LIBRARIES(mysqlmanager dbug mysys strings taocrypt vio yassl zlib wsock32)

View File

@ -1509,7 +1509,6 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
mysql->options.ssl_ca= strdup_if_not_null(ca); mysql->options.ssl_ca= strdup_if_not_null(ca);
mysql->options.ssl_capath= strdup_if_not_null(capath); mysql->options.ssl_capath= strdup_if_not_null(capath);
mysql->options.ssl_cipher= strdup_if_not_null(cipher); mysql->options.ssl_cipher= strdup_if_not_null(cipher);
mysql->options.ssl_verify_server_cert= FALSE; /* Off by default */
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -2198,7 +2197,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
DBUG_PRINT("info", ("IO layer change done!")); DBUG_PRINT("info", ("IO layer change done!"));
/* Verify server cert */ /* Verify server cert */
if (mysql->options.ssl_verify_server_cert && if ((client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) &&
ssl_verify_server_cert(mysql->net.vio, mysql->host)) ssl_verify_server_cert(mysql->net.vio, mysql->host))
{ {
set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate); set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate);
@ -2945,7 +2944,10 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
mysql->reconnect= *(my_bool *) arg; mysql->reconnect= *(my_bool *) arg;
break; break;
case MYSQL_OPT_SSL_VERIFY_SERVER_CERT: case MYSQL_OPT_SSL_VERIFY_SERVER_CERT:
mysql->options.ssl_verify_server_cert= *(my_bool *) arg; if (!arg || test(*(uint*) arg))
mysql->options.client_flag|= CLIENT_SSL_VERIFY_SERVER_CERT;
else
mysql->options.client_flag&= ~CLIENT_SSL_VERIFY_SERVER_CERT;
break; break;
default: default:
DBUG_RETURN(1); DBUG_RETURN(1);

11
sql/examples/CMakeLists.txt Executable file
View File

@ -0,0 +1,11 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/extra/yassl/include
${CMAKE_SOURCE_DIR}/regex)
IF(WITH_EXAMPLE_STORAGE_ENGINE)
ADD_LIBRARY(example ha_example.cc)
ADD_DEPENDENCIES(example GenError)
ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)

View File

@ -442,13 +442,17 @@ int main(int argc,char **argv)
if (get_options(argc,(char **) argv)) if (get_options(argc,(char **) argv))
exit(1); exit(1);
/* Broken up to indicate that it's not advice to you, gentle reader. */
printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n");
printf("/* Copyright (C) 2001-2004 MySQL AB\n\ printf("/* Copyright (C) 2001-2004 MySQL AB\n\
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
and you are welcome to modify and redistribute it under the GPL license\n\ and you are welcome to modify and redistribute it under the GPL license\n\
\n*/\n\n"); \n*/\n\n");
printf("/* This code is generated by gen_lex_hash.cc that seeks for\ /* Broken up to indicate that it's not advice to you, gentle reader. */
a perfect\nhash function */\n\n"); printf("/* Do " "not " "edit " "this " "file! This is generated by "
"gen_lex_hash.cc\nthat seeks for a perfect hash function */\n\n");
printf("#include \"lex.h\"\n\n"); printf("#include \"lex.h\"\n\n");
calc_length(); calc_length();
@ -468,6 +472,14 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\
{\n\ {\n\
register uchar *hash_map;\n\ register uchar *hash_map;\n\
register const char *cur_str= s;\n\ register const char *cur_str= s;\n\
\n\
if (len == 0) {\n\
DBUG_PRINT(\"warning\", (\"get_hash_symbol() received a request for a zero-length symbol, which is probably a mistake.\"));\
return(NULL);\n\
}\n"
);
printf("\
if (function){\n\ if (function){\n\
if (len>sql_functions_max_len) return 0;\n\ if (len>sql_functions_max_len) return 0;\n\
hash_map= sql_functions_map;\n\ hash_map= sql_functions_map;\n\
@ -498,7 +510,10 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\
cur_struct= uint4korr(hash_map+\n\ cur_struct= uint4korr(hash_map+\n\
(((uint16)cur_struct + cur_char - first_char)*4));\n\ (((uint16)cur_struct + cur_char - first_char)*4));\n\
cur_str++;\n\ cur_str++;\n\
}\n\ }\n"
);
printf("\
}else{\n\ }else{\n\
if (len>symbols_max_len) return 0;\n\ if (len>symbols_max_len) return 0;\n\
hash_map= symbols_map;\n\ hash_map= symbols_map;\n\

View File

@ -3567,7 +3567,7 @@ int handler::ha_external_lock(THD *thd, int lock_type)
int handler::ha_reset() int handler::ha_reset()
{ {
DBUG_ENTER("ha_reset"); DBUG_ENTER("ha_reset");
/* Check that we have called all proper delallocation functions */ /* Check that we have called all proper deallocation functions */
DBUG_ASSERT((byte*) table->def_read_set.bitmap + DBUG_ASSERT((byte*) table->def_read_set.bitmap +
table->s->column_bitmap_size == table->s->column_bitmap_size ==
(byte*) table->def_write_set.bitmap); (byte*) table->def_write_set.bitmap);

View File

@ -124,6 +124,7 @@ String *Item_func_md5::val_str(String *str)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
String * sptr= args[0]->val_str(str); String * sptr= args[0]->val_str(str);
str->set_charset(&my_charset_bin);
if (sptr) if (sptr)
{ {
my_MD5_CTX context; my_MD5_CTX context;
@ -170,6 +171,7 @@ String *Item_func_sha::val_str(String *str)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
String * sptr= args[0]->val_str(str); String * sptr= args[0]->val_str(str);
str->set_charset(&my_charset_bin);
if (sptr) /* If we got value different from NULL */ if (sptr) /* If we got value different from NULL */
{ {
SHA1_CONTEXT context; /* Context used to generate SHA1 hash */ SHA1_CONTEXT context; /* Context used to generate SHA1 hash */
@ -1605,7 +1607,7 @@ String *Item_func_encrypt::val_str(String *str)
null_value= 1; null_value= 1;
return 0; return 0;
} }
str->set(tmp,(uint) strlen(tmp),res->charset()); str->set(tmp, (uint) strlen(tmp), &my_charset_bin);
str->copy(); str->copy();
pthread_mutex_unlock(&LOCK_crypt); pthread_mutex_unlock(&LOCK_crypt);
return str; return str;
@ -2041,7 +2043,7 @@ String *Item_func_make_set::val_str(String *str)
return &my_empty_string; return &my_empty_string;
result= &tmp_str; result= &tmp_str;
} }
if (tmp_str.append(',') || tmp_str.append(*res)) if (tmp_str.append(STRING_WITH_LEN(","), &my_charset_bin) || tmp_str.append(*res))
return &my_empty_string; return &my_empty_string;
} }
} }
@ -2719,8 +2721,12 @@ String* Item_func_export_set::val_str(String* str)
} }
break; break;
case 3: case 3:
sep_buf.set(STRING_WITH_LEN(","), default_charset()); {
/* errors is not checked - assume "," can always be converted */
uint errors;
sep_buf.copy(STRING_WITH_LEN(","), &my_charset_bin, collation.collation, &errors);
sep = &sep_buf; sep = &sep_buf;
}
break; break;
default: default:
DBUG_ASSERT(0); // cannot happen DBUG_ASSERT(0); // cannot happen

View File

@ -43,7 +43,10 @@ class Item_func_md5 :public Item_str_func
{ {
String tmp_value; String tmp_value;
public: public:
Item_func_md5(Item *a) :Item_str_func(a) {} Item_func_md5(Item *a) :Item_str_func(a)
{
collation.set(&my_charset_bin);
}
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "md5"; } const char *func_name() const { return "md5"; }
@ -54,7 +57,10 @@ public:
class Item_func_sha :public Item_str_func class Item_func_sha :public Item_str_func
{ {
public: public:
Item_func_sha(Item *a) :Item_str_func(a) {} Item_func_sha(Item *a) :Item_str_func(a)
{
collation.set(&my_charset_bin);
}
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "sha"; } const char *func_name() const { return "sha"; }
@ -333,9 +339,21 @@ public:
class Item_func_encrypt :public Item_str_func class Item_func_encrypt :public Item_str_func
{ {
String tmp_value; String tmp_value;
/* Encapsulate common constructor actions */
void constructor_helper()
{
collation.set(&my_charset_bin);
}
public: public:
Item_func_encrypt(Item *a) :Item_str_func(a) {} Item_func_encrypt(Item *a) :Item_str_func(a)
Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) {} {
constructor_helper();
}
Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b)
{
constructor_helper();
}
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() { maybe_null=1; max_length = 13; } void fix_length_and_dec() { maybe_null=1; max_length = 13; }
const char *func_name() const { return "encrypt"; } const char *func_name() const { return "encrypt"; }

View File

@ -326,8 +326,6 @@ static char *my_bind_addr_str;
static char *default_collation_name; static char *default_collation_name;
static char *default_storage_engine_str; static char *default_storage_engine_str;
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME; static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
static char mysql_data_home_buff[2];
static struct passwd *user_info;
static I_List<THD> thread_cache; static I_List<THD> thread_cache;
static pthread_cond_t COND_thread_cache, COND_flush_thread_cache; static pthread_cond_t COND_thread_cache, COND_flush_thread_cache;
@ -508,7 +506,8 @@ key_map key_map_full(0); // Will be initialized later
const char *opt_date_time_formats[3]; const char *opt_date_time_formats[3];
char *mysql_data_home= mysql_real_data_home; char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
struct passwd *user_info;
char server_version[SERVER_VERSION_LENGTH]; char server_version[SERVER_VERSION_LENGTH];
char *mysqld_unix_port, *opt_mysql_tmpdir; char *mysqld_unix_port, *opt_mysql_tmpdir;
const char **errmesg; /* Error messages */ const char **errmesg; /* Error messages */
@ -6215,7 +6214,7 @@ The minimum value for this variable is 4096.",
"If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.", "If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.",
(gptr*) &global_system_variables.tmp_table_size, (gptr*) &global_system_variables.tmp_table_size,
(gptr*) &max_system_variables.tmp_table_size, 0, GET_ULONG, (gptr*) &max_system_variables.tmp_table_size, 0, GET_ULONG,
REQUIRED_ARG, 32*1024*1024L, 1024, ~0L, 0, 1, 0}, REQUIRED_ARG, 16*1024*1024L, 1024, ~0L, 0, 1, 0}, /* See max_heap_table_size . */
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE, {"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
"Allocation block size for transactions to be stored in binary log", "Allocation block size for transactions to be stored in binary log",
(gptr*) &global_system_variables.trans_alloc_block_size, (gptr*) &global_system_variables.trans_alloc_block_size,
@ -7592,10 +7591,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
} }
switch (method-1) { switch (method-1) {
case 0: case 0:
method_conv= MI_STATS_METHOD_NULLS_EQUAL; method_conv= MI_STATS_METHOD_NULLS_NOT_EQUAL;
break; break;
case 1: case 1:
method_conv= MI_STATS_METHOD_NULLS_NOT_EQUAL; method_conv= MI_STATS_METHOD_NULLS_EQUAL;
break; break;
case 2: case 2:
method_conv= MI_STATS_METHOD_IGNORE_NULLS; method_conv= MI_STATS_METHOD_IGNORE_NULLS;

View File

@ -859,7 +859,7 @@ my_real_read(NET *net, ulong *complen)
#endif /* EXTRA_DEBUG */ #endif /* EXTRA_DEBUG */
} }
#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) #if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
if (vio_should_retry(net->vio)) if (vio_errno(net->vio) == SOCKET_EINTR)
{ {
DBUG_PRINT("warning",("Interrupted read. Retrying...")); DBUG_PRINT("warning",("Interrupted read. Retrying..."));
continue; continue;

View File

@ -5379,14 +5379,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
continue; continue;
} }
if (user_name->host.length > HOSTNAME_LENGTH ||
user_name->user.length > USERNAME_LENGTH)
{
append_user(&wrong_users, user_name);
result= TRUE;
continue;
}
/* /*
Search all in-memory structures and grant tables Search all in-memory structures and grant tables
for a mention of the new user name. for a mention of the new user name.
@ -5579,8 +5571,6 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
} }
if (!find_acl_user(lex_user->host.str, lex_user->user.str, TRUE)) if (!find_acl_user(lex_user->host.str, lex_user->user.str, TRUE))
{ {
sql_print_error("REVOKE ALL PRIVILEGES, GRANT: User '%s'@'%s' does not "
"exists", lex_user->user.str, lex_user->host.str);
result= -1; result= -1;
continue; continue;
} }

View File

@ -1145,16 +1145,15 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
} }
info->updated++; info->updated++;
/* /*
If ON DUP KEY UPDATE updates a row instead of inserting one, and If ON DUP KEY UPDATE updates a row instead of inserting one, it's
there is an auto_increment column, then SELECT LAST_INSERT_ID() like a regular UPDATE statement: it should not affect the value of a
returns the id of the updated row: next SELECT LAST_INSERT_ID() or mysql_insert_id().
Except if LAST_INSERT_ID(#) was in the INSERT query, which is
handled separately by THD::arg_of_last_insert_id_function.
*/ */
insert_id_for_cur_row= table->file->insert_id_for_cur_row= 0;
if (table->next_number_field) if (table->next_number_field)
{ table->file->adjust_next_insert_id_after_explicit_value(table->next_number_field->val_int());
longlong field_val= table->next_number_field->val_int();
thd->record_first_successful_insert_id_in_cur_stmt(field_val);
table->file->adjust_next_insert_id_after_explicit_value(field_val);
}
trg_error= (table->triggers && trg_error= (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
TRG_ACTION_AFTER, TRUE)); TRG_ACTION_AFTER, TRUE));

View File

@ -663,7 +663,8 @@ int MYSQLlex(void *arg, void *yythd)
*/ */
if ((yylval->lex_str.str[0]=='_') && if ((yylval->lex_str.str[0]=='_') &&
(lex->charset=get_charset_by_csname(yylval->lex_str.str+1, (lex->underscore_charset=
get_charset_by_csname(yylval->lex_str.str + 1,
MY_CS_PRIMARY,MYF(0)))) MY_CS_PRIMARY,MYF(0))))
return(UNDERSCORE_CHARSET); return(UNDERSCORE_CHARSET);
return(result_state); // IDENT or IDENT_QUOTED return(result_state); // IDENT or IDENT_QUOTED
@ -1047,6 +1048,8 @@ int MYSQLlex(void *arg, void *yythd)
if (c == '.') if (c == '.')
lex->next_state=MY_LEX_IDENT_SEP; lex->next_state=MY_LEX_IDENT_SEP;
length= (uint) (lex->ptr - lex->tok_start)-1; length= (uint) (lex->ptr - lex->tok_start)-1;
if (length == 0)
return(ABORT_SYM); // Names must be nonempty.
if ((tokval= find_keyword(lex,length,0))) if ((tokval= find_keyword(lex,length,0)))
{ {
yyUnget(); // Put back 'c' yyUnget(); // Put back 'c'

View File

@ -895,7 +895,7 @@ typedef struct st_lex : public Query_tables_list
XID *xid; XID *xid;
gptr yacc_yyss,yacc_yyvs; gptr yacc_yyss,yacc_yyvs;
THD *thd; THD *thd;
CHARSET_INFO *charset; CHARSET_INFO *charset, *underscore_charset;
/* store original leaf_tables for INSERT SELECT and PS/SP */ /* store original leaf_tables for INSERT SELECT and PS/SP */
TABLE_LIST *leaf_tables_insert; TABLE_LIST *leaf_tables_insert;
/* Position (first character index) of SELECT of CREATE VIEW statement */ /* Position (first character index) of SELECT of CREATE VIEW statement */

View File

@ -67,7 +67,6 @@ static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
static void decrease_user_connections(USER_CONN *uc); static void decrease_user_connections(USER_CONN *uc);
#endif /* NO_EMBEDDED_ACCESS_CHECKS */ #endif /* NO_EMBEDDED_ACCESS_CHECKS */
static bool check_multi_update_lock(THD *thd); static bool check_multi_update_lock(THD *thd);
static void remove_escape(char *name);
static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables); static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
const char *any_db="*any*"; // Special symbol for check_access const char *any_db="*any*"; // Special symbol for check_access
@ -1442,7 +1441,6 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name)
} }
if (lower_case_table_names) if (lower_case_table_names)
my_casedn_str(files_charset_info, tbl_name); my_casedn_str(files_charset_info, tbl_name);
remove_escape(table_list->table_name);
if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT))) if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT)))
DBUG_RETURN(1); DBUG_RETURN(1);
@ -1909,7 +1907,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
general_log_print(thd, command, "%s %s", table_list.table_name, fields); general_log_print(thd, command, "%s %s", table_list.table_name, fields);
if (lower_case_table_names) if (lower_case_table_names)
my_casedn_str(files_charset_info, table_list.table_name); my_casedn_str(files_charset_info, table_list.table_name);
remove_escape(table_list.table_name); // This can't have wildcards
if (check_access(thd,SELECT_ACL,table_list.db,&table_list.grant.privilege, if (check_access(thd,SELECT_ACL,table_list.db,&table_list.grant.privilege,
0, 0, test(table_list.schema_table))) 0, 0, test(table_list.schema_table)))
@ -2299,7 +2296,6 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
DBUG_RETURN(1); DBUG_RETURN(1);
} }
db= lex->select_lex.db; db= lex->select_lex.db;
remove_escape(db); // Fix escaped '_'
if (check_db_name(db)) if (check_db_name(db))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), db); my_error(ER_WRONG_DB_NAME, MYF(0), db);
@ -2338,8 +2334,6 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
lex->query_tables_last= query_tables_last; lex->query_tables_last= query_tables_last;
TABLE_LIST *table_list= (TABLE_LIST*) sel->table_list.first; TABLE_LIST *table_list= (TABLE_LIST*) sel->table_list.first;
char *db= table_list->db; char *db= table_list->db;
remove_escape(db); // Fix escaped '_'
remove_escape(table_list->table_name);
if (check_access(thd,SELECT_ACL | EXTRA_ACL,db, if (check_access(thd,SELECT_ACL | EXTRA_ACL,db,
&table_list->grant.privilege, 0, 0, &table_list->grant.privilege, 0, 0,
test(table_list->schema_table))) test(table_list->schema_table)))
@ -6288,36 +6282,6 @@ add_proc_to_list(THD* thd, Item *item)
} }
/* Fix escaping of _, % and \ in database and table names (for ODBC) */
static void remove_escape(char *name)
{
if (!*name) // For empty DB names
return;
char *to;
#ifdef USE_MB
char *strend=name+(uint) strlen(name);
#endif
for (to=name; *name ; name++)
{
#ifdef USE_MB
int l;
if (use_mb(system_charset_info) &&
(l = my_ismbchar(system_charset_info, name, strend)))
{
while (l--)
*to++ = *name++;
name--;
continue;
}
#endif
if (*name == '\\' && name[1])
name++; // Skip '\\'
*to++= *name;
}
*to=0;
}
/**************************************************************************** /****************************************************************************
** save order by and tables in own lists ** save order by and tables in own lists
****************************************************************************/ ****************************************************************************/

View File

@ -1916,7 +1916,8 @@ void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length)
thd->stmt_map.erase(stmt); thd->stmt_map.erase(stmt);
} }
else else
general_log_print(thd, COM_STMT_PREPARE, "[%lu] %s", stmt->id, packet); general_log_print(thd, COM_STMT_PREPARE, "[%lu] %.*b", stmt->id,
stmt->query_length, stmt->query);
/* check_prepared_statemnt sends the metadata packet in case of success */ /* check_prepared_statemnt sends the metadata packet in case of success */
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -2291,7 +2292,8 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
if (!(specialflag & SPECIAL_NO_PRIOR)) if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(), WAIT_PRIOR); my_pthread_setprio(pthread_self(), WAIT_PRIOR);
if (error == 0) if (error == 0)
general_log_print(thd, COM_STMT_EXECUTE, "[%lu] %s", stmt->id, thd->query); general_log_print(thd, COM_STMT_EXECUTE, "[%lu] %.*b", stmt->id,
thd->query_length, thd->query);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;

View File

@ -7268,6 +7268,8 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
left_item->collation.collation == value->collation.collation)) left_item->collation.collation == value->collation.collation))
{ {
Item *tmp=value->new_item(); Item *tmp=value->new_item();
tmp->collation.set(right_item->collation);
if (tmp) if (tmp)
{ {
thd->change_item_tree(args + 1, tmp); thd->change_item_tree(args + 1, tmp);
@ -7290,6 +7292,8 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
right_item->collation.collation == value->collation.collation)) right_item->collation.collation == value->collation.collation))
{ {
Item *tmp=value->new_item(); Item *tmp=value->new_item();
tmp->collation.set(left_item->collation);
if (tmp) if (tmp)
{ {
thd->change_item_tree(args, tmp); thd->change_item_tree(args, tmp);

View File

@ -1228,9 +1228,10 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
store_key_options(thd, packet, table, key_info); store_key_options(thd, packet, table, key_info);
if (key_info->parser) if (key_info->parser)
{ {
packet->append(" WITH PARSER ", 13); packet->append(STRING_WITH_LEN(" /*!50100 WITH PARSER "));
append_identifier(thd, packet, key_info->parser->name.str, append_identifier(thd, packet, key_info->parser->name.str,
key_info->parser->name.length); key_info->parser->name.length);
packet->append(STRING_WITH_LEN(" */ "));
} }
} }
@ -1256,9 +1257,9 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
if ((for_str= file->get_tablespace_name(thd))) if ((for_str= file->get_tablespace_name(thd)))
{ {
packet->append(" TABLESPACE "); packet->append(STRING_WITH_LEN(" /*!50100 TABLESPACE "));
packet->append(for_str, strlen(for_str)); packet->append(for_str, strlen(for_str));
packet->append(" STORAGE DISK"); packet->append(STRING_WITH_LEN(" STORAGE DISK */"));
my_free(for_str, MYF(0)); my_free(for_str, MYF(0));
} }
@ -1297,7 +1298,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
if(create_info.auto_increment_value > 1) if(create_info.auto_increment_value > 1)
{ {
packet->append(" AUTO_INCREMENT=", 16); packet->append(STRING_WITH_LEN(" AUTO_INCREMENT="));
end= longlong10_to_str(create_info.auto_increment_value, buff,10); end= longlong10_to_str(create_info.auto_increment_value, buff,10);
packet->append(buff, (uint) (end - buff)); packet->append(buff, (uint) (end - buff));
} }

View File

@ -238,6 +238,10 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
0 No conversion needed 0 No conversion needed
1 Either character set conversion or adding leading zeros 1 Either character set conversion or adding leading zeros
(e.g. for UCS-2) must be done (e.g. for UCS-2) must be done
NOTE
to_cs may be NULL for "no conversion" if the system variable
character_set_results is NULL.
*/ */
bool String::needs_conversion(uint32 arg_length, bool String::needs_conversion(uint32 arg_length,
@ -246,7 +250,8 @@ bool String::needs_conversion(uint32 arg_length,
uint32 *offset) uint32 *offset)
{ {
*offset= 0; *offset= 0;
if ((to_cs == &my_charset_bin) || if (!to_cs ||
(to_cs == &my_charset_bin) ||
(to_cs == from_cs) || (to_cs == from_cs) ||
my_charset_same(from_cs, to_cs) || my_charset_same(from_cs, to_cs) ||
((from_cs == &my_charset_bin) && ((from_cs == &my_charset_bin) &&

View File

@ -2224,6 +2224,40 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
/*
Convert the default value from client character
set into the column character set if necessary.
*/
if (sql_field->def &&
save_cs != sql_field->def->collation.collation &&
(sql_field->sql_type == FIELD_TYPE_VAR_STRING ||
sql_field->sql_type == FIELD_TYPE_STRING ||
sql_field->sql_type == FIELD_TYPE_SET ||
sql_field->sql_type == FIELD_TYPE_ENUM))
{
Query_arena backup_arena;
bool need_to_change_arena= !thd->stmt_arena->is_conventional();
if (need_to_change_arena)
{
/* Asser that we don't do that at every PS execute */
DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() ||
thd->stmt_arena->is_first_sp_execute());
thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena);
}
sql_field->def= sql_field->def->safe_charset_converter(save_cs);
if (need_to_change_arena)
thd->restore_active_arena(thd->stmt_arena, &backup_arena);
if (sql_field->def == NULL)
{
/* Could not convert */
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
DBUG_RETURN(-1);
}
}
if (sql_field->sql_type == FIELD_TYPE_SET || if (sql_field->sql_type == FIELD_TYPE_SET ||
sql_field->sql_type == FIELD_TYPE_ENUM) sql_field->sql_type == FIELD_TYPE_ENUM)
{ {
@ -2285,35 +2319,6 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->interval_list.empty(); // Don't need interval_list anymore sql_field->interval_list.empty(); // Don't need interval_list anymore
} }
/*
Convert the default value from client character
set into the column character set if necessary.
*/
if (sql_field->def && cs != sql_field->def->collation.collation)
{
Query_arena backup_arena;
bool need_to_change_arena= !thd->stmt_arena->is_conventional();
if (need_to_change_arena)
{
/* Asser that we don't do that at every PS execute */
DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() ||
thd->stmt_arena->is_first_sp_execute());
thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena);
}
sql_field->def= sql_field->def->safe_charset_converter(cs);
if (need_to_change_arena)
thd->restore_active_arena(thd->stmt_arena, &backup_arena);
if (sql_field->def == NULL)
{
/* Could not convert */
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
DBUG_RETURN(-1);
}
}
if (sql_field->sql_type == FIELD_TYPE_SET) if (sql_field->sql_type == FIELD_TYPE_SET)
{ {
uint32 field_length; uint32 field_length;

View File

@ -8902,7 +8902,7 @@ text_literal:
| NCHAR_STRING | NCHAR_STRING
{ $$= new Item_string($1.str,$1.length,national_charset_info); } { $$= new Item_string($1.str,$1.length,national_charset_info); }
| UNDERSCORE_CHARSET TEXT_STRING | UNDERSCORE_CHARSET TEXT_STRING
{ $$ = new Item_string($2.str,$2.length,Lex->charset); } { $$ = new Item_string($2.str,$2.length,Lex->underscore_charset); }
| text_literal TEXT_STRING_literal | text_literal TEXT_STRING_literal
{ ((Item_string*) $1)->append($2.str,$2.length); } { ((Item_string*) $1)->append($2.str,$2.length); }
; ;
@ -8980,7 +8980,7 @@ literal:
(String*) 0; (String*) 0;
$$= new Item_string(str ? str->ptr() : "", $$= new Item_string(str ? str->ptr() : "",
str ? str->length() : 0, str ? str->length() : 0,
Lex->charset); Lex->underscore_charset);
} }
| UNDERSCORE_CHARSET BIN_NUM | UNDERSCORE_CHARSET BIN_NUM
{ {

View File

@ -21,6 +21,7 @@
#ifdef HAVE_STACKTRACE #ifdef HAVE_STACKTRACE
#include <unistd.h> #include <unistd.h>
#include <strings.h>
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end) #define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
@ -44,7 +45,29 @@ void safe_print_str(const char* name, const char* val, int max_len)
} }
#ifdef TARGET_OS_LINUX #ifdef TARGET_OS_LINUX
#define SIGRETURN_FRAME_COUNT 2
#ifdef __i386__
#define SIGRETURN_FRAME_OFFSET 17
#endif
#ifdef __x86_64__
#define SIGRETURN_FRAME_OFFSET 23
#endif
static my_bool is_nptl;
/* Check if we are using NPTL or LinuxThreads on Linux */
void check_thread_lib(void)
{
char buf[5];
#ifdef _CS_GNU_LIBPTHREAD_VERSION
confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof(buf));
is_nptl = !strncasecmp(buf, "NPTL", sizeof(buf));
#else
is_nptl = 0;
#endif
}
#if defined(__alpha__) && defined(__GNUC__) #if defined(__alpha__) && defined(__GNUC__)
/* /*
@ -90,7 +113,7 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp)
void print_stacktrace(gptr stack_bottom, ulong thread_stack) void print_stacktrace(gptr stack_bottom, ulong thread_stack)
{ {
uchar** fp; uchar** fp;
uint frame_count = 0; uint frame_count = 0, sigreturn_frame_count;
#if defined(__alpha__) && defined(__GNUC__) #if defined(__alpha__) && defined(__GNUC__)
uint32* pc; uint32* pc;
#endif #endif
@ -104,24 +127,23 @@ terribly wrong...\n");
__asm __volatile__ ("movl %%ebp,%0" __asm __volatile__ ("movl %%ebp,%0"
:"=r"(fp) :"=r"(fp)
:"r"(fp)); :"r"(fp));
if (!fp) #endif
{ #ifdef __x86_64__
fprintf(stderr, "frame pointer (ebp) is NULL, did you compile with\n\ __asm __volatile__ ("movq %%rbp,%0"
-fomit-frame-pointer? Aborting backtrace!\n"); :"=r"(fp)
return; :"r"(fp));
}
#endif #endif
#if defined(__alpha__) && defined(__GNUC__) #if defined(__alpha__) && defined(__GNUC__)
__asm __volatile__ ("mov $30,%0" __asm __volatile__ ("mov $30,%0"
:"=r"(fp) :"=r"(fp)
:"r"(fp)); :"r"(fp));
#endif
if (!fp) if (!fp)
{ {
fprintf(stderr, "frame pointer (fp) is NULL, did you compile with\n\ fprintf(stderr, "frame pointer is NULL, did you compile with\n\
-fomit-frame-pointer? Aborting backtrace!\n"); -fomit-frame-pointer? Aborting backtrace!\n");
return; return;
} }
#endif /* __alpha__ */
if (!stack_bottom || (gptr) stack_bottom > (gptr) &fp) if (!stack_bottom || (gptr) stack_bottom > (gptr) &fp)
{ {
@ -151,13 +173,16 @@ terribly wrong...\n");
:"r"(pc)); :"r"(pc));
#endif /* __alpha__ */ #endif /* __alpha__ */
/* We are 1 frame above signal frame with NPTL and 2 frames above with LT */
sigreturn_frame_count = is_nptl ? 1 : 2;
while (fp < (uchar**) stack_bottom) while (fp < (uchar**) stack_bottom)
{ {
#ifdef __i386__ #if defined(__i386__) || defined(__x86_64__)
uchar** new_fp = (uchar**)*fp; uchar** new_fp = (uchar**)*fp;
fprintf(stderr, "%p\n", frame_count == SIGRETURN_FRAME_COUNT ? fprintf(stderr, "%p\n", frame_count == sigreturn_frame_count ?
*(fp+17) : *(fp+1)); *(fp + SIGRETURN_FRAME_OFFSET) : *(fp + 1));
#endif /* __386__ */ #endif /* defined(__386__) || defined(__x86_64__) */
#if defined(__alpha__) && defined(__GNUC__) #if defined(__alpha__) && defined(__GNUC__)
uchar** new_fp = find_prev_fp(pc, fp); uchar** new_fp = find_prev_fp(pc, fp);

View File

@ -19,16 +19,20 @@ extern "C" {
#endif #endif
#ifdef TARGET_OS_LINUX #ifdef TARGET_OS_LINUX
#if defined(HAVE_STACKTRACE) || (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) #if defined(HAVE_STACKTRACE) || (defined (__x86_64__) || defined (__i386__) || (defined(__alpha__) && defined(__GNUC__)))
#undef HAVE_STACKTRACE #undef HAVE_STACKTRACE
#define HAVE_STACKTRACE #define HAVE_STACKTRACE
extern char* __bss_start; extern char* __bss_start;
extern char* heap_start; extern char* heap_start;
#define init_stacktrace() { heap_start = (char*) &__bss_start; } #define init_stacktrace() do { \
heap_start = (char*) &__bss_start; \
check_thread_lib(); \
} while(0);
void print_stacktrace(gptr stack_bottom, ulong thread_stack); void print_stacktrace(gptr stack_bottom, ulong thread_stack);
void safe_print_str(const char* name, const char* val, int max_len); void safe_print_str(const char* name, const char* val, int max_len);
void check_thread_lib(void);
#endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */ #endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */
#endif /* TARGET_OS_LINUX */ #endif /* TARGET_OS_LINUX */

View File

@ -143,8 +143,8 @@ btr_root_get(
root_page_no = dict_tree_get_page(tree); root_page_no = dict_tree_get_page(tree);
root = btr_page_get(space, root_page_no, RW_X_LATCH, mtr); root = btr_page_get(space, root_page_no, RW_X_LATCH, mtr);
ut_a((ibool)!!page_is_comp(root) == ut_a((ibool)!!page_is_comp(root)
dict_table_is_comp(tree->tree_index->table)); == dict_table_is_comp(tree->tree_index->table));
return(root); return(root);
} }
@ -303,7 +303,8 @@ btr_page_alloc_for_ibuf(
flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE,
mtr); mtr);
ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr)); ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
mtr));
return(new_page); return(new_page);
} }
@ -596,8 +597,8 @@ btr_page_get_father_for_rec(
offsets = rec_get_offsets(node_ptr, index, offsets, offsets = rec_get_offsets(node_ptr, index, offsets,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
if (btr_node_ptr_get_child_page_no(node_ptr, offsets) != if (UNIV_UNLIKELY(btr_node_ptr_get_child_page_no(node_ptr, offsets)
buf_frame_get_page_no(page)) { != buf_frame_get_page_no(page))) {
rec_t* print_rec; rec_t* print_rec;
fputs("InnoDB: Dump of the child page:\n", stderr); fputs("InnoDB: Dump of the child page:\n", stderr);
buf_page_print(buf_frame_align(page)); buf_page_print(buf_frame_align(page));
@ -621,15 +622,18 @@ btr_page_get_father_for_rec(
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
page_rec_print(node_ptr, offsets); page_rec_print(node_ptr, offsets);
fputs( fputs("InnoDB: You should dump + drop + reimport the table"
"InnoDB: You should dump + drop + reimport the table to fix the\n" " to fix the\n"
"InnoDB: corruption. If the crash happens at the database startup, see\n" "InnoDB: corruption. If the crash happens at "
"InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html about\n" "the database startup, see\n"
"InnoDB: forcing recovery. Then dump + drop + reimport.\n", stderr); "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
"forcing-recovery.html about\n"
"InnoDB: forcing recovery. "
"Then dump + drop + reimport.\n", stderr);
} }
ut_a(btr_node_ptr_get_child_page_no(node_ptr, offsets) == ut_a(btr_node_ptr_get_child_page_no(node_ptr, offsets)
buf_frame_get_page_no(page)); == buf_frame_get_page_no(page));
mem_heap_free(heap); mem_heap_free(heap);
return(node_ptr); return(node_ptr);
@ -648,7 +652,8 @@ btr_page_get_father_node_ptr(
user record */ user record */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
return(btr_page_get_father_for_rec(tree, page, return(btr_page_get_father_for_rec
(tree, page,
page_rec_get_next(page_get_infimum_rec(page)), mtr)); page_rec_get_next(page_get_infimum_rec(page)), mtr));
} }
@ -678,8 +683,8 @@ btr_create(
if (type & DICT_IBUF) { if (type & DICT_IBUF) {
/* Allocate first the ibuf header page */ /* Allocate first the ibuf header page */
ibuf_hdr_frame = fseg_create(space, 0, ibuf_hdr_frame = fseg_create
IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr); (space, 0, IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(ibuf_hdr_frame, SYNC_TREE_NODE_NEW); buf_page_dbg_add_level(ibuf_hdr_frame, SYNC_TREE_NODE_NEW);
@ -689,9 +694,9 @@ btr_create(
/* Allocate then the next page to the segment: it will be the /* Allocate then the next page to the segment: it will be the
tree root page */ tree root page */
page_no = fseg_alloc_free_page( page_no = fseg_alloc_free_page(ibuf_hdr_frame + IBUF_HEADER
ibuf_hdr_frame + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
+ IBUF_TREE_SEG_HEADER, IBUF_TREE_ROOT_PAGE_NO, IBUF_TREE_ROOT_PAGE_NO,
FSP_UP, mtr); FSP_UP, mtr);
ut_ad(page_no == IBUF_TREE_ROOT_PAGE_NO); ut_ad(page_no == IBUF_TREE_ROOT_PAGE_NO);
@ -781,8 +786,8 @@ leaf_loop:
/* NOTE: page hash indexes are dropped when a page is freed inside /* NOTE: page hash indexes are dropped when a page is freed inside
fsp0fsp. */ fsp0fsp. */
finished = fseg_free_step( finished = fseg_free_step
root + PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr); (root + PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
if (!finished) { if (!finished) {
@ -794,8 +799,8 @@ top_loop:
root = btr_page_get(space, root_page_no, RW_X_LATCH, &mtr); root = btr_page_get(space, root_page_no, RW_X_LATCH, &mtr);
finished = fseg_free_step_not_header( finished = fseg_free_step_not_header
root + PAGE_HEADER + PAGE_BTR_SEG_TOP, &mtr); (root + PAGE_HEADER + PAGE_BTR_SEG_TOP, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
if (!finished) { if (!finished) {
@ -822,8 +827,8 @@ btr_free_root(
btr_search_drop_page_hash_index(root); btr_search_drop_page_hash_index(root);
top_loop: top_loop:
finished = fseg_free_step( finished = fseg_free_step
root + PAGE_HEADER + PAGE_BTR_SEG_TOP, mtr); (root + PAGE_HEADER + PAGE_BTR_SEG_TOP, mtr);
if (!finished) { if (!finished) {
goto top_loop; goto top_loop;
@ -885,7 +890,8 @@ btr_page_reorganize_low(
do not copy the lock bits yet */ do not copy the lock bits yet */
page_copy_rec_list_end_no_locks(page, new_page, page_copy_rec_list_end_no_locks(page, new_page,
page_get_infimum_rec(new_page), index, mtr); page_get_infimum_rec(new_page),
index, mtr);
/* Copy max trx id to recreated page */ /* Copy max trx id to recreated page */
page_set_max_trx_id(page, page_get_max_trx_id(new_page)); page_set_max_trx_id(page, page_get_max_trx_id(new_page));
@ -901,9 +907,12 @@ btr_page_reorganize_low(
buf_page_print(page); buf_page_print(page);
buf_page_print(new_page); buf_page_print(new_page);
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: page old data size %lu new data size %lu\n" "InnoDB: Error: page old data size %lu"
"InnoDB: Error: page old max ins size %lu new max ins size %lu\n" " new data size %lu\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", "InnoDB: Error: page old max ins size %lu"
" new max ins size %lu\n"
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n",
(unsigned long) data_size1, (unsigned long) data_size2, (unsigned long) data_size1, (unsigned long) data_size2,
(unsigned long) max_ins_size1, (unsigned long) max_ins_size1,
(unsigned long) max_ins_size2); (unsigned long) max_ins_size2);
@ -1078,8 +1087,10 @@ btr_root_raise_and_insert(
/* We play safe and reset the free bits for the new page */ /* We play safe and reset the free bits for the new page */
/* fprintf(stderr, "Root raise new page no %lu\n", #if 0
buf_frame_get_page_no(new_page)); */ fprintf(stderr, "Root raise new page no %lu\n",
buf_frame_get_page_no(new_page));
#endif
ibuf_reset_free_bits(tree->tree_index, new_page); ibuf_reset_free_bits(tree->tree_index, new_page);
/* Reposition the cursor to the child node */ /* Reposition the cursor to the child node */
@ -1265,7 +1276,8 @@ btr_page_get_sure_split_rec(
incl_data += insert_size; incl_data += insert_size;
} else { } else {
offsets = rec_get_offsets(rec, cursor->index, offsets = rec_get_offsets(rec, cursor->index,
offsets, ULINT_UNDEFINED, &heap); offsets, ULINT_UNDEFINED,
&heap);
incl_data += rec_offs_size(offsets); incl_data += rec_offs_size(offsets);
} }
@ -1423,12 +1435,15 @@ btr_insert_on_non_leaf_level(
first parameter for btr_cur_search_to_nth_level. */ first parameter for btr_cur_search_to_nth_level. */
btr_cur_search_to_nth_level(tree->tree_index, btr_cur_search_to_nth_level(tree->tree_index,
level, tuple, PAGE_CUR_LE, BTR_CONT_MODIFY_TREE, level, tuple, PAGE_CUR_LE,
BTR_CONT_MODIFY_TREE,
&cursor, 0, mtr); &cursor, 0, mtr);
err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG
| BTR_KEEP_SYS_FLAG | BTR_NO_UNDO_LOG_FLAG, | BTR_KEEP_SYS_FLAG
&cursor, tuple, &rec, &dummy_big_rec, NULL, mtr); | BTR_NO_UNDO_LOG_FLAG,
&cursor, tuple, &rec,
&dummy_big_rec, NULL, mtr);
ut_a(err == DB_SUCCESS); ut_a(err == DB_SUCCESS);
} }
@ -1484,9 +1499,8 @@ btr_attach_half_pages(
/* Replace the address of the old child node (= page) with the /* Replace the address of the old child node (= page) with the
address of the new lower half */ address of the new lower half */
btr_node_ptr_set_child_page_no(node_ptr, btr_node_ptr_set_child_page_no(node_ptr, rec_get_offsets
rec_get_offsets(node_ptr, (node_ptr, tree->tree_index,
tree->tree_index,
NULL, ULINT_UNDEFINED, &heap), NULL, ULINT_UNDEFINED, &heap),
lower_page_no, mtr); lower_page_no, mtr);
mem_heap_empty(heap); mem_heap_empty(heap);
@ -1673,10 +1687,12 @@ func_start:
n_uniq, &heap); n_uniq, &heap);
insert_will_fit = btr_page_insert_fits(cursor, insert_will_fit = btr_page_insert_fits(cursor,
split_rec, offsets, tuple, heap); split_rec, offsets,
tuple, heap);
} else { } else {
insert_will_fit = btr_page_insert_fits(cursor, insert_will_fit = btr_page_insert_fits(cursor,
NULL, NULL, tuple, heap); NULL, NULL,
tuple, heap);
} }
if (insert_will_fit && (btr_page_get_level(page, mtr) == 0)) { if (insert_will_fit && (btr_page_get_level(page, mtr) == 0)) {
@ -1775,9 +1791,11 @@ func_start:
ibuf_update_free_bits_for_two_pages_low(cursor->index, left_page, ibuf_update_free_bits_for_two_pages_low(cursor->index, left_page,
right_page, mtr); right_page, mtr);
/* fprintf(stderr, "Split and insert done %lu %lu\n", #if 0
fprintf(stderr, "Split and insert done %lu %lu\n",
buf_frame_get_page_no(left_page), buf_frame_get_page_no(left_page),
buf_frame_get_page_no(right_page)); */ buf_frame_get_page_no(right_page));
#endif
ut_ad(page_validate(left_page, tree->tree_index)); ut_ad(page_validate(left_page, tree->tree_index));
ut_ad(page_validate(right_page, tree->tree_index)); ut_ad(page_validate(right_page, tree->tree_index));
@ -1849,8 +1867,8 @@ btr_set_min_rec_mark_log(
ulint comp, /* nonzero=compact record format */ ulint comp, /* nonzero=compact record format */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
mlog_write_initial_log_record(rec, mlog_write_initial_log_record
comp ? MLOG_COMP_REC_MIN_MARK : MLOG_REC_MIN_MARK, mtr); (rec, comp ? MLOG_COMP_REC_MIN_MARK : MLOG_REC_MIN_MARK, mtr);
/* Write rec offset as a 2-byte ulint */ /* Write rec offset as a 2-byte ulint */
mlog_catenate_ulint(mtr, ut_align_offset(rec, UNIV_PAGE_SIZE), mlog_catenate_ulint(mtr, ut_align_offset(rec, UNIV_PAGE_SIZE),
@ -1961,8 +1979,8 @@ btr_lift_page_up(
ut_ad(btr_page_get_next(page, mtr) == FIL_NULL); ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page), ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
father_page = buf_frame_align( father_page = buf_frame_align
btr_page_get_father_node_ptr(tree, page, mtr)); (btr_page_get_father_node_ptr(tree, page, mtr));
page_level = btr_page_get_level(page, mtr); page_level = btr_page_get_level(page, mtr);
index = tree->tree_index; index = tree->tree_index;
@ -2041,8 +2059,10 @@ btr_compress(
left_page_no = btr_page_get_prev(page, mtr); left_page_no = btr_page_get_prev(page, mtr);
right_page_no = btr_page_get_next(page, mtr); right_page_no = btr_page_get_next(page, mtr);
/* fprintf(stderr, "Merge left page %lu right %lu \n", left_page_no, #if 0
right_page_no); */ fprintf(stderr, "Merge left page %lu right %lu \n",
left_page_no, right_page_no);
#endif
node_ptr = btr_page_get_father_node_ptr(tree, page, mtr); node_ptr = btr_page_get_father_node_ptr(tree, page, mtr);
ut_ad(!comp || rec_get_status(node_ptr) == REC_STATUS_NODE_PTR); ut_ad(!comp || rec_get_status(node_ptr) == REC_STATUS_NODE_PTR);
@ -2082,8 +2102,8 @@ btr_compress(
data_size = page_get_data_size(page); data_size = page_get_data_size(page);
ut_a(page_is_comp(merge_page) == comp); ut_a(page_is_comp(merge_page) == comp);
max_ins_size_reorg = page_get_max_insert_size_after_reorganize( max_ins_size_reorg = page_get_max_insert_size_after_reorganize
merge_page, n_recs); (merge_page, n_recs);
if (data_size > max_ins_size_reorg) { if (data_size > max_ins_size_reorg) {
/* No space for merge */ /* No space for merge */
@ -2129,9 +2149,10 @@ btr_compress(
/* Replace the address of the old child node (= page) with the /* Replace the address of the old child node (= page) with the
address of the merge page to the right */ address of the merge page to the right */
btr_node_ptr_set_child_page_no(node_ptr, btr_node_ptr_set_child_page_no(node_ptr, rec_get_offsets
rec_get_offsets(node_ptr, cursor->index, (node_ptr, cursor->index,
offsets_, ULINT_UNDEFINED, &heap), offsets_, ULINT_UNDEFINED,
&heap),
right_page_no, mtr); right_page_no, mtr);
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
@ -2141,17 +2162,19 @@ btr_compress(
/* Move records to the merge page */ /* Move records to the merge page */
if (is_left) { if (is_left) {
orig_pred = page_rec_get_prev( orig_pred = page_rec_get_prev
page_get_supremum_rec(merge_page)); (page_get_supremum_rec(merge_page));
page_copy_rec_list_start(merge_page, page, page_copy_rec_list_start(merge_page, page,
page_get_supremum_rec(page), cursor->index, mtr); page_get_supremum_rec(page),
cursor->index, mtr);
lock_update_merge_left(merge_page, orig_pred, page); lock_update_merge_left(merge_page, orig_pred, page);
} else { } else {
orig_succ = page_rec_get_next( orig_succ = page_rec_get_next
page_get_infimum_rec(merge_page)); (page_get_infimum_rec(merge_page));
page_copy_rec_list_end(merge_page, page, page_copy_rec_list_end(merge_page, page,
page_get_infimum_rec(page), cursor->index, mtr); page_get_infimum_rec(page),
cursor->index, mtr);
lock_update_merge_right(orig_succ, page); lock_update_merge_right(orig_succ, page);
} }
@ -2292,8 +2315,8 @@ btr_discard_page(
if (left_page_no != FIL_NULL) { if (left_page_no != FIL_NULL) {
lock_update_discard(page_get_supremum_rec(merge_page), page); lock_update_discard(page_get_supremum_rec(merge_page), page);
} else { } else {
lock_update_discard(page_rec_get_next( lock_update_discard(page_rec_get_next
page_get_infimum_rec(merge_page)), page); (page_get_infimum_rec(merge_page)), page);
} }
/* Free the file page */ /* Free the file page */
@ -2316,9 +2339,8 @@ btr_print_size(
mtr_t mtr; mtr_t mtr;
if (tree->type & DICT_IBUF) { if (tree->type & DICT_IBUF) {
fputs( fputs("Sorry, cannot print info of an ibuf tree:"
"Sorry, cannot print info of an ibuf tree: use ibuf functions\n", " use ibuf functions\n", stderr);
stderr);
return; return;
} }
@ -2472,15 +2494,13 @@ btr_check_node_ptr(
heap = mem_heap_create(256); heap = mem_heap_create(256);
node_ptr_tuple = dict_tree_build_node_ptr( node_ptr_tuple = dict_tree_build_node_ptr
tree, (tree, page_rec_get_next(page_get_infimum_rec(page)),
page_rec_get_next(page_get_infimum_rec(page)),
0, heap, btr_page_get_level(page, mtr)); 0, heap, btr_page_get_level(page, mtr));
ut_a(cmp_dtuple_rec(node_ptr_tuple, node_ptr, ut_a(!cmp_dtuple_rec(node_ptr_tuple, node_ptr,
rec_get_offsets(node_ptr, rec_get_offsets(node_ptr, tree->tree_index,
tree->tree_index, NULL, ULINT_UNDEFINED, &heap)));
NULL, ULINT_UNDEFINED, &heap)) == 0);
mem_heap_free(heap); mem_heap_free(heap);
@ -2579,16 +2599,17 @@ btr_index_rec_validate(
if ((dict_index_get_nth_field(index, i)->prefix_len == 0 if ((dict_index_get_nth_field(index, i)->prefix_len == 0
&& len != UNIV_SQL_NULL && fixed_size && len != UNIV_SQL_NULL && fixed_size
&& len != fixed_size) && len != fixed_size)
|| || (dict_index_get_nth_field(index, i)->prefix_len > 0
(dict_index_get_nth_field(index, i)->prefix_len > 0
&& len != UNIV_SQL_NULL && len != UNIV_SQL_NULL
&& len > && len
dict_index_get_nth_field(index, i)->prefix_len)) { > dict_index_get_nth_field(index, i)->prefix_len)) {
btr_index_rec_validate_report(page, rec, index); btr_index_rec_validate_report(page, rec, index);
fprintf(stderr, fprintf(stderr,
"InnoDB: field %lu len is %lu, should be %lu\n", "InnoDB: field %lu len is %lu,"
(ulong) i, (ulong) len, (ulong) dtype_get_fixed_size(type)); " should be %lu\n",
(ulong) i, (ulong) len,
(ulong) dtype_get_fixed_size(type));
if (dump_on_error) { if (dump_on_error) {
buf_page_print(page); buf_page_print(page);
@ -2771,8 +2792,9 @@ loop:
left_page_no = btr_page_get_prev(page, &mtr); left_page_no = btr_page_get_prev(page, &mtr);
ut_a((page_get_n_recs(page) > 0) ut_a((page_get_n_recs(page) > 0)
|| ((level == 0) && || ((level == 0)
(buf_frame_get_page_no(page) == dict_tree_get_page(tree)))); && (buf_frame_get_page_no(page)
== dict_tree_get_page(tree))));
if (right_page_no != FIL_NULL) { if (right_page_no != FIL_NULL) {
rec_t* right_rec; rec_t* right_rec;
@ -2802,14 +2824,15 @@ loop:
} }
rec = page_rec_get_prev(page_get_supremum_rec(page)); rec = page_rec_get_prev(page_get_supremum_rec(page));
right_rec = page_rec_get_next( right_rec = page_rec_get_next(page_get_infimum_rec
page_get_infimum_rec(right_page)); (right_page));
offsets = rec_get_offsets(rec, index, offsets = rec_get_offsets(rec, index,
offsets, ULINT_UNDEFINED, &heap); offsets, ULINT_UNDEFINED, &heap);
offsets2 = rec_get_offsets(right_rec, index, offsets2 = rec_get_offsets(right_rec, index,
offsets2, ULINT_UNDEFINED, &heap); offsets2, ULINT_UNDEFINED, &heap);
if (UNIV_UNLIKELY(cmp_rec_rec(rec, right_rec, if (UNIV_UNLIKELY(cmp_rec_rec(rec, right_rec,
offsets, offsets2, index) >= 0)) { offsets, offsets2,
index) >= 0)) {
btr_validate_report2(index, level, page, right_page); btr_validate_report2(index, level, page, right_page);
@ -2824,8 +2847,8 @@ loop:
rec_print(stderr, rec, index); rec_print(stderr, rec, index);
putc('\n', stderr); putc('\n', stderr);
fputs("InnoDB: record ", stderr); fputs("InnoDB: record ", stderr);
rec = page_rec_get_next(page_get_infimum_rec( rec = page_rec_get_next
right_page)); (page_get_infimum_rec(right_page));
rec_print(stderr, rec, index); rec_print(stderr, rec, index);
putc('\n', stderr); putc('\n', stderr);
@ -2834,8 +2857,8 @@ loop:
} }
if (level > 0 && left_page_no == FIL_NULL) { if (level > 0 && left_page_no == FIL_NULL) {
ut_a(REC_INFO_MIN_REC_FLAG & rec_get_info_bits( ut_a(REC_INFO_MIN_REC_FLAG & rec_get_info_bits
page_rec_get_next(page_get_infimum_rec(page)), (page_rec_get_next(page_get_infimum_rec(page)),
page_is_comp(page))); page_is_comp(page)));
} }
@ -2848,11 +2871,11 @@ loop:
offsets = rec_get_offsets(node_ptr, index, offsets = rec_get_offsets(node_ptr, index,
offsets, ULINT_UNDEFINED, &heap); offsets, ULINT_UNDEFINED, &heap);
if (btr_node_ptr_get_child_page_no(node_ptr, offsets) != if (btr_node_ptr_get_child_page_no(node_ptr, offsets)
buf_frame_get_page_no(page) != buf_frame_get_page_no(page)
|| node_ptr != btr_page_get_father_for_rec(tree, page, || node_ptr != btr_page_get_father_for_rec
page_rec_get_prev(page_get_supremum_rec(page)), (tree, page,
&mtr)) { page_rec_get_prev(page_get_supremum_rec(page)), &mtr)) {
btr_validate_report1(index, level, page); btr_validate_report1(index, level, page);
fputs("InnoDB: node pointer to the page is wrong\n", fputs("InnoDB: node pointer to the page is wrong\n",
@ -2866,13 +2889,13 @@ loop:
fprintf(stderr, "\n" fprintf(stderr, "\n"
"InnoDB: node ptr child page n:o %lu\n", "InnoDB: node ptr child page n:o %lu\n",
(unsigned long) btr_node_ptr_get_child_page_no( (unsigned long) btr_node_ptr_get_child_page_no
node_ptr, offsets)); (node_ptr, offsets));
fputs("InnoDB: record on page ", stderr); fputs("InnoDB: record on page ", stderr);
rec = btr_page_get_father_for_rec(tree, page, rec = btr_page_get_father_for_rec
page_rec_get_prev(page_get_supremum_rec(page)), (tree, page, page_rec_get_prev
&mtr); (page_get_supremum_rec(page)), &mtr);
rec_print(stderr, rec, index); rec_print(stderr, rec, index);
putc('\n', stderr); putc('\n', stderr);
ret = FALSE; ret = FALSE;
@ -2882,19 +2905,18 @@ loop:
if (btr_page_get_level(page, &mtr) > 0) { if (btr_page_get_level(page, &mtr) > 0) {
offsets = rec_get_offsets(node_ptr, index, offsets = rec_get_offsets(node_ptr, index,
offsets, ULINT_UNDEFINED, &heap); offsets, ULINT_UNDEFINED,
&heap);
node_ptr_tuple = dict_tree_build_node_ptr( node_ptr_tuple = dict_tree_build_node_ptr
tree, (tree,
page_rec_get_next( page_rec_get_next(page_get_infimum_rec(page)),
page_get_infimum_rec(page)), 0, heap, btr_page_get_level(page, &mtr));
0, heap,
btr_page_get_level(page, &mtr));
if (cmp_dtuple_rec(node_ptr_tuple, node_ptr, if (cmp_dtuple_rec(node_ptr_tuple, node_ptr,
offsets)) { offsets)) {
rec_t* first_rec = page_rec_get_next( rec_t* first_rec = page_rec_get_next
page_get_infimum_rec(page)); (page_get_infimum_rec(page));
btr_validate_report1(index, level, page); btr_validate_report1(index, level, page);
@ -2915,26 +2937,26 @@ loop:
} }
if (left_page_no == FIL_NULL) { if (left_page_no == FIL_NULL) {
ut_a(node_ptr == page_rec_get_next( ut_a(node_ptr == page_rec_get_next
page_get_infimum_rec(father_page))); (page_get_infimum_rec(father_page)));
ut_a(btr_page_get_prev(father_page, &mtr) == FIL_NULL); ut_a(btr_page_get_prev(father_page, &mtr) == FIL_NULL);
} }
if (right_page_no == FIL_NULL) { if (right_page_no == FIL_NULL) {
ut_a(node_ptr == page_rec_get_prev( ut_a(node_ptr == page_rec_get_prev
page_get_supremum_rec(father_page))); (page_get_supremum_rec(father_page)));
ut_a(btr_page_get_next(father_page, &mtr) == FIL_NULL); ut_a(btr_page_get_next(father_page, &mtr) == FIL_NULL);
} else { } else {
right_node_ptr = btr_page_get_father_node_ptr(tree, right_node_ptr = btr_page_get_father_node_ptr
right_page, &mtr); (tree, right_page, &mtr);
if (page_rec_get_next(node_ptr) != if (page_rec_get_next(node_ptr)
page_get_supremum_rec(father_page)) { != page_get_supremum_rec(father_page)) {
if (right_node_ptr != if (right_node_ptr
page_rec_get_next(node_ptr)) { != page_rec_get_next(node_ptr)) {
ret = FALSE; ret = FALSE;
fputs( fputs("InnoDB: node pointer to"
"InnoDB: node pointer to the right page is wrong\n", " the right page is wrong\n",
stderr); stderr);
btr_validate_report1(index, level, btr_validate_report1(index, level,
@ -2945,15 +2967,15 @@ loop:
buf_page_print(right_page); buf_page_print(right_page);
} }
} else { } else {
right_father_page = buf_frame_align( right_father_page = buf_frame_align
right_node_ptr); (right_node_ptr);
if (right_node_ptr != page_rec_get_next( if (right_node_ptr != page_rec_get_next
page_get_infimum_rec( (page_get_infimum_rec
right_father_page))) { (right_father_page))) {
ret = FALSE; ret = FALSE;
fputs( fputs("InnoDB: node pointer 2 to"
"InnoDB: node pointer 2 to the right page is wrong\n", " the right page is wrong\n",
stderr); stderr);
btr_validate_report1(index, level, btr_validate_report1(index, level,
@ -2969,8 +2991,8 @@ loop:
!= btr_page_get_next(father_page, &mtr)) { != btr_page_get_next(father_page, &mtr)) {
ret = FALSE; ret = FALSE;
fputs( fputs("InnoDB: node pointer 3 to"
"InnoDB: node pointer 3 to the right page is wrong\n", " the right page is wrong\n",
stderr); stderr);
btr_validate_report1(index, level, btr_validate_report1(index, level,

View File

@ -162,8 +162,8 @@ btr_cur_latch_leaves(
== buf_frame_get_page_no(page)); == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(get_page) == page_is_comp(page)); ut_a(page_is_comp(get_page) == page_is_comp(page));
buf_block_align(get_page)->check_index_page_at_flush = buf_block_align(get_page)->check_index_page_at_flush
TRUE; = TRUE;
} }
get_page = btr_page_get(space, page_no, RW_X_LATCH, mtr); get_page = btr_page_get(space, page_no, RW_X_LATCH, mtr);
@ -179,8 +179,8 @@ btr_cur_latch_leaves(
ut_a(btr_page_get_prev(get_page, mtr) ut_a(btr_page_get_prev(get_page, mtr)
== buf_frame_get_page_no(page)); == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
buf_block_align(get_page)->check_index_page_at_flush = buf_block_align(get_page)->check_index_page_at_flush
TRUE; = TRUE;
} }
} else if (latch_mode == BTR_SEARCH_PREV) { } else if (latch_mode == BTR_SEARCH_PREV) {
@ -195,10 +195,10 @@ btr_cur_latch_leaves(
ut_a(btr_page_get_next(cursor->left_page, mtr) ut_a(btr_page_get_next(cursor->left_page, mtr)
== buf_frame_get_page_no(page)); == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(cursor->left_page) == ut_a(page_is_comp(cursor->left_page)
page_is_comp(page)); == page_is_comp(page));
buf_block_align( buf_block_align(cursor->left_page)
cursor->left_page)->check_index_page_at_flush = TRUE; ->check_index_page_at_flush = TRUE;
} }
get_page = btr_page_get(space, page_no, RW_S_LATCH, mtr); get_page = btr_page_get(space, page_no, RW_S_LATCH, mtr);
@ -217,10 +217,10 @@ btr_cur_latch_leaves(
ut_a(btr_page_get_next(cursor->left_page, mtr) ut_a(btr_page_get_next(cursor->left_page, mtr)
== buf_frame_get_page_no(page)); == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(cursor->left_page) == ut_a(page_is_comp(cursor->left_page)
page_is_comp(page)); == page_is_comp(page));
buf_block_align( buf_block_align(cursor->left_page)
cursor->left_page)->check_index_page_at_flush = TRUE; ->check_index_page_at_flush = TRUE;
} }
get_page = btr_page_get(space, page_no, RW_X_LATCH, mtr); get_page = btr_page_get(space, page_no, RW_X_LATCH, mtr);
@ -237,7 +237,12 @@ NOTE: n_fields_cmp in tuple must be set so that it cannot be compared
to node pointer page number fields on the upper levels of the tree! to node pointer page number fields on the upper levels of the tree!
Note that if mode is PAGE_CUR_LE, which is used in inserts, then Note that if mode is PAGE_CUR_LE, which is used in inserts, then
cursor->up_match and cursor->low_match both will have sensible values. cursor->up_match and cursor->low_match both will have sensible values.
If mode is PAGE_CUR_GE, then up_match will a have a sensible value. */ If mode is PAGE_CUR_GE, then up_match will a have a sensible value.
If mode is PAGE_CUR_LE , cursor is left at the place where an insert of the
search tuple should be performed in the B-tree. InnoDB does an insert
immediately after the cursor. Thus, the cursor may end up on a user record,
or on a page infimum record. */
void void
btr_cur_search_to_nth_level( btr_cur_search_to_nth_level(
@ -425,8 +430,8 @@ btr_cur_search_to_nth_level(
rw_latch = latch_mode; rw_latch = latch_mode;
if (insert_planned && ibuf_should_try(index, if (insert_planned
ignore_sec_unique)) { && ibuf_should_try(index, ignore_sec_unique)) {
/* Try insert to the insert buffer if the /* Try insert to the insert buffer if the
page is not in the buffer pool */ page is not in the buffer pool */
@ -447,8 +452,8 @@ retry_page_get:
ut_ad(insert_planned); ut_ad(insert_planned);
ut_ad(cursor->thr); ut_ad(cursor->thr);
if (ibuf_should_try(index, ignore_sec_unique) && if (ibuf_should_try(index, ignore_sec_unique)
ibuf_insert(tuple, index, space, page_no, && ibuf_insert(tuple, index, space, page_no,
cursor->thr)) { cursor->thr)) {
/* Insertion to the insert buffer succeeded */ /* Insertion to the insert buffer succeeded */
cursor->flag = BTR_CUR_INSERT_TO_IBUF; cursor->flag = BTR_CUR_INSERT_TO_IBUF;
@ -493,8 +498,8 @@ retry_page_get:
if (rw_latch == RW_NO_LATCH) { if (rw_latch == RW_NO_LATCH) {
btr_cur_latch_leaves(page, space, btr_cur_latch_leaves(page, space,
page_no, latch_mode, cursor, page_no, latch_mode,
mtr); cursor, mtr);
} }
if ((latch_mode != BTR_MODIFY_TREE) if ((latch_mode != BTR_MODIFY_TREE)
@ -502,8 +507,8 @@ retry_page_get:
/* Release the tree s-latch */ /* Release the tree s-latch */
mtr_release_s_latch_at_savepoint( mtr_release_s_latch_at_savepoint
mtr, savepoint, (mtr, savepoint,
dict_tree_get_lock(tree)); dict_tree_get_lock(tree));
} }
@ -512,15 +517,16 @@ retry_page_get:
page_cur_search_with_match(page, index, tuple, page_mode, page_cur_search_with_match(page, index, tuple, page_mode,
&up_match, &up_bytes, &up_match, &up_bytes,
&low_match, &low_bytes, page_cursor); &low_match, &low_bytes,
page_cursor);
if (estimate) { if (estimate) {
btr_cur_add_path_info(cursor, height, root_height); btr_cur_add_path_info(cursor, height, root_height);
} }
/* If this is the desired level, leave the loop */ /* If this is the desired level, leave the loop */
ut_ad(height ut_ad(height == btr_page_get_level
== btr_page_get_level(page_cur_get_page(page_cursor), mtr)); (page_cur_get_page(page_cursor), mtr));
if (level == height) { if (level == height) {
@ -662,8 +668,8 @@ btr_cur_open_at_index_side(
/* Release the tree s-latch */ /* Release the tree s-latch */
mtr_release_s_latch_at_savepoint( mtr_release_s_latch_at_savepoint
mtr, savepoint, (mtr, savepoint,
dict_tree_get_lock(tree)); dict_tree_get_lock(tree));
} }
} }
@ -883,7 +889,8 @@ btr_cur_ins_lock_and_undo(
if ((index->type & DICT_CLUSTERED) && !(index->type & DICT_IBUF)) { if ((index->type & DICT_CLUSTERED) && !(index->type & DICT_IBUF)) {
err = trx_undo_report_row_operation(flags, TRX_UNDO_INSERT_OP, err = trx_undo_report_row_operation(flags, TRX_UNDO_INSERT_OP,
thr, index, entry, NULL, 0, NULL, thr, index, entry,
NULL, 0, NULL,
&roll_ptr); &roll_ptr);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
@ -986,8 +993,8 @@ calculate_sizes_again:
/* Calculate the record size when entry is converted to a record */ /* Calculate the record size when entry is converted to a record */
rec_size = rec_get_converted_size(index, entry); rec_size = rec_get_converted_size(index, entry);
if (rec_size >= if (rec_size
ut_min(page_get_free_space_of_empty(page_is_comp(page)) / 2, >= ut_min(page_get_free_space_of_empty(page_is_comp(page)) / 2,
REC_MAX_DATA_SIZE)) { REC_MAX_DATA_SIZE)) {
/* The record is so big that we have to store some fields /* The record is so big that we have to store some fields
@ -1089,11 +1096,12 @@ calculate_sizes_again:
lock_update_insert(*rec); lock_update_insert(*rec);
} }
/* fprintf(stderr, "Insert into page %lu, max ins size %lu," #if 0
fprintf(stderr, "Insert into page %lu, max ins size %lu,"
" rec %lu ind type %lu\n", " rec %lu ind type %lu\n",
buf_frame_get_page_no(page), max_size, buf_frame_get_page_no(page), max_size,
rec_size + PAGE_DIR_SLOT_SIZE, type); rec_size + PAGE_DIR_SLOT_SIZE, type);
*/ #endif
if (!(type & DICT_CLUSTERED)) { if (!(type & DICT_CLUSTERED)) {
/* We have added a record to page: update its free bits */ /* We have added a record to page: update its free bits */
ibuf_update_free_bits_if_full(cursor->index, page, max_size, ibuf_update_free_bits_if_full(cursor->index, page, max_size,
@ -1191,8 +1199,8 @@ btr_cur_pessimistic_insert(
} }
} }
if (rec_get_converted_size(index, entry) >= if (rec_get_converted_size(index, entry)
ut_min(page_get_free_space_of_empty(page_is_comp(page)) / 2, >= ut_min(page_get_free_space_of_empty(page_is_comp(page)) / 2,
REC_MAX_DATA_SIZE)) { REC_MAX_DATA_SIZE)) {
/* The record is so big that we have to store some fields /* The record is so big that we have to store some fields
@ -1284,7 +1292,8 @@ btr_cur_upd_lock_and_undo(
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; *offsets_ = (sizeof offsets_) / sizeof *offsets_;
err = lock_clust_rec_modify_check_and_lock(flags, rec, index, err = lock_clust_rec_modify_check_and_lock
(flags, rec, index,
rec_get_offsets(rec, index, offsets_, rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap), thr); ULINT_UNDEFINED, &heap), thr);
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
@ -1326,7 +1335,8 @@ btr_cur_update_in_place_log(
log_ptr = mlog_open_and_write_index(mtr, rec, index, page_is_comp(page) log_ptr = mlog_open_and_write_index(mtr, rec, index, page_is_comp(page)
? MLOG_COMP_REC_UPDATE_IN_PLACE ? MLOG_COMP_REC_UPDATE_IN_PLACE
: MLOG_REC_UPDATE_IN_PLACE, : MLOG_REC_UPDATE_IN_PLACE,
1 + DATA_ROLL_PTR_LEN + 14 + 2 + MLOG_BUF_MARGIN); 1 + DATA_ROLL_PTR_LEN + 14 + 2
+ MLOG_BUF_MARGIN);
if (!log_ptr) { if (!log_ptr) {
/* Logging in mtr is switched off during crash recovery */ /* Logging in mtr is switched off during crash recovery */
@ -1507,8 +1517,8 @@ btr_cur_update_in_place(
/* FIXME: in a mixed tree, all records may not have enough ordering /* FIXME: in a mixed tree, all records may not have enough ordering
fields for btr search: */ fields for btr search: */
was_delete_marked = rec_get_deleted_flag(rec, was_delete_marked = rec_get_deleted_flag
page_is_comp(buf_block_get_frame(block))); (rec, page_is_comp(buf_block_get_frame(block)));
row_upd_rec_in_place(rec, offsets, update); row_upd_rec_in_place(rec, offsets, update);
@ -1518,8 +1528,9 @@ btr_cur_update_in_place(
btr_cur_update_in_place_log(flags, rec, index, update, trx, roll_ptr, btr_cur_update_in_place_log(flags, rec, index, update, trx, roll_ptr,
mtr); mtr);
if (was_delete_marked && !rec_get_deleted_flag(rec, if (was_delete_marked
page_is_comp(buf_block_get_frame(block)))) { && !rec_get_deleted_flag(rec, page_is_comp
(buf_block_get_frame(block)))) {
/* The new updated record owns its possible externally /* The new updated record owns its possible externally
stored fields */ stored fields */
@ -1627,8 +1638,9 @@ btr_cur_optimistic_update(
old_rec_size = rec_offs_size(offsets); old_rec_size = rec_offs_size(offsets);
new_rec_size = rec_get_converted_size(index, new_entry); new_rec_size = rec_get_converted_size(index, new_entry);
if (UNIV_UNLIKELY(new_rec_size >= page_get_free_space_of_empty( if (UNIV_UNLIKELY(new_rec_size
page_is_comp(page)) / 2)) { >= (page_get_free_space_of_empty(page_is_comp(page))
/ 2))) {
mem_heap_free(heap); mem_heap_free(heap);
@ -1849,9 +1861,9 @@ btr_cur_pessimistic_update(
reserve_flag = FSP_NORMAL; reserve_flag = FSP_NORMAL;
} }
success = fsp_reserve_free_extents(&n_reserved, success = fsp_reserve_free_extents(&n_reserved, index->space,
index->space, n_extents,
n_extents, reserve_flag, mtr); reserve_flag, mtr);
if (!success) { if (!success) {
err = DB_OUT_OF_FILE_SPACE; err = DB_OUT_OF_FILE_SPACE;
@ -1899,8 +1911,9 @@ btr_cur_pessimistic_update(
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
n_ext_vect = btr_push_update_extern_fields(ext_vect, offsets, update); n_ext_vect = btr_push_update_extern_fields(ext_vect, offsets, update);
if (UNIV_UNLIKELY(rec_get_converted_size(index, new_entry) >= if (UNIV_UNLIKELY(rec_get_converted_size(index, new_entry)
ut_min(page_get_free_space_of_empty(page_is_comp(page)) / 2, >= ut_min(page_get_free_space_of_empty
(page_is_comp(page)) / 2,
REC_MAX_DATA_SIZE))) { REC_MAX_DATA_SIZE))) {
big_rec_vec = dtuple_convert_big_rec(index, new_entry, big_rec_vec = dtuple_convert_big_rec(index, new_entry,
@ -2036,7 +2049,8 @@ btr_cur_del_mark_set_clust_rec_log(
page_rec_is_comp(rec) page_rec_is_comp(rec)
? MLOG_COMP_REC_CLUST_DELETE_MARK ? MLOG_COMP_REC_CLUST_DELETE_MARK
: MLOG_REC_CLUST_DELETE_MARK, : MLOG_REC_CLUST_DELETE_MARK,
1 + 1 + DATA_ROLL_PTR_LEN + 14 + 2); 1 + 1 + DATA_ROLL_PTR_LEN
+ 14 + 2);
if (!log_ptr) { if (!log_ptr) {
/* Logging in mtr is switched off during crash recovery */ /* Logging in mtr is switched off during crash recovery */
@ -2115,8 +2129,8 @@ btr_cur_parse_del_mark_set_clust_rec(
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; *offsets_ = (sizeof offsets_) / sizeof *offsets_;
row_upd_rec_sys_fields_in_recovery(rec, row_upd_rec_sys_fields_in_recovery
rec_get_offsets(rec, index, offsets_, (rec, rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap), ULINT_UNDEFINED, &heap),
pos, trx_id, roll_ptr); pos, trx_id, roll_ptr);
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
@ -2247,8 +2261,8 @@ btr_cur_del_mark_set_sec_rec_log(
return; return;
} }
log_ptr = mlog_write_initial_log_record_fast( log_ptr = mlog_write_initial_log_record_fast
rec, MLOG_REC_SEC_DELETE_MARK, log_ptr, mtr); (rec, MLOG_REC_SEC_DELETE_MARK, log_ptr, mtr);
mach_write_to_1(log_ptr, val); mach_write_to_1(log_ptr, val);
log_ptr++; log_ptr++;
@ -2469,8 +2483,8 @@ btr_cur_optimistic_delete(
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
no_compress_needed = !rec_offs_any_extern(offsets) no_compress_needed = !rec_offs_any_extern(offsets)
&& btr_cur_can_delete_without_compress( && btr_cur_can_delete_without_compress
cursor, rec_offs_size(offsets), mtr); (cursor, rec_offs_size(offsets), mtr);
if (no_compress_needed) { if (no_compress_needed) {
@ -2478,8 +2492,8 @@ btr_cur_optimistic_delete(
btr_search_update_hash_on_delete(cursor); btr_search_update_hash_on_delete(cursor);
max_ins_size = page_get_max_insert_size_after_reorganize(page, max_ins_size = page_get_max_insert_size_after_reorganize
1); (page, 1);
page_cur_delete_rec(btr_cur_get_page_cur(cursor), page_cur_delete_rec(btr_cur_get_page_cur(cursor),
cursor->index, offsets, mtr); cursor->index, offsets, mtr);
@ -2550,7 +2564,8 @@ btr_cur_pessimistic_delete(
success = fsp_reserve_free_extents(&n_reserved, success = fsp_reserve_free_extents(&n_reserved,
cursor->index->space, cursor->index->space,
n_extents, FSP_CLEANING, mtr); n_extents,
FSP_CLEANING, mtr);
if (!success) { if (!success) {
*err = DB_OUT_OF_FILE_SPACE; *err = DB_OUT_OF_FILE_SPACE;
@ -2571,7 +2586,8 @@ btr_cur_pessimistic_delete(
? !rec_get_node_ptr_flag(rec) ? !rec_get_node_ptr_flag(rec)
: !rec_get_1byte_offs_flag(rec)) { : !rec_get_1byte_offs_flag(rec)) {
btr_rec_free_externally_stored_fields(cursor->index, btr_rec_free_externally_stored_fields(cursor->index,
rec, offsets, in_rollback, mtr); rec, offsets,
in_rollback, mtr);
} }
if (UNIV_UNLIKELY(page_get_n_recs(page) < 2) if (UNIV_UNLIKELY(page_get_n_recs(page) < 2)
@ -2593,8 +2609,8 @@ btr_cur_pessimistic_delete(
level = btr_page_get_level(page, mtr); level = btr_page_get_level(page, mtr);
if (level > 0 if (level > 0
&& UNIV_UNLIKELY(rec == page_rec_get_next( && UNIV_UNLIKELY(rec == page_rec_get_next
page_get_infimum_rec(page)))) { (page_get_infimum_rec(page)))) {
rec_t* next_rec = page_rec_get_next(rec); rec_t* next_rec = page_rec_get_next(rec);
@ -2614,9 +2630,8 @@ btr_cur_pessimistic_delete(
btr_node_ptr_delete(tree, page, mtr); btr_node_ptr_delete(tree, page, mtr);
node_ptr = dict_tree_build_node_ptr( node_ptr = dict_tree_build_node_ptr
tree, next_rec, (tree, next_rec, buf_frame_get_page_no(page),
buf_frame_get_page_no(page),
heap, level); heap, level);
btr_insert_on_non_leaf_level(tree, btr_insert_on_non_leaf_level(tree,
@ -2865,8 +2880,8 @@ btr_estimate_number_of_different_key_vals(
ulint* offsets_rec = offsets_rec_; ulint* offsets_rec = offsets_rec_;
ulint* offsets_next_rec= offsets_next_rec_; ulint* offsets_next_rec= offsets_next_rec_;
*offsets_rec_ = (sizeof offsets_rec_) / sizeof *offsets_rec_; *offsets_rec_ = (sizeof offsets_rec_) / sizeof *offsets_rec_;
*offsets_next_rec_ = *offsets_next_rec_
(sizeof offsets_next_rec_) / sizeof *offsets_next_rec_; = (sizeof offsets_next_rec_) / sizeof *offsets_next_rec_;
n_cols = dict_index_get_n_unique(index); n_cols = dict_index_get_n_unique(index);
@ -2923,9 +2938,9 @@ btr_estimate_number_of_different_key_vals(
n_diff[j]++; n_diff[j]++;
} }
total_external_size += total_external_size
btr_rec_get_externally_stored_len( += btr_rec_get_externally_stored_len
rec, offsets_rec); (rec, offsets_rec);
rec = next_rec; rec = next_rec;
/* Initialize offsets_rec for the next round /* Initialize offsets_rec for the next round
@ -2959,9 +2974,8 @@ btr_estimate_number_of_different_key_vals(
offsets_rec = rec_get_offsets(rec, index, offsets_rec, offsets_rec = rec_get_offsets(rec, index, offsets_rec,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
total_external_size += total_external_size += btr_rec_get_externally_stored_len
btr_rec_get_externally_stored_len(rec, (rec, offsets_rec);
offsets_rec);
mtr_commit(&mtr); mtr_commit(&mtr);
} }
@ -2974,16 +2988,16 @@ btr_estimate_number_of_different_key_vals(
included in index->stat_n_leaf_pages) */ included in index->stat_n_leaf_pages) */
for (j = 0; j <= n_cols; j++) { for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j] = index->stat_n_diff_key_vals[j]
(n_diff[j] = ((n_diff[j]
* (ib_longlong)index->stat_n_leaf_pages * (ib_longlong)index->stat_n_leaf_pages
+ BTR_KEY_VAL_ESTIMATE_N_PAGES - 1 + BTR_KEY_VAL_ESTIMATE_N_PAGES - 1
+ total_external_size + total_external_size
+ not_empty_flag) + not_empty_flag)
/ (BTR_KEY_VAL_ESTIMATE_N_PAGES / (BTR_KEY_VAL_ESTIMATE_N_PAGES
+ total_external_size); + total_external_size));
/* If the tree is small, smaller than < /* If the tree is small, smaller than
10 * BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size, then 10 * BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size, then
the above estimate is ok. For bigger trees it is common that we the above estimate is ok. For bigger trees it is common that we
do not see any borders between key values in the few pages do not see any borders between key values in the few pages
@ -2991,8 +3005,9 @@ btr_estimate_number_of_different_key_vals(
different key values, or even more. Let us try to approximate different key values, or even more. Let us try to approximate
that: */ that: */
add_on = index->stat_n_leaf_pages / add_on = index->stat_n_leaf_pages
(10 * (BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size)); / (10 * (BTR_KEY_VAL_ESTIMATE_N_PAGES
+ total_external_size));
if (add_on > BTR_KEY_VAL_ESTIMATE_N_PAGES) { if (add_on > BTR_KEY_VAL_ESTIMATE_N_PAGES) {
add_on = BTR_KEY_VAL_ESTIMATE_N_PAGES; add_on = BTR_KEY_VAL_ESTIMATE_N_PAGES;
@ -3122,8 +3137,8 @@ btr_cur_mark_extern_inherited_fields(
} }
if (!is_updated) { if (!is_updated) {
btr_cur_set_ownership_of_extern_field(rec, btr_cur_set_ownership_of_extern_field
offsets, i, FALSE, mtr); (rec, offsets, i, FALSE, mtr);
} }
} }
} }
@ -3276,8 +3291,8 @@ btr_push_update_extern_fields(
if (upd_get_nth_field(update, i)->extern_storage) { if (upd_get_nth_field(update, i)->extern_storage) {
ext_vect[n_pushed] = ext_vect[n_pushed] = upd_get_nth_field
upd_get_nth_field(update, i)->field_no; (update, i)->field_no;
n_pushed++; n_pushed++;
} }
@ -3388,7 +3403,8 @@ btr_store_big_rec_extern_fields(
for (i = 0; i < big_rec_vec->n_fields; i++) { for (i = 0; i < big_rec_vec->n_fields; i++) {
data = rec_get_nth_field(rec, offsets, data = rec_get_nth_field(rec, offsets,
big_rec_vec->fields[i].field_no, &local_len); big_rec_vec->fields[i].field_no,
&local_len);
ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE); ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
local_len -= BTR_EXTERN_FIELD_REF_SIZE; local_len -= BTR_EXTERN_FIELD_REF_SIZE;
extern_len = big_rec_vec->fields[i].len; extern_len = big_rec_vec->fields[i].len;
@ -3416,7 +3432,8 @@ btr_store_big_rec_extern_fields(
} }
mlog_write_ulint(page + FIL_PAGE_TYPE, mlog_write_ulint(page + FIL_PAGE_TYPE,
FIL_PAGE_TYPE_BLOB, MLOG_2BYTES, &mtr); FIL_PAGE_TYPE_BLOB,
MLOG_2BYTES, &mtr);
page_no = buf_frame_get_page_no(page); page_no = buf_frame_get_page_no(page);
@ -3492,7 +3509,8 @@ btr_store_big_rec_extern_fields(
/* Set the bit denoting that this field /* Set the bit denoting that this field
in rec is stored externally */ in rec is stored externally */
rec_set_nth_field_extern_bit(rec, index, rec_set_nth_field_extern_bit
(rec, index,
big_rec_vec->fields[i].field_no, big_rec_vec->fields[i].field_no,
TRUE, &mtr); TRUE, &mtr);
} }
@ -3556,7 +3574,8 @@ btr_free_externally_stored_field(
mtr_start(&mtr); mtr_start(&mtr);
rec_page = buf_page_get(buf_frame_get_space_id(data), rec_page = buf_page_get(buf_frame_get_space_id(data),
buf_frame_get_page_no(data), RW_X_LATCH, &mtr); buf_frame_get_page_no(data),
RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK); buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
@ -3671,7 +3690,8 @@ btr_rec_free_externally_stored_fields(
data = rec_get_nth_field(rec, offsets, i, &len); data = rec_get_nth_field(rec, offsets, i, &len);
btr_free_externally_stored_field(index, data, len, btr_free_externally_stored_field(index, data, len,
do_not_free_inherited, mtr); do_not_free_inherited,
mtr);
} }
} }
} }
@ -3716,7 +3736,8 @@ btr_rec_free_updated_extern_fields(
data = rec_get_nth_field(rec, offsets, data = rec_get_nth_field(rec, offsets,
ufield->field_no, &len); ufield->field_no, &len);
btr_free_externally_stored_field(index, data, len, btr_free_externally_stored_field(index, data, len,
do_not_free_inherited, mtr); do_not_free_inherited,
mtr);
} }
} }
} }

View File

@ -133,14 +133,13 @@ btr_pcur_store_position(
} }
cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_stored = BTR_PCUR_OLD_STORED;
cursor->old_rec = dict_tree_copy_rec_order_prefix(tree, rec, cursor->old_rec = dict_tree_copy_rec_order_prefix
&cursor->old_n_fields, (tree, rec, &cursor->old_n_fields,
&cursor->old_rec_buf, &cursor->old_rec_buf, &cursor->buf_size);
&cursor->buf_size);
cursor->block_when_stored = buf_block_align(page); cursor->block_when_stored = buf_block_align(page);
cursor->modify_clock = buf_block_get_modify_clock( cursor->modify_clock = buf_block_get_modify_clock
cursor->block_when_stored); (cursor->block_when_stored);
} }
/****************************************************************** /******************************************************************
@ -216,19 +215,20 @@ btr_pcur_restore_position(
ut_error; ut_error;
} }
if (UNIV_UNLIKELY(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE if (UNIV_UNLIKELY
(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) { || cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
/* In these cases we do not try an optimistic restoration, /* In these cases we do not try an optimistic restoration,
but always do a search */ but always do a search */
btr_cur_open_at_index_side( btr_cur_open_at_index_side
cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE, (cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
btr_pcur_get_btr_cur(cursor)->index, latch_mode, btr_pcur_get_btr_cur(cursor)->index, latch_mode,
btr_pcur_get_btr_cur(cursor), mtr); btr_pcur_get_btr_cur(cursor), mtr);
cursor->block_when_stored = cursor->block_when_stored
buf_block_align(btr_pcur_get_page(cursor)); = buf_block_align(btr_pcur_get_page(cursor));
return(FALSE); return(FALSE);
} }
@ -242,7 +242,8 @@ btr_pcur_restore_position(
|| UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) { || UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
/* Try optimistic restoration */ /* Try optimistic restoration */
if (UNIV_LIKELY(buf_page_optimistic_get(latch_mode, if (UNIV_LIKELY
(buf_page_optimistic_get(latch_mode,
cursor->block_when_stored, page, cursor->block_when_stored, page,
cursor->modify_clock, mtr))) { cursor->modify_clock, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->pos_state = BTR_PCUR_IS_POSITIONED;
@ -262,14 +263,16 @@ btr_pcur_restore_position(
index = btr_pcur_get_btr_cur(cursor)->index; index = btr_pcur_get_btr_cur(cursor)->index;
heap = mem_heap_create(256); heap = mem_heap_create(256);
offsets1 = rec_get_offsets(cursor->old_rec, offsets1 = rec_get_offsets
index, NULL, (cursor->old_rec, index, NULL,
cursor->old_n_fields, &heap); cursor->old_n_fields, &heap);
offsets2 = rec_get_offsets(rec, index, NULL, offsets2 = rec_get_offsets
(rec, index, NULL,
cursor->old_n_fields, &heap); cursor->old_n_fields, &heap);
ut_ad(cmp_rec_rec(cursor->old_rec, ut_ad(!cmp_rec_rec(cursor->old_rec,
rec, offsets1, offsets2, index) == 0); rec, offsets1, offsets2,
index));
mem_heap_free(heap); mem_heap_free(heap);
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
return(TRUE); return(TRUE);
@ -308,7 +311,8 @@ btr_pcur_restore_position(
if (cursor->rel_pos == BTR_PCUR_ON if (cursor->rel_pos == BTR_PCUR_ON
&& btr_pcur_is_on_user_rec(cursor, mtr) && btr_pcur_is_on_user_rec(cursor, mtr)
&& 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor), && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
rec_get_offsets(btr_pcur_get_rec(cursor), rec_get_offsets
(btr_pcur_get_rec(cursor),
btr_pcur_get_btr_cur(cursor)->index, btr_pcur_get_btr_cur(cursor)->index,
NULL, ULINT_UNDEFINED, &heap))) { NULL, ULINT_UNDEFINED, &heap))) {
@ -316,10 +320,10 @@ btr_pcur_restore_position(
the cursor can now be on a different page! But we can retain the cursor can now be on a different page! But we can retain
the value of old_rec */ the value of old_rec */
cursor->block_when_stored = cursor->block_when_stored = buf_block_align
buf_block_align(btr_pcur_get_page(cursor)); (btr_pcur_get_page(cursor));
cursor->modify_clock = cursor->modify_clock = buf_block_get_modify_clock
buf_block_get_modify_clock(cursor->block_when_stored); (cursor->block_when_stored);
cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_stored = BTR_PCUR_OLD_STORED;
mem_heap_free(heap); mem_heap_free(heap);

View File

@ -432,8 +432,9 @@ btr_search_update_hash_ref(
} }
tree_id = ((cursor->index)->tree)->id; tree_id = ((cursor->index)->tree)->id;
fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, fold = rec_fold(rec,
offsets_, ULINT_UNDEFINED, &heap), rec_get_offsets(rec, cursor->index, offsets_,
ULINT_UNDEFINED, &heap),
block->curr_n_fields, block->curr_n_fields,
block->curr_n_bytes, tree_id); block->curr_n_bytes, tree_id);
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
@ -617,8 +618,8 @@ btr_search_check_guess(
prev_rec = page_rec_get_prev(rec); prev_rec = page_rec_get_prev(rec);
if (page_rec_is_infimum(prev_rec)) { if (page_rec_is_infimum(prev_rec)) {
success = btr_page_get_prev( success = btr_page_get_prev
buf_frame_align(prev_rec), mtr) == FIL_NULL; (buf_frame_align(prev_rec), mtr) == FIL_NULL;
goto exit_func; goto exit_func;
} }
@ -642,8 +643,8 @@ btr_search_check_guess(
next_rec = page_rec_get_next(rec); next_rec = page_rec_get_next(rec);
if (page_rec_is_supremum(next_rec)) { if (page_rec_is_supremum(next_rec)) {
if (btr_page_get_next( if (btr_page_get_next
buf_frame_align(next_rec), mtr) == FIL_NULL) { (buf_frame_align(next_rec), mtr) == FIL_NULL) {
cursor->up_match = 0; cursor->up_match = 0;
success = TRUE; success = TRUE;
@ -762,10 +763,10 @@ btr_search_guess_on_hash(
if (UNIV_LIKELY(!has_search_latch)) { if (UNIV_LIKELY(!has_search_latch)) {
if (UNIV_UNLIKELY(!buf_page_get_known_nowait(latch_mode, page, if (UNIV_UNLIKELY
(!buf_page_get_known_nowait(latch_mode, page,
BUF_MAKE_YOUNG, BUF_MAKE_YOUNG,
__FILE__, __LINE__, __FILE__, __LINE__, mtr))) {
mtr))) {
goto failure_unlock; goto failure_unlock;
} }
@ -802,7 +803,8 @@ btr_search_guess_on_hash(
right. */ right. */
if (UNIV_EXPECT(ut_dulint_cmp(tree_id, btr_page_get_index_id(page)), 0) if (UNIV_EXPECT(ut_dulint_cmp(tree_id, btr_page_get_index_id(page)), 0)
|| !btr_search_check_guess(cursor, || !btr_search_check_guess(cursor,
can_only_compare_to_cursor_rec, tuple, mode, mtr)) { can_only_compare_to_cursor_rec,
tuple, mode, mtr)) {
if (UNIV_LIKELY(!has_search_latch)) { if (UNIV_LIKELY(!has_search_latch)) {
btr_leaf_page_release(page, latch_mode, mtr); btr_leaf_page_release(page, latch_mode, mtr);
} }
@ -1029,8 +1031,10 @@ cleanup:
/* Corruption */ /* Corruption */
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Corruption of adaptive hash index. After dropping\n" " InnoDB: Corruption of adaptive hash index."
"InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n", " After dropping\n"
"InnoDB: the hash index to a page of %s,"
" still %lu hash nodes remain.\n",
index->name, (ulong) block->n_pointers); index->name, (ulong) block->n_pointers);
rw_lock_x_unlock(&btr_search_latch); rw_lock_x_unlock(&btr_search_latch);
@ -1378,8 +1382,8 @@ btr_search_update_hash_on_delete(
tree_id = cursor->index->tree->id; tree_id = cursor->index->tree->id;
fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, offsets_, fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, offsets_,
ULINT_UNDEFINED, &heap), block->curr_n_fields, ULINT_UNDEFINED, &heap),
block->curr_n_bytes, tree_id); block->curr_n_fields, block->curr_n_bytes, tree_id);
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
} }
@ -1635,10 +1639,11 @@ btr_search_validate(void)
offsets = rec_get_offsets((rec_t*) node->data, offsets = rec_get_offsets((rec_t*) node->data,
block->index, offsets, block->index, offsets,
block->curr_n_fields block->curr_n_fields
+ (block->curr_n_bytes > 0), &heap); + (block->curr_n_bytes > 0),
&heap);
if (!block->is_hashed if (!block->is_hashed || node->fold
|| node->fold != rec_fold((rec_t*)(node->data), != rec_fold((rec_t*)(node->data),
offsets, offsets,
block->curr_n_fields, block->curr_n_fields,
block->curr_n_bytes, block->curr_n_bytes,
@ -1647,28 +1652,36 @@ btr_search_validate(void)
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error in an adaptive hash index pointer to page %lu\n" " InnoDB: Error in an adaptive hash"
"ptr mem address %p index id %lu %lu, node fold %lu, rec fold %lu\n", " index pointer to page %lu\n"
"InnoDB: ptr mem address %p"
" index id %lu %lu,"
" node fold %lu, rec fold %lu\n",
(ulong) buf_frame_get_page_no(page), (ulong) buf_frame_get_page_no(page),
node->data, node->data,
(ulong) ut_dulint_get_high(btr_page_get_index_id(page)), (ulong) ut_dulint_get_high
(ulong) ut_dulint_get_low(btr_page_get_index_id(page)), (btr_page_get_index_id(page)),
(ulong) ut_dulint_get_low
(btr_page_get_index_id(page)),
(ulong) node->fold, (ulong) node->fold,
(ulong) rec_fold((rec_t*)(node->data), (ulong) rec_fold((rec_t*)(node->data),
offsets, offsets,
block->curr_n_fields, block->curr_n_fields,
block->curr_n_bytes, block->curr_n_bytes,
btr_page_get_index_id(page))); btr_page_get_index_id
(page)));
fputs("InnoDB: Record ", stderr); fputs("InnoDB: Record ", stderr);
rec_print_new(stderr, (rec_t*)node->data, rec_print_new(stderr, (rec_t*)node->data,
offsets); offsets);
fprintf(stderr, "\nInnoDB: on that page." fprintf(stderr, "\nInnoDB: on that page."
"Page mem address %p, is hashed %lu, n fields %lu, n bytes %lu\n" " Page mem address %p, is hashed %lu,"
"side %lu\n", " n fields %lu, n bytes %lu\n"
page, (ulong) block->is_hashed, "InnoDB: side %lu\n",
(void*) page, (ulong) block->is_hashed,
(ulong) block->curr_n_fields, (ulong) block->curr_n_fields,
(ulong) block->curr_n_bytes, (ulong) block->curr_side); (ulong) block->curr_n_bytes,
(ulong) block->curr_side);
if (n_page_dumps < 20) { if (n_page_dumps < 20) {
buf_page_print(page); buf_page_print(page);

View File

@ -160,8 +160,8 @@ and the io-operation for loading the page is queued. The io-handler thread
releases the X-lock on the frame and resets the io_fix field releases the X-lock on the frame and resets the io_fix field
when the io operation completes. when the io operation completes.
A thread may request the above operation using the buf_page_get- A thread may request the above operation using the function
function. It may then continue to request a lock on the frame. buf_page_get(). It may then continue to request a lock on the frame.
The lock is granted when the io-handler releases the x-lock. The lock is granted when the io-handler releases the x-lock.
Read-ahead Read-ahead
@ -319,17 +319,23 @@ buf_page_is_corrupted(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: page %lu log sequence number %lu %lu\n" " InnoDB: Error: page %lu log sequence number"
"InnoDB: is in the future! Current system log sequence number %lu %lu.\n" " %lu %lu\n"
"InnoDB: Your database may be corrupt or you may have copied the InnoDB\n" "InnoDB: is in the future! Current system "
"InnoDB: tablespace but not the InnoDB log files. See\n" "log sequence number %lu %lu.\n"
"InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html\n" "InnoDB: Your database may be corrupt or "
"you may have copied the InnoDB\n"
"InnoDB: tablespace but not the InnoDB "
"log files. See\n"
"InnoDB: http://dev.mysql.com/doc/refman/"
"5.1/en/forcing-recovery.html\n"
"InnoDB: for more information.\n", "InnoDB: for more information.\n",
(ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET), (ulong) mach_read_from_4(read_buf
(ulong) ut_dulint_get_high( + FIL_PAGE_OFFSET),
mach_read_from_8(read_buf + FIL_PAGE_LSN)), (ulong) ut_dulint_get_high
(ulong) ut_dulint_get_low( (mach_read_from_8(read_buf + FIL_PAGE_LSN)),
mach_read_from_8(read_buf + FIL_PAGE_LSN)), (ulong) ut_dulint_get_low
(mach_read_from_8(read_buf + FIL_PAGE_LSN)),
(ulong) ut_dulint_get_high(current_lsn), (ulong) ut_dulint_get_high(current_lsn),
(ulong) ut_dulint_get_low(current_lsn)); (ulong) ut_dulint_get_low(current_lsn));
} }
@ -344,7 +350,8 @@ buf_page_is_corrupted(
if (srv_use_checksums) { if (srv_use_checksums) {
old_checksum = buf_calc_page_old_checksum(read_buf); old_checksum = buf_calc_page_old_checksum(read_buf);
old_checksum_field = mach_read_from_4(read_buf + UNIV_PAGE_SIZE old_checksum_field = mach_read_from_4
(read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM); - FIL_PAGE_END_LSN_OLD_CHKSUM);
/* There are 2 valid formulas for old_checksum_field: /* There are 2 valid formulas for old_checksum_field:
@ -364,8 +371,8 @@ buf_page_is_corrupted(
} }
checksum = buf_calc_page_new_checksum(read_buf); checksum = buf_calc_page_new_checksum(read_buf);
checksum_field = mach_read_from_4(read_buf + checksum_field = mach_read_from_4(read_buf
FIL_PAGE_SPACE_OR_CHKSUM); + FIL_PAGE_SPACE_OR_CHKSUM);
/* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id /* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
(always equal to 0), to FIL_PAGE_SPACE_SPACE_OR_CHKSUM */ (always equal to 0), to FIL_PAGE_SPACE_SPACE_OR_CHKSUM */
@ -398,29 +405,33 @@ buf_page_print(
ut_print_buf(stderr, read_buf, UNIV_PAGE_SIZE); ut_print_buf(stderr, read_buf, UNIV_PAGE_SIZE);
fputs("InnoDB: End of page dump\n", stderr); fputs("InnoDB: End of page dump\n", stderr);
checksum = srv_use_checksums ? checksum = srv_use_checksums
buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC; ? buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
old_checksum = srv_use_checksums ? old_checksum = srv_use_checksums
buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC; ? buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Page checksum %lu, prior-to-4.0.14-form checksum %lu\n" " InnoDB: Page checksum %lu, prior-to-4.0.14-form"
"InnoDB: stored checksum %lu, prior-to-4.0.14-form stored checksum %lu\n", " checksum %lu\n"
"InnoDB: stored checksum %lu, prior-to-4.0.14-form"
" stored checksum %lu\n"
"InnoDB: Page lsn %lu %lu, low 4 bytes of lsn"
" at page end %lu\n"
"InnoDB: Page number (if stored to page already) %lu,\n"
"InnoDB: space id (if created with >= MySQL-4.1.1"
" and stored already) %lu\n",
(ulong) checksum, (ulong) old_checksum, (ulong) checksum, (ulong) old_checksum,
(ulong) mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM), (ulong) mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
(ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE (ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM)); - FIL_PAGE_END_LSN_OLD_CHKSUM),
fprintf(stderr,
"InnoDB: Page lsn %lu %lu, low 4 bytes of lsn at page end %lu\n"
"InnoDB: Page number (if stored to page already) %lu,\n"
"InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) %lu\n",
(ulong) mach_read_from_4(read_buf + FIL_PAGE_LSN), (ulong) mach_read_from_4(read_buf + FIL_PAGE_LSN),
(ulong) mach_read_from_4(read_buf + FIL_PAGE_LSN + 4), (ulong) mach_read_from_4(read_buf + FIL_PAGE_LSN + 4),
(ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE (ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4), - FIL_PAGE_END_LSN_OLD_CHKSUM + 4),
(ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET), (ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET),
(ulong) mach_read_from_4(read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID)); (ulong) mach_read_from_4(read_buf
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
if (mach_read_from_2(read_buf + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE) if (mach_read_from_2(read_buf + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE)
== TRX_UNDO_INSERT) { == TRX_UNDO_INSERT) {
@ -436,17 +447,20 @@ buf_page_print(
switch (fil_page_get_type(read_buf)) { switch (fil_page_get_type(read_buf)) {
case FIL_PAGE_INDEX: case FIL_PAGE_INDEX:
fprintf(stderr, fprintf(stderr,
"InnoDB: Page may be an index page where index id is %lu %lu\n", "InnoDB: Page may be an index page where"
(ulong) ut_dulint_get_high(btr_page_get_index_id(read_buf)), " index id is %lu %lu\n",
(ulong) ut_dulint_get_low(btr_page_get_index_id(read_buf))); (ulong) ut_dulint_get_high
(btr_page_get_index_id(read_buf)),
(ulong) ut_dulint_get_low
(btr_page_get_index_id(read_buf)));
/* If the code is in ibbackup, dict_sys may be uninitialized, /* If the code is in ibbackup, dict_sys may be uninitialized,
i.e., NULL */ i.e., NULL */
if (dict_sys != NULL) { if (dict_sys != NULL) {
index = dict_index_find_on_id_low( index = dict_index_find_on_id_low
btr_page_get_index_id(read_buf)); (btr_page_get_index_id(read_buf));
if (index) { if (index) {
fputs("InnoDB: (", stderr); fputs("InnoDB: (", stderr);
dict_index_name_print(stderr, NULL, index); dict_index_name_print(stderr, NULL, index);
@ -561,9 +575,12 @@ buf_pool_init(
if (n_frames > curr_size) { if (n_frames > curr_size) {
fprintf(stderr, fprintf(stderr,
"InnoDB: AWE: Error: you must specify in my.cnf .._awe_mem_mb larger\n" "InnoDB: AWE: Error: you must specify in my.cnf"
"InnoDB: than .._buffer_pool_size. Now the former is %lu pages,\n" " .._awe_mem_mb larger\n"
"InnoDB: the latter %lu pages.\n", (ulong) curr_size, (ulong) n_frames); "InnoDB: than .._buffer_pool_size. Now the former"
" is %lu pages,\n"
"InnoDB: the latter %lu pages.\n",
(ulong) curr_size, (ulong) n_frames);
return(NULL); return(NULL);
} }
@ -581,8 +598,8 @@ buf_pool_init(
/* Allocate the virtual address space window, i.e., the /* Allocate the virtual address space window, i.e., the
buffer pool frames */ buffer pool frames */
buf_pool->frame_mem = os_awe_allocate_virtual_mem_window( buf_pool->frame_mem = os_awe_allocate_virtual_mem_window
UNIV_PAGE_SIZE * (n_frames + 1)); (UNIV_PAGE_SIZE * (n_frames + 1));
/* Allocate the physical memory for AWE and the AWE info array /* Allocate the physical memory for AWE and the AWE info array
for buf_pool */ for buf_pool */
@ -590,23 +607,26 @@ buf_pool_init(
if ((curr_size % ((1024 * 1024) / UNIV_PAGE_SIZE)) != 0) { if ((curr_size % ((1024 * 1024) / UNIV_PAGE_SIZE)) != 0) {
fprintf(stderr, fprintf(stderr,
"InnoDB: AWE: Error: physical memory must be allocated in full megabytes.\n" "InnoDB: AWE: Error: physical memory must be"
"InnoDB: Trying to allocate %lu database pages.\n", " allocated in full megabytes.\n"
"InnoDB: Trying to allocate %lu"
" database pages.\n",
(ulong) curr_size); (ulong) curr_size);
return(NULL); return(NULL);
} }
if (!os_awe_allocate_physical_mem(&(buf_pool->awe_info), if (!os_awe_allocate_physical_mem(&(buf_pool->awe_info),
curr_size / ((1024 * 1024) / UNIV_PAGE_SIZE))) { curr_size
/ ((1024 * 1024)
/ UNIV_PAGE_SIZE))) {
return(NULL); return(NULL);
} }
/*----------------------------------------*/ /*----------------------------------------*/
} else { } else {
buf_pool->frame_mem = os_mem_alloc_large( buf_pool->frame_mem = os_mem_alloc_large
UNIV_PAGE_SIZE * (n_frames + 1), (UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE);
TRUE, FALSE);
} }
if (buf_pool->frame_mem == NULL) { if (buf_pool->frame_mem == NULL) {
@ -639,8 +659,9 @@ buf_pool_init(
the window */ the window */
os_awe_map_physical_mem_to_window(buf_pool->frame_zero, os_awe_map_physical_mem_to_window(buf_pool->frame_zero,
n_frames * n_frames
(UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE), * (UNIV_PAGE_SIZE
/ OS_AWE_X86_PAGE_SIZE),
buf_pool->awe_info); buf_pool->awe_info);
/*----------------------------------------*/ /*----------------------------------------*/
} }
@ -738,7 +759,8 @@ buf_pool_init(
frames */ frames */
UT_LIST_ADD_LAST(awe_LRU_free_mapped, UT_LIST_ADD_LAST(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block); buf_pool->awe_LRU_free_mapped,
block);
} }
} }
@ -749,8 +771,8 @@ buf_pool_init(
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
if (srv_use_adaptive_hash_indexes) { if (srv_use_adaptive_hash_indexes) {
btr_search_sys_create( btr_search_sys_create(curr_size * UNIV_PAGE_SIZE
curr_size * UNIV_PAGE_SIZE / sizeof(void*) / 64); / sizeof(void*) / 64);
} else { } else {
/* Create only a small dummy system */ /* Create only a small dummy system */
btr_search_sys_create(1000); btr_search_sys_create(1000);
@ -799,8 +821,8 @@ buf_awe_map_page_to_frame(
} else { } else {
/* We can map block to the frame of bck */ /* We can map block to the frame of bck */
os_awe_map_physical_mem_to_window( os_awe_map_physical_mem_to_window
bck->frame, (bck->frame,
UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE, UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE,
block->awe_info); block->awe_info);
@ -818,7 +840,8 @@ buf_awe_map_page_to_frame(
bck); bck);
if (add_to_mapped_list) { if (add_to_mapped_list) {
UT_LIST_ADD_FIRST(awe_LRU_free_mapped, UT_LIST_ADD_FIRST
(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, buf_pool->awe_LRU_free_mapped,
block); block);
} }
@ -1598,7 +1621,8 @@ buf_page_init(
if (buf_page_hash_get(space, offset)) { if (buf_page_hash_get(space, offset)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: page %lu %lu already found from the hash table\n", "InnoDB: Error: page %lu %lu already found"
" in the hash table\n",
(ulong) space, (ulong) space,
(ulong) offset); (ulong) offset);
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
@ -1686,16 +1710,17 @@ buf_page_init_for_read(
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
if (fil_tablespace_deleted_or_being_deleted_in_mem(space, if (fil_tablespace_deleted_or_being_deleted_in_mem
tablespace_version)) { (space, tablespace_version)) {
*err = DB_TABLESPACE_DELETED; *err = DB_TABLESPACE_DELETED;
} }
if (*err == DB_TABLESPACE_DELETED if (*err == DB_TABLESPACE_DELETED
|| NULL != buf_page_hash_get(space, offset)) { || NULL != buf_page_hash_get(space, offset)) {
/* The page belongs to a space which has been deleted or is /* The page belongs to a space which has been
being deleted, or the page is already in buf_pool, return */ deleted or is being deleted, or the page is
already in buf_pool, return */
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
buf_block_free(block); buf_block_free(block);
@ -1866,18 +1891,19 @@ buf_page_io_complete(
/* If this page is not uninitialized and not in the /* If this page is not uninitialized and not in the
doublewrite buffer, then the page number and space id doublewrite buffer, then the page number and space id
should be the same as in block. */ should be the same as in block. */
ulint read_page_no = mach_read_from_4((block->frame) ulint read_page_no = mach_read_from_4
+ FIL_PAGE_OFFSET); (block->frame + FIL_PAGE_OFFSET);
ulint read_space_id = mach_read_from_4((block->frame) ulint read_space_id = mach_read_from_4
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); (block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
if (!block->space && trx_doublewrite_page_inside( if (!block->space
block->offset)) { && trx_doublewrite_page_inside(block->offset)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: reading page %lu\n" " InnoDB: Error: reading page %lu\n"
"InnoDB: which is in the doublewrite buffer!\n", "InnoDB: which is in the"
" doublewrite buffer!\n",
(ulong) block->offset); (ulong) block->offset);
} else if (!read_space_id && !read_page_no) { } else if (!read_space_id && !read_page_no) {
/* This is likely an uninitialized page. */ /* This is likely an uninitialized page. */
@ -1890,8 +1916,10 @@ buf_page_io_complete(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: space id and page n:o stored in the page\n" " InnoDB: Error: space id and page n:o"
"InnoDB: read in are %lu:%lu, should be %lu:%lu!\n", " stored in the page\n"
"InnoDB: read in are %lu:%lu,"
" should be %lu:%lu!\n",
(ulong) read_space_id, (ulong) read_page_no, (ulong) read_space_id, (ulong) read_page_no,
(ulong) block->space, (ulong) block->offset); (ulong) block->space, (ulong) block->offset);
} }
@ -1900,36 +1928,47 @@ buf_page_io_complete(
if (buf_page_is_corrupted(block->frame)) { if (buf_page_is_corrupted(block->frame)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Database page corruption on disk or a failed\n" "InnoDB: Database page corruption on disk"
"InnoDB: file read of page %lu.\n", (ulong) block->offset); " or a failed\n"
"InnoDB: file read of page %lu.\n",
(ulong) block->offset);
fputs( fputs("InnoDB: You may have to recover"
"InnoDB: You may have to recover from a backup.\n", stderr); " from a backup.\n", stderr);
buf_page_print(block->frame); buf_page_print(block->frame);
fprintf(stderr, fprintf(stderr,
"InnoDB: Database page corruption on disk or a failed\n" "InnoDB: Database page corruption on disk"
"InnoDB: file read of page %lu.\n", (ulong) block->offset); " or a failed\n"
fputs( "InnoDB: file read of page %lu.\n",
"InnoDB: You may have to recover from a backup.\n", stderr); (ulong) block->offset);
fputs( fputs("InnoDB: You may have to recover"
"InnoDB: It is also possible that your operating\n" " from a backup.\n", stderr);
"InnoDB: system has corrupted its own file cache\n" fputs("InnoDB: It is also possible that"
"InnoDB: and rebooting your computer removes the\n" " your operating\n"
"InnoDB: system has corrupted its"
" own file cache\n"
"InnoDB: and rebooting your computer"
" removes the\n"
"InnoDB: error.\n" "InnoDB: error.\n"
"InnoDB: If the corrupt page is an index page\n" "InnoDB: If the corrupt page is an index page\n"
"InnoDB: you can also try to fix the corruption\n" "InnoDB: you can also try to"
"InnoDB: by dumping, dropping, and reimporting\n" " fix the corruption\n"
"InnoDB: the corrupt table. You can use CHECK\n" "InnoDB: by dumping, dropping,"
"InnoDB: TABLE to scan your table for corruption.\n" " and reimporting\n"
"InnoDB: the corrupt table."
" You can use CHECK\n"
"InnoDB: TABLE to scan your"
" table for corruption.\n"
"InnoDB: See also" "InnoDB: See also"
"InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html\n" " http://dev.mysql.com/doc/refman/5.1/en/"
"forcing-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr); "InnoDB: about forcing recovery.\n", stderr);
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) { if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
fputs( fputs("InnoDB: Ending processing because of"
"InnoDB: Ending processing because of a corrupt database page.\n", " a corrupt database page.\n",
stderr); stderr);
exit(1); exit(1);
} }
@ -1941,8 +1980,9 @@ buf_page_io_complete(
} }
if (!recv_no_ibuf_operations) { if (!recv_no_ibuf_operations) {
ibuf_merge_or_delete_for_page(block->frame, ibuf_merge_or_delete_for_page
block->space, block->offset, TRUE); (block->frame, block->space,
block->offset, TRUE);
} }
} }
@ -2070,13 +2110,13 @@ buf_validate(void)
if (block->flush_type == BUF_FLUSH_LRU) { if (block->flush_type == BUF_FLUSH_LRU) {
n_lru_flush++; n_lru_flush++;
ut_a(rw_lock_is_locked(&(block->lock), ut_a(rw_lock_is_locked
RW_LOCK_SHARED)); (&block->lock, RW_LOCK_SHARED));
} else if (block->flush_type == } else if (block->flush_type
BUF_FLUSH_LIST) { == BUF_FLUSH_LIST) {
n_list_flush++; n_list_flush++;
} else if (block->flush_type == } else if (block->flush_type
BUF_FLUSH_SINGLE_PAGE) { == BUF_FLUSH_SINGLE_PAGE) {
n_single_flush++; n_single_flush++;
} else { } else {
ut_error; ut_error;
@ -2101,14 +2141,16 @@ buf_validate(void)
} }
if (n_lru + n_free > buf_pool->curr_size) { if (n_lru + n_free > buf_pool->curr_size) {
fprintf(stderr, "n LRU %lu, n free %lu\n", (ulong) n_lru, (ulong) n_free); fprintf(stderr, "n LRU %lu, n free %lu\n",
(ulong) n_lru, (ulong) n_free);
ut_error; ut_error;
} }
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru); ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
if (UT_LIST_GET_LEN(buf_pool->free) != n_free) { if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
fprintf(stderr, "Free list len %lu, free blocks %lu\n", fprintf(stderr, "Free list len %lu, free blocks %lu\n",
(ulong) UT_LIST_GET_LEN(buf_pool->free), (ulong) n_free); (ulong) UT_LIST_GET_LEN(buf_pool->free),
(ulong) n_free);
ut_error; ut_error;
} }
ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush); ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush);
@ -2243,10 +2285,11 @@ buf_get_latched_pages_number(void)
block = buf_pool_get_nth_block(buf_pool, i); block = buf_pool_get_nth_block(buf_pool, i);
if (((block->buf_fix_count != 0) || (block->io_fix != 0)) && if (((block->buf_fix_count != 0) || (block->io_fix != 0))
block->magic_n == BUF_BLOCK_MAGIC_N ) && block->magic_n == BUF_BLOCK_MAGIC_N) {
fixed_pages_number++; fixed_pages_number++;
} }
}
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
@ -2312,8 +2355,10 @@ buf_print_io(
(ulong) buf_pool->n_frames); (ulong) buf_pool->n_frames);
fprintf(stderr, fprintf(stderr,
"AWE: Database pages and free buffers mapped in frames %lu\n", "AWE: Database pages and free buffers"
(ulong) UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped)); " mapped in frames %lu\n",
(ulong)
UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
} }
fprintf(file, fprintf(file,
"Buffer pool size %lu\n" "Buffer pool size %lu\n"
@ -2360,9 +2405,11 @@ buf_print_io(
if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) { if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) {
fprintf(file, "Buffer pool hit rate %lu / 1000\n", fprintf(file, "Buffer pool hit rate %lu / 1000\n",
(ulong) (1000 - (ulong)
((1000 * (buf_pool->n_pages_read - buf_pool->n_pages_read_old)) (1000 - ((1000 * (buf_pool->n_pages_read
/ (buf_pool->n_page_gets - buf_pool->n_page_gets_old)))); - buf_pool->n_pages_read_old))
/ (buf_pool->n_page_gets
- buf_pool->n_page_gets_old))));
} else { } else {
fputs("No buffer pool page gets since the last printout\n", fputs("No buffer pool page gets since the last printout\n",
file); file);
@ -2416,7 +2463,8 @@ buf_all_freed(void)
fprintf(stderr, fprintf(stderr,
"Page %lu %lu still fixed or dirty\n", "Page %lu %lu still fixed or dirty\n",
(ulong) block->space, (ulong) block->offset); (ulong) block->space,
(ulong) block->offset);
ut_error; ut_error;
} }
} }

View File

@ -55,8 +55,7 @@ buf_flush_insert_into_flush_list(
ut_a(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL) ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
|| (ut_dulint_cmp( || (ut_dulint_cmp((UT_LIST_GET_FIRST(buf_pool->flush_list))
(UT_LIST_GET_FIRST(buf_pool->flush_list))
->oldest_modification, ->oldest_modification,
block->oldest_modification) <= 0)); block->oldest_modification) <= 0));
@ -118,7 +117,8 @@ buf_flush_ready_for_replace(
if (block->state != BUF_BLOCK_FILE_PAGE) { if (block->state != BUF_BLOCK_FILE_PAGE) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: buffer block state %lu in the LRU list!\n", " InnoDB: Error: buffer block state %lu"
" in the LRU list!\n",
(ulong)block->state); (ulong)block->state);
ut_print_buf(stderr, block, sizeof(buf_block_t)); ut_print_buf(stderr, block, sizeof(buf_block_t));
@ -259,9 +259,12 @@ buf_flush_buffered_writes(void)
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) { - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n" " InnoDB: ERROR: The page to be written"
"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n" " seems corrupt!\n"
"InnoDB: before posting to the doublewrite buffer.\n"); "InnoDB: The lsn fields do not match!"
" Noticed in the buffer pool\n"
"InnoDB: before posting to the"
" doublewrite buffer.\n");
} }
if (block->check_index_page_at_flush if (block->check_index_page_at_flush
@ -271,9 +274,12 @@ buf_flush_buffered_writes(void)
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Apparent corruption of an index page n:o %lu in space %lu\n" " InnoDB: Apparent corruption of an"
"InnoDB: to be written to data file. We intentionally crash server\n" " index page n:o %lu in space %lu\n"
"InnoDB: to prevent corrupt data from ending up in data\n" "InnoDB: to be written to data file."
" We intentionally crash server\n"
"InnoDB: to prevent corrupt data"
" from ending up in data\n"
"InnoDB: files.\n", "InnoDB: files.\n",
(ulong) block->offset, (ulong) block->space); (ulong) block->offset, (ulong) block->space);
@ -304,8 +310,10 @@ buf_flush_buffered_writes(void)
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) { - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n" " InnoDB: ERROR: The page to be written"
"InnoDB: The lsn fields do not match! Noticed in the doublewrite block1.\n"); " seems corrupt!\n"
"InnoDB: The lsn fields do not match!"
" Noticed in the doublewrite block1.\n");
} }
} }
@ -317,7 +325,8 @@ buf_flush_buffered_writes(void)
TRUE, TRX_SYS_SPACE, TRUE, TRX_SYS_SPACE,
trx_doublewrite->block2, 0, len, trx_doublewrite->block2, 0, len,
(void*)(trx_doublewrite->write_buf (void*)(trx_doublewrite->write_buf
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE), + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
* UNIV_PAGE_SIZE),
NULL); NULL);
write_buf = trx_doublewrite->write_buf write_buf = trx_doublewrite->write_buf
@ -328,11 +337,15 @@ buf_flush_buffered_writes(void)
+ FIL_PAGE_LSN + 4) + FIL_PAGE_LSN + 4)
!= mach_read_from_4(write_buf + len2 != mach_read_from_4(write_buf + len2
+ UNIV_PAGE_SIZE + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) { - FIL_PAGE_END_LSN_OLD_CHKSUM
+ 4)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n" " InnoDB: ERROR: The page to be"
"InnoDB: The lsn fields do not match! Noticed in the doublewrite block2.\n"); " written seems corrupt!\n"
"InnoDB: The lsn fields do not match!"
" Noticed in"
" the doublewrite block2.\n");
} }
} }
} }
@ -353,10 +366,14 @@ buf_flush_buffered_writes(void)
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) { - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n" " InnoDB: ERROR: The page to be written"
"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n" " seems corrupt!\n"
"InnoDB: after posting and flushing the doublewrite buffer.\n" "InnoDB: The lsn fields do not match!"
"InnoDB: Page buf fix count %lu, io fix %lu, state %lu\n", " Noticed in the buffer pool\n"
"InnoDB: after posting and flushing"
" the doublewrite buffer.\n"
"InnoDB: Page buf fix count %lu,"
" io fix %lu, state %lu\n",
(ulong)block->buf_fix_count, (ulong)block->buf_fix_count,
(ulong)block->io_fix, (ulong)block->io_fix,
(ulong)block->state); (ulong)block->state);
@ -457,8 +474,9 @@ buf_flush_init_for_writing(
/* Store the new formula checksum */ /* Store the new formula checksum */
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums ? srv_use_checksums
buf_calc_page_new_checksum(page) : BUF_NO_CHECKSUM_MAGIC); ? buf_calc_page_new_checksum(page)
: BUF_NO_CHECKSUM_MAGIC);
/* We overwrite the first 4 bytes of the end lsn field to store /* We overwrite the first 4 bytes of the end lsn field to store
the old formula checksum. Since it depends also on the field the old formula checksum. Since it depends also on the field
@ -466,8 +484,9 @@ buf_flush_init_for_writing(
new formula checksum. */ new formula checksum. */
mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM, mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
srv_use_checksums ? srv_use_checksums
buf_calc_page_old_checksum(page) : BUF_NO_CHECKSUM_MAGIC); ? buf_calc_page_old_checksum(page)
: BUF_NO_CHECKSUM_MAGIC);
} }
/************************************************************************ /************************************************************************
@ -493,8 +512,8 @@ buf_flush_write_block_low(
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (!univ_log_debug_warned) { if (!univ_log_debug_warned) {
univ_log_debug_warned = TRUE; univ_log_debug_warned = TRUE;
fputs( fputs("Warning: cannot force log to disk if"
"Warning: cannot force log to disk if UNIV_LOG_DEBUG is defined!\n" " UNIV_LOG_DEBUG is defined!\n"
"Crash recovery will not work!\n", "Crash recovery will not work!\n",
stderr); stderr);
} }
@ -680,7 +699,8 @@ buf_flush_try_page(
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fprintf(stderr, fprintf(stderr,
"Flushing single page space %lu, page no %lu \n", "Flushing single page space %lu,"
" page no %lu \n",
(ulong) block->space, (ulong) block->space,
(ulong) block->offset); (ulong) block->offset);
} }
@ -870,9 +890,8 @@ buf_flush_batch(
old_page_count = page_count; old_page_count = page_count;
/* Try to flush also all the neighbors */ /* Try to flush also all the neighbors */
page_count += page_count += buf_flush_try_neighbors
buf_flush_try_neighbors(space, offset, (space, offset, flush_type);
flush_type);
/* fprintf(stderr, /* fprintf(stderr,
"Flush type %lu, page no %lu, neighb %lu\n", "Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset, flush_type, offset,

View File

@ -103,7 +103,7 @@ scan_again:
if (block->space == id) { if (block->space == id) {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
printf( fprintf(stderr,
"Dropping space %lu page %lu\n", "Dropping space %lu page %lu\n",
(ulong) block->space, (ulong) block->space,
(ulong) block->offset); (ulong) block->offset);
@ -216,7 +216,8 @@ buf_LRU_search_and_free_block(
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fprintf(stderr, fprintf(stderr,
"Putting space %lu page %lu to free list\n", "Putting space %lu page %lu"
" to free list\n",
(ulong) block->space, (ulong) block->space,
(ulong) block->offset); (ulong) block->offset);
} }
@ -344,14 +345,19 @@ loop:
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: ERROR: over 95 percent of the buffer pool is occupied by\n" " InnoDB: ERROR: over 95 percent of the buffer pool"
"InnoDB: lock heaps or the adaptive hash index! Check that your\n" " is occupied by\n"
"InnoDB: lock heaps or the adaptive hash index!"
" Check that your\n"
"InnoDB: transactions do not set too many row locks.\n" "InnoDB: transactions do not set too many row locks.\n"
"InnoDB: Your buffer pool size is %lu MB. Maybe you should make\n" "InnoDB: Your buffer pool size is %lu MB."
" Maybe you should make\n"
"InnoDB: the buffer pool bigger?\n" "InnoDB: the buffer pool bigger?\n"
"InnoDB: We intentionally generate a seg fault to print a stack trace\n" "InnoDB: We intentionally generate a seg fault"
" to print a stack trace\n"
"InnoDB: on Linux!\n", "InnoDB: on Linux!\n",
(ulong)(buf_pool->curr_size / (1024 * 1024 / UNIV_PAGE_SIZE))); (ulong) (buf_pool->curr_size
/ (1024 * 1024 / UNIV_PAGE_SIZE)));
ut_error; ut_error;
@ -366,14 +372,20 @@ loop:
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: WARNING: over 67 percent of the buffer pool is occupied by\n" " InnoDB: WARNING: over 67 percent of"
"InnoDB: lock heaps or the adaptive hash index! Check that your\n" " the buffer pool is occupied by\n"
"InnoDB: transactions do not set too many row locks.\n" "InnoDB: lock heaps or the adaptive"
"InnoDB: Your buffer pool size is %lu MB. Maybe you should make\n" " hash index! Check that your\n"
"InnoDB: transactions do not set too many"
" row locks.\n"
"InnoDB: Your buffer pool size is %lu MB."
" Maybe you should make\n"
"InnoDB: the buffer pool bigger?\n" "InnoDB: the buffer pool bigger?\n"
"InnoDB: Starting the InnoDB Monitor to print diagnostics, including\n" "InnoDB: Starting the InnoDB Monitor to print"
" diagnostics, including\n"
"InnoDB: lock heap and hash index sizes.\n", "InnoDB: lock heap and hash index sizes.\n",
(ulong) (buf_pool->curr_size / (1024 * 1024 / UNIV_PAGE_SIZE))); (ulong) (buf_pool->curr_size
/ (1024 * 1024 / UNIV_PAGE_SIZE)));
buf_lru_switched_on_innodb_mon = TRUE; buf_lru_switched_on_innodb_mon = TRUE;
srv_print_innodb_monitor = TRUE; srv_print_innodb_monitor = TRUE;
@ -405,7 +417,8 @@ loop:
/* Remove from the list of mapped pages */ /* Remove from the list of mapped pages */
UT_LIST_REMOVE(awe_LRU_free_mapped, UT_LIST_REMOVE(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block); buf_pool->awe_LRU_free_mapped,
block);
} else { } else {
/* We map the page to a frame; second param /* We map the page to a frame; second param
FALSE below because we do not want it to be FALSE below because we do not want it to be
@ -441,15 +454,22 @@ loop:
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
"InnoDB: Warning: difficult to find free blocks from\n" "InnoDB: Warning: difficult to find free blocks from\n"
"InnoDB: the buffer pool (%lu search iterations)! Consider\n" "InnoDB: the buffer pool (%lu search iterations)!"
" Consider\n"
"InnoDB: increasing the buffer pool size.\n" "InnoDB: increasing the buffer pool size.\n"
"InnoDB: It is also possible that in your Unix version\n" "InnoDB: It is also possible that"
"InnoDB: fsync is very slow, or completely frozen inside\n" " in your Unix version\n"
"InnoDB: the OS kernel. Then upgrading to a newer version\n" "InnoDB: fsync is very slow, or"
"InnoDB: of your operating system may help. Look at the\n" " completely frozen inside\n"
"InnoDB: the OS kernel. Then upgrading to"
" a newer version\n"
"InnoDB: of your operating system may help."
" Look at the\n"
"InnoDB: number of fsyncs in diagnostic info below.\n" "InnoDB: number of fsyncs in diagnostic info below.\n"
"InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n" "InnoDB: Pending flushes (fsync) log: %lu;"
"InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n" " buffer pool: %lu\n"
"InnoDB: %lu OS file reads, %lu OS file writes,"
" %lu OS fsyncs\n"
"InnoDB: Starting InnoDB Monitor to print further\n" "InnoDB: Starting InnoDB Monitor to print further\n"
"InnoDB: diagnostics to the standard output.\n", "InnoDB: diagnostics to the standard output.\n",
(ulong) n_iterations, (ulong) n_iterations,
@ -522,16 +542,16 @@ buf_LRU_old_adjust_len(void)
if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) { if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) {
buf_pool->LRU_old = UT_LIST_GET_PREV(LRU, buf_pool->LRU_old = UT_LIST_GET_PREV
buf_pool->LRU_old); (LRU, buf_pool->LRU_old);
(buf_pool->LRU_old)->old = TRUE; (buf_pool->LRU_old)->old = TRUE;
buf_pool->LRU_old_len++; buf_pool->LRU_old_len++;
} else if (old_len > new_len + BUF_LRU_OLD_TOLERANCE) { } else if (old_len > new_len + BUF_LRU_OLD_TOLERANCE) {
(buf_pool->LRU_old)->old = FALSE; (buf_pool->LRU_old)->old = FALSE;
buf_pool->LRU_old = UT_LIST_GET_NEXT(LRU, buf_pool->LRU_old = UT_LIST_GET_NEXT
buf_pool->LRU_old); (LRU, buf_pool->LRU_old);
buf_pool->LRU_old_len--; buf_pool->LRU_old_len--;
} else { } else {
ut_a(buf_pool->LRU_old); /* Check that we did not ut_a(buf_pool->LRU_old); /* Check that we did not
@ -875,15 +895,20 @@ buf_LRU_block_remove_hashed_page(
if (block != buf_page_hash_get(block->space, block->offset)) { if (block != buf_page_hash_get(block->space, block->offset)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: page %lu %lu not found from the hash table\n", "InnoDB: Error: page %lu %lu not found"
" in the hash table\n",
(ulong) block->space, (ulong) block->space,
(ulong) block->offset); (ulong) block->offset);
if (buf_page_hash_get(block->space, block->offset)) { if (buf_page_hash_get(block->space, block->offset)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: From hash table we find block %p of %lu %lu which is not %p\n", "InnoDB: In hash table we find block"
(void*) buf_page_hash_get(block->space, block->offset), " %p of %lu %lu which is not %p\n",
(ulong) buf_page_hash_get(block->space, block->offset)->space, (void*) buf_page_hash_get
(ulong) buf_page_hash_get(block->space, block->offset)->offset, (block->space, block->offset),
(ulong) buf_page_hash_get
(block->space, block->offset)->space,
(ulong) buf_page_hash_get
(block->space, block->offset)->offset,
(void*) block); (void*) block);
} }
@ -1009,7 +1034,8 @@ buf_LRU_print(void)
ut_ad(buf_pool); ut_ad(buf_pool);
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
fprintf(stderr, "Pool ulint clock %lu\n", (ulong) buf_pool->ulint_clock); fprintf(stderr, "Pool ulint clock %lu\n",
(ulong) buf_pool->ulint_clock);
block = UT_LIST_GET_FIRST(buf_pool->LRU); block = UT_LIST_GET_FIRST(buf_pool->LRU);
@ -1042,7 +1068,8 @@ buf_LRU_print(void)
fprintf(stderr, "LRU pos %lu type %lu index id %lu ", fprintf(stderr, "LRU pos %lu type %lu index id %lu ",
(ulong) block->LRU_position, (ulong) block->LRU_position,
(ulong) fil_page_get_type(frame), (ulong) fil_page_get_type(frame),
(ulong) ut_dulint_get_low(btr_page_get_index_id(frame))); (ulong) ut_dulint_get_low
(btr_page_get_index_id(frame)));
block = UT_LIST_GET_NEXT(LRU, block); block = UT_LIST_GET_NEXT(LRU, block);
if (++len == 10) { if (++len == 10) {

View File

@ -89,24 +89,13 @@ buf_read_page_low(
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE))) { + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE))) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Warning: trying to read doublewrite buffer page %lu\n", " InnoDB: Warning: trying to read"
" doublewrite buffer page %lu\n",
(ulong) offset); (ulong) offset);
return(0); return(0);
} }
#ifdef UNIV_LOG_DEBUG
if (space % 2 == 1) {
/* We are updating a replicate space while holding the
log mutex: the read must be handled before other reads
which might incur ibuf operations and thus write to the log */
fputs("Log debug: reading replicate page in sync mode\n",
stderr);
sync = TRUE;
}
#endif
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) { if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
/* Trx sys header is so low in the latching order that we play /* Trx sys header is so low in the latching order that we play
@ -224,8 +213,8 @@ buf_read_ahead_random(
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
if (buf_pool->n_pend_reads > if (buf_pool->n_pend_reads
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) { > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
return(0); return(0);
@ -268,15 +257,18 @@ buf_read_ahead_random(
mode: hence FALSE as the first parameter */ mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(i)) { if (!ibuf_bitmap_page(i)) {
count += buf_read_page_low(&err, FALSE, ibuf_mode count += buf_read_page_low
| OS_AIO_SIMULATED_WAKE_LATER, (&err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, i); space, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Warning: in random readahead trying to access tablespace\n" " InnoDB: Warning: in random"
"InnoDB: %lu page no. %lu,\n" " readahead trying to access\n"
"InnoDB: but the tablespace does not exist or is just being dropped.\n", "InnoDB: tablespace %lu page %lu,\n"
"InnoDB: but the tablespace does not"
" exist or is just being dropped.\n",
(ulong) space, (ulong) i); (ulong) space, (ulong) i);
} }
} }
@ -334,8 +326,10 @@ buf_read_page(
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: trying to access tablespace %lu page no. %lu,\n" " InnoDB: Error: trying to access"
"InnoDB: but the tablespace does not exist or is just being dropped.\n", " tablespace %lu page no. %lu,\n"
"InnoDB: but the tablespace does not exist"
" or is just being dropped.\n",
(ulong) space, (ulong) offset); (ulong) space, (ulong) offset);
} }
@ -432,8 +426,8 @@ buf_read_ahead_linear(
return(0); return(0);
} }
if (buf_pool->n_pend_reads > if (buf_pool->n_pend_reads
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) { > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
return(0); return(0);
@ -469,8 +463,8 @@ buf_read_ahead_linear(
} }
} }
if (fail_count > BUF_READ_AHEAD_LINEAR_AREA - if (fail_count > BUF_READ_AHEAD_LINEAR_AREA
BUF_READ_AHEAD_LINEAR_THRESHOLD) { - BUF_READ_AHEAD_LINEAR_THRESHOLD) {
/* Too many failures: return */ /* Too many failures: return */
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
@ -555,15 +549,18 @@ buf_read_ahead_linear(
aio mode: hence FALSE as the first parameter */ aio mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(i)) { if (!ibuf_bitmap_page(i)) {
count += buf_read_page_low(&err, FALSE, ibuf_mode count += buf_read_page_low
| OS_AIO_SIMULATED_WAKE_LATER, (&err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, i); space, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Warning: in linear readahead trying to access tablespace\n" " InnoDB: Warning: in"
"InnoDB: %lu page no. %lu,\n" " linear readahead trying to access\n"
"InnoDB: but the tablespace does not exist or is just being dropped.\n", "InnoDB: tablespace %lu page %lu,\n"
"InnoDB: but the tablespace does not"
" exist or is just being dropped.\n",
(ulong) space, (ulong) i); (ulong) space, (ulong) i);
} }
} }
@ -618,19 +615,17 @@ buf_read_ibuf_merge_pages(
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
ut_a(n_stored < UNIV_PAGE_SIZE); ut_a(n_stored < UNIV_PAGE_SIZE);
#endif #endif
while (buf_pool->n_pend_reads > while (buf_pool->n_pend_reads
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) { > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
os_thread_sleep(500000); os_thread_sleep(500000);
} }
for (i = 0; i < n_stored; i++) { for (i = 0; i < n_stored; i++) {
if ((i + 1 == n_stored) && sync) { buf_read_page_low(&err,
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, (i + 1 == n_stored) && sync,
space_ids[i], space_versions[i], page_nos[i]); BUF_READ_ANY_PAGE,
} else { space_ids[i], space_versions[i],
buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE, page_nos[i]);
space_ids[i], space_versions[i], page_nos[i]);
}
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
/* We have deleted or are deleting the single-table /* We have deleted or are deleting the single-table
@ -691,9 +686,12 @@ buf_read_recv_pages(
if (count > 100) { if (count > 100) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: InnoDB has waited for 50 seconds for pending\n" "InnoDB: Error: InnoDB has waited for"
"InnoDB: reads to the buffer pool to be finished.\n" " 50 seconds for pending\n"
"InnoDB: Number of pending reads %lu, pending pread calls %lu\n", "InnoDB: reads to the buffer pool to"
" be finished.\n"
"InnoDB: Number of pending reads %lu,"
" pending pread calls %lu\n",
(ulong) buf_pool->n_pend_reads, (ulong) buf_pool->n_pend_reads,
(ulong)os_file_n_pending_preads); (ulong)os_file_n_pending_preads);
@ -704,12 +702,14 @@ buf_read_recv_pages(
os_aio_print_debug = FALSE; os_aio_print_debug = FALSE;
if ((i + 1 == n_stored) && sync) { if ((i + 1 == n_stored) && sync) {
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space, buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE,
tablespace_version, page_nos[i]); space, tablespace_version,
page_nos[i]);
} else { } else {
buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE
| OS_AIO_SIMULATED_WAKE_LATER, | OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, page_nos[i]); space, tablespace_version,
page_nos[i]);
} }
} }
@ -721,7 +721,8 @@ buf_read_recv_pages(
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fprintf(stderr, fprintf(stderr,
"Recovery applies read-ahead pages %lu\n", (ulong) n_stored); "Recovery applies read-ahead pages %lu\n",
(ulong) n_stored);
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
} }

View File

@ -433,15 +433,20 @@ dfield_print_also_hex(
/***************************************************************** /*****************************************************************
Print a dfield value using ut_print_buf. */ Print a dfield value using ut_print_buf. */
static
void void
dfield_print_raw( dfield_print_raw(
/*=============*/ /*=============*/
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
dfield_t* dfield) /* in: dfield */ dfield_t* dfield) /* in: dfield */
{ {
if (dfield->len != UNIV_SQL_NULL) { ulint len = dfield->len;
ut_print_buf(f, dfield->data, dfield->len); if (len != UNIV_SQL_NULL) {
ulint print_len = ut_min(len, 1000);
ut_print_buf(f, dfield->data, print_len);
if (len != print_len) {
fprintf(f, "(total %lu bytes)", (ulong) len);
}
} else { } else {
fputs(" SQL NULL", f); fputs(" SQL NULL", f);
} }
@ -513,7 +518,8 @@ dtuple_convert_big_rec(
if (UNIV_UNLIKELY(size > 1000000000)) { if (UNIV_UNLIKELY(size > 1000000000)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Warning: tuple size very big: %lu\n", (ulong) size); "InnoDB: Warning: tuple size very big: %lu\n",
(ulong) size);
fputs("InnoDB: Tuple contents: ", stderr); fputs("InnoDB: Tuple contents: ", stderr);
dtuple_print(stderr, entry); dtuple_print(stderr, entry);
putc('\n', stderr); putc('\n', stderr);
@ -534,8 +540,8 @@ dtuple_convert_big_rec(
n_fields = 0; n_fields = 0;
while (rec_get_converted_size(index, entry) while (rec_get_converted_size(index, entry)
>= ut_min(page_get_free_space_of_empty( >= ut_min(page_get_free_space_of_empty
dict_table_is_comp(index->table)) / 2, (dict_table_is_comp(index->table)) / 2,
REC_MAX_DATA_SIZE)) { REC_MAX_DATA_SIZE)) {
longest = 0; longest = 0;
@ -559,8 +565,8 @@ dtuple_convert_big_rec(
dfield = dtuple_get_nth_field(entry, i); dfield = dtuple_get_nth_field(entry, i);
if (dfield->len != UNIV_SQL_NULL && if (dfield->len != UNIV_SQL_NULL
dfield->len > longest) { && dfield->len > longest) {
longest = dfield->len; longest = dfield->len;
@ -604,8 +610,8 @@ dtuple_convert_big_rec(
vector->fields[n_fields].len = dfield->len vector->fields[n_fields].len = dfield->len
- DICT_MAX_INDEX_COL_LEN; - DICT_MAX_INDEX_COL_LEN;
vector->fields[n_fields].data = mem_heap_alloc(heap, vector->fields[n_fields].data = mem_heap_alloc
vector->fields[n_fields].len); (heap, vector->fields[n_fields].len);
/* Copy data (from the end of field) to big rec vector */ /* Copy data (from the end of field) to big rec vector */

View File

@ -67,8 +67,8 @@ dtype_get_at_most_n_mbchars(
if (dtype->mbminlen != dtype->mbmaxlen) { if (dtype->mbminlen != dtype->mbmaxlen) {
ut_a(!(prefix_len % dtype->mbmaxlen)); ut_a(!(prefix_len % dtype->mbmaxlen));
return(innobase_get_at_most_n_mbchars( return(innobase_get_at_most_n_mbchars
dtype_get_charset_coll(dtype->prtype), (dtype_get_charset_coll(dtype->prtype),
prefix_len, data_len, str)); prefix_len, data_len, str));
} }

View File

@ -236,9 +236,9 @@ dict_boot(void)
..._MARGIN, it will immediately be updated to the disk-based ..._MARGIN, it will immediately be updated to the disk-based
header. */ header. */
dict_sys->row_id = ut_dulint_add( dict_sys->row_id = ut_dulint_add
ut_dulint_align_up( (ut_dulint_align_up(mtr_read_dulint
mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID, &mtr), (dict_hdr + DICT_HDR_ROW_ID, &mtr),
DICT_HDR_ROW_ID_WRITE_MARGIN), DICT_HDR_ROW_ID_WRITE_MARGIN),
DICT_HDR_ROW_ID_WRITE_MARGIN); DICT_HDR_ROW_ID_WRITE_MARGIN);
@ -262,14 +262,16 @@ dict_boot(void)
dict_sys->sys_tables = table; dict_sys->sys_tables = table;
index = dict_mem_index_create("SYS_TABLES", "CLUST_IND", index = dict_mem_index_create("SYS_TABLES", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 1); DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 1);
dict_mem_index_add_field(index, "NAME", 0); dict_mem_index_add_field(index, "NAME", 0);
index->id = DICT_TABLES_ID; index->id = DICT_TABLES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint( success = dict_index_add_to_cache(table, index, mtr_read_ulint
dict_hdr + DICT_HDR_TABLES, MLOG_4BYTES, &mtr)); (dict_hdr + DICT_HDR_TABLES,
MLOG_4BYTES, &mtr));
ut_a(success); ut_a(success);
/*-------------------------*/ /*-------------------------*/
index = dict_mem_index_create("SYS_TABLES", "ID_IND", index = dict_mem_index_create("SYS_TABLES", "ID_IND",
@ -277,8 +279,10 @@ dict_boot(void)
dict_mem_index_add_field(index, "ID", 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_TABLE_IDS_ID; index->id = DICT_TABLE_IDS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint( success = dict_index_add_to_cache(table, index,
dict_hdr + DICT_HDR_TABLE_IDS, MLOG_4BYTES, &mtr)); mtr_read_ulint
(dict_hdr + DICT_HDR_TABLE_IDS,
MLOG_4BYTES, &mtr));
ut_a(success); ut_a(success);
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0); table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0);
@ -297,14 +301,16 @@ dict_boot(void)
dict_sys->sys_columns = table; dict_sys->sys_columns = table;
index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND", index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2); DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "TABLE_ID", 0); dict_mem_index_add_field(index, "TABLE_ID", 0);
dict_mem_index_add_field(index, "POS", 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_COLUMNS_ID; index->id = DICT_COLUMNS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint( success = dict_index_add_to_cache(table, index, mtr_read_ulint
dict_hdr + DICT_HDR_COLUMNS, MLOG_4BYTES, &mtr)); (dict_hdr + DICT_HDR_COLUMNS,
MLOG_4BYTES, &mtr));
ut_a(success); ut_a(success);
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0); table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0);
@ -333,14 +339,16 @@ dict_boot(void)
dict_sys->sys_indexes = table; dict_sys->sys_indexes = table;
index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND", index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2); DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "TABLE_ID", 0); dict_mem_index_add_field(index, "TABLE_ID", 0);
dict_mem_index_add_field(index, "ID", 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_INDEXES_ID; index->id = DICT_INDEXES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint( success = dict_index_add_to_cache(table, index, mtr_read_ulint
dict_hdr + DICT_HDR_INDEXES, MLOG_4BYTES, &mtr)); (dict_hdr + DICT_HDR_INDEXES,
MLOG_4BYTES, &mtr));
ut_a(success); ut_a(success);
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0); table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0);
@ -354,14 +362,16 @@ dict_boot(void)
dict_sys->sys_fields = table; dict_sys->sys_fields = table;
index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND", index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2); DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "INDEX_ID", 0); dict_mem_index_add_field(index, "INDEX_ID", 0);
dict_mem_index_add_field(index, "POS", 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_FIELDS_ID; index->id = DICT_FIELDS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint( success = dict_index_add_to_cache(table, index, mtr_read_ulint
dict_hdr + DICT_HDR_FIELDS, MLOG_4BYTES, &mtr)); (dict_hdr + DICT_HDR_FIELDS,
MLOG_4BYTES, &mtr));
ut_a(success); ut_a(success);
mtr_commit(&mtr); mtr_commit(&mtr);

View File

@ -222,8 +222,8 @@ dict_build_table_def_step(
row_len = 0; row_len = 0;
for (i = 0; i < table->n_def; i++) { for (i = 0; i < table->n_def; i++) {
row_len += dtype_get_min_size(dict_col_get_type( row_len += dtype_get_min_size(dict_col_get_type
&table->cols[i])); (&table->cols[i]));
} }
if (row_len > BTR_PAGE_MAX_REC_SIZE) { if (row_len > BTR_PAGE_MAX_REC_SIZE) {
return(DB_TOO_BIG_RECORD); return(DB_TOO_BIG_RECORD);
@ -251,8 +251,8 @@ dict_build_table_def_step(
is_path = FALSE; is_path = FALSE;
} }
error = fil_create_new_single_table_tablespace( error = fil_create_new_single_table_tablespace
&(table->space), path_or_name, is_path, (&table->space, path_or_name, is_path,
FIL_IBD_FILE_INITIAL_SIZE); FIL_IBD_FILE_INITIAL_SIZE);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
@ -684,7 +684,8 @@ dict_drop_index_tree(
btr_free_root(space, root_page_no, mtr); btr_free_root(space, root_page_no, mtr);
page_rec_write_index_page_no(rec, page_rec_write_index_page_no(rec,
DICT_SYS_INDEXES_PAGE_NO_FIELD, FIL_NULL, mtr); DICT_SYS_INDEXES_PAGE_NO_FIELD,
FIL_NULL, mtr);
} }
/*********************************************************************** /***********************************************************************
@ -767,8 +768,8 @@ dict_truncate_index_tree(
appropriate field in the SYS_INDEXES record: this mini-transaction appropriate field in the SYS_INDEXES record: this mini-transaction
marks the B-tree totally truncated */ marks the B-tree totally truncated */
comp = page_is_comp(btr_page_get( comp = page_is_comp(btr_page_get
space, root_page_no, RW_X_LATCH, mtr)); (space, root_page_no, RW_X_LATCH, mtr));
btr_free_root(space, root_page_no, mtr); btr_free_root(space, root_page_no, mtr);
/* We will temporarily write FIL_NULL to the PAGE_NO field /* We will temporarily write FIL_NULL to the PAGE_NO field
@ -1157,13 +1158,15 @@ dict_create_or_check_foreign_constraint_tables(void)
if (table1) { if (table1) {
fprintf(stderr, fprintf(stderr,
"InnoDB: dropping incompletely created SYS_FOREIGN table\n"); "InnoDB: dropping incompletely created"
" SYS_FOREIGN table\n");
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE); row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
} }
if (table2) { if (table2) {
fprintf(stderr, fprintf(stderr,
"InnoDB: dropping incompletely created SYS_FOREIGN_COLS table\n"); "InnoDB: dropping incompletely created"
" SYS_FOREIGN_COLS table\n");
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE); row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
} }
@ -1184,13 +1187,19 @@ dict_create_or_check_foreign_constraint_tables(void)
"PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n" "PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
"BEGIN\n" "BEGIN\n"
"CREATE TABLE\n" "CREATE TABLE\n"
"SYS_FOREIGN(ID CHAR, FOR_NAME CHAR, REF_NAME CHAR, N_COLS INT);\n" "SYS_FOREIGN(ID CHAR, FOR_NAME CHAR,"
"CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN (ID);\n" " REF_NAME CHAR, N_COLS INT);\n"
"CREATE INDEX FOR_IND ON SYS_FOREIGN (FOR_NAME);\n" "CREATE UNIQUE CLUSTERED INDEX ID_IND"
"CREATE INDEX REF_IND ON SYS_FOREIGN (REF_NAME);\n" " ON SYS_FOREIGN (ID);\n"
"CREATE INDEX FOR_IND"
" ON SYS_FOREIGN (FOR_NAME);\n"
"CREATE INDEX REF_IND"
" ON SYS_FOREIGN (REF_NAME);\n"
"CREATE TABLE\n" "CREATE TABLE\n"
"SYS_FOREIGN_COLS(ID CHAR, POS INT, FOR_COL_NAME CHAR, REF_COL_NAME CHAR);\n" "SYS_FOREIGN_COLS(ID CHAR, POS INT,"
"CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN_COLS (ID, POS);\n" " FOR_COL_NAME CHAR, REF_COL_NAME CHAR);\n"
"CREATE UNIQUE CLUSTERED INDEX ID_IND"
" ON SYS_FOREIGN_COLS (ID, POS);\n"
"COMMIT WORK;\n" "COMMIT WORK;\n"
"END;\n" "END;\n"
, FALSE, trx); , FALSE, trx);
@ -1201,10 +1210,11 @@ dict_create_or_check_foreign_constraint_tables(void)
ut_a(error == DB_OUT_OF_FILE_SPACE); ut_a(error == DB_OUT_OF_FILE_SPACE);
fprintf(stderr, "InnoDB: creation failed\n");
fprintf(stderr, "InnoDB: tablespace is full\n");
fprintf(stderr, fprintf(stderr,
"InnoDB: dropping incompletely created SYS_FOREIGN tables\n"); "InnoDB: creation failed\n"
"InnoDB: tablespace is full\n"
"InnoDB: dropping incompletely created"
" SYS_FOREIGN tables\n");
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE); row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE); row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
@ -1220,7 +1230,8 @@ dict_create_or_check_foreign_constraint_tables(void)
if (error == DB_SUCCESS) { if (error == DB_SUCCESS) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Foreign key constraint system tables created\n"); "InnoDB: Foreign key constraint system tables"
" created\n");
} }
return(error); return(error);
@ -1282,7 +1293,8 @@ dict_foreign_eval_sql(
" for table ", ef); " for table ", ef);
ut_print_name(ef, trx, TRUE, table->name); ut_print_name(ef, trx, TRUE, table->name);
fputs(".\n" fputs(".\n"
"See the MySQL .err log in the datadir for more information.\n", ef); "See the MySQL .err log in the datadir"
" for more information.\n", ef);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
return(error); return(error);
@ -1316,13 +1328,13 @@ dict_create_add_foreign_field_to_dictionary(
pars_info_add_str_literal(info, "ref_col_name", pars_info_add_str_literal(info, "ref_col_name",
foreign->referenced_col_names[field_nr]); foreign->referenced_col_names[field_nr]);
return dict_foreign_eval_sql(info, return(dict_foreign_eval_sql
"PROCEDURE P () IS\n" (info, "PROCEDURE P () IS\n"
"BEGIN\n" "BEGIN\n"
"INSERT INTO SYS_FOREIGN_COLS VALUES" "INSERT INTO SYS_FOREIGN_COLS VALUES"
"(:id, :pos, :for_col_name, :ref_col_name);\n" "(:id, :pos, :for_col_name, :ref_col_name);\n"
"END;\n" "END;\n",
, table, foreign, trx); table, foreign, trx));
} }
/************************************************************************ /************************************************************************
@ -1381,8 +1393,8 @@ dict_create_add_foreign_to_dictionary(
} }
for (i = 0; i < foreign->n_fields; i++) { for (i = 0; i < foreign->n_fields; i++) {
error = dict_create_add_foreign_field_to_dictionary(i, error = dict_create_add_foreign_field_to_dictionary
table, foreign, trx); (i, table, foreign, trx);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
@ -1428,7 +1440,8 @@ dict_create_add_foreigns_to_dictionary(
if (NULL == dict_table_get_low("SYS_FOREIGN")) { if (NULL == dict_table_get_low("SYS_FOREIGN")) {
fprintf(stderr, fprintf(stderr,
"InnoDB: table SYS_FOREIGN not found from internal data dictionary\n"); "InnoDB: table SYS_FOREIGN not found"
" in internal data dictionary\n");
return(DB_ERROR); return(DB_ERROR);
} }
@ -1437,8 +1450,8 @@ dict_create_add_foreigns_to_dictionary(
foreign; foreign;
foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) { foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) {
error = dict_create_add_foreign_to_dictionary(&number, error = dict_create_add_foreign_to_dictionary
table, foreign, trx); (&number, table, foreign, trx);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {

Some files were not shown because too many files have changed in this diff Show More