diff options
author | Michael Widenius <monty@mysql.com> | 2010-08-18 10:52:57 +0300 |
---|---|---|
committer | Michael Widenius <monty@mysql.com> | 2010-08-18 10:52:57 +0300 |
commit | 909e4eb08d7ea38cf09575756cff79648e326fd5 (patch) | |
tree | 84729e5a7b409cbe8b58a888fb76762ed3900f0d | |
parent | 6795a545e382a2de7104cdc57e0a2834e4aa9b67 (diff) | |
download | mariadb-git-909e4eb08d7ea38cf09575756cff79648e326fd5.tar.gz |
Added verbose mode to recovery
More DBUG
Added convert-debug-for-diff
Added missing (from last push) federated test case
.bzrignore:
Ignore generated files
mysql-test/README:
Updated documentation for --extern
mysql-test/suite/federated/federated_bug_32426.result:
Added test for federatedx
mysql-test/suite/federated/federated_bug_32426.test:
Added test for federatedx
scripts/Makefile.am:
Added convert-debug-for-diff
scripts/convert-debug-for-diff.sh:
Added script for converting
sql/log.cc:
Added DBUG
sql/mysqld.cc:
Added DBUG
storage/maria/ma_recovery.c:
If verbose, write dirty pages (for debugging)
storage/maria/ma_static.c:
Added verbose mode to recovery
storage/maria/maria_def.h:
Added verbose mode to recovery
storage/maria/maria_read_log.c:
Added verbose mode to recovery
-rw-r--r-- | .bzrignore | 2 | ||||
-rw-r--r-- | mysql-test/README | 2 | ||||
-rw-r--r-- | mysql-test/suite/federated/federated_bug_32426.result | 30 | ||||
-rw-r--r-- | mysql-test/suite/federated/federated_bug_32426.test | 24 | ||||
-rw-r--r-- | scripts/Makefile.am | 7 | ||||
-rwxr-xr-x | scripts/convert-debug-for-diff.sh | 25 | ||||
-rw-r--r-- | sql/log.cc | 3 | ||||
-rw-r--r-- | sql/mysqld.cc | 10 | ||||
-rw-r--r-- | storage/maria/ma_recovery.c | 5 | ||||
-rw-r--r-- | storage/maria/ma_static.c | 2 | ||||
-rw-r--r-- | storage/maria/maria_def.h | 1 | ||||
-rw-r--r-- | storage/maria/maria_read_log.c | 5 |
12 files changed, 106 insertions, 10 deletions
diff --git a/.bzrignore b/.bzrignore index a5358590417..9a01b642787 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1928,3 +1928,5 @@ libmysqld/ha_federatedx.cc tmp libmysqld/debug_sync.cc storage/pbxt/bin/xtstat +mysql-test/mtr_command +scripts/convert-debug-for-diff diff --git a/mysql-test/README b/mysql-test/README index 77b398ebf39..3c8303ca070 100644 --- a/mysql-test/README +++ b/mysql-test/README @@ -18,7 +18,7 @@ the test suite expects you to provide the names of the tests to run. For example, here is the command to run the "alias" and "analyze" tests with an external server: -mysql-test-run --extern alias analyze +mysql-test-run --extern socket=/tmp/mysql.sock alias analyze To match your setup, you might also need to provide --socket, --user, and other relevant options. diff --git a/mysql-test/suite/federated/federated_bug_32426.result b/mysql-test/suite/federated/federated_bug_32426.result new file mode 100644 index 00000000000..fbfa6dc3d52 --- /dev/null +++ b/mysql-test/suite/federated/federated_bug_32426.result @@ -0,0 +1,30 @@ +CREATE DATABASE federated; +CREATE DATABASE federated; +# +# Bug #32426: FEDERATED query returns corrupt results for ORDER BY +# on a TEXT column +# +CREATE TABLE federated.t1(a TEXT); +INSERT INTO federated.t1 VALUES('abc'), ('gh'), ('f'), ('ijk'), ('de'); +CREATE TABLE federated.t1(a TEXT) ENGINE=FEDERATED +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +SELECT * FROM federated.t1 ORDER BY A; +a +abc +de +f +gh +ijk +SELECT * FROM federated.t1 ORDER BY A DESC; +a +ijk +gh +f +de +abc +DROP TABLE federated.t1; +DROP TABLE federated.t1; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federated_bug_32426.test b/mysql-test/suite/federated/federated_bug_32426.test new file mode 100644 index 00000000000..254dfaa610a --- /dev/null +++ b/mysql-test/suite/federated/federated_bug_32426.test @@ -0,0 +1,24 @@ +source federated.inc; + +--echo # +--echo # Bug #32426: FEDERATED query returns corrupt results for ORDER BY +--echo # on a TEXT column +--echo # +connection slave; +CREATE TABLE federated.t1(a TEXT); +INSERT INTO federated.t1 VALUES('abc'), ('gh'), ('f'), ('ijk'), ('de'); + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1(a TEXT) ENGINE=FEDERATED + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +SELECT * FROM federated.t1 ORDER BY A; +SELECT * FROM federated.t1 ORDER BY A DESC; +DROP TABLE federated.t1; + +connection slave; +DROP TABLE federated.t1; + +connection default; + +source federated_cleanup.inc; diff --git a/scripts/Makefile.am b/scripts/Makefile.am index b74e7b8df8b..be9354bd628 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -37,7 +37,8 @@ bin_SCRIPTS = @server_scripts@ \ mysqld_multi noinst_SCRIPTS = make_binary_distribution \ - make_sharedlib_distribution + make_sharedlib_distribution \ + convert-debug-for-diff EXTRA_SCRIPTS = make_binary_distribution.sh \ make_sharedlib_distribution.sh \ @@ -59,7 +60,8 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \ mysqlhotcopy.sh \ mysqldumpslow.sh \ mysqld_multi.sh \ - mysqld_safe.sh + mysqld_safe.sh \ + convert-debug-for-diff.sh EXTRA_DIST = $(EXTRA_SCRIPTS) \ mysqlaccess.conf \ @@ -91,6 +93,7 @@ CLEANFILES = @server_scripts@ \ mysqlhotcopy \ mysqldumpslow \ mysqld_multi \ + convert-debug-for-diff \ $(EXTRA_PROGRAMS) pkgplugindir = $(pkglibdir)/plugin diff --git a/scripts/convert-debug-for-diff.sh b/scripts/convert-debug-for-diff.sh new file mode 100755 index 00000000000..2c4c86acd3c --- /dev/null +++ b/scripts/convert-debug-for-diff.sh @@ -0,0 +1,25 @@ +#!/usr/bin/perl -i +# +# This script converts all numbers that look like addresses or memory sizes, +# in a debug files generated by --debug (like mysqld --debug), to #. +# The script also deletes all thread id's from the start of the line. + +# This allows you to easily compare the files (for example with diff) +# to find out what changes between different executions. +# This is extremely useful for comparing two mysqld versions to see +# why things now work differently. + +# The script converts the files in place. +# +# Typical usage: +# +# convert-debug-for-diff /tmp/mysqld.trace /tmp/mysqld-old.trace +# diff /tmp/mysqld.trace /tmp/mysqld-old.trace + +while (<>) +{ + s/^T@[0-9]+://g; + s/0x[0-9a-f]+(\s|\n|\))/#$1/g; + s/size: [0-9]+/size: #/g; + print $_; +} diff --git a/sql/log.cc b/sql/log.cc index cbbe294387b..c70b7816a9d 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -372,6 +372,7 @@ bool Log_to_csv_event_handler:: Open_tables_state open_tables_backup; ulonglong save_thd_options; bool save_time_zone_used; + DBUG_ENTER("log_general"); /* CSV uses TIME_to_timestamp() internally if table needs to be repaired @@ -490,7 +491,7 @@ err: thd->options= save_thd_options; thd->time_zone_used= save_time_zone_used; - return result; + DBUG_RETURN(result); } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 4f8cfd70615..ab7ad549121 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -9309,6 +9309,8 @@ bool is_secure_file_path(char *path) static int fix_paths(void) { char buff[FN_REFLEN],*pos; + DBUG_ENTER("fix_paths"); + convert_dirname(mysql_home,mysql_home,NullS); /* Resolve symlinks to allow 'mysql_home' to be a relative symlink */ my_realpath(mysql_home,mysql_home,MYF(0)); @@ -9353,12 +9355,12 @@ static int fix_paths(void) charsets_dir=mysql_charsets_dir; if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) - return 1; + DBUG_RETURN(1); #ifdef HAVE_REPLICATION if (!slave_load_tmpdir) { if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE)))) - return 1; + DBUG_RETURN(1); } #endif /* HAVE_REPLICATION */ /* @@ -9379,7 +9381,7 @@ static int fix_paths(void) if (my_realpath(buff, opt_secure_file_priv, 0)) { sql_print_warning("Failed to normalize the argument for --secure-file-priv."); - return 1; + DBUG_RETURN(1); } secure_file_real_path= (char *)my_malloc(FN_REFLEN, MYF(MY_FAE)); convert_dirname(secure_file_real_path, buff, NullS); @@ -9387,7 +9389,7 @@ static int fix_paths(void) opt_secure_file_priv= secure_file_real_path; } } - return 0; + DBUG_RETURN(0); } diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index 58f16658957..3ac3d3179d7 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -3167,6 +3167,8 @@ static LSN parse_checkpoint_record(LSN lsn) return LSN_ERROR; next_dirty_page_in_pool= dirty_pages_pool; minimum_rec_lsn_of_dirty_pages= LSN_MAX; + if (maria_recovery_verbose) + tprint(tracef, "Table_id Is_index Page_id Rec_lsn\n"); for (i= 0; i < nb_dirty_pages ; i++) { pgcache_page_no_t page_id; @@ -3183,6 +3185,9 @@ static LSN parse_checkpoint_record(LSN lsn) if (new_page((is_index << 16) | table_id, page_id, rec_lsn, next_dirty_page_in_pool++)) return LSN_ERROR; + if (maria_recovery_verbose) + tprint(tracef, "%8u %8u %12lu %u,0x%lx\n", (uint) table_id, + (uint) is_index, (ulong) page_id, LSN_IN_PARTS(rec_lsn)); set_if_smaller(minimum_rec_lsn_of_dirty_pages, rec_lsn); } /* after that, there will be no insert/delete into the hash */ diff --git a/storage/maria/ma_static.c b/storage/maria/ma_static.c index d870b034eb8..917385f9568 100644 --- a/storage/maria/ma_static.c +++ b/storage/maria/ma_static.c @@ -37,7 +37,7 @@ my_bool maria_flush= 0, maria_single_user= 0; my_bool maria_delay_key_write= 0, maria_page_checksums= 1; my_bool maria_inited= FALSE; my_bool maria_in_ha_maria= FALSE; /* If used from ha_maria or not */ -my_bool maria_recovery_changed_data= 0; +my_bool maria_recovery_changed_data= 0, maria_recovery_verbose= 0; pthread_mutex_t THR_LOCK_maria; #if defined(THREAD) && !defined(DONT_USE_RW_LOCKS) ulong maria_concurrent_insert= 2; diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index e9980cf9695..8c2ce447a36 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -797,6 +797,7 @@ extern uint maria_quick_table_bits; extern char *maria_data_root; extern uchar maria_zero_string[]; extern my_bool maria_inited, maria_in_ha_maria, maria_recovery_changed_data; +extern my_bool maria_recovery_verbose; extern HASH maria_stored_state; extern int (*maria_create_trn_hook)(MARIA_HA *); diff --git a/storage/maria/maria_read_log.c b/storage/maria/maria_read_log.c index c964e47eafd..98bc638c77f 100644 --- a/storage/maria/maria_read_log.c +++ b/storage/maria/maria_read_log.c @@ -211,7 +211,10 @@ static struct my_option my_long_options[] = "will not be applied", &opt_end_lsn, &opt_end_lsn, 0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 }, {"silent", 's', "Print less information during apply/undo phase", - (uchar **) &opt_silent, (uchar **) &opt_silent, 0, + &opt_silent, &opt_silent, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"verbose", 'v', "Print more information during apply/undo phase", + &maria_recovery_verbose, &maria_recovery_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"tmpdir", 't', "Path for temporary files. Multiple paths can be specified, " "separated by " |