diff options
-rw-r--r-- | client/client_priv.h | 2 | ||||
-rw-r--r-- | client/mysqldump.c | 26 | ||||
-rw-r--r-- | innobase/buf/buf0buf.c | 5 | ||||
-rw-r--r-- | innobase/buf/buf0lru.c | 11 | ||||
-rw-r--r-- | innobase/buf/buf0rea.c | 5 | ||||
-rw-r--r-- | innobase/dict/dict0load.c | 1 | ||||
-rw-r--r-- | innobase/fil/fil0fil.c | 8 | ||||
-rw-r--r-- | innobase/ibuf/ibuf0ibuf.c | 18 | ||||
-rw-r--r-- | innobase/include/fil0fil.h | 2 | ||||
-rw-r--r-- | innobase/include/row0mysql.h | 2 | ||||
-rw-r--r-- | innobase/include/ut0mem.h | 3 | ||||
-rw-r--r-- | innobase/log/log0recv.c | 2 | ||||
-rw-r--r-- | innobase/row/row0mysql.c | 94 | ||||
-rw-r--r-- | innobase/row/row0sel.c | 25 | ||||
-rw-r--r-- | innobase/srv/srv0start.c | 4 | ||||
-rw-r--r-- | innobase/sync/sync0rw.c | 2 | ||||
-rw-r--r-- | innobase/sync/sync0sync.c | 2 | ||||
-rw-r--r-- | myisam/ft_boolean_search.c | 5 | ||||
-rw-r--r-- | myisam/ft_nlq_search.c | 8 | ||||
-rw-r--r-- | mysql-test/r/mysqldump.result | 90 | ||||
-rw-r--r-- | mysql-test/t/mysqldump.test | 23 | ||||
-rw-r--r-- | sql/ha_innodb.cc | 6 | ||||
-rw-r--r-- | sql/set_var.cc | 5 | ||||
-rw-r--r-- | sql/slave.cc | 51 | ||||
-rw-r--r-- | sql/slave.h | 29 | ||||
-rw-r--r-- | sql/sql_show.cc | 4 |
26 files changed, 185 insertions, 248 deletions
diff --git a/client/client_priv.h b/client/client_priv.h index aa1de85f489..854d205e585 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -43,5 +43,5 @@ enum options_client OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL, OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION, 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 }; diff --git a/client/mysqldump.c b/client/mysqldump.c index 60cf89b3af4..229da83f545 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -37,7 +37,7 @@ ** 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_sys.h> @@ -132,9 +132,6 @@ static struct my_option my_long_options[] = "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, 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.", (gptr*) &opt_drop, (gptr*) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, @@ -148,7 +145,7 @@ static struct my_option my_long_options[] = "Directory where character sets are.", (gptr*) &charsets_dir, (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"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, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"compact", OPT_COMPACT, @@ -160,6 +157,10 @@ static struct my_option my_long_options[] = {"compress", 'C', "Use compression in server/client protocol.", (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 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', "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, @@ -483,7 +484,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case (int) OPT_SKIP_OPTIMIZATION: 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; case (int) OPT_COMPACT: if (opt_compact) @@ -863,7 +864,7 @@ static void print_xml_row(FILE *xml_file, const char *row_name, print_quoted_xml(xml_file, field->name, field->name_length); fputs("=\"", xml_file); print_quoted_xml(xml_file, (*row)[i], lengths[i]); - fputc('"', file); + fputc('"', xml_file); } } fputs(" />\n", xml_file); @@ -897,6 +898,9 @@ static uint getTableStructure(char *table, char* db) sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d", (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); opt_quoted_table= quote_name(table, table_buff2, 0); if (!opt_xml && !mysql_query(sock,insert_pat)) @@ -978,8 +982,10 @@ static uint getTableStructure(char *table, char* db) } else { - /* fprintf(stderr, "%s: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n", - my_progname, mysql_error(sock)); */ + if (verbose) + 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); if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock))) @@ -1172,7 +1178,7 @@ static uint getTableStructure(char *table, char* db) else { 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,"comment=","Comment",1); fputs(" */",sql_file); diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index d96bc7586e6..7a5ef3c5e14 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -1545,11 +1545,12 @@ buf_page_init( "InnoDB: Error: page %lu %lu already found from the hash table\n", (ulong) space, (ulong) offset); +#ifdef UNIV_DEBUG buf_print(); buf_LRU_print(); buf_validate(); buf_LRU_validate(); - +#endif /* UNIV_DEBUG */ ut_a(0); } @@ -2243,7 +2244,7 @@ buf_print_io( / time_elapsed); if (srv_use_awe) { - buf += sprintf(buf, "AWE: %.2f page remaps/s\n", + fprintf(file, "AWE: %.2f page remaps/s\n", (buf_pool->n_pages_awe_remapped - buf_pool->n_pages_awe_remapped_old) / time_elapsed); diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c index 55d638989b5..053161986e4 100644 --- a/innobase/buf/buf0lru.c +++ b/innobase/buf/buf0lru.c @@ -97,13 +97,14 @@ scan_again: } if (block->space == id) { +#ifdef UNIV_DEBUG if (buf_debug_prints) { printf( "Dropping space %lu page %lu\n", (ulong) block->space, (ulong) block->offset); } - +#endif if (block->is_hashed) { page_no = block->offset; @@ -207,6 +208,7 @@ buf_LRU_search_and_free_block( while (block != NULL) { ut_a(block->in_LRU_list); if (buf_flush_ready_for_replace(block)) { + #ifdef UNIV_DEBUG if (buf_debug_prints) { fprintf(stderr, @@ -215,6 +217,7 @@ buf_LRU_search_and_free_block( (ulong) block->offset); } #endif /* UNIV_DEBUG */ + buf_LRU_block_remove_hashed_page(block); mutex_exit(&(buf_pool->mutex)); @@ -419,7 +422,8 @@ loop: (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); + (ulong) os_n_file_reads, (ulong) os_n_file_writes, + (ulong) os_n_fsyncs); mon_value_was = srv_print_innodb_monitor; started_monitor = TRUE; @@ -849,11 +853,12 @@ buf_LRU_block_remove_hashed_page( (ulong) block); } +#ifdef UNIV_DEBUG buf_print(); buf_LRU_print(); buf_validate(); buf_LRU_validate(); - +#endif ut_a(0); } diff --git a/innobase/buf/buf0rea.c b/innobase/buf/buf0rea.c index 0c0b0f6a89d..e0f8291977e 100644 --- a/innobase/buf/buf0rea.c +++ b/innobase/buf/buf0rea.c @@ -125,11 +125,14 @@ buf_read_page_low( return(0); } +#ifdef UNIV_DEBUG 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) sync); } +#endif ut_a(block->state == BUF_BLOCK_FILE_PAGE); diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c index 1f60d625284..abb06b15ea7 100644 --- a/innobase/dict/dict0load.c +++ b/innobase/dict/dict0load.c @@ -121,7 +121,6 @@ dict_print(void) byte* field; ulint len; mtr_t mtr; - char table_name[10000]; mutex_enter(&(dict_sys->mutex)); diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c index b3cf1457225..b9aff246802 100644 --- a/innobase/fil/fil0fil.c +++ b/innobase/fil/fil0fil.c @@ -86,7 +86,7 @@ the count drops to zero. */ /* 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 directory, and we must set the base file path explicitly */ -const 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_tablespace_flushes = 0; @@ -2727,7 +2727,7 @@ fil_load_single_table_tablespaces(void) /* 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) { @@ -2739,7 +2739,7 @@ fil_load_single_table_tablespaces(void) /* Scan all directories under the datadir. They are the database 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); while (ret == 0) { /* printf("Looking at %s in datadir\n", dbinfo.name); */ @@ -2800,7 +2800,7 @@ next_file_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); } diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c index 2973c9880ae..ecdcf08e4c6 100644 --- a/innobase/ibuf/ibuf0ibuf.c +++ b/innobase/ibuf/ibuf0ibuf.c @@ -332,9 +332,9 @@ ibuf_count_get( return(*(ibuf_counts[space] + page_no)); } -#ifdef UNIV_IBUF_DEBUG /********************************************************************** Sets the ibuf count for a given page. */ +#ifdef UNIV_IBUF_DEBUG static void ibuf_count_set( @@ -2710,17 +2710,17 @@ ibuf_insert_to_index_page( fprintf(stderr, "InnoDB: Trying to insert a record from the insert buffer to an index page\n" -"InnoDB: but the number of fields does not match!\n%s\n", errbuf); +"InnoDB: but the number of fields does not match!\n"); buf_page_print(page); - dtuple_sprintf(errbuf, 900, entry); + dtuple_print(stderr, entry); - fprintf(stderr, + fputs( "InnoDB: The table where where this index record belongs\n" "InnoDB: is now probably corrupt. Please run CHECK TABLE on\n" "InnoDB: your tables.\n" -"InnoDB: Send a detailed bug report to mysql@lists.mysql.com!\n"); +"InnoDB: Send a detailed bug report to mysql@lists.mysql.com!\n", stderr); return; } @@ -3386,13 +3386,17 @@ ibuf_print( (ulong) data->seg_size); if (data->empty) { - buf += sprintf(buf, " is empty\n"); + fputs(" is empty\n", file); } else { - buf += sprintf(buf, " is not empty\n"); + fputs(" is not empty\n", file); } fprintf(file, "Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,\n" "%lu inserts, %lu merged recs, %lu merges\n", + (ulong) data->space, + (ulong) data->size, + (ulong) data->free_list_len, + (ulong) data->seg_size, (ulong) data->n_inserts, (ulong) data->n_merged_recs, (ulong) data->n_merges); diff --git a/innobase/include/fil0fil.h b/innobase/include/fil0fil.h index 310336af38e..f7cdeb7f195 100644 --- a/innobase/include/fil0fil.h +++ b/innobase/include/fil0fil.h @@ -19,7 +19,7 @@ Created 10/25/1995 Heikki Tuuri /* When mysqld is run, the default directory "." is the mysqld datadir, but in ibbackup we must set it explicitly; the patgh must NOT contain the trailing '/' or '\' */ -extern char* fil_path_to_mysql_datadir; +extern const char* fil_path_to_mysql_datadir; /* Initial size of a single-table tablespace in pages */ #define FIL_IBD_FILE_INITIAL_SIZE 4 diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h index 13898e75216..0fb2994a414 100644 --- a/innobase/include/row0mysql.h +++ b/innobase/include/row0mysql.h @@ -339,6 +339,8 @@ row_drop_table_for_mysql( char* name, /* in: table name */ trx_t* trx, /* in: transaction handle */ ibool drop_db);/* in: TRUE=dropping whole database */ + +/************************************************************************* Discards the tablespace of a table which stored in an .ibd file. Discarding means that this function deletes the .ibd file and assigns a new table id for the table. Also the flag table->ibd_file_missing is set TRUE. diff --git a/innobase/include/ut0mem.h b/innobase/include/ut0mem.h index 7ca2c26e840..b208fac8691 100644 --- a/innobase/include/ut0mem.h +++ b/innobase/include/ut0mem.h @@ -128,6 +128,8 @@ ut_str_catenate( /* out, own: catenated null-terminated string */ char* str1, /* in: null-terminated string */ char* str2); /* in: null-terminated string */ + +/************************************************************************** Return a copy of the given string. The returned string must be freed using mem_free. */ @@ -136,7 +138,6 @@ ut_strdup( /*======*/ /* out, own: cnull-terminated string */ char* str); /* in: null-terminated string */ -/************************************************************************** #ifndef UNIV_NONINL #include "ut0mem.ic" diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c index 0df79f07f63..4f4220962f0 100644 --- a/innobase/log/log0recv.c +++ b/innobase/log/log0recv.c @@ -1868,7 +1868,7 @@ recv_report_corrupt_log( "InnoDB: Recv offset %lu, prev %lu\n", (ulong) type, (ulong) space, (ulong) page_no, (ulong) ut_dulint_get_high(recv_sys->recovered_lsn), - (ulong) ut_dulint_get_low(recv_sys->recovered_lsn)); + (ulong) ut_dulint_get_low(recv_sys->recovered_lsn), (ulong) recv_previous_parsed_rec_type, (ulong) recv_previous_parsed_rec_is_multi, (ulong) (ptr - recv_sys->buf), diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 804c809eaee..4da27bca1a9 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -1318,6 +1318,7 @@ Does a table creation operation for MySQL. If the name of the table to be created is equal with one of the predefined magic table names, then this also starts printing the corresponding monitor output by the master thread. */ + int row_create_table_for_mysql( /*=======================*/ @@ -2116,79 +2117,6 @@ row_drop_table_for_mysql( "PROCEDURE DROP_TABLE_PROC () IS\n" "table_name CHAR;\n" "sys_foreign_id CHAR;\n" - - ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); - ut_a(name != NULL); - - if (srv_created_new_raw) { - fprintf(stderr, - "InnoDB: A new raw disk partition was initialized or\n" - "InnoDB: innodb_force_recovery is on: we do not allow\n" - "InnoDB: database modifications by the user. Shut down\n" - "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n" - "InnoDB: with raw, and innodb_force_... is removed.\n"); - - return(DB_ERROR); - } - - trx->op_info = (char *) "dropping table"; - - trx_start_if_not_started(trx); - - namelen = ut_strlen(name); - keywordlen = ut_strlen((char *) "innodb_monitor"); - - if (namelen >= keywordlen - && 0 == ut_memcmp(name + namelen - keywordlen, - (char *) "innodb_monitor", keywordlen)) { - - /* Table name ends to characters innodb_monitor: - stop monitor prints */ - - srv_print_innodb_monitor = FALSE; - srv_print_innodb_lock_monitor = FALSE; - } - - keywordlen = ut_strlen((char *) "innodb_lock_monitor"); - - if (namelen >= keywordlen - && 0 == ut_memcmp(name + namelen - keywordlen, - (char *) "innodb_lock_monitor", - keywordlen)) { - - srv_print_innodb_monitor = FALSE; - srv_print_innodb_lock_monitor = FALSE; - } - - keywordlen = ut_strlen((char *) "innodb_tablespace_monitor"); - - if (namelen >= keywordlen - && 0 == ut_memcmp(name + namelen - keywordlen, - (char *) "innodb_tablespace_monitor", - keywordlen)) { - - srv_print_innodb_tablespace_monitor = FALSE; - } - - keywordlen = ut_strlen((char *) "innodb_table_monitor"); - - if (namelen >= keywordlen - && 0 == ut_memcmp(name + namelen - keywordlen, - (char *) "innodb_table_monitor", - keywordlen)) { - - srv_print_innodb_table_monitor = FALSE; - } - - /* We use the private SQL parser of Innobase to generate the - query graphs needed in deleting the dictionary data from system - tables in Innobase. Deleting a row from SYS_INDEXES table also - frees the file segments of the B-tree associated with the index. */ - - str1 = (char *) - "PROCEDURE DROP_TABLE_PROC () IS\n" - "table_name CHAR;\n" - "sys_foreign_id CHAR;\n" "table_id CHAR;\n" "index_id CHAR;\n" "foreign_id CHAR;\n" @@ -2256,7 +2184,7 @@ row_drop_table_for_mysql( "InnoDB: database modifications by the user. Shut down\n" "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n" "InnoDB: with raw, and innodb_force_... is removed.\n", - stderr); + stderr); return(DB_ERROR); } @@ -2279,7 +2207,6 @@ row_drop_table_for_mysql( } else if (namelen == sizeof S_innodb_lock_monitor && !memcmp(name, S_innodb_lock_monitor, sizeof S_innodb_lock_monitor)) { - srv_print_innodb_monitor = FALSE; srv_print_innodb_lock_monitor = FALSE; } else if (namelen == sizeof S_innodb_tablespace_monitor @@ -2294,6 +2221,21 @@ row_drop_table_for_mysql( srv_print_innodb_table_monitor = FALSE; } + ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); + ut_a(name != NULL); + + if (srv_created_new_raw) { + fputs( + "InnoDB: A new raw disk partition was initialized or\n" + "InnoDB: innodb_force_recovery is on: we do not allow\n" + "InnoDB: database modifications by the user. Shut down\n" + "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n" + "InnoDB: with raw, and innodb_force_... is removed.\n", + stderr); + + return(DB_ERROR); + } + quoted_name = mem_strdupq(name, '\''); namelen = strlen(quoted_name); sql = mem_alloc((sizeof str1) + (sizeof str2) - 2 + 1 + namelen); @@ -2676,7 +2618,7 @@ row_rename_table_for_mysql( ibool recovering_temp_table = FALSE; ulint len; ulint i; - ibool success; + ibool success; /* length of database name; 0 if not renaming to a temporary table */ ulint db_name_len; char* sql; diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index fc7436683d2..4c43f75125c 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2035,8 +2035,7 @@ row_sel_convert_mysql_key_to_innobase( (ulong) data_field_len, (ulong) (key_ptr - key_end)); fflush(stderr); - ut_print_buf(original_key_ptr, key_len); - fflush(stdout); + ut_print_buf(stderr, original_key_ptr, key_len); fprintf(stderr, "\n"); if (!is_null) { @@ -2772,14 +2771,12 @@ row_search_for_mysql( } if (trx->n_mysql_tables_in_use == 0) { - char err_buf[1000]; - - trx_print(err_buf, trx); - - fprintf(stderr, + fputs( "InnoDB: Error: MySQL is trying to perform a SELECT\n" -"InnoDB: but it has not locked any tables in ::external_lock()!\n%s\n", - err_buf); +"InnoDB: but it has not locked any tables in ::external_lock()!\n", + stderr); + trx_print(stderr, trx); + fputc('\n', stderr); ut_a(0); } @@ -3092,14 +3089,12 @@ shortcut_fails_too_big_rec: if (trx->read_view == NULL && prebuilt->select_lock_type == LOCK_NONE) { - char err_buf[1000]; - trx_print(err_buf, trx); - - fprintf(stderr, + fputs( "InnoDB: Error: MySQL is trying to perform a consistent read\n" -"InnoDB: but the read view is not assigned!\n%s\n", err_buf); - +"InnoDB: but the read view is not assigned!\n", stderr); + trx_print(stderr, trx); + fputc('\n', stderr); ut_a(0); } } else if (prebuilt->select_lock_type == LOCK_NONE) { diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 93957f2fd35..33d84cfaa8e 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -520,6 +520,8 @@ ulint open_or_create_log_file( /*====================*/ /* out: DB_SUCCESS or error code */ + ibool create_new_db, /* in: TRUE if we should create a + new database */ ibool* log_file_created, /* out: TRUE if new log file created */ ibool log_file_has_been_opened,/* in: TRUE if a log file has been @@ -533,6 +535,8 @@ open_or_create_log_file( ulint size_high; char name[10000]; + UT_NOT_USED(create_new_db); + *log_file_created = FALSE; srv_normalize_path_for_win(srv_log_group_home_dirs[k]); diff --git a/innobase/sync/sync0rw.c b/innobase/sync/sync0rw.c index 3d219f27fb6..43f8d646eaa 100644 --- a/innobase/sync/sync0rw.c +++ b/innobase/sync/sync0rw.c @@ -146,7 +146,9 @@ rw_lock_free( /*=========*/ rw_lock_t* lock) /* in: rw-lock */ { +#ifdef UNIV_DEBUG ut_a(rw_lock_validate(lock)); +#endif /* UNIV_DEBUG */ ut_a(rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED); ut_a(rw_lock_get_waiters(lock) == 0); ut_a(rw_lock_get_reader_count(lock) == 0); diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c index 5c42876a7bb..e711acbf84e 100644 --- a/innobase/sync/sync0sync.c +++ b/innobase/sync/sync0sync.c @@ -251,7 +251,9 @@ mutex_free( /*=======*/ mutex_t* mutex) /* in: mutex */ { +#ifdef UNIV_DEBUG ut_a(mutex_validate(mutex)); +#endif /* UNIV_DEBUG */ ut_a(mutex_get_lock_word(mutex) == 0); ut_a(mutex_get_waiters(mutex) == 0); diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index f6092921a02..2a1c07acf0b 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -224,8 +224,9 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) /* Skip rows inserted by concurrent insert */ while (!r && info->lastpos >= info->state->data_file_length) - r= _mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length, - SEARCH_BIGGER, keyroot); + r= _mi_search_next(info, ftbw->keyinfo, info->lastkey, + info->lastkey_length, + SEARCH_BIGGER, ftbw->key_root); if (!r && !ftbw->off) { diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index b79bf8a2baa..f8ca7e96564 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -89,8 +89,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) doc_cnt=0; /* Skip rows inserted by current inserted */ - for (r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root) - !r && info->lastpos >= info->state->data_file_length; + for (r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root) ; + !r && info->lastpos >= info->state->data_file_length ; r= _mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length, SEARCH_BIGGER, key_root)) ; @@ -159,8 +159,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) SEARCH_BIGGER, key_root); while (!r && info->lastpos >= info->state->data_file_length) - r= _mi_search(info, keyinfo, info->lastkey, info->lastkey_length, - SEARCH_BIGGER, key_root); + r= _mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length, + SEARCH_BIGGER, key_root); } word->weight=gweight; diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index dc3c6c6d28f..01114104088 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -21,6 +21,38 @@ DROP TABLE t1; CREATE TABLE t1 (a decimal(240, 20)); INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), ("0987654321098765432109876543210987654321"); +CREATE TABLE `t1` ( + `a` decimal(240,20) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000'); +DROP TABLE t1; +CREATE TABLE t1 (a double); +INSERT INTO t1 VALUES (-9e999999); +CREATE TABLE `t1` ( + `a` double default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO `t1` VALUES (RES); +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT); +INSERT INTO t1 VALUES (1.2345, 2.3456); +INSERT INTO t1 VALUES ('1.2345', 2.3456); +INSERT INTO t1 VALUES ("1.2345", 2.3456); +SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES'; +INSERT INTO t1 VALUES (1.2345, 2.3456); +INSERT INTO t1 VALUES ('1.2345', 2.3456); +INSERT INTO t1 VALUES ("1.2345", 2.3456); +ERROR 42S22: Unknown column '1.2345' in 'field list' +SET SQL_MODE=@OLD_SQL_MODE; +CREATE TABLE `t1` ( + `a` decimal(10,5) default NULL, + `b` float default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456); +CREATE TABLE `t1` ( + `a` decimal(10,5) default NULL, + `b` float default NULL +); +INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -28,13 +60,14 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( - `a` decimal(240,20) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; + `a` decimal(10,5) default NULL, + `b` float default NULL +); /*!40000 ALTER TABLE `t1` DISABLE KEYS */; LOCK TABLES `t1` WRITE; -INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000'); +INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456); UNLOCK TABLES; /*!40000 ALTER TABLE `t1` ENABLE KEYS */; @@ -43,44 +76,19 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -DROP TABLE t1; -CREATE TABLE t1 (a double); -INSERT INTO t1 VALUES (-9e999999); - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */; -DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( - `a` double default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - + `a` decimal(10,5) default NULL, + `b` float default NULL +); -/*!40000 ALTER TABLE `t1` DISABLE KEYS */; -LOCK TABLES `t1` WRITE; -INSERT INTO `t1` VALUES (RES); -UNLOCK TABLES; -/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; - -DROP TABLE t1; -CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT); -INSERT INTO t1 VALUES (1.2345, 2.3456); -INSERT INTO t1 VALUES ('1.2345', 2.3456); -INSERT INTO t1 VALUES ("1.2345", 2.3456); -CREATE TABLE t1 ( - a decimal(10,5) default NULL, - b float default NULL -) TYPE=MyISAM; - -INSERT INTO t1 VALUES ('1.23450',2.3456); -INSERT INTO t1 VALUES ('1.23450',2.3456); -INSERT INTO t1 VALUES ('1.23450',2.3456); DROP TABLE t1; CREATE TABLE t1(a int, b text, c varchar(3)); @@ -194,27 +202,9 @@ UNLOCK TABLES; DROP TABLE t1; create table ```a` (i int); - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */; -DROP TABLE IF EXISTS ```a`; CREATE TABLE ```a` ( `i` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; - - -/*!40000 ALTER TABLE ```a` DISABLE KEYS */; -LOCK TABLES ```a` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE ```a` ENABLE KEYS */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; - drop table ```a`; create table t1(a int); diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 84d89b5491d..bcfe81dc95f 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -6,7 +6,7 @@ DROP TABLE IF EXISTS t1, `"t"1`; CREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2); ---exec $MYSQL_DUMP --skip-all --skip-comments -X test t1 +--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1 DROP TABLE t1; # @@ -16,7 +16,7 @@ DROP TABLE t1; CREATE TABLE t1 (a decimal(240, 20)); INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), ("0987654321098765432109876543210987654321"); ---exec $MYSQL_DUMP --skip-comments test t1 +--exec $MYSQL_DUMP --compact test t1 DROP TABLE t1; # @@ -28,11 +28,11 @@ INSERT INTO t1 VALUES (-9e999999); # The following replaces is here because some systems replaces the above # double with '-inf' and others with MAX_DOUBLE --replace_result (-1.79769313486232e+308) (RES) (NULL) (RES) ---exec $MYSQL_DUMP --skip-comments test t1 +--exec $MYSQL_DUMP --compact test t1 DROP TABLE t1; # -# Bug #3361 mysqldum quotes DECIMAL values +# Bug #3361 mysqldump quotes DECIMAL values inconsistently # CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT); @@ -51,12 +51,15 @@ INSERT INTO t1 VALUES ("1.2345", 2.3456); SET SQL_MODE=@OLD_SQL_MODE; # check how mysqldump make quoting ---exec $MYSQL_DUMP --skip-comments test t1 +--exec $MYSQL_DUMP --compact test t1 +--exec $MYSQL_DUMP --compact --skip-create test t1 +--exec $MYSQL_DUMP --skip-create --skip-comments test t1 +--exec $MYSQL_DUMP --skip-opt --extended-insert --skip-comments test t1 DROP TABLE t1; CREATE TABLE t1(a int, b text, c varchar(3)); INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES"); ---exec $MYSQL_DUMP --skip-all --skip-comments -X test t1 +--exec $MYSQL_DUMP --skip-create --compact -X test t1 DROP TABLE t1; # @@ -65,7 +68,7 @@ DROP TABLE t1; CREATE TABLE t1 (`a"b"` char(2)); INSERT INTO t1 VALUES ("1\""), ("\"2"); ---exec $MYSQL_DUMP --skip-all --skip-comments -X test t1 +--exec $MYSQL_DUMP --compact --skip-create -X test t1 DROP TABLE t1; # @@ -74,7 +77,7 @@ DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r; INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'); ---exec $MYSQL_DUMP --skip-comments test t1 +--exec $MYSQL_DUMP --skip-comments test t1 DROP TABLE t1; # @@ -88,11 +91,11 @@ INSERT INTO t1 VALUES (1), (2); DROP TABLE t1; # -# Bug #2592 'mysqldum doesn't quote "tricky" names correctly' +# Bug #2592 'mysqldump doesn't quote "tricky" names correctly' # create table ```a` (i int); ---exec $MYSQL_DUMP --skip-comments test +--exec $MYSQL_DUMP --compact test drop table ```a`; # diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index b6b2123fd66..4192df22e5c 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -3748,7 +3748,7 @@ ha_innobase::delete_table( /* Drop the table in InnoDB */ error = row_drop_table_for_mysql(norm_name, trx, - thd->lex.sql_command == SQLCOM_DROP_DB); + thd->lex->sql_command == SQLCOM_DROP_DB); /* Flush the log to reduce probability that the .frm files and the InnoDB data dictionary get out-of-sync if the user runs @@ -4830,7 +4830,7 @@ innodb_show_status( field_list.push_back(new Item_empty_string("Status", flen)); - if (protocol->send_fields(field_list, 1)) { + if (protocol->send_fields(&field_list, 1)) { my_free(str, MYF(0)); @@ -4844,7 +4844,7 @@ innodb_show_status( if (protocol->write()) DBUG_RETURN(-1); - send_eof(&thd->net); + send_eof(thd); DBUG_RETURN(0); } diff --git a/sql/set_var.cc b/sql/set_var.cc index 5ccda5c7052..b175fae38f8 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1090,9 +1090,9 @@ static void fix_max_relay_log_size(THD *thd, enum_var_type type) static int check_max_delayed_threads(THD *thd, set_var *var) { - int val= var->value->val_int(); + longlong val= var->value->val_int(); if (var->type != OPT_GLOBAL && val != 0 && - val != global_system_variables.max_insert_delayed_threads) + val != (longlong) global_system_variables.max_insert_delayed_threads) { char buf[64]; my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name, llstr(val, buf)); @@ -1101,6 +1101,7 @@ static int check_max_delayed_threads(THD *thd, set_var *var) return 0; } + static void fix_max_connections(THD *thd, enum_var_type type) { resize_thr_alarm(max_connections + diff --git a/sql/slave.cc b/sql/slave.cc index d3af72f78bd..061c737b538 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -361,19 +361,32 @@ void init_slave_skip_errors(const char* arg) } } -void st_relay_log_info::inc_pending(ulonglong val) -{ - pending += val; -} -/* TODO: this probably needs to be fixed */ -void st_relay_log_info::inc_pos(ulonglong val, ulonglong log_pos, bool skip_lock) +void st_relay_log_info::inc_group_relay_log_pos(ulonglong val, + ulonglong log_pos, + bool skip_lock) { if (!skip_lock) pthread_mutex_lock(&data_lock); - relay_log_pos += val+pending; - pending = 0; - if (log_pos) + inc_event_relay_log_pos(val); + group_relay_log_pos= event_relay_log_pos; + strmake(group_relay_log_name,event_relay_log_name, + sizeof(group_relay_log_name)-1); + + notify_group_relay_log_name_update(); + + /* + If the slave does not support transactions and replicates a transaction, + users should not trust group_master_log_pos (which they can display with + SHOW SLAVE STATUS or read from relay-log.info), because to compute + group_master_log_pos the slave relies on log_pos stored in the master's + binlog, but if we are in a master's transaction these positions are always + the BEGIN's one (excepted for the COMMIT), so group_master_log_pos does + not advance as it should on the non-transactional slave (it advances by + big leaps, whereas it should advance by small leaps). + */ + if (log_pos) // 3.23 binlogs don't have log_posx + { #if MYSQL_VERSION_ID < 50000 /* If the event was converted from a 3.23 format, get_event_len() has @@ -384,28 +397,18 @@ void st_relay_log_info::inc_pos(ulonglong val, ulonglong log_pos, bool skip_lock mi->old_format will not help if the I/O thread has not started yet. Yes this is a hack but it's just to make 3.23->4.x replication work; 3.23->5.0 replication is working much better. - - The line "mi->old_format ? : " below should NOT BE MERGED to 5.0 which - already works. But it SHOULD be merged to 4.1. */ - master_log_pos= log_pos + val - + group_master_log_pos= log_pos + val - (mi->old_format ? (LOG_EVENT_HEADER_LEN - OLD_HEADER_LEN) : 0); -#endif +#else + group_master_log_pos= log_pos+ val; +#endif /* MYSQL_VERSION_ID < 5000 */ + } pthread_cond_broadcast(&data_cond); if (!skip_lock) pthread_mutex_unlock(&data_lock); } -/* - thread safe read of position - not needed if we are in the slave thread, - but required otherwise as var is a longlong -*/ -void st_relay_log_info::read_pos(ulonglong& var) -{ - pthread_mutex_lock(&data_lock); - var = relay_log_pos; - pthread_mutex_unlock(&data_lock); -} void st_relay_log_info::close_temporary_tables() { diff --git a/sql/slave.h b/sql/slave.h index 549ceb5d42c..c925831d1a5 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -291,34 +291,7 @@ typedef struct st_relay_log_info event_relay_log_pos+= val; } - void inc_group_relay_log_pos(ulonglong val, ulonglong log_pos, bool skip_lock=0) - { - if (!skip_lock) - pthread_mutex_lock(&data_lock); - inc_event_relay_log_pos(val); - group_relay_log_pos= event_relay_log_pos; - strmake(group_relay_log_name,event_relay_log_name, - sizeof(group_relay_log_name)-1); - - notify_group_relay_log_name_update(); - - /* - If the slave does not support transactions and replicates a transaction, - users should not trust group_master_log_pos (which they can display with - SHOW SLAVE STATUS or read from relay-log.info), because to compute - group_master_log_pos the slave relies on log_pos stored in the master's - binlog, but if we are in a master's transaction these positions are always - the BEGIN's one (excepted for the COMMIT), so group_master_log_pos does - not advance as it should on the non-transactional slave (it advances by - big leaps, whereas it should advance by small leaps). - */ - if (log_pos) // 3.23 binlogs don't have log_posx - group_master_log_pos= log_pos+ val; - pthread_cond_broadcast(&data_cond); - if (!skip_lock) - pthread_mutex_unlock(&data_lock); - } - + void inc_group_relay_log_pos(ulonglong val, ulonglong log_pos, bool skip_lock=0); int wait_for_pos(THD* thd, String* log_name, longlong log_pos, longlong timeout); void close_temporary_tables(); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e87a37150ea..448dc825a26 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -181,7 +181,7 @@ int mysqld_show_storage_engines(THD *thd) Protocol *protocol= thd->protocol; DBUG_ENTER("mysqld_show_storage_engines"); - field_list.push_back(new Item_empty_string("Type",10)); + field_list.push_back(new Item_empty_string("Engine",10)); field_list.push_back(new Item_empty_string("Support",10)); field_list.push_back(new Item_empty_string("Comment",80)); @@ -471,7 +471,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) (void) sprintf(path,"%s/%s",mysql_data_home,db); (void) unpack_dirname(path,path); field_list.push_back(item=new Item_empty_string("Name",NAME_LEN)); - field_list.push_back(item=new Item_empty_string("Type",10)); + field_list.push_back(item=new Item_empty_string("Engine",10)); item->maybe_null=1; field_list.push_back(item=new Item_empty_string("Row_format",10)); item->maybe_null=1; |