mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Trivial fixes, more safe DBUG_ASSERT()'s and some more DBUG_
- CTRL-C now aborts 'source' commands in mysql client - Fix that thread id's are removed in convert-debug-for-diff.sh client/mysql.cc: CTRL-C now aborts 'source' commands scripts/convert-debug-for-diff.sh: Fix expression to remove thread id storage/maria/ha_maria.cc: Don't call DBUG_ASSERT() when we kill a query during REPAIR / ALTER TABLE storage/maria/ma_bitmap.c: Added DBUG_ASSERT() if we call _ma_bitmap_set_full_page_bits() storage/maria/ma_key_recover.c: Don't do an assert if table is marked crashed. storage/maria/ma_recovery.c: Added DBUG_ENTER
This commit is contained in:
@ -156,6 +156,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
|
||||
static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error;
|
||||
static my_bool column_types_flag;
|
||||
static my_bool preserve_comments= 0;
|
||||
static my_bool in_com_source, aborted= 0;
|
||||
static ulong opt_max_allowed_packet, opt_net_buffer_length;
|
||||
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
|
||||
static uint my_end_arg;
|
||||
@ -1087,6 +1088,7 @@ int main(int argc,char *argv[])
|
||||
"\\N [\\d]> ",MYF(MY_WME));
|
||||
current_prompt = my_strdup(default_prompt,MYF(MY_WME));
|
||||
prompt_counter=0;
|
||||
aborted= 0;
|
||||
|
||||
outfile[0]=0; // no (default) outfile
|
||||
strmov(pager, "stdout"); // the default, if --pager wasn't given
|
||||
@ -1281,8 +1283,10 @@ sig_handler mysql_end(int sig)
|
||||
/*
|
||||
This function handles sigint calls
|
||||
If query is in process, kill query
|
||||
If 'source' is executed, abort source command
|
||||
no query in process, terminate like previous behavior
|
||||
*/
|
||||
|
||||
sig_handler handle_sigint(int sig)
|
||||
{
|
||||
char kill_buffer[40];
|
||||
@ -1321,7 +1325,8 @@ sig_handler handle_sigint(int sig)
|
||||
mysql_close(kill_mysql);
|
||||
tee_fprintf(stdout, "Ctrl-C -- query killed. Continuing normally.\n");
|
||||
interrupted_query= 0;
|
||||
|
||||
if (in_com_source)
|
||||
aborted= 1; // Abort source command
|
||||
return;
|
||||
|
||||
err:
|
||||
@ -1886,7 +1891,7 @@ static int read_and_execute(bool interactive)
|
||||
bool truncated= 0;
|
||||
status.exit_status=1;
|
||||
|
||||
for (;;)
|
||||
while (!aborted)
|
||||
{
|
||||
if (!interactive)
|
||||
{
|
||||
@ -4066,17 +4071,19 @@ static int com_source(String *buffer, char *line)
|
||||
status.file_name=source_name;
|
||||
glob_buffer.length(0); // Empty command buffer
|
||||
ignore_errors= !batch_abort_on_error;
|
||||
in_com_source= 1;
|
||||
error= read_and_execute(false);
|
||||
ignore_errors= save_ignore_errors;
|
||||
status=old_status; // Continue as before
|
||||
in_com_source= aborted= 0;
|
||||
my_fclose(sql_file,MYF(0));
|
||||
batch_readline_end(line_buff);
|
||||
/*
|
||||
If we got an error during source operation, don't abort the client
|
||||
if ignore_errors is set
|
||||
*/
|
||||
if (error && batch_abort_on_error && ignore_errors)
|
||||
error= -1;
|
||||
if (error && !batch_abort_on_error && ignore_errors)
|
||||
error= -1; // Ignore error
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
while (<>)
|
||||
{
|
||||
s/^T@[0-9]+://g;
|
||||
s/^T@[0-9]+\s*://g;
|
||||
s/0x[0-9a-f]+(\s|\n|\))/#$1/g;
|
||||
s/size: [0-9]+/size: #/g;
|
||||
print $_;
|
||||
|
@ -1814,7 +1814,7 @@ int ha_maria::enable_indexes(uint mode)
|
||||
"retrying",
|
||||
my_errno, param.db_name, param.table_name);
|
||||
/* This should never fail normally */
|
||||
DBUG_ASSERT(0);
|
||||
DBUG_ASSERT(thd->killed != 0);
|
||||
/* Repairing by sort failed. Now try standard repair method. */
|
||||
param.testflag &= ~T_REP_BY_SORT;
|
||||
error= (repair(thd, ¶m, 0) != HA_ADMIN_OK);
|
||||
|
@ -2063,6 +2063,13 @@ my_bool _ma_bitmap_set_full_page_bits(MARIA_HA *info,
|
||||
safe_mutex_assert_owner(&info->s->bitmap.bitmap_lock);
|
||||
|
||||
bitmap_page= page - page % bitmap->pages_covered;
|
||||
if (page == bitmap_page ||
|
||||
page + page_count >= bitmap_page + bitmap->pages_covered)
|
||||
{
|
||||
DBUG_ASSERT(0); /* Wrong in data */
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
if (bitmap_page != bitmap->page &&
|
||||
_ma_change_bitmap_page(info, bitmap, bitmap_page))
|
||||
DBUG_RETURN(1);
|
||||
|
@ -64,8 +64,9 @@ void _ma_unpin_all_pages(MARIA_HA *info, LSN undo_lsn)
|
||||
builds.
|
||||
*/
|
||||
#ifdef EXTRA_DEBUG
|
||||
DBUG_ASSERT(!pinned_page->changed ||
|
||||
undo_lsn != LSN_IMPOSSIBLE || !info->s->now_transactional);
|
||||
DBUG_ASSERT((!pinned_page->changed ||
|
||||
undo_lsn != LSN_IMPOSSIBLE || !info->s->now_transactional) ||
|
||||
(info->s->state.changed & STATE_CRASHED));
|
||||
#endif
|
||||
pagecache_unlock_by_link(info->s->pagecache, pinned_page->link,
|
||||
pinned_page->unlock, PAGECACHE_UNPIN,
|
||||
|
@ -2397,6 +2397,7 @@ static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply)
|
||||
struct st_translog_scanner_data scanner;
|
||||
int len;
|
||||
uint i;
|
||||
DBUG_ENTER("run_redo_phase");
|
||||
|
||||
/* install hooks for execution */
|
||||
#define install_redo_exec_hook(R) \
|
||||
@ -2461,7 +2462,7 @@ static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply)
|
||||
{
|
||||
tprint(tracef, "checkpoint address refers to the log end log or "
|
||||
"log is empty, nothing to do.\n");
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
len= translog_read_record_header(lsn, &rec);
|
||||
@ -2469,12 +2470,12 @@ static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply)
|
||||
if (len == RECHEADER_READ_ERROR)
|
||||
{
|
||||
eprint(tracef, "Failed to read header of the first record.");
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (translog_scanner_init(lsn, 1, &scanner, 1))
|
||||
{
|
||||
tprint(tracef, "Scanner init failed\n");
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
for (i= 1;;i++)
|
||||
{
|
||||
@ -2527,7 +2528,7 @@ static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply)
|
||||
LSN_IN_PARTS(rec2.lsn));
|
||||
translog_destroy_scanner(&scanner);
|
||||
translog_free_record_header(&rec);
|
||||
return(0);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
if (translog_scanner_init(rec2.lsn, 1, &scanner2, 1))
|
||||
@ -2625,12 +2626,12 @@ static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply)
|
||||
fflush(stderr);
|
||||
procent_printed= 1;
|
||||
}
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
|
||||
err:
|
||||
translog_destroy_scanner(&scanner);
|
||||
translog_free_record_header(&rec);
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user