Commit graph

139 commits

Author SHA1 Message Date
Monty
536215e32f Added DBUG_ASSERT_AS_PRINTF compile flag
If compiling a non DBUG binary with
-DDBUG_ASSERT_AS_PRINTF asserts will be
changed to printf + stack trace (of stack
trace are enabled).

- Changed #ifndef DBUG_OFF to
  #ifdef DBUG_ASSERT_EXISTS
  for those DBUG_OFF that was just used to enable
  assert
- Assert checking that could greatly impact
  performance where changed to DBUG_ASSERT_SLOW which
  is not affected by DBUG_ASSERT_AS_PRINTF
- Added one extra option to my_print_stacktrace() to
  get more silent in case of stack trace printing as
  part of assert.
2017-08-24 01:05:50 +02:00
Sergei Golubchik
da4d71d10d Merge branch '10.1' into 10.2 2017-03-30 12:48:42 +02:00
Sergei Golubchik
5d40ed864e MDEV-11752 Unsafe strmov - function definition in include/m_string.h
assert that strmov() cannot be used on overlapping strings.
(because strpcpy cannot)
2017-03-10 18:21:29 +01:00
Marko Mäkelä
89d80c1b0b Fix many -Wconversion warnings.
Define my_thread_id as an unsigned type, to avoid mismatch with
ulonglong.  Change some parameters to this type.

Use size_t in a few more places.

Declare many flag constants as unsigned to avoid sign mismatch
when shifting bits or applying the unary ~ operator.

When applying the unary ~ operator to enum constants, explictly
cast the result to an unsigned type, because enum constants can
be treated as signed.

In InnoDB, change the source code line number parameters from
ulint to unsigned type. Also, make some InnoDB functions return
a narrower type (unsigned or uint32_t instead of ulint;
bool instead of ibool).
2017-03-07 19:07:27 +02:00
Marko Mäkelä
bf35deda09 MDEV-11713 Optimize DBUG_PRINT and introduce DBUG_LOG
MariaDB Server is unnecessarily evaluating the arguments of
DBUG_PRINT() macros when the label is not defined.

The macro DBUG_LOG() for C++ operator<< output which was added for
InnoDB diagnostics in MySQL 5.7 is missing from MariaDB. Unlike the
MySQL 5.7 implementation, MariaDB will avoid allocating and
initializing the output string when the label is not defined.

Introduce DBUG_OUT("crypt") and DBUG_OUT("checksum") for some InnoDB
diagnostics, replacing some use of ib::info().
2017-01-05 10:51:18 +02:00
Sergei Golubchik
29dd634a4c dbug: correct trace for DBUG_RETURN(func()); -- gcc only
when func1 calls func2 from DBUG_RETURN, dbug shows the trace as
| > func1
| < func1
| > func2
| < func2
because DBUG_LEAVE happens before func2(). Change that to invoke
DBUG_LEAVE when the local variable goes out of scope. This uses
gcc specific __attribute__((cleanup)).
2015-11-16 07:55:55 +01:00
Sergei Golubchik
10740939eb 5.5 merge 2014-03-26 22:25:38 +01:00
Sergei Golubchik
434bbc34ad MDEV-5913 Windows: 10.0 crashes on shutdown
add pthread_mutex_destroy(&THR_LOCK_dbug); that was apparently
forgotten since the very first MySQL version
2014-03-24 20:02:08 +01:00
Sergei Golubchik
9af177042e 10.0-base merge.
Partitioning/InnoDB changes are *not* merged (they'll come from 5.6)
TokuDB does not compile (not updated to 10.0 SE API)
2013-09-21 10:14:42 +02:00
Vladislav Vaintroub
3ef0157daa MDEV-4815 - allow multiple mysql_server_init() / mysql_server_end() in the same process, for embedded library.
- Reset  static variables that are used to signal "init done"  for DBUG, in dbug_end()
- Set string server variables to NULL after memory for the value is freed - avoids double free()
- fix DBUG_ASSERTs that happened during reinitialization.
2013-07-29 16:03:41 +02:00
Michael Widenius
068c61978e Temporary commit of 10.0-merge 2013-03-26 00:03:13 +02:00
Michael Widenius
cee888acb3 Fixed compiler warnings (A few of these was bugs)
client/mysqldump.c:
  Slave needs to be initialized with 0
dbug/dbug.c:
  Removed not existing function
plugin/semisync/semisync_master.cc:
  Fixed compiler warning
sql/opt_range.cc:
  thd needs to be set early as it's used in some error conditions.
sql/sql_table.cc:
  Changed to use uchar* to make array indexing portable
storage/innobase/handler/ha_innodb.cc:
  Removed not used variable
storage/maria/ma_delete.c:
  Fixed compiler warning
storage/maria/ma_write.c:
  Fixed compiler warning
2012-08-13 22:23:28 +03:00
Sergei Golubchik
6f79b3fa83 fix a memory leak in dbug 2012-03-24 21:51:10 +01:00
Sergei Golubchik
619f67b1b4 mdev-200 set session dbug resets the output to stderr.
it makes "./mtr --debug" unusable

revert the mysql fix for bug#46165.
implement shared FILE's with reference counting
2012-03-23 20:49:47 +01:00
unknown
9305f2b52f Merge latest MariaDB 5.5 into MWL#192: Non-blocking client library. 2012-02-22 12:14:34 +01:00
unknown
f6b68a1070 Merge MWL#192: Non-blocking client library, into MariaDB 5.5. 2012-02-21 22:15:44 +01:00
unknown
a03d846576 Fix memory leak when one +O debug on top of another. 2012-02-08 21:55:40 +01:00
Sergei Golubchik
506984181b fixes for opensolaris compilation failures 2012-01-05 18:56:31 +01:00
Sergei Golubchik
6cc9d0ffa0 move safemalloc out of dbug.
remeber a real backtrace for every allocation.
make safemalloc to tract C++ new/delete too.
collateral fixes to make the test suite pass.
2011-12-12 22:58:24 +01:00
Vladislav Vaintroub
5beb816a7e Make it possible to compile without SAFEMALLOC in debug builds
Default to no SAFEMALLOC on Windows, because C runtime malloc
has this functionslity already
2011-12-02 14:35:26 +01:00
Sergei Golubchik
6edd76785c merge 2011-11-03 23:39:53 +01:00
Sergei Golubchik
0e007344ea mysql-5.5.18 merge 2011-11-03 19:17:05 +01:00
Sergei Golubchik
7714adaef8 build on windows 2011-11-02 12:26:30 +01:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
unknown
a5b881594d MWL#192: Non-blocking client API for libmysqlclient.
All client functions that can block on I/O have alternate _start() and
_cont() versions that do not block but return control back to the
application, which can then issue I/O wait in its own fashion and later
call back into the library to continue the operation.

Works behind the scenes by spawning a co-routine/fiber to run the
blocking operation and suspend it while waiting for I/O. This
co-routine/fiber use is invisible to applications.

For i368/x86_64 on GCC, uses very fast assembler co-routine support. On
Windows uses native Win32 Fibers. Falls back to POSIX ucontext on other
platforms. Assembler routines for more platforms are relatively easy to
add by extending mysys/my_context.c, eg. similar to the Lua lcoco
library.

For testing, mysqltest and mysql_client_test are extended with the
option --non-blocking-api. This causes the programs to use the
non-blocking API for database access. mysql-test-run.pl has a similar
option --non-blocking-api that uses this, as well as additional
testcases.

An example program tests/async_queries.c is included that uses the new
non-blocking API with libevent to show how, in a single-threaded
program, to issue many queries in parallel against a database.


client/async_example.c:
  Fix const warning
  ******
  Fix bug with wrong timeout value for poll().
include/Makefile.am:
  Fix missing include for `make dist`
include/mysql.h:
  Add prototypes for all non-blocking API calls.
include/mysql.h.pp:
  Add prototypes for all non-blocking API calls.
mysys/my_context.c:
  Fix type warning for makecontext() function pointer argument.
sql-common/mysql_async.c:
  Fix crashes in the non-blocking API for functions that can take MYSQL argument
  that is NULL.
tests/Makefile.am:
  Add header file to `make dist`
tests/mysql_client_test.c:
  Replace blocking calls with wrappers around the non-blocking calls, used in
  mysql_client_test to test the new non-blocking API.
tests/nonblock-wrappers.h:
  Replace blocking calls with wrappers around the non-blocking calls, used in
  mysql_client_test to test the new non-blocking API.
2011-09-20 12:49:25 +02:00
Sergei Golubchik
172f5e28ba add safemalloc back
... but differently

client/mysqltest.cc:
  my_safe_print_str() don't append \n anymore
dbug/dbug.c:
  restore safemalloc as a part of dbug suite
dbug/user.r:
  restore 'S' flag documentation
include/my_dbug.h:
  restore safemalloc as a part of dbug suite
include/my_sys.h:
  move valgrind defines to a dedicated header
mysys/my_malloc.c:
  use new safemalloc
mysys/stacktrace.c:
  don't append \n. let the calller do it, if needed
sql/mysqld.cc:
  my_safe_print_str() don't append \n anymore
2011-07-10 19:55:54 +02:00
Sergei Golubchik
02b8232629 small dbug cleanup 2011-07-10 19:50:29 +02:00
Davi Arnaut
71e0ff64f0 Bug#12727287: Maintainer mode compilation fails with gcc 4.6
GCC 4.6 has new -Wunused-but-set-variable flag, which is enabled
by -Wall, that causes GCC to emit a warning whenever a local variable
is assigned to, but otherwise unused (aside from its declaration).

Since the maintainer mode uses -Wall and -Werror, source code which
triggers these warnings will be rejected. That is, these warnings
become hard errors.

The solution is to fix the code which triggers these specific warnings.
In most of the cases, this is a welcome cleanup as code which triggers
this warning is probably dead anyway.

dbug/dbug.c:
  Unused but set.
libmysqld/lib_sql.cc:
  Length is not necessary as the converted error message is always
  null-terminated.
sql/item_func.cc:
  Make get_var_with_binlog private to this compilation unit.
  If a error was raised, do not attempt to evaluate the user
  variable as the statement execution will be interrupted
  anyway.
sql/mysqld.cc:
  Use a void expression to silence the warning. Avoids the use of
  macros that would make the code more unreadable than it already is.
sql/protocol.cc:
  Length is not necessary as the converted error message is always
  null-terminated. Remove unnecessary casts and assignment.
sql/sql_class.h:
  Function is only used in a single compilation unit.
sql/sql_load.cc:
  Only use the variable outside of EMBEDDED_LIBRARY.
storage/innobase/btr/btr0cur.c:
  Do not retrieve field, only the record length is being used.
storage/perfschema/pfs.cc:
  Use a void expression to silence the warning.
tests/mysql_client_test.c:
  Unused but set.
unittest/mysys/lf-t.c:
  Unused but set.
2011-07-07 08:22:43 -03:00
Sergei Golubchik
9809f05199 5.5-merge 2011-07-02 22:08:51 +02:00
Sergei Golubchik
0accbd0364 lots of post-merge changes 2011-04-25 17:22:25 +02:00
Michael Widenius
139a2b64bf Merge with 5.2 2011-03-09 15:47:59 +02:00
Michael Widenius
39616eb9ef Fixed compiler warnings and some test failures found by buildbot
dbug/dbug.c:
  Fixed compiler warnings on windows
mysql-test/r/index_intersect_innodb.result:
  Don't print number of rows as this varies
mysql-test/suite/funcs_1/r/processlist_val_no_prot.result:
  Update to use new State
mysql-test/suite/handler/heap.result:
  Update results
mysql-test/suite/handler/heap.test:
  Changed key used in test as the key 'b' will not guarantee order of the two last elements (as the key value is the same)
mysql-test/suite/pbxt/r/lock_multi.result:
  Update to use new State
mysql-test/t/index_intersect.test:
  Don't print number of rows as this varies
mysql-test/valgrind.supp:
  Added suppression for linux
mysys/hash.c:
  Fixed compiler warnings on windows
plugin/handler_socket/handlersocket/database.cpp:
  Fixed compiler warnings
sql-common/client_plugin.c:
  Changed variable to define to avoid compiler warnings when variable is not used
sql-common/my_time.c:
  Initialize all my_time elements to avoid compiler warnings
storage/oqgraph/ha_oqgraph.cc:
  Use right function (to avoid compiler warning)
storage/pbxt/src/table_xt.cc:
  Initialize variables (to avoid compiler warnings)
2011-02-23 02:06:58 +02:00
Michael Widenius
58bb0769bd Merge with MySQL 5.1.55
- Fixed some issues with partitions and connection_string, which also fixed lp:716890 "Pre- and post-recovery crash in Aria"
- Fixed wrong assert in Aria

Now need to merge with latest xtradb before pushing 

sql/ha_partition.cc:
  Ensure that m_ordered_rec_buffer is not freed before close.
sql/mysqld.cc:
  Changed to use opt_stack_trace instead of opt_pstack.
  Removed references to pstack
sql/partition_element.h:
  Ensure that connect_string is initialized
storage/maria/ma_key_recover.c:
  Fixed wrong assert
2011-02-20 18:51:43 +02:00
Magne Mahre
8ede0759c3 Remove configuration preprocessor symbols 'THREAD'
and 'THREAD_SAFE_CLIENT'.
  
As of MySQL 5.5, we no longer support non-threaded
builds.   This patch removes all references to the
obsolete THREAD and THREAD_SAFE_CLIENT preprocessor
symbols.  These were used to distinguish between
threaded and non-threaded builds.
2011-01-11 10:07:37 +01:00
Tor Didriksen
fda6290041 Bug #58426 Crashing tests not failing as they are supposed to on Solaris 10 debug
On this platform we seem to get lots of other signals
while waiting for SIGKILL to be delivered.

Solution: use sigsuspend(<all signals blocked>)



dbug/dbug.c:
  New function _db_suicide_() which does kill(myself, -9) and then waits forever.
include/my_dbug.h:
  Let DBUG_SUICE wait forever until the KILL signal is delivered, and process dies.
2010-12-13 17:13:01 +01:00
Tor Didriksen
8d311a8551 Automerge 5.1-bugteam => 5.5-bugteam 2010-12-13 17:13:31 +01:00
Tor Didriksen
0611bf2203 Bug #58426 Crashing tests not failing as they are supposed to on Solaris 10 debug
On this platform we seem to get lots of other signals
while waiting for SIGKILL to be delivered.

Solution: use sigsuspend(<all signals blocked>)



dbug/dbug.c:
  New function _db_suicide_() which does kill(myself, -9) and then waits forever.
include/my_dbug.h:
  Let DBUG_SUICE wait forever until the KILL signal is delivered, and process dies.
2010-12-13 12:19:30 +01:00
Sergei Golubchik
65ca700def merge.
checkpoint.
does not compile.
2010-11-25 18:17:28 +01:00
Michael Widenius
1a6373e8e2 Merge with MySQL 5.1.53
Open issues:
- A better fix for #57688; Igor is working on this
- Test failure in index_merge_innodb.test ; Igor promised to look at this
- Some Innodb tests fails (need to merge with latest xtradb) ; Kristian promised to look at this.
 - Failing tests: innodb_plugin.innodb_bug56143 innodb_plugin.innodb_bug56632 innodb_plugin.innodb_bug56680 innodb_plugin.innodb_bug57255 
- Werror is disabled;  Should be enabled after merge with xtradb.
2010-11-25 00:57:34 +02:00
Michael Widenius
b52020221e Merge with MySQL 5.1.52 2010-11-23 23:39:59 +02:00
Michael Widenius
3bac9cf7fe Fixed compile error when not using gcc (crashes at least on windows) 2010-11-03 21:02:23 +02:00
Michael Widenius
20acfbf30d Fix for: LP #634955: Assert in _ma_update_at_original_place()
Added locking of lock mutex when updating status in external_unlock() for Aria and MyISAM tables.
Fixed that 'source' command doesn't cause mysql command line tool to exit on error.
DEBUG_EXECUTE() and DEBUG_EVALUATE_IF() should not execute things based on wildcards. (Allows one to run --debug with mysql-test-run scripts that uses @debug)
Fixed several core dump, deadlock and crashed table bugs in handling of LOCK TABLE with MERGE tables:
- Added priority of locks to avoid crashes with MERGE tables.
- Added thr_lock_merge() to allow one to merge two results of thr_lock().
Fixed 'not found row' bug in REPLACE with Aria tables.
Mark MyISAM tables that are part of MERGE with HA_OPEN_MERGE_TABLE and set the locks to have priority THR_LOCK_MERGE_PRIV.
- By sorting MERGE tables last in thr_multi_unlock() it's safer to release and relock them many times (can happen when TRIGGERS are created)
Avoid printing (null) in debug file (to easier find out wrong NULL pointer usage with %s).



client/mysql.cc:
  Fixed that 'source' command doesn't cause mysql command line tool to exit on error.
client/mysqltest.cc:
  Don't send NULL to fn_format(). (Can cause crash on Solaris when using --debug)
dbug/dbug.c:
  DEBUG_EXECUTE() and DEBUG_EVALUATE_IF() should not execute things based on wildcards.
include/my_base.h:
  Added flag to signal if one opens a MERGE table.
  Added extra() command to signal that one is not part of a MERGE table anymore.
include/thr_lock.h:
  Added priority for locks (needed to fix bug in thr_lock when using MERGE tables)
  Added option to thr_unlock() if get_status() should be called.
  Added prototype for thr_merge_locks().
mysql-test/mysql-test-run.pl:
  Ignore crashed table warnings for tables named 'crashed'.
mysql-test/r/merge.result:
  Renamed triggers to make debugging easier.
  Added some CHECK TABLES to catch errors earlier.
  Additional tests.
mysql-test/r/merge_debug.result:
  Test of error handling when reopening MERGE tables.
mysql-test/r/udf_query_cache.result:
  Added missing flush status
mysql-test/suite/parts/r/partition_repair_myisam.result:
  Update results
mysql-test/t/merge.test:
  Renamed triggers to make debugging easier.
  Added some CHECK TABLES to catch errors earlier.
  Additional tests.
mysql-test/t/merge_debug.test:
  Test of error handling when reopening MERGE tables.
mysql-test/t/udf_query_cache.test:
  Added missing flush status
mysys/my_getopt.c:
  Removed not used variable
mysys/my_symlink2.c:
  Changed (null) to (NULL) to make it easier to find NULL arguments to DBUG_PRINT() functions.
  (On linux, NULL to sprintf is printed 'null')
mysys/thr_lock.c:
  Added priority of locks to avoid crashes with MERGE tables.
  Added thr_lock_merge() to allow one to merge two results of thr_lock().
  - This is needed for MyISAM as all locked table must share the same status. If not, you will not see newly inserted rows in other instances of the table.
  If calling thr_unlock() with THR_UNLOCK_UPDATE_STATUS, call update_status() and restore_status() for the locks. This is needed in some rare cases where we call thr_unlock() followed by thr_lock() without calling external_unlock/external_lock in between.
  Simplify loop in thr_multi_lock().
  Added 'start_trans', which is called at end of thr_multi_lock() when all locks are taken.
  - This was needed by Aria to ensure that transaction is started when we got all locks, not at get_status(). Without this, some rows could not be visible when we lock two tables at the same time, causing REPLACE using two tables to fail unexpectedly.
sql/handler.cc:
  Add an assert() in handler::print_error() for "impossible errors" (like table is crashed) when --debug-assert-if-crashed-table is used.
sql/lock.cc:
  Simplify mysql_lock_tables() code if get_lock_data() returns 0 locks.
  Added new parameter to thr_multi_unlock()
  In mysql_unlock_read_tables(), call first externa_unlock(), then thr_multi_unlock();  This is same order as we do in mysql_unlock_tables().
  Don't abort locks in mysql_lock_abort() for merged tables when a MERGE table is deleted; Would cause a spin lock.
  Added call to thr_merge_locks() in mysql_lock_merge() to ensure consistency in thr_locks().
  - New locks of same type and table is stored after the old lock to ensure that we get the status from the original lock.
sql/mysql_priv.h:
  Added debug_assert_if_crashed_table
sql/mysqld.cc:
  Added --debug-assert-if-crashed-table
sql/parse_file.cc:
  Don't print '(null)' in DBUG_PRINT of no dir given
sql/set_var.cc:
  Increase default size of buffer for @debug variable.
sql/sql_base.cc:
  In case of error from reopen_table() in reopen_tables(), call unlock_open_table() and restart loop.
  - This fixed bug when we twice deleted same table from open_cache.
  Don't take name lock for already name locked table in open_unireg_entry().
  - Fixed bug when doing repair in reopen_table().
  - In detach_merge_children(), always detach if 'clear_refs' is given. We can't trust parent->children_attached as this function can be called twice, first time with clear_refs set to 0.
sql/sql_class.cc:
  Changed printing of (null) to "" in set_thd_proc_info()
sql/sql_parse.cc:
  Added DBUG
sql/sql_trigger.cc:
  Don't call unlink_open_table() if reopen_table() fails as the table may already be freed.
storage/maria/ma_bitmap.c:
  Fixed DBUG_ASSERT() in allocate_tail()
storage/maria/ma_blockrec.c:
  Fixed wrong calculation of row length for very small rows in undo_row_update().
  - Fixes ASSERT() when doing undo.
storage/maria/ma_blockrec.h:
  Added _ma_block_start_trans() and _ma_block_start_trans_no_versioning()
storage/maria/ma_locking.c:
  Call _ma_update_status_with_lock() when releasing write locks.
  - Fixes potential problem with updating status without the proper lock.
storage/maria/ma_open.c:
  Changed to use start_trans() instead of get_status() to ensure that we see all rows in all locked tables when we got the locks.
  - Fixed 'not found row' bug in REPLACE with Aria tables.
storage/maria/ma_state.c:
  Added _ma_update_status_with_lock() and _ma_block_start_trans().
  This is to ensure that we see all rows in all locked tables when we got the locks.
storage/maria/ma_state.h:
  Added _ma_update_status_with_lock()
storage/maria/ma_write.c:
  More DBUG_PRINT
storage/myisam/mi_check.c:
  Fixed error message
storage/myisam/mi_extra.c:
  Added HA_EXTRA_DETACH_CHILD:
  - Detach MyISAM table to not be part of MERGE table (remove flag & lock priority).
storage/myisam/mi_locking.c:
  Call mi_update_status_with_lock() when releasing write locks.
  - Fixes potential problem with updating status without the proper lock.
  Change to use new HA_OPEN_MERGE_TABLE flag to test if MERGE table.
  Added mi_fix_status(), called by thr_merge().
storage/myisam/mi_open.c:
  Added marker if part of MERGE table.
  Call mi_fix_status() in thr_lock() for transactional tables.
storage/myisam/myisamdef.h:
  Change my_once_flag to uint, as it stored different values than just 0/1
  Added 'open_flag' to store state given to mi_open()
storage/myisammrg/ha_myisammrg.cc:
  Add THR_LOCK_MERGE_PRIV to THR_LOCK_DATA to get MERGE locks sorted after other types of locks.
storage/myisammrg/myrg_locking.c:
  Remove windows specific code.
storage/myisammrg/myrg_open.c:
  Use HA_OPEN_MERGE_TABLE to mi_open().
  Set HA_OPEN_MERGE_TABLE for linked MyISAM tables.
storage/xtradb/buf/buf0buf.c:
  Fixed compiler warning
storage/xtradb/buf/buf0lru.c:
  Initialize variable that could be used not initialized.
2010-11-02 17:22:57 +02:00
Jon Olav Hauglid
4776282bed Bug #57274 SET GLOBAL debug crashes on Solaris in embedded server mode
(variables_debug fails)

The problem was that "SET GLOBAL debug" could cause a crash on Solaris.
The crash happened if the server failed to open the trace file given in 
the "SET GLOBAL debug" statement. This caused an error message to be
printed to stderr containing the process name. However, printing to
stderr crashed the server since the pointer to the process name had
not been initialized.

This patch fixes the problem by initializing the process name 
properly when doing "SET GLOBAL debug".

No test case added as this bug was repeatable with existing test
coverage in variables_debug.test.
2010-10-19 10:19:57 +02:00
Tor Didriksen
af665ea977 Bug#52172 post-push fix: init auto-variable to NULL 2010-10-19 09:06:48 +02:00
Jon Olav Hauglid
87b91752f9 Merge from mysql-5.1-bugteam to mysql-5.5-bugteam
No conflicts
2010-10-19 10:30:26 +02:00
Tor Didriksen
ebe356cb32 automerge from 5.1-bugteam: Bug#52172 post-push fix: init auto-variable to NULL 2010-10-19 09:17:26 +02:00
Tor Didriksen
9074307102 Bug#52172 test binlog.binlog_index needs --skip-core-file to avoid leaving core files
For crash testing: kill the server without generating core file.

include/my_dbug.h
  Use kill(getpid(), SIGKILL) which cannot be caught by signal handlers.
  All DBUG_XXX macros should be no-ops in optimized mode, do that for DBUG_ABORT as well.
sql/handler.cc
  Kill server without generating core.
sql/log.cc
  Kill server without generating core.
2010-10-18 13:24:34 +02:00
Michael Widenius
01672cc026 Fixes for bugs found by running test case for LP#608369 "Page: 1 Found wrong page type 0' on CHECK TABLE EXTENDED"
Fixed overflow when using long --debug=xxxxxx line.
Fixed that "mysqld --disable-debug --debug" works.
Ensure that MariaDB doesn't start if the Aria engine didn't start and we are using Aria for temporary tables.
More DBUG_ASSERT() and more info in debug log.


dbug/dbug.c:
  Fixed crash in mysqld caused by an overflow when using long --debug=xxxxxx line
sql/mysqld.cc:
  Fixed that "mysqld --disable-debug --debug" works.
  Documented myisam-recover=OFF option
storage/maria/ha_maria.cc:
  Ensure that MariaDB doesn't start if the Aria engine didn't start and we are using Aria for temporary tables.
storage/maria/ma_delete.c:
  Added missing write of changed key on node page.
  This could fix LP#608369 "Page: 1 Found wrong page type 0' on CHECK TABLE EXTENDED"
  Changed so that we log page numbers (not positions)
  Added KEY_OP_DEBUG_2 log entry to get more debug information into the log
storage/maria/ma_key_recover.c:
  Changed so that we log page numbers (not positions)
  In case of wrong page information after index_redo, dump pages to debug log
storage/maria/ma_loghandler.h:
  Added KEY_OP_DEBUG_2
storage/maria/ma_search.c:
  Changed so that we log page numbers (not positions)
storage/maria/ma_write.c:
  Changed so that we log page numbers (not positions)
2010-10-13 18:15:43 +03:00
Alexey Kopytov
d72c594739 Manual merge from mysql-5.1-bugteam into mysql-5.5-bugteam.
conflicts:
   conflict      dbug/dbug.c
   conflict      sql/sql_load.cc
2010-10-02 00:12:27 +04:00
Jon Olav Hauglid
7f80cffa52 Bug #46165 server crash in dbug
This crash occured if the same debug trace file was closed twice,
leading to the same memory being free'd twice. This could occur
if the "debug" server system variable refered to the same trace
file in both global and session scope.

Example of an order of events that would lead to a crash:
1) Enable debug tracing to a trace file (global scope)
2) Enable debug tracing to the same trace file (session scope)
3) Reset debug settings (global scope)
4) Reset debug settings (session scope)

This caused a crash because the trace file was, by mistake, closed
in 3), leading to the same memory being free'd twice when the file
was closed again in 4).

Internally, the debug settings are stored in a stack, with session
settings (if any) on top and the global settings below. Each connection
has its own stack. When a set of settings is changed, it must be 
determined if its debug trace file is to be closed. Before, this was done
by only checking below on the settings stack. So if the global settings
were changed, an existing debug trace file reference in session settings
would be missed. This caused the file to be closed even if it was in use,
leading to a crash later when it was closed again.

This patch fixes the problem by preventing the trace file from being shared
between global and session settings. If session debug settings are set without
specifying a new trace file, stderr is used for output. This is a change
in behaviour and should be reflected in the documentation.

Test case added to variables.test.
2010-09-28 11:07:58 +02:00