mirror of
https://github.com/MariaDB/server.git
synced 2025-07-18 23:03:28 +03:00
- Major rewrite of ddl_log.cc and ddl_log.h - ddl_log.cc described in the beginning how the recovery works. - ddl_log.log has unique signature and is dynamic. It's easy to add more information to the header and other ddl blocks while still being able to execute old ddl entries. - IO_SIZE for ddl blocks is now dynamic. Can be changed without affecting recovery of old logs. - Code is more modular and is now usable outside of partition handling. - Renamed log file to dll_recovery.log and added option --log-ddl-recovery to allow one to specify the path & filename. - Added ddl_log_entry_phase[], number of phases for each DDL action, which allowed me to greatly simply set_global_from_ddl_log_entry() - Changed how strings are stored in log entries, which allows us to store much more information in a log entry. - ddl log is now always created at start and deleted on normal shutdown. This simplices things notable. - Added probes debug_crash_here() and debug_simulate_error() to simply crash testing and allow crash after a given number of times a probe is executed. See comments in debug_sync.cc and rename_table.test for how this can be used. - Reverting failed table and view renames is done trough the ddl log. This ensures that the ddl log is tested also outside of recovery. - Added helper function 'handler::needs_lower_case_filenames()' - Extend binary log with Q_XID events. ddl log handling is using this to check if a ddl log entry was logged to the binary log (if yes, it will be deleted from the log during ddl_log_close_binlogged_events() - If a DDL entry fails 3 time, disable it. This is to ensure that if we have a crash in ddl recovery code the server will not get stuck in a forever crash-restart-crash loop. mysqltest.cc changes: - --die will now replace $variables with their values - $error will contain the error of the last failed statement storage engine changes: - maria_rename() was changed to be more robust against crashes during rename.
65 lines
2.2 KiB
C++
65 lines
2.2 KiB
C++
#ifndef DEBUG_SYNC_INCLUDED
|
|
#define DEBUG_SYNC_INCLUDED
|
|
|
|
/* Copyright (c) 2009, 2010, Oracle and/or its affiliates.
|
|
|
|
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
|
|
|
/**
|
|
@file
|
|
|
|
Declarations for the Debug Sync Facility. See debug_sync.cc for details.
|
|
*/
|
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
|
#pragma interface /* gcc class implementation */
|
|
#endif
|
|
|
|
class THD;
|
|
|
|
#if defined(ENABLED_DEBUG_SYNC)
|
|
|
|
/* Command line option --debug-sync-timeout. See mysqld.cc. */
|
|
extern MYSQL_PLUGIN_IMPORT 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);
|
|
void debug_sync_reset_thread(THD *thd);
|
|
extern bool debug_sync_set_action(THD *thd, const char *action_str, size_t len);
|
|
extern bool debug_sync_update(THD *thd, char *val_str, size_t len);
|
|
extern uchar *debug_sync_value_ptr(THD *thd);
|
|
#else
|
|
static inline void debug_sync_init_thread(THD *thd) {}
|
|
static inline void debug_sync_end_thread(THD *thd) {}
|
|
static inline void debug_sync_reset_thread(THD *thd) {}
|
|
static inline bool debug_sync_set_action(THD *, const char *, size_t)
|
|
{ return false; }
|
|
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
|
|
|
#ifndef DBUG_OFF
|
|
void debug_crash_here(const char *keyword);
|
|
bool debug_simulate_error(const char *keyword, uint error);
|
|
#else
|
|
#define debug_crash_here(A) do { } while(0)
|
|
#define debug_simulate_error(A, B) 0
|
|
#endif
|
|
|
|
#endif /* DEBUG_SYNC_INCLUDED */
|