Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
496a14e1
Commit
496a14e1
authored
May 14, 2021
by
Monty
Committed by
Sergei Golubchik
May 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move debug_crash_here to it's own source files
parent
ad02d53a
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
151 additions
and
102 deletions
+151
-102
libmysqld/CMakeLists.txt
libmysqld/CMakeLists.txt
+2
-1
sql/CMakeLists.txt
sql/CMakeLists.txt
+1
-1
sql/debug.cc
sql/debug.cc
+88
-0
sql/debug.h
sql/debug.h
+39
-0
sql/debug_sync.cc
sql/debug_sync.cc
+0
-71
sql/debug_sync.h
sql/debug_sync.h
+0
-9
sql/parse_file.cc
sql/parse_file.cc
+1
-1
sql/sql_db.cc
sql/sql_db.cc
+1
-1
sql/sql_insert.cc
sql/sql_insert.cc
+2
-2
sql/sql_rename.cc
sql/sql_rename.cc
+1
-1
sql/sql_table.cc
sql/sql_table.cc
+2
-2
sql/sql_trigger.cc
sql/sql_trigger.cc
+3
-2
sql/sql_view.cc
sql/sql_view.cc
+10
-10
storage/maria/ha_maria.cc
storage/maria/ha_maria.cc
+1
-1
No files found.
libmysqld/CMakeLists.txt
View file @
496a14e1
...
@@ -78,7 +78,8 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
...
@@ -78,7 +78,8 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_binlog.cc ../sql/sql_manager.cc
../sql/sql_binlog.cc ../sql/sql_manager.cc
../sql/sql_parse.cc ../sql/sql_bootstrap.cc
../sql/sql_parse.cc ../sql/sql_bootstrap.cc
../sql/sql_partition.cc ../sql/sql_plugin.cc
../sql/sql_partition.cc ../sql/sql_plugin.cc
../sql/debug_sync.cc ../sql/opt_table_elimination.cc
../sql/debug_sync.cc ../sql/debug.cc
../sql/opt_table_elimination.cc
../sql/sql_prepare.cc ../sql/sql_rename.cc ../sql/sql_repl.cc
../sql/sql_prepare.cc ../sql/sql_rename.cc ../sql/sql_repl.cc
../sql/sql_select.cc ../sql/sql_servers.cc
../sql/sql_select.cc ../sql/sql_servers.cc
../sql/group_by_handler.cc ../sql/derived_handler.cc
../sql/group_by_handler.cc ../sql/derived_handler.cc
...
...
sql/CMakeLists.txt
View file @
496a14e1
...
@@ -117,7 +117,7 @@ SET (SQL_SOURCE
...
@@ -117,7 +117,7 @@ SET (SQL_SOURCE
sql_list.cc sql_load.cc sql_manager.cc
sql_list.cc sql_load.cc sql_manager.cc
sql_parse.cc sql_bootstrap.cc
sql_parse.cc sql_bootstrap.cc
sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc
sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc
debug_sync.cc
debug_sync.cc
debug.cc
sql_repl.cc sql_select.cc sql_show.cc sql_state.c
sql_repl.cc sql_select.cc sql_show.cc sql_state.c
group_by_handler.cc derived_handler.cc select_handler.cc
group_by_handler.cc derived_handler.cc select_handler.cc
sql_statistics.cc sql_string.cc lex_string.h
sql_statistics.cc sql_string.cc lex_string.h
...
...
sql/debug.cc
0 → 100644
View file @
496a14e1
/* Copyright (c) 2021, MariaDB Corporation.
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,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
#include "mariadb.h"
#include "sql_class.h"
#include "debug.h"
/**
Debug utility to do crash after a set number of executions
The user variable, either @debug_crash_counter or @debug_error_counter,
is decremented each time debug_crash() or debug_simulate_error is called
if the keyword is set with @@debug_push, like
@@debug_push="d+frm_data_type_info_emulate"
If the variable is not set or is not an integer it will be ignored.
*/
#ifndef DBUG_OFF
static
const
LEX_CSTRING
debug_crash_counter
=
{
STRING_WITH_LEN
(
"debug_crash_counter"
)
};
static
const
LEX_CSTRING
debug_error_counter
=
{
STRING_WITH_LEN
(
"debug_error_counter"
)
};
static
bool
debug_decrement_counter
(
const
LEX_CSTRING
*
name
)
{
THD
*
thd
=
current_thd
;
user_var_entry
*
entry
=
(
user_var_entry
*
)
my_hash_search
(
&
thd
->
user_vars
,
(
uchar
*
)
name
->
str
,
name
->
length
);
if
(
!
entry
||
entry
->
type
!=
INT_RESULT
||
!
entry
->
value
)
return
0
;
(
*
(
ulonglong
*
)
entry
->
value
)
=
(
*
(
ulonglong
*
)
entry
->
value
)
-
1
;
return
!*
(
ulonglong
*
)
entry
->
value
;
}
void
debug_crash_here
(
const
char
*
keyword
)
{
DBUG_ENTER
(
"debug_crash_here"
);
DBUG_PRINT
(
"enter"
,
(
"keyword: %s"
,
keyword
));
DBUG_EXECUTE_IF
(
keyword
,
if
(
debug_decrement_counter
(
&
debug_crash_counter
))
{
my_printf_error
(
ER_INTERNAL_ERROR
,
"Crashing at %s"
,
MYF
(
ME_ERROR_LOG
|
ME_NOTE
),
keyword
);
DBUG_SUICIDE
();
});
DBUG_VOID_RETURN
;
}
/*
This can be used as debug_counter to simulate an error at a specific
position.
Typical usage would be
if (debug_simualte_error("keyword"))
error= 1;
*/
bool
debug_simulate_error
(
const
char
*
keyword
,
uint
error
)
{
DBUG_ENTER
(
"debug_crash_here"
);
DBUG_PRINT
(
"enter"
,
(
"keyword: %s"
,
keyword
));
DBUG_EXECUTE_IF
(
keyword
,
if
(
debug_decrement_counter
(
&
debug_error_counter
))
{
my_printf_error
(
error
,
"Simulating error for '%s'"
,
MYF
(
ME_ERROR_LOG
),
keyword
);
DBUG_RETURN
(
1
);
});
DBUG_RETURN
(
0
);
}
#endif
/* DBUG_OFF */
sql/debug.h
0 → 100644
View file @
496a14e1
#ifndef DEBUG_INCLUDED
#define DEBUG_INCLUDED
/* Copyright (c) 2021, MariaDB Corporation
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 debug_crash_here and other future mariadb server debug
functionality.
*/
/* debug_crash_here() functionallity.
See mysql_test/suite/atomic/create_table.test for an example of how it
can be used
*/
#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_INCLUDED */
sql/debug_sync.cc
View file @
496a14e1
...
@@ -1628,74 +1628,3 @@ bool debug_sync_set_action(THD *thd, const char *action_str, size_t len)
...
@@ -1628,74 +1628,3 @@ bool debug_sync_set_action(THD *thd, const char *action_str, size_t len)
/* prevent linker/lib warning about file without public symbols */
/* prevent linker/lib warning about file without public symbols */
int
debug_sync_dummy
;
int
debug_sync_dummy
;
#endif
/* defined(ENABLED_DEBUG_SYNC) */
#endif
/* defined(ENABLED_DEBUG_SYNC) */
/**
Debug utility to do crash after a set number of executions
The user variable, either @debug_crash_counter or @debug_error_counter,
is decremented each time debug_crash() or debug_simulate_error is called
if the keyword is set with @@debug_push, like
@@debug_push="d+frm_data_type_info_emulate"
If the variable is not set or is not an integer it will be ignored.
*/
#ifndef DBUG_OFF
static
const
LEX_CSTRING
debug_crash_counter
=
{
STRING_WITH_LEN
(
"debug_crash_counter"
)
};
static
const
LEX_CSTRING
debug_error_counter
=
{
STRING_WITH_LEN
(
"debug_error_counter"
)
};
static
bool
debug_decrement_counter
(
const
LEX_CSTRING
*
name
)
{
THD
*
thd
=
current_thd
;
user_var_entry
*
entry
=
(
user_var_entry
*
)
my_hash_search
(
&
thd
->
user_vars
,
(
uchar
*
)
name
->
str
,
name
->
length
);
if
(
!
entry
||
entry
->
type
!=
INT_RESULT
||
!
entry
->
value
)
return
0
;
(
*
(
ulonglong
*
)
entry
->
value
)
=
(
*
(
ulonglong
*
)
entry
->
value
)
-
1
;
return
!*
(
ulonglong
*
)
entry
->
value
;
}
void
debug_crash_here
(
const
char
*
keyword
)
{
DBUG_ENTER
(
"debug_crash_here"
);
DBUG_PRINT
(
"enter"
,
(
"keyword: %s"
,
keyword
));
DBUG_EXECUTE_IF
(
keyword
,
if
(
debug_decrement_counter
(
&
debug_crash_counter
))
{
my_printf_error
(
ER_INTERNAL_ERROR
,
"Crashing at %s"
,
MYF
(
ME_ERROR_LOG
|
ME_NOTE
),
keyword
);
DBUG_SUICIDE
();
});
DBUG_VOID_RETURN
;
}
/*
This can be used as debug_counter to simulate an error at a specific
position.
Typical usage would be
if (debug_simualte_error("keyword"))
error= 1;
*/
bool
debug_simulate_error
(
const
char
*
keyword
,
uint
error
)
{
DBUG_ENTER
(
"debug_crash_here"
);
DBUG_PRINT
(
"enter"
,
(
"keyword: %s"
,
keyword
));
DBUG_EXECUTE_IF
(
keyword
,
if
(
debug_decrement_counter
(
&
debug_error_counter
))
{
my_printf_error
(
error
,
"Simulating error for '%s'"
,
MYF
(
ME_ERROR_LOG
),
keyword
);
DBUG_RETURN
(
1
);
});
DBUG_RETURN
(
0
);
}
#endif
/* DBUG_OFF */
sql/debug_sync.h
View file @
496a14e1
...
@@ -52,13 +52,4 @@ static inline void debug_sync_reset_thread(THD *thd) {}
...
@@ -52,13 +52,4 @@ static inline void debug_sync_reset_thread(THD *thd) {}
static
inline
bool
debug_sync_set_action
(
THD
*
,
const
char
*
,
size_t
)
static
inline
bool
debug_sync_set_action
(
THD
*
,
const
char
*
,
size_t
)
{
return
false
;
}
{
return
false
;
}
#endif
/* defined(ENABLED_DEBUG_SYNC) */
#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 */
#endif
/* DEBUG_SYNC_INCLUDED */
sql/parse_file.cc
View file @
496a14e1
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#include "parse_file.h"
#include "parse_file.h"
#include "unireg.h" // CREATE_MODE
#include "unireg.h" // CREATE_MODE
#include "sql_table.h" // build_table_filename
#include "sql_table.h" // build_table_filename
#include "debug
_sync
.h"
#include "debug.h"
#include <mysys_err.h> // EE_WRITE
#include <mysys_err.h> // EE_WRITE
#include <m_ctype.h>
#include <m_ctype.h>
#include <my_dir.h>
#include <my_dir.h>
...
...
sql/sql_db.cc
View file @
496a14e1
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
#ifdef __WIN__
#ifdef __WIN__
#include <direct.h>
#include <direct.h>
#endif
#endif
#include "debug
_sync.h"
#include "debug
.h" // debug_crash_here
#define MAX_DROP_TABLE_Q_LEN 1024
#define MAX_DROP_TABLE_Q_LEN 1024
...
...
sql/sql_insert.cc
View file @
496a14e1
...
@@ -77,10 +77,10 @@
...
@@ -77,10 +77,10 @@
#include "sql_audit.h"
#include "sql_audit.h"
#include "sql_derived.h" // mysql_handle_derived
#include "sql_derived.h" // mysql_handle_derived
#include "sql_prepare.h"
#include "sql_prepare.h"
#include "debug_sync.h" // DEBUG_SYNC
#include "debug.h" // debug_crash_here
#include <my_bit.h>
#include <my_bit.h>
#include "debug_sync.h"
#ifdef WITH_WSREP
#ifdef WITH_WSREP
#include "wsrep_trans_observer.h"
/* wsrep_start_transction() */
#include "wsrep_trans_observer.h"
/* wsrep_start_transction() */
#endif
/* WITH_WSREP */
#endif
/* WITH_WSREP */
...
...
sql/sql_rename.cc
View file @
496a14e1
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#include "sql_handler.h" // mysql_ha_rm_tables
#include "sql_handler.h" // mysql_ha_rm_tables
#include "sql_statistics.h"
#include "sql_statistics.h"
#include "ddl_log.h"
#include "ddl_log.h"
#include "debug
_sync
.h"
#include "debug.h"
/* used to hold table entries for as part of list of renamed temporary tables */
/* used to hold table entries for as part of list of renamed temporary tables */
struct
TABLE_PAIR
struct
TABLE_PAIR
...
...
sql/sql_table.cc
View file @
496a14e1
...
@@ -54,9 +54,9 @@
...
@@ -54,9 +54,9 @@
#include "sql_audit.h"
#include "sql_audit.h"
#include "sql_sequence.h"
#include "sql_sequence.h"
#include "tztime.h"
#include "tztime.h"
#include "sql_insert.h"
// binlog_drop_table
#include "sql_insert.h" // binlog_drop_table
#include "ddl_log.h"
#include "ddl_log.h"
#include "debug
_sync.h"
// debug_crash_here()
#include "debug
.h"
// debug_crash_here()
#include <algorithm>
#include <algorithm>
#ifdef __WIN__
#ifdef __WIN__
...
...
sql/sql_trigger.cc
View file @
496a14e1
...
@@ -33,8 +33,9 @@
...
@@ -33,8 +33,9 @@
#include "sql_handler.h" // mysql_ha_rm_tables
#include "sql_handler.h" // mysql_ha_rm_tables
#include "sp_cache.h" // sp_invalidate_cache
#include "sp_cache.h" // sp_invalidate_cache
#include <mysys_err.h>
#include <mysys_err.h>
#include <ddl_log.h> // ddl_log_state
#include "ddl_log.h" // ddl_log_state
#include "debug_sync.h"
#include "debug_sync.h" // DEBUG_SYNC
#include "debug.h" // debug_crash_here
#include "mysql/psi/mysql_sp.h"
#include "mysql/psi/mysql_sp.h"
/*************************************************************************/
/*************************************************************************/
...
...
sql/sql_view.cc
View file @
496a14e1
...
@@ -16,29 +16,29 @@
...
@@ -16,29 +16,29 @@
*/
*/
#define MYSQL_LEX 1
#define MYSQL_LEX 1
#include "mariadb.h"
/* NO_EMBEDDED_ACCESS_CHECKS */
#include "mariadb.h"
/* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "sql_priv.h"
#include "unireg.h"
#include "unireg.h"
#include "sql_view.h"
#include "sql_view.h"
#include "sql_base.h" // find_table_in_global_list, lock_table_names
#include "sql_base.h"
// find_table_in_global_list, lock_table_names
#include "sql_parse.h"
// sql_parse
#include "sql_parse.h" // sql_parse
#include "sql_cache.h"
// query_cache_*
#include "sql_cache.h" // query_cache_*
#include "lock.h"
// MYSQL_OPEN_SKIP_TEMPORARY
#include "lock.h"
// MYSQL_OPEN_SKIP_TEMPORARY
#include "sql_show.h" // append_identifier
#include "sql_show.h"
// append_identifier
#include "sql_table.h"
// build_table_filename
#include "sql_table.h" // build_table_filename
#include "sql_db.h" // mysql_opt_change_db, mysql_change_db
#include "sql_db.h" // mysql_opt_change_db, mysql_change_db
#include "sql_select.h"
#include "sql_select.h"
#include "parse_file.h"
#include "parse_file.h"
#include "sp_head.h"
#include "sp_head.h"
#include "sp.h"
#include "sp.h"
#include "sp_cache.h"
#include "sp_cache.h"
#include "datadict.h" // dd_frm_is_view()
#include "datadict.h"
// dd_frm_is_view()
#include "sql_derived.h"
#include "sql_derived.h"
#include "sql_cte.h" // check_dependencies_in_with_clauses()
#include "sql_cte.h"
// check_dependencies_in_with_clauses()
#include "opt_trace.h"
#include "opt_trace.h"
#include "ddl_log.h"
#include "ddl_log.h"
#include "debug.h" // debug_crash_here
#include "wsrep_mysqld.h"
#include "wsrep_mysqld.h"
#include "debug_sync.h" // debug_crash_here
#define MD5_BUFF_LENGTH 33
#define MD5_BUFF_LENGTH 33
...
...
storage/maria/ha_maria.cc
View file @
496a14e1
...
@@ -45,7 +45,7 @@ C_MODE_END
...
@@ -45,7 +45,7 @@ C_MODE_END
#include "key.h"
#include "key.h"
#include "log.h"
#include "log.h"
#include "sql_parse.h"
#include "sql_parse.h"
#include "debug
_sync
.h"
#include "debug.h"
/*
/*
Note that in future versions, only *transactional* Maria tables can
Note that in future versions, only *transactional* Maria tables can
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment