Commit graph

129 commits

Author SHA1 Message Date
Marko Mäkelä
1a0dde9206 Bug #11766513 - 59641: Prepared XA transaction in system after hard crash
causes future shutdown hang

InnoDB would hang on shutdown if any XA transactions exist in the
system in the PREPARED state. This has been masked by the fact that
MySQL would roll back any PREPARED transaction on shutdown, in the
spirit of Bug #12161 Xa recovery and client disconnection.

[mysql-test-run] do_shutdown_server: Interpret --shutdown_server 0 as
a request to kill the server immediately without initiating a
shutdown procedure.

xid_cache_insert(): Initialize XID_STATE::rm_error in order to avoid a
bogus error message on XA ROLLBACK of a recovered PREPARED transaction.

innobase_commit_by_xid(), innobase_rollback_by_xid(): Free the InnoDB
transaction object after rolling back a PREPARED transaction.

trx_get_trx_by_xid(): Only consider transactions whose
trx->is_prepared flag is set. The MySQL layer seems to prevent
attempts to roll back connected transactions that are in the PREPARED
state from another connection, but it is better to play it safe. The
is_prepared flag was introduced in the InnoDB Plugin.

trx_n_prepared: A new counter, counting the number of InnoDB
transactions in the PREPARED state.

logs_empty_and_mark_files_at_shutdown(): On shutdown, allow
trx_n_prepared transactions to exist in the system.

trx_undo_free_prepared(), trx_free_prepared(): New functions, to free
the memory objects of PREPARED transactions on shutdown. This is not
needed in the built-in InnoDB, because it would collect all allocated
memory on shutdown. The InnoDB Plugin needs this because of
innodb_use_sys_malloc.

trx_sys_close(): Invoke trx_free_prepared() on all remaining
transactions.
2011-04-07 21:12:54 +03:00
Bjorn Munch
f4ac6eb117 Bug #11885854 MYSQLTEST: PS-PROTOCOL IMPLIED BY CURSOR-PROTOCOL LOST AFTER ENABLE_PS_PROTOCOL
The condition cursor-protocol => ps-protocol was done at "current setting" level"
Moved it to "set by command line" level
2011-03-18 12:13:54 +01:00
Mattias Jonsson
15f635fdf6 merge 2011-01-26 16:34:34 +01:00
Bjorn Munch
097445ebf5 Fixed copyright headers in mtr src files 2011-01-18 11:03:44 +01:00
Bjorn Munch
0630418539 Bug #58900 query_get_value crashes when result begins with dollar sign
Generalized fix for recursive backtick
Optional arg to eval_expr telling it not to interpret
2011-01-11 10:54:42 +01:00
Bjorn Munch
c6ad5c819e Bug #59002 Please make mtr print correct file and line number when tests fail
This patchs adds printing of a file stack (with line numbers)
It does not fix the problem of a failure in the non-first iteration of a loop
2011-01-11 10:51:31 +01:00
Mattias Jonsson
3a0b067654 Bug#47902: partition_recover_myisam fails with --ps-protocol
The problem was that the warnings was never written out
when running with --ps-protocol. This was because the
warnings only appeared during the prepare phase, not
the execute phase.

Solved by not clearing the warnings from the prepare phase
if there was no other warnings.

If there are warnings from the execute phase, it is very
likely to be the same as from the prepare phase. My tests
show that if not clearing the warnings from the prepare
phase when there are warnings from the execute phase, there
will be duplicated warnings in the result.
2011-01-10 23:42:37 +01:00
Sven Sandberg
09c80e12c5 BUG#49978: Replication tests don't clean up replication state at the end
Major replication test framework cleanup. This does the following:
 - Ensure that all tests clean up the replication state when they
   finish, by making check-testcase check the output of SHOW SLAVE STATUS.
   This implies:
    - Slave must not be running after test finished. This is good
      because it removes the risk for sporadic errors in subsequent
      tests when a test forgets to sync correctly.
    - Slave SQL and IO errors must be cleared when test ends. This is
      good because we will notice if a test gets an unexpected error in
      the slave threads near the end.
    - We no longer have to clean up before a test starts.
 - Ensure that all tests that wait for an error in one of the slave
   threads waits for a specific error. It is no longer possible to
   source wait_for_slave_[sql|io]_to_stop.inc when there is an error
   in one of the slave threads. This is good because:
    - If a test expects an error but there is a bug that causes
      another error to happen, or if it stops the slave thread without
      an error, then we will notice.
    - When developing tests, wait_for_*_to_[start|stop].inc will fail
      immediately if there is an error in the relevant slave thread.
      Before this patch, we had to wait for the timeout.
 - Remove duplicated and repeated code for setting up unusual replication
   topologies. Now, there is a single file that is capable of setting
   up arbitrary topologies (include/rpl_init.inc, but
   include/master-slave.inc is still available for the most common
   topology). Tests can now end with include/rpl_end.inc, which will clean
   up correctly no matter what topology is used. The topology can be
   changed with include/rpl_change_topology.inc.
 - Improved debug information when tests fail. This includes:
    - debug info is printed on all servers configured by include/rpl_init.inc
    - User can set $rpl_debug=1, which makes auxiliary replication files
      print relevant debug info.
 - Improved documentation for all auxiliary replication files. Now they
   describe purpose, usage, parameters, and side effects.
 - Many small code cleanups:
    - Made have_innodb.inc output a sensible error message.
    - Moved contents of rpl000017-slave.sh into rpl000017.test
    - Added mysqltest variables that expose the current state of
      disable_warnings/enable_warnings and friends.
    - Too many to list here: see per-file comments for details.
2010-12-19 18:07:28 +01:00
Georgi Kodinov
7bdecb1d4a merge 2010-12-16 16:40:52 +02:00
Bjorn Munch
7a404214e0 merge from 5.1-mtr 2010-12-09 20:32:47 +01:00
Bjorn Munch
bff782d0f0 Bug #58511 mysqltest doesn't always run statements in ps mode
mysqltest checks if the stmt is one that should be run in ps mode,
  but regexp doesn't match if preceeded by /* */ comment.
Fix: match function will jump over /*..*/ if found at start
2010-12-09 14:43:42 +01:00
Bjorn Munch
83e7edde87 Bug #58522 mtr --debug leaks memory when test fails
Backported use of setenv() from 5.5
This will remove the leak on systems that have setenv()
I have not fixed the string.c leak, it's a local variable
   that the cleanup function cannot access.
2010-12-09 14:42:04 +01:00
Bjorn Munch
9dca123d02 Bug #58092 Test "rpl_cross_version" has "copy_file" failing
I am not fixing the test failure
Adds printing of my_errno when commands fail, could hopefully help
2010-12-01 11:11:16 +01:00
Davi Arnaut
0008e06489 Bug#51817: incorrect assumption: thd->query at 0x2ab2a8360360 is an invalid pointer
The problem is that the logic which checks if a pointer is
valid relies on a poor heuristic based on the start and end
addresses of the data segment and heap.

Apart from miscalculating the heap bounds, this approach also
suffers from the fact that memory can come from places other
than the heap. See Bug#58528 for a more detailed explanation.

On Linux, the solution is to access the process's memory
through /proc/self/task/<tid>/mem, which allows for retrieving
the contents of pages within the virtual address space of
the calling process. If a address range is not mapped, a
input/output error is returned.
2010-11-26 19:59:10 -02:00
Ramil Kalimullin
0628752fe9 Manual-merge from mysql-5.1-bugteam. 2010-11-22 12:21:10 +03:00
Bjorn Munch
b295a25109 merge from 5.1-mtr 2010-11-19 10:29:08 +01:00
Bjorn Munch
d718af063e Bug #58257 mysqltest: in if(), ! $var with space is always false
Evaluation would start with the space and thus ignore the $
Added while() to skip past white space
2010-11-17 16:05:52 +01:00
Mattias Jonsson
d25e3389f4 post-push fix, backported --replace_result patch
for --list_files in mysqltest.
2010-11-17 10:13:57 +01:00
Bjorn Munch
9142f7462b Bug #58087 mysqltest re-evaluates 'let' expressions infinitely
Results from query is sent for evaluation
Break recursion by asking for ` to be ignored
2010-11-15 14:23:02 +01:00
Bjorn Munch
2ab2426104 merge from 5.1 up to rev 3471 2010-11-14 12:23:51 +01:00
Bjorn Munch
16a55614cc merge from 5.1-mtr 2010-10-25 15:48:41 +02:00
Davi Arnaut
560ee2158d Bug#45288: pb2 returns a lot of compilation warnings
Fix assorted warnings that are generated in optimized builds.
Most of it is silencing variables that are set but unused.

This patch also introduces the MY_ASSERT_UNREACHABLE macro
which helps the compiler to deduce that a certain piece of
code is unreachable.
2010-10-20 16:21:40 -02:00
Bjorn Munch
441e3b2412 Fixed wrong feof check in read_line, see 52019 2010-10-20 11:41:51 +02:00
Bjorn Munch
daa70e0ab9 Fixed missing cast of arg to my_mbcharlen 2010-10-20 11:39:58 +02:00
Bjorn Munch
af056dc560 48863 followup: move an array declaration out from within if block 2010-10-20 11:30:50 +02:00
Bjorn Munch
ce786ab04d Bug #52019 main.mysqltest fails on new tests for lowercase_result
Limited to actual bug fix, fixing a while condition
Again confirmed on Linux PPC and on AIX 5.3
2010-10-20 11:22:08 +02:00
Bjorn Munch
687696a97a merge from 5.1-mtr 2010-10-03 19:37:58 +02:00
Bjorn Munch
ad7521df31 Bug #20304 mysqltest: reap with no preceding statement hangs forever
Added sanity check, similar to the one preventing send without reap
2010-10-01 11:00:18 +02:00
Bjorn Munch
87234b74ca Bug #52828 Tests that use perl fail when perl is not in path
Trying to run perl fails, just like it does when perl is started but fails
Trap the case that perl was not found/could not be started, and skip test
Also force a restart of servers since test may already have done something
mtr now also appends path of current perl to PATH to aid mysqltest
2010-09-30 12:42:37 +02:00
Bjorn Munch
1a75a23ce1 merge from 5.1 2010-09-29 12:56:10 +02:00
Bjorn Munch
80d666bc21 Bug #56921 It should be possible to log connection statements in mysqltest
Added --enable-connect-log, somewhet similar to --enable-query-log
If query log is disabled, disable connect log too
Also some related cleanup in mysqltest.test: removing duplicate test loop
2010-09-22 10:57:10 +02:00
Bjorn Munch
c679e8dc80 Bug #55426 mysqltest crashes when trying to unlock not acquired mutex
Follow-up: don't call pthread_join() on Windows
This change only valid for 5.1
2010-09-20 11:21:27 +02:00
Bjorn Munch
38604de3a0 Bug #56753 mtr silently ignores junk after backticks
When stepping backward to end of `` expression, check for illegal chars
2010-09-15 14:56:22 +02:00
Bjorn Munch
4e23534bf7 Bug #55426 mysqltest crashes when trying to unlock not acquired mutex
Bug #55546 mysqltest fails to create a new thread on HPUX
Missing call to pthread_join(), in embedded mode
This independently solves both problems, see 55426 for details.
Addendum: cannot test against a pthread_t, adds boolean flag instead
2010-09-14 14:04:37 +02:00
Bjorn Munch
c824cbbaff Bug #56647 Valgrind warnings for memory leak in mysqltest.cc
Moved an init_dynamic_string() from before to after potential die()
2010-09-10 13:08:06 +02:00
Bjorn Munch
4b1d6118e8 merge 55178,55413,56383 2010-09-10 09:58:26 +02:00
Bjorn Munch
c3f69b4191 merge 55413 2010-08-30 11:26:40 +02:00
Bjorn Munch
a22b5651fd Bug #52301 Add --protocol to mysqltest
Added code resulted in strange linking problem for embedded on Windows
Avoided by not doing this for embedded mode
It's irrelevant for embedded server anyway, --protocol will be ignored
2010-08-25 10:23:19 +02:00
Bjorn Munch
fba50f8401 Reduced #ifndef for 52301, caused compile warning 2010-08-26 15:14:50 +02:00
Bjorn Munch
79aefacb04 merge followup fix for 52301 2010-08-25 22:49:52 +02:00
Bjorn Munch
3ca814b760 Bug #55413 mysqltest gives parse error for lines matching "^let.*\\.*;$"
Allow escaped quotes also in statements not starting with --
But will not support single unescaped ' or `
2010-08-10 12:13:58 +02:00
Bjorn Munch
8e242e8140 merge from 5.1-mtr 2010-08-06 11:13:52 +02:00
Bjorn Munch
992f49c0c4 merge from 5.1 2010-08-04 12:19:51 +02:00
Bjorn Munch
1ba9d79b7b Bug #55582 mtr root detection (and if-expression execution) broken
if() treated any non-numeric string as false
Fixed to treat those as true instead
Added some test cases
Fixed missing $ in variable name in include/mix2.inc
2010-08-03 16:11:23 +02:00
Davi Arnaut
93fb8bb235 Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.

One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.

There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.
2010-07-02 15:30:47 -03:00
Bjorn Munch
711ce77612 Bug #54111 mysqltest command remove_files_wildcard does not work in embedded server
Wildcard chars are changed in embedded mode
Temporarily reset the wild_* variables before wild_compare, also for list_files
2010-06-15 11:29:24 +02:00
Davi Arnaut
bb036c93b4 Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.

Essentially, the problem is that large parts of the server were
developed in simpler times (last decades, pre C99 standard) when
strict aliasing and compilers supporting such optimizations were
rare to non-existent. Thus, when compiling the server with a modern
compiler that uses strict aliasing rules to perform optimizations,
there are several places in the code that might trigger undefined
behavior.

As evinced by some recent bugs, GCC does a somewhat good of job
misoptimizing such code, but on the other hand also gives warnings
about suspicious code. One problem is that the warnings aren't
always accurate, yet we can't afford to just shut them off as we
might miss real cases. False-positive cases are aggravated mostly
by casts that are likely to trigger undefined behavior.

The solution is to start a cleanup process focused on fixing and
reducing the amount of strict-aliasing related warnings produced
by GCC and others compilers. A good deal of noise reduction can
be achieved by just removing useless casts that are product of
historical cruft and are likely to trigger undefined behavior if
dereferenced.
2010-06-10 17:16:43 -03:00
Bjorn Munch
f9fa3b7a3f Bug #53374 Don't delete temporary perl file if perl fails
Simple condition on the delete stmt
But NB: next mtr run will clean up and remove the temp file
2010-06-07 13:30:23 +02:00
Bjorn Munch
b7c8385e05 Merge from 5.1 up to rev 3392 2010-06-02 16:23:29 +02:00
Bjorn Munch
2682fb67c3 Bug #52214 Misleading error msg when test fails before having produced any query
output
Print error message only if real error
2010-04-13 12:41:42 +02:00