mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
c3cd608aef
DBUG_SYNC_POINT has at least one strong limitation that it's not defined on all platforms. It has issues cooperating with @@debug. All in all its functionality is superseded by DEBUG_SYNC facility and there is no reason to maintain the old less flexible one. Fixed with adding debug_sync_set_action() function as a facility to set up a sync-action in the server sources code and re-writing existing simulations (found 3) to use it. Couple of tests have been reworked as well. The patch offers a pattern for setting sync-points in replication threads where the standard DEBUG_SYNC does not suffice to reach goals. mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test: rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based; a pattern of usage DEBUG_SYNC for replication testing is provided. mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result: results are changed. mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test: rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based; limiting the test to run only with MIXED binlog-format as the test last some 10 secs sensitively contributing to the total of tests run. mysql-test/suite/rpl/t/rpl_show_slave_running.test: rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based. sql/debug_sync.cc: adding debug_sync_set_action() function as a facility to set up a sync-action in the server sources code. sql/debug_sync.h: externalizing debug_sync_set_action(). sql/item_func.cc: purging sources from DBUG_SYNC_POINT. sql/mysql_priv.h: purging sources from DBUG_SYNC_POINT. sql/slave.cc: rewriting failure simulations to base on DEBUG_SYNC rather than GET_LOCK()-based DBUG_SYNC_POINT. sql/sql_repl.cc: removing an orphan failure simulation line because no counterpart in tests existing.
61 lines
2.1 KiB
C++
61 lines
2.1 KiB
C++
#ifndef DEBUG_SYNC_INCLUDED
|
|
#define DEBUG_SYNC_INCLUDED
|
|
|
|
/* Copyright (C) 2008 Sun Microsystems, Inc.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
/**
|
|
@file
|
|
|
|
Declarations for the Debug Sync Facility. See debug_sync.cc for details.
|
|
*/
|
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
|
#pragma interface /* gcc class implementation */
|
|
#endif
|
|
|
|
#include <my_global.h>
|
|
|
|
class THD;
|
|
|
|
#if defined(ENABLED_DEBUG_SYNC)
|
|
|
|
/* Macro to be put in the code at synchronization points. */
|
|
#define DEBUG_SYNC(_thd_, _sync_point_name_) \
|
|
do { if (unlikely(opt_debug_sync_timeout)) \
|
|
debug_sync(_thd_, STRING_WITH_LEN(_sync_point_name_)); \
|
|
} while (0)
|
|
|
|
/* Command line option --debug-sync-timeout. See mysqld.cc. */
|
|
extern uint opt_debug_sync_timeout;
|
|
|
|
/* Default WAIT_FOR timeout if command line option is given without argument. */
|
|
#define DEBUG_SYNC_DEFAULT_WAIT_TIMEOUT 300
|
|
|
|
/* Debug Sync prototypes. See debug_sync.cc. */
|
|
extern int debug_sync_init(void);
|
|
extern void debug_sync_end(void);
|
|
extern void debug_sync_init_thread(THD *thd);
|
|
extern void debug_sync_end_thread(THD *thd);
|
|
extern void debug_sync(THD *thd, const char *sync_point_name, size_t name_len);
|
|
extern bool debug_sync_set_action(THD *thd, const char *action_str, size_t len);
|
|
|
|
#else /* defined(ENABLED_DEBUG_SYNC) */
|
|
|
|
#define DEBUG_SYNC(_thd_, _sync_point_name_) /* disabled DEBUG_SYNC */
|
|
|
|
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
|
|
|
#endif /* DEBUG_SYNC_INCLUDED */
|