Commit d4e95229 authored by sergefp@mysql.com's avatar sergefp@mysql.com

Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/dbdata/psergey/mysql-4.1-ps-merge
parents 9250a0e4 9d8bb4bd
...@@ -772,3 +772,5 @@ ndb/lib/libNEWTON_BASICTEST_COMMON.so ...@@ -772,3 +772,5 @@ ndb/lib/libNEWTON_BASICTEST_COMMON.so
ndb/lib/libREP_API.so ndb/lib/libREP_API.so
ndb/lib/libndbclient.so ndb/lib/libndbclient.so
ndb/lib/libndbclient_extra.so ndb/lib/libndbclient_extra.so
libmysqld/discover.cc
include/readline
...@@ -9,6 +9,6 @@ extra_configs="$pentium_configs" ...@@ -9,6 +9,6 @@ extra_configs="$pentium_configs"
extra_configs="$extra_configs --with-innodb --with-berkeley-db \ extra_configs="$extra_configs --with-innodb --with-berkeley-db \
--with-embedded-server --enable-thread-safe-client \ --with-embedded-server --enable-thread-safe-client \
--with-openssl --with-vio --with-raid" --with-openssl --with-vio --with-raid --with-ndbcluster"
. "$path/FINISH.sh" . "$path/FINISH.sh"
...@@ -92,6 +92,7 @@ monty@donna.mysql.fi ...@@ -92,6 +92,7 @@ monty@donna.mysql.fi
monty@hundin.mysql.fi monty@hundin.mysql.fi
monty@mashka.(none) monty@mashka.(none)
monty@mashka.mysql.fi monty@mashka.mysql.fi
monty@mishka.local
monty@mishka.mysql.fi monty@mishka.mysql.fi
monty@mysql.com monty@mysql.com
monty@narttu. monty@narttu.
......
This diff is collapsed.
...@@ -43,5 +43,5 @@ enum options_client ...@@ -43,5 +43,5 @@ enum options_client
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL, OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION, OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS
}; };
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov ** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
*/ */
#define DUMP_VERSION "10.6" #define DUMP_VERSION "10.7"
#include <my_global.h> #include <my_global.h>
#include <my_sys.h> #include <my_sys.h>
...@@ -91,7 +91,6 @@ static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, ...@@ -91,7 +91,6 @@ static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*opt_compatible_mode_str= 0, *opt_compatible_mode_str= 0,
*err_ptr= 0; *err_ptr= 0;
static char compatible_mode_normal_str[255]; static char compatible_mode_normal_str[255];
static char *default_charset= (char*) MYSQL_UNIVERSAL_CLIENT_CHARSET;
static ulong opt_compatible_mode= 0; static ulong opt_compatible_mode= 0;
static uint opt_mysql_port= 0, err_len= 0; static uint opt_mysql_port= 0, err_len= 0;
static my_string opt_mysql_unix_port=0; static my_string opt_mysql_unix_port=0;
...@@ -104,7 +103,9 @@ FILE *md_result_file; ...@@ -104,7 +103,9 @@ FILE *md_result_file;
static char *shared_memory_base_name=0; static char *shared_memory_base_name=0;
#endif #endif
static uint opt_protocol= 0; static uint opt_protocol= 0;
static char *default_charset= (char*) MYSQL_UNIVERSAL_CLIENT_CHARSET;
static CHARSET_INFO *charset_info= &my_charset_latin1; static CHARSET_INFO *charset_info= &my_charset_latin1;
const char *default_dbug_option="d:t:o,/tmp/mysqldump.trace";
const char *compatible_mode_names[]= const char *compatible_mode_names[]=
{ {
...@@ -132,9 +133,6 @@ static struct my_option my_long_options[] = ...@@ -132,9 +133,6 @@ static struct my_option my_long_options[] =
"Dump all the databases. This will be same as --databases with all databases selected.", "Dump all the databases. This will be same as --databases with all databases selected.",
(gptr*) &opt_alldbs, (gptr*) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, (gptr*) &opt_alldbs, (gptr*) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0}, 0, 0},
{"all", 'a', "Include all MySQL specific create options.",
(gptr*) &create_options, (gptr*) &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"add-drop-table", OPT_DROP, "Add a 'drop table' before each create.", {"add-drop-table", OPT_DROP, "Add a 'drop table' before each create.",
(gptr*) &opt_drop, (gptr*) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, (gptr*) &opt_drop, (gptr*) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0}, 0},
...@@ -148,7 +146,7 @@ static struct my_option my_long_options[] = ...@@ -148,7 +146,7 @@ static struct my_option my_long_options[] =
"Directory where character sets are.", (gptr*) &charsets_dir, "Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compatible", OPT_COMPATIBLE, {"compatible", OPT_COMPATIBLE,
"Change the dump to be compatible with a given mode. By default tables are dumped without any restrictions. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option does a no operation on earlier server versions.", "Change the dump to be compatible with a given mode. By default tables are dumped in a format optimized for MySQL. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option is ignored with earlier server versions.",
(gptr*) &opt_compatible_mode_str, (gptr*) &opt_compatible_mode_str, 0, (gptr*) &opt_compatible_mode_str, (gptr*) &opt_compatible_mode_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compact", OPT_COMPACT, {"compact", OPT_COMPACT,
...@@ -160,12 +158,21 @@ static struct my_option my_long_options[] = ...@@ -160,12 +158,21 @@ static struct my_option my_long_options[] =
{"compress", 'C', "Use compression in server/client protocol.", {"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0}, 0, 0, 0},
{"create-options", OPT_CREATE_OPTIONS,
"Include all MySQL specific create options.",
(gptr*) &create_options, (gptr*) &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"databases", 'B', {"databases", 'B',
"To dump several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames. 'USE db_name;' will be included in the output.", "To dump several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames. 'USE db_name;' will be included in the output.",
(gptr*) &opt_databases, (gptr*) &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0, (gptr*) &opt_databases, (gptr*) &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0}, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", #ifdef DBUG_OFF
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
{"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"default-character-set", OPT_DEFAULT_CHARSET, {"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset, "Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
...@@ -463,7 +470,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -463,7 +470,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_disable_keys=0; opt_disable_keys=0;
break; break;
case '#': case '#':
DBUG_PUSH(argument ? argument : "d:t:o"); DBUG_PUSH(argument ? argument : default_dbug_option);
break; break;
#include <sslopt-case.h> #include <sslopt-case.h>
case 'V': print_version(); exit(0); case 'V': print_version(); exit(0);
...@@ -483,7 +490,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -483,7 +490,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
case (int) OPT_SKIP_OPTIMIZATION: case (int) OPT_SKIP_OPTIMIZATION:
extended_insert= opt_drop= opt_lock= quick= create_options= extended_insert= opt_drop= opt_lock= quick= create_options=
opt_disable_keys= lock_tables= 0; opt_disable_keys= lock_tables= opt_set_charset= 0;
break; break;
case (int) OPT_COMPACT: case (int) OPT_COMPACT:
if (opt_compact) if (opt_compact)
...@@ -859,11 +866,11 @@ static void print_xml_row(FILE *xml_file, const char *row_name, ...@@ -859,11 +866,11 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
{ {
if ((*row)[i]) if ((*row)[i])
{ {
fputs(" ", xml_file); fputc(' ', xml_file);
print_quoted_xml(xml_file, field->name, field->name_length); print_quoted_xml(xml_file, field->name, field->name_length);
fputs("=\"", xml_file); fputs("=\"", xml_file);
print_quoted_xml(xml_file, (*row)[i], lengths[i]); print_quoted_xml(xml_file, (*row)[i], lengths[i]);
fputs("\"", xml_file); fputc('"', xml_file);
} }
} }
fputs(" />\n", xml_file); fputs(" />\n", xml_file);
...@@ -897,6 +904,9 @@ static uint getTableStructure(char *table, char* db) ...@@ -897,6 +904,9 @@ static uint getTableStructure(char *table, char* db)
sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d", sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d",
(opt_quoted || opt_keywords)); (opt_quoted || opt_keywords));
if (!create_options)
strmov(strend(insert_pat), "/*!40102 ,SQL_MODE=concat(@@sql_mode, _utf8 'NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS') */");
result_table= quote_name(table, table_buff, 1); result_table= quote_name(table, table_buff, 1);
opt_quoted_table= quote_name(table, table_buff2, 0); opt_quoted_table= quote_name(table, table_buff2, 0);
if (!opt_xml && !mysql_query(sock,insert_pat)) if (!opt_xml && !mysql_query(sock,insert_pat))
...@@ -978,8 +988,10 @@ static uint getTableStructure(char *table, char* db) ...@@ -978,8 +988,10 @@ static uint getTableStructure(char *table, char* db)
} }
else else
{ {
/* fprintf(stderr, "%s: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n", if (verbose)
my_progname, mysql_error(sock)); */ fprintf(stderr,
"%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
my_progname, mysql_error(sock));
sprintf(insert_pat,"show fields from %s", result_table); sprintf(insert_pat,"show fields from %s", result_table);
if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock))) if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock)))
...@@ -1172,7 +1184,7 @@ static uint getTableStructure(char *table, char* db) ...@@ -1172,7 +1184,7 @@ static uint getTableStructure(char *table, char* db)
else else
{ {
fputs("/*!",sql_file); fputs("/*!",sql_file);
print_value(sql_file,tableRes,row,"type=","Type",0); print_value(sql_file,tableRes,row,"engine=","Engine",0);
print_value(sql_file,tableRes,row,"","Create_options",0); print_value(sql_file,tableRes,row,"","Create_options",0);
print_value(sql_file,tableRes,row,"comment=","Comment",1); print_value(sql_file,tableRes,row,"comment=","Comment",1);
fputs(" */",sql_file); fputs(" */",sql_file);
...@@ -1413,12 +1425,12 @@ static void dumpTable(uint numFields, char *table) ...@@ -1413,12 +1425,12 @@ static void dumpTable(uint numFields, char *table)
fputs("Aborting dump (out of memory)",stderr); fputs("Aborting dump (out of memory)",stderr);
safe_exit(EX_EOM); safe_exit(EX_EOM);
} }
dynstr_append(&extended_row,"\'"); dynstr_append(&extended_row,"'");
extended_row.length += extended_row.length +=
mysql_real_escape_string(&mysql_connection, mysql_real_escape_string(&mysql_connection,
&extended_row.str[extended_row.length],row[i],length); &extended_row.str[extended_row.length],row[i],length);
extended_row.str[extended_row.length]='\0'; extended_row.str[extended_row.length]='\0';
dynstr_append(&extended_row,"\'"); dynstr_append(&extended_row,"'");
} }
else else
{ {
...@@ -1432,9 +1444,9 @@ static void dumpTable(uint numFields, char *table) ...@@ -1432,9 +1444,9 @@ static void dumpTable(uint numFields, char *table)
if (field->type == FIELD_TYPE_DECIMAL) if (field->type == FIELD_TYPE_DECIMAL)
{ {
/* add " signs around */ /* add " signs around */
dynstr_append(&extended_row, "\""); dynstr_append(&extended_row, "'");
dynstr_append(&extended_row, ptr); dynstr_append(&extended_row, ptr);
dynstr_append(&extended_row, "\""); dynstr_append(&extended_row, "'");
} }
else else
dynstr_append(&extended_row, ptr); dynstr_append(&extended_row, ptr);
...@@ -1442,7 +1454,7 @@ static void dumpTable(uint numFields, char *table) ...@@ -1442,7 +1454,7 @@ static void dumpTable(uint numFields, char *table)
} }
} }
else else
dynstr_append(&extended_row,"\'\'"); dynstr_append(&extended_row,"''");
} }
else if (dynstr_append(&extended_row,"NULL")) else if (dynstr_append(&extended_row,"NULL"))
{ {
...@@ -1486,9 +1498,9 @@ static void dumpTable(uint numFields, char *table) ...@@ -1486,9 +1498,9 @@ static void dumpTable(uint numFields, char *table)
else if (field->type == FIELD_TYPE_DECIMAL) else if (field->type == FIELD_TYPE_DECIMAL)
{ {
/* add " signs around */ /* add " signs around */
fputs("\"", md_result_file); fputc('\'', md_result_file);
fputs(ptr, md_result_file); fputs(ptr, md_result_file);
fputs("\"", md_result_file); fputc('\'', md_result_file);
} }
else else
fputs(ptr, md_result_file); fputs(ptr, md_result_file);
......
...@@ -2228,7 +2228,6 @@ if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then ...@@ -2228,7 +2228,6 @@ if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
# For NetWare, do not need readline # For NetWare, do not need readline
echo "Skipping readline" echo "Skipping readline"
else else
mkdir include/readline
if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"] if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"]
then then
...@@ -2236,7 +2235,7 @@ then ...@@ -2236,7 +2235,7 @@ then
readline_basedir="libedit" readline_basedir="libedit"
readline_dir="$readline_topdir/$readline_basedir" readline_dir="$readline_topdir/$readline_basedir"
readline_link="\$(top_builddir)/cmd-line-utils/libedit/liblibedit.a" readline_link="\$(top_builddir)/cmd-line-utils/libedit/liblibedit.a"
readline_h_ln_cmd="\$(LN) \$(top_builddir)/cmd-line-utils/libedit/readline/*.h readline/" readline_h_ln_cmd="\$(LN) -s \$(top_builddir)/cmd-line-utils/libedit/readline readline"
compile_libedit=yes compile_libedit=yes
AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE) AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE)
elif test "$with_readline" = "yes" elif test "$with_readline" = "yes"
...@@ -2245,7 +2244,7 @@ then ...@@ -2245,7 +2244,7 @@ then
readline_basedir="readline" readline_basedir="readline"
readline_dir="$readline_topdir/$readline_basedir" readline_dir="$readline_topdir/$readline_basedir"
readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a" readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a"
readline_h_ln_cmd="\$(LN) \$(top_builddir)/cmd-line-utils/readline/*.h readline/" readline_h_ln_cmd="\$(LN) -s \$(top_builddir)/cmd-line-utils/readline readline"
compile_readline=yes compile_readline=yes
AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE) AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE)
else else
......
...@@ -39,23 +39,23 @@ SUPERCLEANFILES = mysql_version.h my_config.h ...@@ -39,23 +39,23 @@ SUPERCLEANFILES = mysql_version.h my_config.h
DISTCLEANFILES = sched.h $(SUPERCLEANFILES) DISTCLEANFILES = sched.h $(SUPERCLEANFILES)
clean: clean:
$(RM) -f readline/* $(RM) -fr readline
distclean: distclean:
$(RM) -f readline/* $(RM) -fr readline
all-local: my_config.h all-local: my_config.h
# Since we include my_config.h it better exist from the beginning # Since we include my_config.h it better exist from the beginning
link_sources: link_sources:
$(CP) ../config.h my_config.h $(CP) ../config.h my_config.h
$(RM) -f readline/* -$(RM) -fr readline
@readline_h_ln_cmd@ @readline_h_ln_cmd@
# Keep automake happy # Keep automake happy
my_config.h: ../config.h my_config.h: ../config.h
$(CP) ../config.h my_config.h $(CP) ../config.h my_config.h
$(RM) -f readline/* -$(RM) -fr readline
@readline_h_ln_cmd@ @readline_h_ln_cmd@
# These files should not be included in distributions since they are # These files should not be included in distributions since they are
......
...@@ -90,7 +90,7 @@ enum my_lex_states ...@@ -90,7 +90,7 @@ enum my_lex_states
MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END, MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END,
MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL, MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL,
MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE, MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE,
MY_LEX_LONG_COMMENT, MY_LEX_END_LONG_COMMENT, MY_LEX_COLON, MY_LEX_LONG_COMMENT, MY_LEX_END_LONG_COMMENT, MY_LEX_SEMICOLON,
MY_LEX_SET_VAR, MY_LEX_USER_END, MY_LEX_HOSTNAME, MY_LEX_SKIP, MY_LEX_SET_VAR, MY_LEX_USER_END, MY_LEX_HOSTNAME, MY_LEX_SKIP,
MY_LEX_USER_VARIABLE_DELIMITER, MY_LEX_SYSTEM_VAR, MY_LEX_USER_VARIABLE_DELIMITER, MY_LEX_SYSTEM_VAR,
MY_LEX_IDENT_OR_KEYWORD, MY_LEX_IDENT_OR_KEYWORD,
......
...@@ -287,6 +287,9 @@ enum ha_base_keytype { ...@@ -287,6 +287,9 @@ enum ha_base_keytype {
#define HA_ERR_ROW_IS_REFERENCED 152 /* Cannot delete a parent row */ #define HA_ERR_ROW_IS_REFERENCED 152 /* Cannot delete a parent row */
#define HA_ERR_NO_SAVEPOINT 153 /* No savepoint with that name */ #define HA_ERR_NO_SAVEPOINT 153 /* No savepoint with that name */
#define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154 /* Non unique key block size */ #define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154 /* Non unique key block size */
#define HA_ERR_OLD_METADATA 155 /* The frm file on disk is old */
#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
/* Other constants */ /* Other constants */
......
...@@ -36,7 +36,7 @@ extern "C" { ...@@ -36,7 +36,7 @@ extern "C" {
/* defines used by myisam-funktions */ /* defines used by myisam-funktions */
/* The following defines can be increased if necessary */ /* The following defines can be increased if necessary */
#define MI_MAX_KEY 32 /* Max allowed keys */ #define MI_MAX_KEY 64 /* Max allowed keys */
#define MI_MAX_KEY_SEG 16 /* Max segments for key */ #define MI_MAX_KEY_SEG 16 /* Max segments for key */
#define MI_MAX_KEY_LENGTH 1000 #define MI_MAX_KEY_LENGTH 1000
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#undef HAVE_OPENSSL #undef HAVE_OPENSSL
#undef HAVE_ISAM #undef HAVE_ISAM
#undef HAVE_SMEM /* No shared memory */ #undef HAVE_SMEM /* No shared memory */
#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
#define DONT_USE_RAID #define DONT_USE_RAID
......
This diff is collapsed.
...@@ -120,7 +120,6 @@ static ...@@ -120,7 +120,6 @@ static
void void
btr_cur_latch_leaves( btr_cur_latch_leaves(
/*=================*/ /*=================*/
dict_tree_t* tree __attribute__((unused)), /* in: index tree */
page_t* page, /* in: leaf page where the search page_t* page, /* in: leaf page where the search
converged */ converged */
ulint space, /* in: space id */ ulint space, /* in: space id */
...@@ -133,7 +132,7 @@ btr_cur_latch_leaves( ...@@ -133,7 +132,7 @@ btr_cur_latch_leaves(
ulint right_page_no; ulint right_page_no;
page_t* get_page; page_t* get_page;
ut_ad(tree && page && mtr); ut_ad(page && mtr);
if (latch_mode == BTR_SEARCH_LEAF) { if (latch_mode == BTR_SEARCH_LEAF) {
...@@ -366,17 +365,19 @@ btr_cur_search_to_nth_level( ...@@ -366,17 +365,19 @@ btr_cur_search_to_nth_level(
B-tree. These let us end up in the right B-tree leaf. In that leaf B-tree. These let us end up in the right B-tree leaf. In that leaf
we use the original search mode. */ we use the original search mode. */
if (mode == PAGE_CUR_GE) { switch (mode) {
case PAGE_CUR_GE:
page_mode = PAGE_CUR_L; page_mode = PAGE_CUR_L;
} else if (mode == PAGE_CUR_G) { break;
case PAGE_CUR_G:
page_mode = PAGE_CUR_LE; page_mode = PAGE_CUR_LE;
} else if (mode == PAGE_CUR_LE) { break;
page_mode = PAGE_CUR_LE; default:
} else if (mode == PAGE_CUR_LE_OR_EXTENDS) { ut_ad(mode == PAGE_CUR_L
page_mode = PAGE_CUR_LE_OR_EXTENDS; || mode == PAGE_CUR_LE
} else { || mode == PAGE_CUR_LE_OR_EXTENDS);
ut_ad(mode == PAGE_CUR_L); page_mode = mode;
page_mode = PAGE_CUR_L; break;
} }
/* Loop and search until we arrive at the desired level */ /* Loop and search until we arrive at the desired level */
...@@ -451,7 +452,7 @@ retry_page_get: ...@@ -451,7 +452,7 @@ retry_page_get:
if (height == 0) { if (height == 0) {
if (rw_latch == RW_NO_LATCH) { if (rw_latch == RW_NO_LATCH) {
btr_cur_latch_leaves(tree, page, space, btr_cur_latch_leaves(page, space,
page_no, latch_mode, cursor, page_no, latch_mode, cursor,
mtr); mtr);
} }
...@@ -478,6 +479,9 @@ retry_page_get: ...@@ -478,6 +479,9 @@ retry_page_get:
/* If this is the desired level, leave the loop */ /* If this is the desired level, leave the loop */
ut_ad(height
== btr_page_get_level(page_cur_get_page(page_cursor), mtr));
if (level == height) { if (level == height) {
if (level > 0) { if (level > 0) {
...@@ -591,7 +595,7 @@ btr_cur_open_at_index_side( ...@@ -591,7 +595,7 @@ btr_cur_open_at_index_side(
} }
if (height == 0) { if (height == 0) {
btr_cur_latch_leaves(tree, page, space, page_no, btr_cur_latch_leaves(page, space, page_no,
latch_mode, cursor, mtr); latch_mode, cursor, mtr);
/* In versions <= 3.23.52 we had forgotten to /* In versions <= 3.23.52 we had forgotten to
...@@ -697,7 +701,7 @@ btr_cur_open_at_rnd_pos( ...@@ -697,7 +701,7 @@ btr_cur_open_at_rnd_pos(
} }
if (height == 0) { if (height == 0) {
btr_cur_latch_leaves(tree, page, space, page_no, btr_cur_latch_leaves(page, space, page_no,
latch_mode, cursor, mtr); latch_mode, cursor, mtr);
} }
...@@ -829,6 +833,24 @@ btr_cur_ins_lock_and_undo( ...@@ -829,6 +833,24 @@ btr_cur_ins_lock_and_undo(
return(DB_SUCCESS); return(DB_SUCCESS);
} }
/*****************************************************************
Report information about a transaction. */
static
void
btr_cur_trx_report(
/*===============*/
const trx_t* trx, /* in: transaction */
const dict_index_t* index, /* in: index */
const char* op) /* in: operation */
{
fprintf(stderr, "Trx with id %lu %lu going to ",
ut_dulint_get_high(trx->id),
ut_dulint_get_low(trx->id));
fputs(op, stderr);
dict_index_name_print(stderr, index);
putc('\n', stderr);
}
/***************************************************************** /*****************************************************************
Tries to perform an insert to a page in an index tree, next to cursor. Tries to perform an insert to a page in an index tree, next to cursor.
It is assumed that mtr holds an x-latch on the page. The operation does It is assumed that mtr holds an x-latch on the page. The operation does
...@@ -876,18 +898,13 @@ btr_cur_optimistic_insert( ...@@ -876,18 +898,13 @@ btr_cur_optimistic_insert(
index = cursor->index; index = cursor->index;
if (!dtuple_check_typed_no_assert(entry)) { if (!dtuple_check_typed_no_assert(entry)) {
fprintf(stderr, fputs("InnoDB: Error in a tuple to insert into ", stderr);
"InnoDB: Error in a tuple to insert into table %s index %s\n", dict_index_name_print(stderr, index);
index->table_name, index->name);
} }
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( btr_cur_trx_report(thr_get_trx(thr), index, "insert into ");
"Trx with id %lu %lu going to insert to table %s index %s\n", dtuple_print(stderr, entry);
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
dtuple_print(entry);
} }
ut_ad(mtr_memo_contains(mtr, buf_block_align(page), ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
...@@ -980,21 +997,15 @@ calculate_sizes_again: ...@@ -980,21 +997,15 @@ calculate_sizes_again:
*rec = page_cur_tuple_insert(page_cursor, entry, mtr); *rec = page_cur_tuple_insert(page_cursor, entry, mtr);
if (!(*rec)) { if (!*rec) {
char* err_buf = mem_alloc(1000); fputs("InnoDB: Error: cannot insert tuple ", stderr);
dtuple_print(stderr, entry);
dtuple_sprintf(err_buf, 900, entry); fputs(" into ", stderr);
dict_index_name_print(stderr, index);
fprintf(stderr, fprintf(stderr, "\nInnoDB: max insert size %lu\n",
"InnoDB: Error: cannot insert tuple %s to index %s of table %s\n" (ulong) max_size);
"InnoDB: max insert size %lu\n", ut_error;
err_buf, index->name, index->table->name,
(unsigned long) max_size);
mem_free(err_buf);
} }
ut_a(*rec); /* <- We calculated above the record would fit */
} }
#ifdef BTR_CUR_HASH_ADAPT #ifdef BTR_CUR_HASH_ADAPT
...@@ -1010,7 +1021,8 @@ calculate_sizes_again: ...@@ -1010,7 +1021,8 @@ calculate_sizes_again:
lock_update_insert(*rec); lock_update_insert(*rec);
} }
/* printf("Insert to page %lu, max ins size %lu, rec %lu ind type %lu\n", /* fprintf(stderr, "Insert into page %lu, max ins size %lu,"
" 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);
*/ */
...@@ -1363,12 +1375,8 @@ btr_cur_update_in_place( ...@@ -1363,12 +1375,8 @@ btr_cur_update_in_place(
trx = thr_get_trx(thr); trx = thr_get_trx(thr);
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( btr_cur_trx_report(trx, index, "update ");
"Trx with id %lu %lu going to update table %s index %s\n", rec_print(stderr, rec);
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
} }
/* Do lock checking and undo logging */ /* Do lock checking and undo logging */
...@@ -1467,12 +1475,8 @@ btr_cur_optimistic_update( ...@@ -1467,12 +1475,8 @@ btr_cur_optimistic_update(
index = cursor->index; index = cursor->index;
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( btr_cur_trx_report(thr_get_trx(thr), index, "update ");
"Trx with id %lu %lu going to update table %s index %s\n", rec_print(stderr, rec);
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
} }
ut_ad(mtr_memo_contains(mtr, buf_block_align(page), ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
...@@ -2016,12 +2020,8 @@ btr_cur_del_mark_set_clust_rec( ...@@ -2016,12 +2020,8 @@ btr_cur_del_mark_set_clust_rec(
index = cursor->index; index = cursor->index;
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( btr_cur_trx_report(thr_get_trx(thr), index, "del mark ");
"Trx with id %lu %lu going to del mark table %s index %s\n", rec_print(stderr, rec);
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
} }
ut_ad(index->type & DICT_CLUSTERED); ut_ad(index->type & DICT_CLUSTERED);
...@@ -2156,12 +2156,9 @@ btr_cur_del_mark_set_sec_rec( ...@@ -2156,12 +2156,9 @@ btr_cur_del_mark_set_sec_rec(
rec = btr_cur_get_rec(cursor); rec = btr_cur_get_rec(cursor);
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( btr_cur_trx_report(thr_get_trx(thr), cursor->index,
"Trx with id %lu %lu going to del mark table %s index %s\n", "del mark ");
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id), rec_print(stderr, rec);
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
cursor->index->table_name, cursor->index->name);
rec_print(rec);
} }
err = lock_sec_rec_modify_check_and_lock(flags, rec, cursor->index, err = lock_sec_rec_modify_check_and_lock(flags, rec, cursor->index,
......
...@@ -803,7 +803,7 @@ btr_search_guess_on_hash( ...@@ -803,7 +803,7 @@ btr_search_guess_on_hash(
success = FALSE; success = FALSE;
/* /*
printf("Tree id %lu, page index id %lu fold %lu\n", fprintf(stderr, "Tree id %lu, page index id %lu fold %lu\n",
ut_dulint_get_low(tree_id), ut_dulint_get_low(tree_id),
ut_dulint_get_low(btr_page_get_index_id(page)), ut_dulint_get_low(btr_page_get_index_id(page)),
fold); fold);
...@@ -1517,8 +1517,9 @@ check_next_rec: ...@@ -1517,8 +1517,9 @@ check_next_rec:
ha_insert_for_fold(table, ins_fold, ins_rec); ha_insert_for_fold(table, ins_fold, ins_rec);
/* /*
printf("Hash insert for %s, fold %lu\n", fputs("Hash insert for ", stderr);
cursor->index->name, ins_fold); dict_index_name_print(stderr, cursor->index);
fprintf(stderr, " fold %lu\n", ins_fold);
*/ */
} else { } else {
ha_insert_for_fold(table, next_fold, next_rec); ha_insert_for_fold(table, next_fold, next_rec);
...@@ -1545,7 +1546,6 @@ btr_search_validate(void) ...@@ -1545,7 +1546,6 @@ btr_search_validate(void)
ulint n_page_dumps = 0; ulint n_page_dumps = 0;
ibool ok = TRUE; ibool ok = TRUE;
ulint i; ulint i;
char rec_str[500];
rw_lock_x_lock(&btr_search_latch); rw_lock_x_lock(&btr_search_latch);
...@@ -1566,29 +1566,25 @@ btr_search_validate(void) ...@@ -1566,29 +1566,25 @@ btr_search_validate(void)
fprintf(stderr, fprintf(stderr,
" InnoDB: Error in an adaptive hash index pointer to page %lu\n" " InnoDB: Error in an adaptive hash index pointer to page %lu\n"
"ptr mem address %lu index id %lu %lu, node fold %lu, rec fold %lu\n", "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),
(ulong)(node->data), node->data,
(ulong) ut_dulint_get_high(btr_page_get_index_id(page)), (ulong) ut_dulint_get_high(btr_page_get_index_id(page)),
(ulong) ut_dulint_get_low(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),
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)));
rec_sprintf(rec_str, 450, (rec_t*)(node->data)); fputs("InnoDB: Record ", stderr);
rec_print(stderr, (rec_t*)(node->data));
fprintf(stderr, fprintf(stderr, "\nInnoDB: on that page."
"InnoDB: Record %s\n" "Page mem address %p, is hashed %lu, n fields %lu, n bytes %lu\n"
"InnoDB: on that page.", rec_str);
fprintf(stderr,
"Page mem address %lu, is hashed %lu, n fields %lu, n bytes %lu\n"
"side %lu\n", "side %lu\n",
(ulong) page, (ulong) block->is_hashed, 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);
......
This diff is collapsed.
...@@ -32,6 +32,7 @@ flushed along with the original page. */ ...@@ -32,6 +32,7 @@ flushed along with the original page. */
#define BUF_FLUSH_AREA ut_min(BUF_READ_AHEAD_AREA,\ #define BUF_FLUSH_AREA ut_min(BUF_READ_AHEAD_AREA,\
buf_pool->curr_size / 16) buf_pool->curr_size / 16)
#ifdef UNIV_DEBUG
/********************************************************************** /**********************************************************************
Validates the flush list. */ Validates the flush list. */
static static
...@@ -39,6 +40,7 @@ ibool ...@@ -39,6 +40,7 @@ ibool
buf_flush_validate_low(void); buf_flush_validate_low(void);
/*========================*/ /*========================*/
/* out: TRUE if ok */ /* out: TRUE if ok */
#endif /* UNIV_DEBUG */
/************************************************************************ /************************************************************************
Inserts a modified block into the flush list. */ Inserts a modified block into the flush list. */
...@@ -193,7 +195,7 @@ buf_flush_write_complete( ...@@ -193,7 +195,7 @@ buf_flush_write_complete(
buf_pool->LRU_flush_ended++; buf_pool->LRU_flush_ended++;
} }
/* printf("n pending flush %lu\n", /* fprintf(stderr, "n pending flush %lu\n",
buf_pool->n_flush[block->flush_type]); */ buf_pool->n_flush[block->flush_type]); */
if ((buf_pool->n_flush[block->flush_type] == 0) if ((buf_pool->n_flush[block->flush_type] == 0)
...@@ -420,8 +422,8 @@ buf_flush_write_block_low( ...@@ -420,8 +422,8 @@ buf_flush_write_block_low(
ut_ad(!ut_dulint_is_zero(block->newest_modification)); ut_ad(!ut_dulint_is_zero(block->newest_modification));
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
printf( fputs("Warning: cannot force log to disk in the log debug version!\n",
"Warning: cannot force log to disk in the log debug version!\n"); stderr);
#else #else
/* Force the log to the disk before writing the modified block */ /* Force the log to the disk before writing the modified block */
log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE); log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE);
...@@ -511,11 +513,13 @@ buf_flush_try_page( ...@@ -511,11 +513,13 @@ buf_flush_try_page(
rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE); rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE);
} }
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
printf("Flushing page space %lu, page no %lu \n", fprintf(stderr,
(ulong) block->space, "Flushing page space %lu, page no %lu \n",
(ulong) block->offset); (ulong) block->space, (ulong) block->offset);
} }
#endif /* UNIV_DEBUG */
buf_flush_write_block_low(block); buf_flush_write_block_low(block);
...@@ -599,12 +603,14 @@ buf_flush_try_page( ...@@ -599,12 +603,14 @@ buf_flush_try_page(
rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE); rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE);
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
printf( 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);
} }
#endif /* UNIV_DEBUG */
buf_flush_write_block_low(block); buf_flush_write_block_low(block);
...@@ -645,7 +651,7 @@ buf_flush_try_neighbors( ...@@ -645,7 +651,7 @@ buf_flush_try_neighbors(
high = offset + 1; high = offset + 1;
} }
/* printf("Flush area: low %lu high %lu\n", low, high); */ /* fprintf(stderr, "Flush area: low %lu high %lu\n", low, high); */
if (high > fil_space_get_size(space)) { if (high > fil_space_get_size(space)) {
high = fil_space_get_size(space); high = fil_space_get_size(space);
...@@ -793,7 +799,7 @@ buf_flush_batch( ...@@ -793,7 +799,7 @@ buf_flush_batch(
page_count += page_count +=
buf_flush_try_neighbors(space, offset, buf_flush_try_neighbors(space, offset,
flush_type); flush_type);
/* printf( /* 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,
page_count - old_page_count); */ page_count - old_page_count); */
...@@ -831,17 +837,16 @@ buf_flush_batch( ...@@ -831,17 +837,16 @@ buf_flush_batch(
buf_flush_buffered_writes(); buf_flush_buffered_writes();
#ifdef UNIV_DEBUG
if (buf_debug_prints && page_count > 0) { if (buf_debug_prints && page_count > 0) {
if (flush_type == BUF_FLUSH_LRU) { ut_a(flush_type == BUF_FLUSH_LRU
printf("Flushed %lu pages in LRU flush\n", || flush_type == BUF_FLUSH_LIST);
(ulong) page_count); fprintf(stderr, flush_type == BUF_FLUSH_LRU
} else if (flush_type == BUF_FLUSH_LIST) { ? "Flushed %lu pages in LRU flush\n"
printf("Flushed %lu pages in flush list flush\n", : "Flushed %lu pages in flush list flush\n",
(ulong) page_count); (ulong) page_count);
} else {
ut_error;
}
} }
#endif /* UNIV_DEBUG */
return(page_count); return(page_count);
} }
...@@ -933,6 +938,7 @@ buf_flush_free_margin(void) ...@@ -933,6 +938,7 @@ buf_flush_free_margin(void)
} }
} }
#ifdef UNIV_DEBUG
/********************************************************************** /**********************************************************************
Validates the flush list. */ Validates the flush list. */
static static
...@@ -982,3 +988,4 @@ buf_flush_validate(void) ...@@ -982,3 +988,4 @@ buf_flush_validate(void)
return(ret); return(ret);
} }
#endif /* UNIV_DEBUG */
...@@ -97,13 +97,14 @@ scan_again: ...@@ -97,13 +97,14 @@ scan_again:
} }
if (block->space == id) { if (block->space == id) {
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
printf( printf(
"Dropping space %lu page %lu\n", "Dropping space %lu page %lu\n",
(ulong) block->space, (ulong) block->space,
(ulong) block->offset); (ulong) block->offset);
} }
#endif
if (block->is_hashed) { if (block->is_hashed) {
page_no = block->offset; page_no = block->offset;
...@@ -207,12 +208,16 @@ buf_LRU_search_and_free_block( ...@@ -207,12 +208,16 @@ buf_LRU_search_and_free_block(
while (block != NULL) { while (block != NULL) {
ut_a(block->in_LRU_list); ut_a(block->in_LRU_list);
if (buf_flush_ready_for_replace(block)) { if (buf_flush_ready_for_replace(block)) {
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
printf( 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);
} }
#endif /* UNIV_DEBUG */
buf_LRU_block_remove_hashed_page(block); buf_LRU_block_remove_hashed_page(block);
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
...@@ -404,28 +409,21 @@ loop: ...@@ -404,28 +409,21 @@ loop:
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"
(ulong) n_iterations);
fprintf(stderr,
"InnoDB: It is also possible that in your Unix version\n" "InnoDB: It is also possible that in your Unix version\n"
"InnoDB: fsync is very slow, or completely frozen inside\n" "InnoDB: fsync is very slow, or completely frozen inside\n"
"InnoDB: the OS kernel. Then upgrading to a newer version\n" "InnoDB: the OS kernel. Then upgrading to a newer version\n"
"InnoDB: of your operating system may help. Look at the\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"
fprintf(stderr, "InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n"
"InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n",
(ulong) fil_n_pending_log_flushes,
(ulong) fil_n_pending_tablespace_flushes);
fprintf(stderr,
"InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n",
(ulong) os_n_file_reads,
(ulong) os_n_file_writes,
(ulong) os_n_fsyncs);
fprintf(stderr,
"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) fil_n_pending_log_flushes,
(ulong) fil_n_pending_tablespace_flushes,
(ulong) os_n_file_reads, (ulong) os_n_file_writes,
(ulong) os_n_fsyncs);
mon_value_was = srv_print_innodb_monitor; mon_value_was = srv_print_innodb_monitor;
started_monitor = TRUE; started_monitor = TRUE;
...@@ -855,11 +853,12 @@ buf_LRU_block_remove_hashed_page( ...@@ -855,11 +853,12 @@ buf_LRU_block_remove_hashed_page(
(ulong) block); (ulong) block);
} }
#ifdef UNIV_DEBUG
buf_print(); buf_print();
buf_LRU_print(); buf_LRU_print();
buf_validate(); buf_validate();
buf_LRU_validate(); buf_LRU_validate();
#endif
ut_a(0); ut_a(0);
} }
...@@ -889,6 +888,7 @@ buf_LRU_block_free_hashed_page( ...@@ -889,6 +888,7 @@ buf_LRU_block_free_hashed_page(
buf_LRU_block_free_non_file_page(block); buf_LRU_block_free_non_file_page(block);
} }
#ifdef UNIV_DEBUG
/************************************************************************** /**************************************************************************
Validates the LRU list. */ Validates the LRU list. */
...@@ -975,7 +975,7 @@ buf_LRU_print(void) ...@@ -975,7 +975,7 @@ buf_LRU_print(void)
ut_ad(buf_pool); ut_ad(buf_pool);
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
printf("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);
...@@ -983,39 +983,40 @@ buf_LRU_print(void) ...@@ -983,39 +983,40 @@ buf_LRU_print(void)
while (block != NULL) { while (block != NULL) {
printf("BLOCK %lu ", (ulong) block->offset); fprintf(stderr, "BLOCK %lu ", (ulong) block->offset);
if (block->old) { if (block->old) {
printf("old "); fputs("old ", stderr);
} }
if (block->buf_fix_count) { if (block->buf_fix_count) {
printf("buffix count %lu ", (ulong) block->buf_fix_count); fprintf(stderr, "buffix count %lu ",
(ulong) block->buf_fix_count);
} }
if (block->io_fix) { if (block->io_fix) {
printf("io_fix %lu ", (ulong) block->io_fix); fprintf(stderr, "io_fix %lu ", (ulong) block->io_fix);
} }
if (ut_dulint_cmp(block->oldest_modification, if (ut_dulint_cmp(block->oldest_modification,
ut_dulint_zero) > 0) { ut_dulint_zero) > 0) {
printf("modif. "); fputs("modif. ", stderr);
} }
printf("LRU pos %lu ", (ulong) block->LRU_position);
frame = buf_block_get_frame(block); frame = buf_block_get_frame(block);
printf("type %lu ", (ulong) fil_page_get_type(frame)); fprintf(stderr, "LRU pos %lu type %lu index id %lu ",
printf("index id %lu ", (ulong) ut_dulint_get_low( (ulong) block->LRU_position,
btr_page_get_index_id(frame))); (ulong) fil_page_get_type(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);
len++; if (++len == 10) {
if (len % 10 == 0) { len = 0;
printf("\n"); putc('\n', stderr);
} }
} }
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
} }
#endif /* UNIV_DEBUG */
...@@ -97,7 +97,8 @@ buf_read_page_low( ...@@ -97,7 +97,8 @@ buf_read_page_low(
log mutex: the read must be handled before other reads log mutex: the read must be handled before other reads
which might incur ibuf operations and thus write to the log */ which might incur ibuf operations and thus write to the log */
printf("Log debug: reading replicate page in sync mode\n"); fputs("Log debug: reading replicate page in sync mode\n",
stderr);
sync = TRUE; sync = TRUE;
} }
...@@ -117,7 +118,6 @@ buf_read_page_low( ...@@ -117,7 +118,6 @@ buf_read_page_low(
or is being dropped; if we succeed in initing the page in the buffer or is being dropped; if we succeed in initing the page in the buffer
pool for read, then DISCARD cannot proceed until the read has pool for read, then DISCARD cannot proceed until the read has
completed */ completed */
block = buf_page_init_for_read(err, mode, space, tablespace_version, block = buf_page_init_for_read(err, mode, space, tablespace_version,
offset); offset);
if (block == NULL) { if (block == NULL) {
...@@ -125,11 +125,14 @@ buf_read_page_low( ...@@ -125,11 +125,14 @@ buf_read_page_low(
return(0); return(0);
} }
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
printf("Posting read request for page %lu, sync %lu\n", fprintf(stderr,
"Posting read request for page %lu, sync %lu\n",
(ulong) offset, (ulong) offset,
(ulong) sync); (ulong) sync);
} }
#endif
ut_a(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
...@@ -281,12 +284,14 @@ buf_read_ahead_random( ...@@ -281,12 +284,14 @@ buf_read_ahead_random(
os_aio_simulated_wake_handler_threads(); os_aio_simulated_wake_handler_threads();
#ifdef UNIV_DEBUG
if (buf_debug_prints && (count > 0)) { if (buf_debug_prints && (count > 0)) {
fprintf(stderr,
printf("Random read-ahead space %lu offset %lu pages %lu\n", "Random read-ahead space %lu offset %lu pages %lu\n",
(ulong) space, (ulong) offset, (ulong) space, (ulong) offset,
(ulong) count); (ulong) count);
} }
#endif /* UNIV_DEBUG */
return(count); return(count);
} }
...@@ -566,11 +571,13 @@ buf_read_ahead_linear( ...@@ -566,11 +571,13 @@ buf_read_ahead_linear(
/* Flush pages from the end of the LRU list if necessary */ /* Flush pages from the end of the LRU list if necessary */
buf_flush_free_margin(); buf_flush_free_margin();
#ifdef UNIV_DEBUG
if (buf_debug_prints && (count > 0)) { if (buf_debug_prints && (count > 0)) {
printf( fprintf(stderr,
"LINEAR read-ahead space %lu offset %lu pages %lu\n", "LINEAR read-ahead space %lu offset %lu pages %lu\n",
(ulong) space, (ulong) offset, (ulong) count); (ulong) space, (ulong) offset, (ulong) count);
} }
#endif /* UNIV_DEBUG */
return(count); return(count);
} }
...@@ -629,9 +636,13 @@ buf_read_ibuf_merge_pages( ...@@ -629,9 +636,13 @@ buf_read_ibuf_merge_pages(
/* Flush pages from the end of the LRU list if necessary */ /* Flush pages from the end of the LRU list if necessary */
buf_flush_free_margin(); buf_flush_free_margin();
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
printf("Ibuf merge read-ahead pages %lu\n", (ulong) n_stored); fprintf(stderr,
"Ibuf merge read-ahead space %lu pages %lu\n",
(ulong) space, (ulong) n_stored);
} }
#endif /* UNIV_DEBUG */
} }
/************************************************************************ /************************************************************************
...@@ -695,8 +706,10 @@ buf_read_recv_pages( ...@@ -695,8 +706,10 @@ buf_read_recv_pages(
/* Flush pages from the end of the LRU list if necessary */ /* Flush pages from the end of the LRU list if necessary */
buf_flush_free_margin(); buf_flush_free_margin();
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
printf("Recovery applies read-ahead pages %lu\n", fprintf(stderr,
(ulong) n_stored); "Recovery applies read-ahead pages %lu\n", (ulong) n_stored);
} }
#endif /* UNIV_DEBUG */
} }
...@@ -12,7 +12,6 @@ Created 5/30/1994 Heikki Tuuri ...@@ -12,7 +12,6 @@ Created 5/30/1994 Heikki Tuuri
#include "data0data.ic" #include "data0data.ic"
#endif #endif
#include "ut0rnd.h"
#include "rem0rec.h" #include "rem0rec.h"
#include "rem0cmp.h" #include "rem0cmp.h"
#include "page0page.h" #include "page0page.h"
...@@ -22,12 +21,10 @@ Created 5/30/1994 Heikki Tuuri ...@@ -22,12 +21,10 @@ Created 5/30/1994 Heikki Tuuri
byte data_error; /* data pointers of tuple fields are initialized byte data_error; /* data pointers of tuple fields are initialized
to point here for error checking */ to point here for error checking */
#ifdef UNIV_DEBUG
ulint data_dummy; /* this is used to fool the compiler in ulint data_dummy; /* this is used to fool the compiler in
dtuple_validate */ dtuple_validate */
#endif /* UNIV_DEBUG */
byte data_buf[8192]; /* used in generating test tuples */
ulint data_rnd = 756511;
/* Some non-inlined functions used in the MySQL interface: */ /* Some non-inlined functions used in the MySQL interface: */
void void
...@@ -215,16 +212,15 @@ dtuple_check_typed_no_assert( ...@@ -215,16 +212,15 @@ dtuple_check_typed_no_assert(
{ {
dfield_t* field; dfield_t* field;
ulint i; ulint i;
char err_buf[1000];
if (dtuple_get_n_fields(tuple) > REC_MAX_N_FIELDS) { if (dtuple_get_n_fields(tuple) > REC_MAX_N_FIELDS) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: index entry has %lu fields\n", "InnoDB: Error: index entry has %lu fields\n",
(ulong) dtuple_get_n_fields(tuple)); (ulong) dtuple_get_n_fields(tuple));
dump:
dtuple_sprintf(err_buf, 900, tuple); fputs("InnoDB: Tuple contents: ", stderr);
fprintf(stderr, dtuple_print(stderr, tuple);
"InnoDB: Tuple contents: %s\n", err_buf); putc('\n', stderr);
return(FALSE); return(FALSE);
} }
...@@ -234,12 +230,7 @@ dtuple_check_typed_no_assert( ...@@ -234,12 +230,7 @@ dtuple_check_typed_no_assert(
field = dtuple_get_nth_field(tuple, i); field = dtuple_get_nth_field(tuple, i);
if (!dfield_check_typed_no_assert(field)) { if (!dfield_check_typed_no_assert(field)) {
goto dump;
dtuple_sprintf(err_buf, 900, tuple);
fprintf(stderr,
"InnoDB: Tuple contents: %s\n", err_buf);
return(FALSE);
} }
} }
...@@ -291,6 +282,7 @@ dtuple_check_typed( ...@@ -291,6 +282,7 @@ dtuple_check_typed(
return(TRUE); return(TRUE);
} }
#ifdef UNIV_DEBUG
/************************************************************** /**************************************************************
Validates the consistency of a tuple which must be complete, i.e, Validates the consistency of a tuple which must be complete, i.e,
all fields must have been set. */ all fields must have been set. */
...@@ -338,6 +330,7 @@ dtuple_validate( ...@@ -338,6 +330,7 @@ dtuple_validate(
return(TRUE); return(TRUE);
} }
#endif /* UNIV_DEBUG */
/***************************************************************** /*****************************************************************
Pretty prints a dfield value according to its data type. */ Pretty prints a dfield value according to its data type. */
...@@ -356,7 +349,7 @@ dfield_print( ...@@ -356,7 +349,7 @@ dfield_print(
data = dfield_get_data(dfield); data = dfield_get_data(dfield);
if (len == UNIV_SQL_NULL) { if (len == UNIV_SQL_NULL) {
printf("NULL"); fputs("NULL", stderr);
return; return;
} }
...@@ -366,18 +359,12 @@ dfield_print( ...@@ -366,18 +359,12 @@ dfield_print(
if ((mtype == DATA_CHAR) || (mtype == DATA_VARCHAR)) { if ((mtype == DATA_CHAR) || (mtype == DATA_VARCHAR)) {
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
int c = *data++;
if (isprint((char)(*data))) { putc(isprint(c) ? c : ' ', stderr);
printf("%c", (char)*data);
} else {
printf(" ");
}
data++;
} }
} else if (mtype == DATA_INT) { } else if (mtype == DATA_INT) {
ut_a(len == 4); /* only works for 32-bit integers */ ut_a(len == 4); /* only works for 32-bit integers */
printf("%i", (int)mach_read_from_4(data)); fprintf(stderr, "%d", (int)mach_read_from_4(data));
} else { } else {
ut_error; ut_error;
} }
...@@ -402,7 +389,7 @@ dfield_print_also_hex( ...@@ -402,7 +389,7 @@ dfield_print_also_hex(
data = dfield_get_data(dfield); data = dfield_get_data(dfield);
if (len == UNIV_SQL_NULL) { if (len == UNIV_SQL_NULL) {
printf("NULL"); fputs("NULL", stderr);
return; return;
} }
...@@ -414,15 +401,12 @@ dfield_print_also_hex( ...@@ -414,15 +401,12 @@ dfield_print_also_hex(
print_also_hex = FALSE; print_also_hex = FALSE;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
int c = *data++;
if (isprint((char)(*data))) { if (!isprint(c)) {
printf("%c", (char)*data);
} else {
print_also_hex = TRUE; print_also_hex = TRUE;
printf(" "); c = ' ';
} }
putc(c, stderr);
data++;
} }
if (!print_also_hex) { if (!print_also_hex) {
...@@ -430,18 +414,18 @@ dfield_print_also_hex( ...@@ -430,18 +414,18 @@ dfield_print_also_hex(
return; return;
} }
printf(" Hex: "); fputs(" Hex: ", stderr);
data = dfield_get_data(dfield); data = dfield_get_data(dfield);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
printf("%02lx", (ulong)*data); fprintf(stderr, "%02lx", (ulint)*data);
data++; data++;
} }
} else if (mtype == DATA_INT) { } else if (mtype == DATA_INT) {
ut_a(len == 4); /* inly works for 32-bit integers */ ut_a(len == 4); /* only works for 32-bit integers */
printf("%i", (int)mach_read_from_4(data)); fprintf(stderr, "%d", (int)mach_read_from_4(data));
} else { } else {
ut_error; ut_error;
} }
...@@ -453,6 +437,7 @@ The following function prints the contents of a tuple. */ ...@@ -453,6 +437,7 @@ The following function prints the contents of a tuple. */
void void
dtuple_print( dtuple_print(
/*=========*/ /*=========*/
FILE* f, /* in: output stream */
dtuple_t* tuple) /* in: tuple */ dtuple_t* tuple) /* in: tuple */
{ {
dfield_t* field; dfield_t* field;
...@@ -461,73 +446,24 @@ dtuple_print( ...@@ -461,73 +446,24 @@ dtuple_print(
n_fields = dtuple_get_n_fields(tuple); n_fields = dtuple_get_n_fields(tuple);
printf("DATA TUPLE: %lu fields;\n", (ulong) n_fields); fprintf(f, "DATA TUPLE: %lu fields;\n", (ulong) n_fields);
for (i = 0; i < n_fields; i++) {
printf(" %lu:", (ulong) i);
field = dtuple_get_nth_field(tuple, i);
if (field->len != UNIV_SQL_NULL) {
ut_print_buf(field->data, field->len);
} else {
printf(" SQL NULL");
}
printf(";");
}
printf("\n");
dtuple_validate(tuple);
}
/**************************************************************
The following function prints the contents of a tuple to a buffer. */
ulint
dtuple_sprintf(
/*===========*/
/* out: printed length in bytes */
char* buf, /* in: print buffer */
ulint buf_len,/* in: buf length in bytes */
dtuple_t* tuple) /* in: tuple */
{
dfield_t* field;
ulint n_fields;
ulint len;
ulint i;
len = 0;
n_fields = dtuple_get_n_fields(tuple);
for (i = 0; i < n_fields; i++) { for (i = 0; i < n_fields; i++) {
if (len + 30 > buf_len) { fprintf(f, " %lu:", (ulong) i);
return(len);
}
len += sprintf(buf + len, " %lu:", (ulong) i);
field = dtuple_get_nth_field(tuple, i); field = dtuple_get_nth_field(tuple, i);
if (field->len != UNIV_SQL_NULL) { if (field->len != UNIV_SQL_NULL) {
if (5 * field->len + len + 30 > buf_len) { ut_print_buf(f, field->data, field->len);
return(len);
}
len += ut_sprintf_buf(buf + len, field->data,
field->len);
} else { } else {
len += sprintf(buf + len, " SQL NULL"); fputs(" SQL NULL", f);
} }
len += sprintf(buf + len, ";"); putc(';', f);
} }
return(len); putc('\n', f);
ut_ad(dtuple_validate(tuple));
} }
/****************************************************************** /******************************************************************
...@@ -561,7 +497,6 @@ dtuple_convert_big_rec( ...@@ -561,7 +497,6 @@ dtuple_convert_big_rec(
ibool is_externally_stored; ibool is_externally_stored;
ulint i; ulint i;
ulint j; ulint j;
char err_buf[1000];
ut_a(dtuple_check_typed_no_assert(entry)); ut_a(dtuple_check_typed_no_assert(entry));
...@@ -570,10 +505,9 @@ dtuple_convert_big_rec( ...@@ -570,10 +505,9 @@ dtuple_convert_big_rec(
if (size > 1000000000) { if (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);
dtuple_sprintf(err_buf, 900, entry); dtuple_print(stderr, entry);
fprintf(stderr, putc('\n', stderr);
"InnoDB: Tuple contents: %s\n", err_buf);
} }
heap = mem_heap_create(size + dtuple_get_n_fields(entry) heap = mem_heap_create(size + dtuple_get_n_fields(entry)
......
...@@ -104,6 +104,7 @@ dtype_form_prtype( ...@@ -104,6 +104,7 @@ dtype_form_prtype(
return(old_prtype + (charset_coll << 16)); return(old_prtype + (charset_coll << 16));
} }
#ifdef UNIV_DEBUG
/************************************************************************* /*************************************************************************
Validates a data type structure. */ Validates a data type structure. */
...@@ -122,6 +123,7 @@ dtype_validate( ...@@ -122,6 +123,7 @@ dtype_validate(
return(TRUE); return(TRUE);
} }
#endif /* UNIV_DEBUG */
/************************************************************************* /*************************************************************************
Prints a data type structure. */ Prints a data type structure. */
...@@ -140,19 +142,19 @@ dtype_print( ...@@ -140,19 +142,19 @@ dtype_print(
mtype = type->mtype; mtype = type->mtype;
prtype = type->prtype; prtype = type->prtype;
if (mtype == DATA_VARCHAR) { if (mtype == DATA_VARCHAR) {
printf("DATA_VARCHAR"); fputs("DATA_VARCHAR", stderr);
} else if (mtype == DATA_CHAR) { } else if (mtype == DATA_CHAR) {
printf("DATA_CHAR"); fputs("DATA_CHAR", stderr);
} else if (mtype == DATA_BINARY) { } else if (mtype == DATA_BINARY) {
printf("DATA_BINARY"); fputs("DATA_BINARY", stderr);
} else if (mtype == DATA_INT) { } else if (mtype == DATA_INT) {
printf("DATA_INT"); fputs("DATA_INT", stderr);
} else if (mtype == DATA_MYSQL) { } else if (mtype == DATA_MYSQL) {
printf("DATA_MYSQL"); fputs("DATA_MYSQL", stderr);
} else if (mtype == DATA_SYS) { } else if (mtype == DATA_SYS) {
printf("DATA_SYS"); fputs("DATA_SYS", stderr);
} else { } else {
printf("type %lu", (ulong) mtype); fprintf(stderr, "type %lu", (ulong) mtype);
} }
len = type->len; len = type->len;
...@@ -160,24 +162,24 @@ dtype_print( ...@@ -160,24 +162,24 @@ dtype_print(
if ((type->mtype == DATA_SYS) if ((type->mtype == DATA_SYS)
|| (type->mtype == DATA_VARCHAR) || (type->mtype == DATA_VARCHAR)
|| (type->mtype == DATA_CHAR)) { || (type->mtype == DATA_CHAR)) {
printf(" "); putc(' ', stderr);
if (prtype == DATA_ROW_ID) { if (prtype == DATA_ROW_ID) {
printf("DATA_ROW_ID"); fputs("DATA_ROW_ID", stderr);
len = DATA_ROW_ID_LEN; len = DATA_ROW_ID_LEN;
} else if (prtype == DATA_ROLL_PTR) { } else if (prtype == DATA_ROLL_PTR) {
printf("DATA_ROLL_PTR"); fputs("DATA_ROLL_PTR", stderr);
len = DATA_ROLL_PTR_LEN; len = DATA_ROLL_PTR_LEN;
} else if (prtype == DATA_TRX_ID) { } else if (prtype == DATA_TRX_ID) {
printf("DATA_TRX_ID"); fputs("DATA_TRX_ID", stderr);
len = DATA_TRX_ID_LEN; len = DATA_TRX_ID_LEN;
} else if (prtype == DATA_MIX_ID) { } else if (prtype == DATA_MIX_ID) {
printf("DATA_MIX_ID"); fputs("DATA_MIX_ID", stderr);
} else if (prtype == DATA_ENGLISH) { } else if (prtype == DATA_ENGLISH) {
printf("DATA_ENGLISH"); fputs("DATA_ENGLISH", stderr);
} else { } else {
printf("prtype %lu", (ulong) mtype); fprintf(stderr, "prtype %lu", (ulong) mtype);
} }
} }
printf(" len %lu prec %lu", (ulong) len, (ulong) type->prec); fprintf(stderr, " len %lu prec %lu", (ulong) len, (ulong) type->prec);
} }
...@@ -71,7 +71,8 @@ dict_hdr_get_new_id( ...@@ -71,7 +71,8 @@ dict_hdr_get_new_id(
compile wrong */ compile wrong */
if (0 == ut_dulint_cmp(id, ut_dulint_max)) { if (0 == ut_dulint_cmp(id, ut_dulint_max)) {
printf("Max id\n"); /* TO DO: remove this code, or make it conditional */
ut_dbg_null_ptr = 0;
} }
id = ut_dulint_add(id, 1); id = ut_dulint_add(id, 1);
......
This diff is collapsed.
This diff is collapsed.
...@@ -40,7 +40,6 @@ dict_get_first_table_name_in_db( ...@@ -40,7 +40,6 @@ dict_get_first_table_name_in_db(
rec_t* rec; rec_t* rec;
byte* field; byte* field;
ulint len; ulint len;
char* table_name;
mtr_t mtr; mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -92,9 +91,7 @@ loop: ...@@ -92,9 +91,7 @@ loop:
/* We found one */ /* We found one */
table_name = mem_alloc(len + 1); char* table_name = mem_strdupl(field, len);
ut_memcpy(table_name, field, len);
table_name[len] = '\0';
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -124,7 +121,6 @@ dict_print(void) ...@@ -124,7 +121,6 @@ dict_print(void)
byte* field; byte* field;
ulint len; ulint len;
mtr_t mtr; mtr_t mtr;
char table_name[10000];
mutex_enter(&(dict_sys->mutex)); mutex_enter(&(dict_sys->mutex));
...@@ -157,18 +153,19 @@ loop: ...@@ -157,18 +153,19 @@ loop:
/* We found one */ /* We found one */
ut_memcpy(table_name, field, len); char* table_name = mem_strdupl(field, len);
table_name[len] = '\0';
btr_pcur_store_position(&pcur, &mtr); btr_pcur_store_position(&pcur, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
table = dict_table_get_low(table_name); table = dict_table_get_low(table_name);
mem_free(table_name);
if (table == NULL) { if (table == NULL) {
fprintf(stderr, "InnoDB: Failed to load table %s\n", fputs("InnoDB: Failed to load table ", stderr);
table_name); ut_print_namel(stderr, field, len);
putc('\n', stderr);
} else { } else {
/* The table definition was corrupt if there /* The table definition was corrupt if there
is no index */ is no index */
...@@ -300,7 +297,6 @@ dict_load_columns( ...@@ -300,7 +297,6 @@ dict_load_columns(
byte* field; byte* field;
ulint len; ulint len;
byte* buf; byte* buf;
char* name_buf;
char* name; char* name;
ulint mtype; ulint mtype;
ulint prtype; ulint prtype;
...@@ -351,12 +347,7 @@ dict_load_columns( ...@@ -351,12 +347,7 @@ dict_load_columns(
dict_table_get_first_index(sys_columns), 4))->name)); dict_table_get_first_index(sys_columns), 4))->name));
field = rec_get_nth_field(rec, 4, &len); field = rec_get_nth_field(rec, 4, &len);
name = mem_heap_strdupl(heap, field, len);
name_buf = mem_heap_alloc(heap, len + 1);
ut_memcpy(name_buf, field, len);
name_buf[len] = '\0';
name = name_buf;
field = rec_get_nth_field(rec, 5, &len); field = rec_get_nth_field(rec, 5, &len);
mtype = mach_read_from_4(field); mtype = mach_read_from_4(field);
...@@ -393,6 +384,27 @@ dict_load_columns( ...@@ -393,6 +384,27 @@ dict_load_columns(
mtr_commit(&mtr); mtr_commit(&mtr);
} }
/************************************************************************
Report that an index field or index for a table has been delete marked. */
static
void
dict_load_report_deleted_index(
char* name, /* in: table name */
ulint field) /* in: index field, or ULINT_UNDEFINED */
{
fputs("InnoDB: Error: data dictionary entry"
" for table ", stderr);
ut_print_name(stderr, name);
fputs(" is corrupt!\n", stderr);
if (field != ULINT_UNDEFINED) {
fprintf(stderr,
"InnoDB: Index field %lu is delete marked.\n", field);
}
else {
fputs("InnoDB: An index is delete marked.\n", stderr);
}
}
/************************************************************************ /************************************************************************
Loads definitions for index fields. */ Loads definitions for index fields. */
static static
...@@ -408,7 +420,6 @@ dict_load_fields( ...@@ -408,7 +420,6 @@ dict_load_fields(
btr_pcur_t pcur; btr_pcur_t pcur;
dtuple_t* tuple; dtuple_t* tuple;
dfield_t* dfield; dfield_t* dfield;
char* col_name;
ulint pos_and_prefix_len; ulint pos_and_prefix_len;
ulint prefix_len; ulint prefix_len;
rec_t* rec; rec_t* rec;
...@@ -446,10 +457,7 @@ dict_load_fields( ...@@ -446,10 +457,7 @@ dict_load_fields(
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr)); ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
if (rec_get_deleted_flag(rec)) { if (rec_get_deleted_flag(rec)) {
fprintf(stderr, dict_load_report_deleted_index(table->name, i);
"InnoDB: Error: data dictionary entry for table %s is corrupt!\n"
"InnoDB: An index field is delete marked.\n",
table->name);
} }
field = rec_get_nth_field(rec, 0, &len); field = rec_get_nth_field(rec, 0, &len);
...@@ -487,11 +495,8 @@ dict_load_fields( ...@@ -487,11 +495,8 @@ dict_load_fields(
field = rec_get_nth_field(rec, 4, &len); field = rec_get_nth_field(rec, 4, &len);
col_name = mem_heap_alloc(heap, len + 1); dict_mem_index_add_field(index,
ut_memcpy(col_name, field, len); mem_heap_strdupl(heap, field, len), 0, prefix_len);
col_name[len] = '\0';
dict_mem_index_add_field(index, col_name, 0, prefix_len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr); btr_pcur_move_to_next_user_rec(&pcur, &mtr);
} }
...@@ -575,10 +580,8 @@ dict_load_indexes( ...@@ -575,10 +580,8 @@ dict_load_indexes(
} }
if (rec_get_deleted_flag(rec)) { if (rec_get_deleted_flag(rec)) {
fprintf(stderr, dict_load_report_deleted_index(table->name,
"InnoDB: Error: data dictionary entry for table %s is corrupt!\n" ULINT_UNDEFINED);
"InnoDB: An index is delete marked.\n",
table->name);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -596,10 +599,7 @@ dict_load_indexes( ...@@ -596,10 +599,7 @@ dict_load_indexes(
dict_table_get_first_index(sys_indexes), 4))->name)); dict_table_get_first_index(sys_indexes), 4))->name));
field = rec_get_nth_field(rec, 4, &name_len); field = rec_get_nth_field(rec, 4, &name_len);
name_buf = mem_heap_strdupl(heap, field, name_len);
name_buf = mem_heap_alloc(heap, name_len + 1);
ut_memcpy(name_buf, field, name_len);
name_buf[name_len] = '\0';
field = rec_get_nth_field(rec, 5, &len); field = rec_get_nth_field(rec, 5, &len);
n_fields = mach_read_from_4(field); n_fields = mach_read_from_4(field);
...@@ -620,11 +620,13 @@ dict_load_indexes( ...@@ -620,11 +620,13 @@ dict_load_indexes(
if (page_no == FIL_NULL) { if (page_no == FIL_NULL) {
fprintf(stderr, fputs("InnoDB: Error: trying to load index ", stderr);
"InnoDB: Error: trying to load index %s for table %s\n" ut_print_name(stderr, name_buf);
"InnoDB: but the index tree has been freed!\n", fputs(" for table ", stderr);
name_buf, table->name); ut_print_name(stderr, table->name);
fputs("\n"
"InnoDB: but the index tree has been freed!\n", stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -634,10 +636,12 @@ dict_load_indexes( ...@@ -634,10 +636,12 @@ dict_load_indexes(
if ((type & DICT_CLUSTERED) == 0 if ((type & DICT_CLUSTERED) == 0
&& NULL == dict_table_get_first_index(table)) { && NULL == dict_table_get_first_index(table)) {
fprintf(stderr, fputs("InnoDB: Error: trying to load index ", stderr);
"InnoDB: Error: trying to load index %s for table %s\n" ut_print_namel(stderr, name_buf, name_len);
"InnoDB: but the first index was not clustered!\n", fputs(" for table ", stderr);
name_buf, table->name); ut_print_name(stderr, table->name);
fputs("\n"
"InnoDB: but the first index is not clustered!\n", stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -648,7 +652,7 @@ dict_load_indexes( ...@@ -648,7 +652,7 @@ dict_load_indexes(
if (is_sys_table if (is_sys_table
&& ((type & DICT_CLUSTERED) && ((type & DICT_CLUSTERED)
|| ((table == dict_sys->sys_tables) || ((table == dict_sys->sys_tables)
&& (name_len == ut_strlen("ID_IND")) && (name_len == (sizeof "ID_IND") - 1)
&& (0 == ut_memcmp(name_buf, (char*) "ID_IND", && (0 == ut_memcmp(name_buf, (char*) "ID_IND",
name_len))))) { name_len))))) {
...@@ -702,7 +706,6 @@ dict_load_table( ...@@ -702,7 +706,6 @@ dict_load_table(
rec_t* rec; rec_t* rec;
byte* field; byte* field;
ulint len; ulint len;
char* buf;
ulint space; ulint space;
ulint n_cols; ulint n_cols;
ulint err; ulint err;
...@@ -802,15 +805,13 @@ dict_load_table( ...@@ -802,15 +805,13 @@ dict_load_table(
if (table->type == DICT_TABLE_CLUSTER_MEMBER) { if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
ut_error; ut_error;
#if 0 /* clustered tables have not been implemented yet */
field = rec_get_nth_field(rec, 6, &len); field = rec_get_nth_field(rec, 6, &len);
table->mix_id = mach_read_from_8(field); table->mix_id = mach_read_from_8(field);
field = rec_get_nth_field(rec, 8, &len); field = rec_get_nth_field(rec, 8, &len);
buf = mem_heap_alloc(heap, len); table->cluster_name = mem_heap_strdupl(heap, field, len);
ut_memcpy(buf, field, len); #endif
table->cluster_name = buf;
} }
if ((table->type == DICT_TABLE_CLUSTER) if ((table->type == DICT_TABLE_CLUSTER)
...@@ -879,7 +880,6 @@ dict_load_table_on_id( ...@@ -879,7 +880,6 @@ dict_load_table_on_id(
byte* field; byte* field;
ulint len; ulint len;
dict_table_t* table; dict_table_t* table;
char* name;
mtr_t mtr; mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -942,13 +942,8 @@ dict_load_table_on_id( ...@@ -942,13 +942,8 @@ dict_load_table_on_id(
/* Now we get the table name from the record */ /* Now we get the table name from the record */
field = rec_get_nth_field(rec, 1, &len); field = rec_get_nth_field(rec, 1, &len);
name = mem_heap_alloc(heap, len + 1);
ut_memcpy(name, field, len);
name[len] = '\0';
/* Load the table definition to memory */ /* Load the table definition to memory */
table = dict_load_table(name); table = dict_load_table(mem_heap_strdupl(heap, field, len));
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -995,7 +990,6 @@ dict_load_foreign_cols( ...@@ -995,7 +990,6 @@ dict_load_foreign_cols(
btr_pcur_t pcur; btr_pcur_t pcur;
dtuple_t* tuple; dtuple_t* tuple;
dfield_t* dfield; dfield_t* dfield;
char* col_name;
rec_t* rec; rec_t* rec;
byte* field; byte* field;
ulint len; ulint len;
...@@ -1040,21 +1034,13 @@ dict_load_foreign_cols( ...@@ -1040,21 +1034,13 @@ dict_load_foreign_cols(
ut_a(i == mach_read_from_4(field)); ut_a(i == mach_read_from_4(field));
field = rec_get_nth_field(rec, 4, &len); field = rec_get_nth_field(rec, 4, &len);
foreign->foreign_col_names[i] =
col_name = mem_heap_alloc(foreign->heap, len + 1); mem_heap_strdupl(foreign->heap, field, len);
ut_memcpy(col_name, field, len);
col_name[len] = '\0';
foreign->foreign_col_names[i] = col_name;
field = rec_get_nth_field(rec, 5, &len); field = rec_get_nth_field(rec, 5, &len);
foreign->referenced_col_names[i] =
mem_heap_strdupl(foreign->heap, field, len);
col_name = mem_heap_alloc(foreign->heap, len + 1);
ut_memcpy(col_name, field, len);
col_name[len] = '\0';
foreign->referenced_col_names[i] = col_name;
btr_pcur_move_to_next_user_rec(&pcur, &mtr); btr_pcur_move_to_next_user_rec(&pcur, &mtr);
} }
...@@ -1110,8 +1096,10 @@ dict_load_foreign( ...@@ -1110,8 +1096,10 @@ dict_load_foreign(
|| rec_get_deleted_flag(rec)) { || rec_get_deleted_flag(rec)) {
/* Not found */ /* Not found */
fprintf(stderr, fputs("InnoDB: Error A: cannot load foreign constraint ",
"InnoDB: Error A: cannot load foreign constraint %s\n", id); stderr);
ut_print_name(stderr, id);
putc('\n', stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -1125,8 +1113,10 @@ dict_load_foreign( ...@@ -1125,8 +1113,10 @@ dict_load_foreign(
/* Check if the id in record is the searched one */ /* Check if the id in record is the searched one */
if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) { if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) {
fprintf(stderr, fputs("InnoDB: Error B: cannot load foreign constraint ",
"InnoDB: Error B: cannot load foreign constraint %s\n", id); stderr);
ut_print_name(stderr, id);
putc('\n', stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -1151,23 +1141,15 @@ dict_load_foreign( ...@@ -1151,23 +1141,15 @@ dict_load_foreign(
foreign->type = foreign->n_fields >> 24; foreign->type = foreign->n_fields >> 24;
foreign->n_fields = foreign->n_fields & 0xFFFFFFUL; foreign->n_fields = foreign->n_fields & 0xFFFFFFUL;
foreign->id = mem_heap_alloc(foreign->heap, ut_strlen(id) + 1); foreign->id = mem_heap_strdup(foreign->heap, id);
ut_memcpy(foreign->id, id, ut_strlen(id) + 1);
field = rec_get_nth_field(rec, 3, &len); field = rec_get_nth_field(rec, 3, &len);
foreign->foreign_table_name =
foreign->foreign_table_name = mem_heap_alloc(foreign->heap, 1 + len); mem_heap_strdupl(foreign->heap, field, len);
ut_memcpy(foreign->foreign_table_name, field, len);
foreign->foreign_table_name[len] = '\0';
field = rec_get_nth_field(rec, 4, &len); field = rec_get_nth_field(rec, 4, &len);
foreign->referenced_table_name =
foreign->referenced_table_name = mem_heap_alloc(foreign->heap, mem_heap_strdupl(foreign->heap, field, len);
1 + len);
ut_memcpy(foreign->referenced_table_name, field, len);
foreign->referenced_table_name[len] = '\0';
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -1281,10 +1263,7 @@ loop: ...@@ -1281,10 +1263,7 @@ loop:
/* Now we get a foreign key constraint id */ /* Now we get a foreign key constraint id */
field = rec_get_nth_field(rec, 1, &len); field = rec_get_nth_field(rec, 1, &len);
id = mem_heap_strdupl(heap, field, len);
id = mem_heap_alloc(heap, len + 1);
ut_memcpy(id, field, len);
id[len] = '\0';
btr_pcur_store_position(&pcur, &mtr); btr_pcur_store_position(&pcur, &mtr);
......
...@@ -49,9 +49,7 @@ dict_mem_table_create( ...@@ -49,9 +49,7 @@ dict_mem_table_create(
table->heap = heap; table->heap = heap;
str = mem_heap_alloc(heap, 1 + ut_strlen(name)); str = mem_heap_strdup(heap, name);
ut_strcpy(str, name);
table->type = DICT_TABLE_ORDINARY; table->type = DICT_TABLE_ORDINARY;
table->name = str; table->name = str;
...@@ -148,7 +146,6 @@ dict_mem_table_add_col( ...@@ -148,7 +146,6 @@ dict_mem_table_add_col(
ulint len, /* in: length */ ulint len, /* in: length */
ulint prec) /* in: precision */ ulint prec) /* in: precision */
{ {
char* str;
dict_col_t* col; dict_col_t* col;
dtype_t* type; dtype_t* type;
...@@ -156,15 +153,11 @@ dict_mem_table_add_col( ...@@ -156,15 +153,11 @@ dict_mem_table_add_col(
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
table->n_def++; table->n_def++;
col = dict_table_get_nth_col(table, table->n_def - 1);
str = mem_heap_alloc(table->heap, 1 + ut_strlen(name));
ut_strcpy(str, name); col = dict_table_get_nth_col(table, table->n_def - 1);
col->ind = table->n_def - 1; col->ind = table->n_def - 1;
col->name = str; col->name = mem_heap_strdup(table->heap, name);
col->table = table; col->table = table;
col->ord_part = 0; col->ord_part = 0;
...@@ -190,7 +183,6 @@ dict_mem_index_create( ...@@ -190,7 +183,6 @@ dict_mem_index_create(
ulint type, /* in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */ ulint type, /* in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */
ulint n_fields) /* in: number of fields */ ulint n_fields) /* in: number of fields */
{ {
char* str;
dict_index_t* index; dict_index_t* index;
mem_heap_t* heap; mem_heap_t* heap;
...@@ -201,13 +193,9 @@ dict_mem_index_create( ...@@ -201,13 +193,9 @@ dict_mem_index_create(
index->heap = heap; index->heap = heap;
str = mem_heap_alloc(heap, 1 + ut_strlen(index_name));
ut_strcpy(str, index_name);
index->type = type; index->type = type;
index->space = space; index->space = space;
index->name = str; index->name = mem_heap_strdup(heap, index_name);
index->table_name = table_name; index->table_name = table_name;
index->table = NULL; index->table = NULL;
index->n_def = 0; index->n_def = 0;
...@@ -303,56 +291,3 @@ dict_mem_index_free( ...@@ -303,56 +291,3 @@ dict_mem_index_free(
{ {
mem_heap_free(index->heap); mem_heap_free(index->heap);
} }
/**************************************************************************
Creates a procedure memory object. */
dict_proc_t*
dict_mem_procedure_create(
/*======================*/
/* out, own: procedure object */
char* name, /* in: procedure name */
char* sql_string, /* in: procedure definition as an SQL
string */
que_fork_t* graph) /* in: parsed procedure graph */
{
dict_proc_t* proc;
proc_node_t* proc_node;
mem_heap_t* heap;
char* str;
ut_ad(name);
heap = mem_heap_create(128);
proc = mem_heap_alloc(heap, sizeof(dict_proc_t));
proc->heap = heap;
str = mem_heap_alloc(heap, 1 + ut_strlen(name));
ut_strcpy(str, name);
proc->name = str;
str = mem_heap_alloc(heap, 1 + ut_strlen(sql_string));
ut_strcpy(str, sql_string);
proc->sql_string = str;
UT_LIST_INIT(proc->graphs);
/* UT_LIST_ADD_LAST(graphs, proc->graphs, graph); */
#ifdef UNIV_DEBUG
UT_LIST_VALIDATE(graphs, que_t, proc->graphs);
#endif
proc->mem_fix = 0;
proc_node = que_fork_get_child(graph);
proc_node->dict_proc = proc;
return(proc);
}
...@@ -311,12 +311,13 @@ eval_predefined_2( ...@@ -311,12 +311,13 @@ eval_predefined_2(
arg = que_node_get_next(arg); arg = que_node_get_next(arg);
} }
printf("\n"); putc('\n', stderr);
} else if (func == PARS_ASSERT_TOKEN) { } else if (func == PARS_ASSERT_TOKEN) {
if (!eval_node_get_ibool_val(arg1)) { if (!eval_node_get_ibool_val(arg1)) {
printf("SQL assertion fails in a stored procedure!\n"); fputs("SQL assertion fails in a stored procedure!\n",
stderr);
} }
ut_a(eval_node_get_ibool_val(arg1)); ut_a(eval_node_get_ibool_val(arg1));
...@@ -667,7 +668,6 @@ eval_predefined( ...@@ -667,7 +668,6 @@ eval_predefined(
{ {
que_node_t* arg1; que_node_t* arg1;
lint int_val; lint int_val;
byte* str1;
byte* data; byte* data;
int func; int func;
...@@ -681,21 +681,63 @@ eval_predefined( ...@@ -681,21 +681,63 @@ eval_predefined(
} else if (func == PARS_TO_CHAR_TOKEN) { } else if (func == PARS_TO_CHAR_TOKEN) {
/* Convert number to character string as a
signed decimal integer. */
ulint uint_val;
int int_len;
int_val = eval_node_get_int_val(arg1); int_val = eval_node_get_int_val(arg1);
data = eval_node_ensure_val_buf(func_node, 11);
sprintf((char*)data, "%10li", int_val); /* Determine the length of the string. */
if (int_val == 0) {
int_len = 1; /* the number 0 occupies 1 byte */
} else {
int_len = 0;
if (int_val < 0) {
uint_val = ((ulint) -int_val - 1) + 1;
int_len++; /* reserve space for minus sign */
} else {
uint_val = (ulint) int_val;
}
for (; uint_val > 0; int_len++) {
uint_val /= 10;
}
}
/* allocate the string */
data = eval_node_ensure_val_buf(func_node, int_len + 1);
dfield_set_len(que_node_get_val(func_node), 10); /* add terminating NUL character */
data[int_len] = 0;
/* convert the number */
if (int_val == 0) {
data[0] = '0';
} else {
int tmp;
if (int_val < 0) {
data[0] = '-'; /* preceding minus sign */
uint_val = ((ulint) -int_val - 1) + 1;
} else {
uint_val = (ulint) int_val;
}
for (tmp = int_len; uint_val > 0; uint_val /= 10) {
data[--tmp] = '0' + (uint_val % 10);
}
}
dfield_set_len((dfield_t*) que_node_get_val(func_node),
int_len);
return; return;
} else if (func == PARS_TO_NUMBER_TOKEN) { } else if (func == PARS_TO_NUMBER_TOKEN) {
str1 = dfield_get_data(que_node_get_val(arg1)); int_val = atoi((char*)
dfield_get_data(que_node_get_val(arg1)));
int_val = atoi((char*)str1);
} else if (func == PARS_SYSDATE_TOKEN) { } else if (func == PARS_SYSDATE_TOKEN) {
int_val = (lint)ut_time(); int_val = (lint)ut_time();
......
...@@ -86,7 +86,7 @@ the count drops to zero. */ ...@@ -86,7 +86,7 @@ the count drops to zero. */
/* When mysqld is run, the default directory "." is the mysqld datadir, /* When mysqld is run, the default directory "." is the mysqld datadir,
but in the MySQL Embedded Server Library and ibbackup it is not the default but in the MySQL Embedded Server Library and ibbackup it is not the default
directory, and we must set the base file path explicitly */ directory, and we must set the base file path explicitly */
char* fil_path_to_mysql_datadir = (char*)"."; const char* fil_path_to_mysql_datadir = ".";
ulint fil_n_pending_log_flushes = 0; ulint fil_n_pending_log_flushes = 0;
ulint fil_n_pending_tablespace_flushes = 0; ulint fil_n_pending_tablespace_flushes = 0;
...@@ -399,7 +399,6 @@ fil_node_create( ...@@ -399,7 +399,6 @@ fil_node_create(
fil_system_t* system = fil_system; fil_system_t* system = fil_system;
fil_node_t* node; fil_node_t* node;
fil_space_t* space; fil_space_t* space;
char* name2;
ut_a(system); ut_a(system);
ut_a(name); ut_a(name);
...@@ -408,11 +407,7 @@ fil_node_create( ...@@ -408,11 +407,7 @@ fil_node_create(
node = mem_alloc(sizeof(fil_node_t)); node = mem_alloc(sizeof(fil_node_t));
name2 = mem_alloc(ut_strlen(name) + 1); node->name = mem_strdup(name);
ut_strcpy(name2, name);
node->name = name2;
node->open = FALSE; node->open = FALSE;
ut_a(!is_raw || srv_start_raw_disk_in_use); ut_a(!is_raw || srv_start_raw_disk_in_use);
...@@ -433,7 +428,7 @@ fil_node_create( ...@@ -433,7 +428,7 @@ fil_node_create(
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: Could not find tablespace %lu for\n" " InnoDB: Error: Could not find tablespace %lu for\n"
"InnoDB: file %s from the tablespace memory cache.\n", (ulong) id, name); "InnoDB: file %s from the tablespace memory cache.\n", (ulong) id, name);
mem_free(name2); mem_free(node->name);
mem_free(node); mem_free(node);
...@@ -816,7 +811,6 @@ fil_space_create( ...@@ -816,7 +811,6 @@ fil_space_create(
{ {
fil_system_t* system = fil_system; fil_system_t* system = fil_system;
fil_space_t* space; fil_space_t* space;
char* name2;
ulint namesake_id; ulint namesake_id;
try_again: try_again:
/*printf( /*printf(
...@@ -881,11 +875,7 @@ try_again: ...@@ -881,11 +875,7 @@ try_again:
space = mem_alloc(sizeof(fil_space_t)); space = mem_alloc(sizeof(fil_space_t));
name2 = mem_alloc(ut_strlen(name) + 1); space->name = mem_strdup(name);
ut_strcpy(name2, name);
space->name = name2;
space->id = id; space->id = id;
system->tablespace_version++; system->tablespace_version++;
...@@ -2737,7 +2727,7 @@ fil_load_single_table_tablespaces(void) ...@@ -2737,7 +2727,7 @@ fil_load_single_table_tablespaces(void)
/* The datadir of MySQL is always the default directory of mysqld */ /* The datadir of MySQL is always the default directory of mysqld */
dir = os_file_opendir(fil_path_to_mysql_datadir, TRUE); dir = os_file_opendir((char*) fil_path_to_mysql_datadir, TRUE);
if (dir == NULL) { if (dir == NULL) {
...@@ -2749,7 +2739,7 @@ fil_load_single_table_tablespaces(void) ...@@ -2749,7 +2739,7 @@ fil_load_single_table_tablespaces(void)
/* Scan all directories under the datadir. They are the database /* Scan all directories under the datadir. They are the database
directories of MySQL. */ directories of MySQL. */
ret = os_file_readdir_next_file(fil_path_to_mysql_datadir, dir, ret = os_file_readdir_next_file((char*) fil_path_to_mysql_datadir, dir,
&dbinfo); &dbinfo);
while (ret == 0) { while (ret == 0) {
/* printf("Looking at %s in datadir\n", dbinfo.name); */ /* printf("Looking at %s in datadir\n", dbinfo.name); */
...@@ -2810,7 +2800,7 @@ next_file_item: ...@@ -2810,7 +2800,7 @@ next_file_item:
} }
next_datadir_item: next_datadir_item:
ret = os_file_readdir_next_file(fil_path_to_mysql_datadir, ret = os_file_readdir_next_file((char*) fil_path_to_mysql_datadir,
dir, &dbinfo); dir, &dbinfo);
} }
...@@ -3726,7 +3716,7 @@ fil_aio_wait( ...@@ -3726,7 +3716,7 @@ fil_aio_wait(
ut_ad(fil_validate()); ut_ad(fil_validate());
if (os_aio_use_native_aio) { if (os_aio_use_native_aio) {
srv_io_thread_op_info[segment] = (char *) "handle native aio"; srv_set_io_thread_op_info(segment, "native aio handle");
#ifdef WIN_ASYNC_IO #ifdef WIN_ASYNC_IO
ret = os_aio_windows_handle(segment, 0, (void**) &fil_node, ret = os_aio_windows_handle(segment, 0, (void**) &fil_node,
&message, &type); &message, &type);
...@@ -3737,7 +3727,7 @@ fil_aio_wait( ...@@ -3737,7 +3727,7 @@ fil_aio_wait(
ut_error; ut_error;
#endif #endif
} else { } else {
srv_io_thread_op_info[segment] =(char *)"handle simulated aio"; srv_set_io_thread_op_info(segment, "simulated aio handle");
ret = os_aio_simulated_handle(segment, (void**) &fil_node, ret = os_aio_simulated_handle(segment, (void**) &fil_node,
&message, &type); &message, &type);
...@@ -3745,7 +3735,7 @@ fil_aio_wait( ...@@ -3745,7 +3735,7 @@ fil_aio_wait(
ut_a(ret); ut_a(ret);
srv_io_thread_op_info[segment] = (char *) "complete io for fil node"; srv_set_io_thread_op_info(segment, "complete io for fil node");
mutex_enter(&(system->mutex)); mutex_enter(&(system->mutex));
...@@ -3762,11 +3752,10 @@ fil_aio_wait( ...@@ -3762,11 +3752,10 @@ fil_aio_wait(
open, and use a special i/o thread to serve insert buffer requests. */ open, and use a special i/o thread to serve insert buffer requests. */
if (buf_pool_is_block(message)) { if (buf_pool_is_block(message)) {
srv_io_thread_op_info[segment] = srv_set_io_thread_op_info(segment, "complete io for buf page");
(char *) "complete io for buf page";
buf_page_io_complete(message); buf_page_io_complete(message);
} else { } else {
srv_io_thread_op_info[segment] =(char *) "complete io for log"; srv_set_io_thread_op_info(segment, "complete io for log");
log_io_complete(message); log_io_complete(message);
} }
} }
...@@ -3847,7 +3836,9 @@ retry: ...@@ -3847,7 +3836,9 @@ retry:
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
/* printf("Flushing to file %s\n", node->name); */ /* fprintf(stderr, "Flushing to file %s\n",
node->name); */
os_file_flush(file); os_file_flush(file);
mutex_enter(&(system->mutex)); mutex_enter(&(system->mutex));
......
This diff is collapsed.
...@@ -490,6 +490,7 @@ flst_validate( ...@@ -490,6 +490,7 @@ flst_validate(
return(TRUE); return(TRUE);
} }
#ifdef UNIV_DEBUG
/************************************************************************ /************************************************************************
Prints info of a file-based list. */ Prints info of a file-based list. */
...@@ -509,9 +510,11 @@ flst_print( ...@@ -509,9 +510,11 @@ flst_print(
len = flst_get_len(base, mtr); len = flst_get_len(base, mtr);
printf("FILE-BASED LIST:\n"); fprintf(stderr,
printf("Base node in space %lu page %lu byte offset %lu; len %lu\n", "FILE-BASED LIST:\n"
"Base node in space %lu page %lu byte offset %lu; len %lu\n",
(ulong) buf_frame_get_space_id(frame), (ulong) buf_frame_get_space_id(frame),
(ulong) buf_frame_get_page_no(frame), (ulong) buf_frame_get_page_no(frame),
(ulong) (base - frame), (ulong) len); (ulong) (base - frame), (ulong) len);
} }
#endif /* UNIV_DEBUG */
...@@ -317,22 +317,13 @@ Prints info of a hash table. */ ...@@ -317,22 +317,13 @@ Prints info of a hash table. */
void void
ha_print_info( ha_print_info(
/*==========*/ /*==========*/
char* buf, /* in/out: buffer where to print */ FILE* file, /* in: file where to print */
char* buf_end,/* in: buffer end */
hash_table_t* table) /* in: hash table */ hash_table_t* table) /* in: hash table */
{ {
hash_cell_t* cell; hash_cell_t* cell;
/* ha_node_t* node;
ulint nodes = 0;
ulint len = 0;
ulint max_len = 0; */
ulint cells = 0; ulint cells = 0;
ulint n_bufs; ulint n_bufs;
ulint i; ulint i;
if (buf_end - buf < 200) {
return;
}
for (i = 0; i < hash_get_n_cells(table); i++) { for (i = 0; i < hash_get_n_cells(table); i++) {
...@@ -341,33 +332,12 @@ ha_print_info( ...@@ -341,33 +332,12 @@ ha_print_info(
if (cell->node) { if (cell->node) {
cells++; cells++;
/*
len = 0;
node = cell->node;
for (;;) {
len++;
nodes++;
if (ha_chain_get_next(table, node) == NULL) {
break;
}
node = node->next;
}
if (len > max_len) {
max_len = len;
}
*/
} }
} }
buf += sprintf(buf, fprintf(file,
"Hash table size %lu, used cells %lu", (ulong) hash_get_n_cells(table), "Hash table size %lu, used cells %lu",
(ulong) cells); (ulong) hash_get_n_cells(table), (ulong) cells);
if (table->heaps == NULL && table->heap != NULL) { if (table->heaps == NULL && table->heap != NULL) {
...@@ -380,6 +350,6 @@ ha_print_info( ...@@ -380,6 +350,6 @@ ha_print_info(
n_bufs++; n_bufs++;
} }
buf += sprintf(buf, ", node heap has %lu buffer(s)\n", (ulong) n_bufs); fprintf(file, ", node heap has %lu buffer(s)\n", (ulong) n_bufs);
} }
} }
This diff is collapsed.
...@@ -392,6 +392,7 @@ btr_page_free_low( ...@@ -392,6 +392,7 @@ btr_page_free_low(
page_t* page, /* in: page to be freed, x-latched */ page_t* page, /* in: page to be freed, x-latched */
ulint level, /* in: page level */ ulint level, /* in: page level */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
#ifdef UNIV_DEBUG
/***************************************************************** /*****************************************************************
Prints size info of a B-tree. */ Prints size info of a B-tree. */
...@@ -408,6 +409,7 @@ btr_print_tree( ...@@ -408,6 +409,7 @@ btr_print_tree(
dict_tree_t* tree, /* in: tree */ dict_tree_t* tree, /* in: tree */
ulint width); /* in: print this many entries from start ulint width); /* in: print this many entries from start
and end */ and end */
#endif /* UNIV_DEBUG */
/**************************************************************** /****************************************************************
Checks the size and number of fields in a record based on the definition of Checks the size and number of fields in a record based on the definition of
the index. */ the index. */
......
...@@ -54,9 +54,11 @@ Created 11/5/1995 Heikki Tuuri ...@@ -54,9 +54,11 @@ Created 11/5/1995 Heikki Tuuri
#define BUF_KEEP_OLD 52 #define BUF_KEEP_OLD 52
extern buf_pool_t* buf_pool; /* The buffer pool of the database */ extern buf_pool_t* buf_pool; /* The buffer pool of the database */
#ifdef UNIV_DEBUG
extern ibool buf_debug_prints;/* If this is set TRUE, the program extern ibool buf_debug_prints;/* If this is set TRUE, the program
prints info whenever read or flush prints info whenever read or flush
occurs */ occurs */
#endif /* UNIV_DEBUG */
/************************************************************************ /************************************************************************
Creates the buffer pool. */ Creates the buffer pool. */
...@@ -476,12 +478,14 @@ buf_pool_is_block( ...@@ -476,12 +478,14 @@ buf_pool_is_block(
/*==============*/ /*==============*/
/* out: TRUE if pointer to block */ /* out: TRUE if pointer to block */
void* ptr); /* in: pointer to memory */ void* ptr); /* in: pointer to memory */
#ifdef UNIV_DEBUG
/************************************************************************* /*************************************************************************
Validates the buffer pool data structure. */ Validates the buffer pool data structure. */
ibool ibool
buf_validate(void); buf_validate(void);
/*==============*/ /*==============*/
#endif /* UNIV_DEBUG */
/************************************************************************ /************************************************************************
Prints a page to stderr. */ Prints a page to stderr. */
...@@ -507,8 +511,7 @@ Prints info of the buffer i/o. */ ...@@ -507,8 +511,7 @@ Prints info of the buffer i/o. */
void void
buf_print_io( buf_print_io(
/*=========*/ /*=========*/
char* buf, /* in/out: buffer where to print */ FILE* file); /* in: file where to print */
char* buf_end);/* in: buffer end */
/************************************************************************* /*************************************************************************
Returns the ratio in percents of modified pages in the buffer pool / Returns the ratio in percents of modified pages in the buffer pool /
database pages in the buffer pool. */ database pages in the buffer pool. */
...@@ -894,7 +897,7 @@ struct buf_pool_struct{ ...@@ -894,7 +897,7 @@ struct buf_pool_struct{
ulint n_pend_reads; /* number of pending read operations */ ulint n_pend_reads; /* number of pending read operations */
time_t last_printout_time; /* when buf_print was last time time_t last_printout_time; /* when buf_print_io was last time
called */ called */
ulint n_pages_read; /* number read operations */ ulint n_pages_read; /* number read operations */
ulint n_pages_written;/* number write operations */ ulint n_pages_written;/* number write operations */
...@@ -909,10 +912,10 @@ struct buf_pool_struct{ ...@@ -909,10 +912,10 @@ struct buf_pool_struct{
ulint n_pages_awe_remapped; /* if AWE is enabled, the ulint n_pages_awe_remapped; /* if AWE is enabled, the
number of remaps of blocks to number of remaps of blocks to
buffer frames */ buffer frames */
ulint n_page_gets_old;/* n_page_gets when buf_print was ulint n_page_gets_old;/* n_page_gets when buf_print_io was
last time called: used to calculate last time called: used to calculate
hit rate */ hit rate */
ulint n_pages_read_old;/* n_pages_read when buf_print was ulint n_pages_read_old;/* n_pages_read when buf_print_io was
last time called */ last time called */
ulint n_pages_written_old;/* number write operations */ ulint n_pages_written_old;/* number write operations */
ulint n_pages_created_old;/* number of pages created in ulint n_pages_created_old;/* number of pages created in
......
This diff is collapsed.
...@@ -97,6 +97,7 @@ buf_flush_ready_for_replace( ...@@ -97,6 +97,7 @@ buf_flush_ready_for_replace(
/* out: TRUE if can replace immediately */ /* out: TRUE if can replace immediately */
buf_block_t* block); /* in: buffer control block, must be in state buf_block_t* block); /* in: buffer control block, must be in state
BUF_BLOCK_FILE_PAGE and in the LRU list */ BUF_BLOCK_FILE_PAGE and in the LRU list */
#ifdef UNIV_DEBUG
/********************************************************************** /**********************************************************************
Validates the flush list. */ Validates the flush list. */
...@@ -104,6 +105,7 @@ ibool ...@@ -104,6 +105,7 @@ ibool
buf_flush_validate(void); buf_flush_validate(void);
/*====================*/ /*====================*/
/* out: TRUE if ok */ /* out: TRUE if ok */
#endif /* UNIV_DEBUG */
/* When buf_flush_free_margin is called, it tries to make this many blocks /* When buf_flush_free_margin is called, it tries to make this many blocks
available to replacement in the free list and at the end of the LRU list (to available to replacement in the free list and at the end of the LRU list (to
......
...@@ -112,6 +112,7 @@ void ...@@ -112,6 +112,7 @@ void
buf_LRU_make_block_old( buf_LRU_make_block_old(
/*===================*/ /*===================*/
buf_block_t* block); /* in: control block */ buf_block_t* block); /* in: control block */
#ifdef UNIV_DEBUG
/************************************************************************** /**************************************************************************
Validates the LRU list. */ Validates the LRU list. */
...@@ -124,6 +125,7 @@ Prints the LRU list. */ ...@@ -124,6 +125,7 @@ Prints the LRU list. */
void void
buf_LRU_print(void); buf_LRU_print(void);
/*===============*/ /*===============*/
#endif /* UNIV_DEBUG */
#ifndef UNIV_NONINL #ifndef UNIV_NONINL
#include "buf0lru.ic" #include "buf0lru.ic"
......
This diff is collapsed.
This diff is collapsed.
...@@ -305,6 +305,7 @@ dtype_new_read_for_order_and_null_size( ...@@ -305,6 +305,7 @@ dtype_new_read_for_order_and_null_size(
/*===================================*/ /*===================================*/
dtype_t* type, /* in: type struct */ dtype_t* type, /* in: type struct */
byte* buf); /* in: buffer for stored type order info */ byte* buf); /* in: buffer for stored type order info */
#ifdef UNIV_DEBUG
/************************************************************************* /*************************************************************************
Validates a data type structure. */ Validates a data type structure. */
...@@ -313,6 +314,7 @@ dtype_validate( ...@@ -313,6 +314,7 @@ dtype_validate(
/*===========*/ /*===========*/
/* out: TRUE if ok */ /* out: TRUE if ok */
dtype_t* type); /* in: type struct to validate */ dtype_t* type); /* in: type struct to validate */
#endif /* UNIV_DEBUG */
/************************************************************************* /*************************************************************************
Prints a data type structure. */ Prints a data type structure. */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment