Skip to content

Commit

Permalink
Merge branch '10.6' into 10.11
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed Apr 26, 2024
2 parents 9e92582 + 0ccdf54 commit c9b1ebe
Show file tree
Hide file tree
Showing 34 changed files with 314 additions and 111 deletions.
6 changes: 6 additions & 0 deletions BUILD/SETUP.sh
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ if test `$CC -v 2>&1 | tail -1 | sed 's/ .*$//'` = 'gcc' ; then
fi
fi

if test `$CC -v 2>&1 | head -1 | sed 's/ .*$//'` = 'clang' ; then
dbug_cflags="$dbug_cflags -Wframe-larger-than=16384 -fno-inline"
c_warnings="$c_warnings -Wframe-larger-than=16384"
cxx_warnings="$cxx_warnings -Wframe-larger-than=16384"
fi


# If ccache (a compiler cache which reduces build time)
# (http://samba.org/ccache) is installed, use it.
Expand Down
7 changes: 6 additions & 1 deletion client/mysqlcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ static int disable_binlog()
return run_query("SET SQL_LOG_BIN=0", 0);
}


static int handle_request_for_tables(char *tables, size_t length,
my_bool view, my_bool dont_quote)
{
Expand Down Expand Up @@ -1028,7 +1029,10 @@ static void insert_table_name(DYNAMIC_ARRAY *arr, char *in, size_t dblen)
insert_dynamic(arr, (uchar*) buf);
}

static void print_result()
/* Ok as mysqlcheck is not multi threaded */
PRAGMA_DISABLE_CHECK_STACK_FRAME

static void __attribute__((noinline)) print_result()
{
MYSQL_RES *res;
MYSQL_ROW row;
Expand Down Expand Up @@ -1119,6 +1123,7 @@ static void print_result()
mysql_free_result(res);
DBUG_VOID_RETURN;
}
PRAGMA_REENABLE_CHECK_STACK_FRAME


static int dbConnect(char *host, char *user, char *passwd)
Expand Down
4 changes: 4 additions & 0 deletions client/mysqlslap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,9 @@ drop_primary_key_list(void)
return 0;
}


PRAGMA_DISABLE_CHECK_STACK_FRAME

static int
create_schema(MYSQL *mysql, const char *db, statement *stmt,
option_string *engine_stmt)
Expand Down Expand Up @@ -1744,6 +1747,7 @@ create_schema(MYSQL *mysql, const char *db, statement *stmt,

DBUG_RETURN(0);
}
PRAGMA_REENABLE_CHECK_STACK_FRAME

static int
drop_schema(MYSQL *mysql, const char *db)
Expand Down
2 changes: 1 addition & 1 deletion client/mysqltest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static my_bool non_blocking_api_enabled= 0;
#define MAX_DELIMITER_LENGTH 16
#define DEFAULT_MAX_CONN 64

#define DIE_BUFF_SIZE 256*1024
#define DIE_BUFF_SIZE 15*1024

#define RESULT_STRING_INIT_MEM 2048
#define RESULT_STRING_INCREMENT_MEM 2048
Expand Down
4 changes: 4 additions & 0 deletions extra/mariabackup/fil_cur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ xb_fil_cur_open(
return(XB_FIL_CUR_SUCCESS);
}

/* Stack usage 131224 with clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME

static bool page_is_corrupted(const byte *page, ulint page_no,
const xb_fil_cur_t *cursor,
const fil_space_t *space)
Expand Down Expand Up @@ -339,6 +342,7 @@ static bool page_is_corrupted(const byte *page, ulint page_no,

return buf_page_is_corrupted(true, page, space->flags);
}
PRAGMA_REENABLE_CHECK_STACK_FRAME

/** Reads and verifies the next block of pages from the source
file. Positions the cursor after the last read non-corrupted page.
Expand Down
14 changes: 14 additions & 0 deletions include/my_attribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,19 @@
# endif /* GNUC >= 3.1 */
#endif

/* Define pragmas to disable warnings for stack frame checking */

#if defined(__clang__)
#define PRAGMA_DISABLE_CHECK_STACK_FRAME \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wframe-larger-than=\"")

#define PRAGMA_REENABLE_CHECK_STACK_FRAME \
_Pragma("clang diagnostic pop")

#else
#define PRAGMA_DISABLE_CHECK_STACK_FRAME
#define PRAGMA_REENABLE_CHECK_STACK_FRAME
#endif

#endif /* _my_attribute_h */
24 changes: 20 additions & 4 deletions sql/service_wsrep.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2018-2023 Codership Oy <info@codership.com>
/* Copyright 2018-2024 Codership Oy <info@codership.com>
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
Expand Down Expand Up @@ -263,12 +263,28 @@ extern "C" my_bool wsrep_thd_order_before(const THD *left, const THD *right)
return FALSE;
}

/** Check if wsrep transaction is aborting state.
Calling function should make sure that wsrep transaction state
can't change during this function.
This function is called from
wsrep_abort_thd where we hold THD::LOCK_thd_data
wsrep_handle_mdl_conflict we hold THD::LOCK_thd_data
wsrep_assert_no_bf_bf_wait we hold lock_sys.latch
innobase_kill_query we hold THD::LOCK_thd_data (THD::awake_no_mutex)
@param thd thread handle
@return true if wsrep transaction is aborting
@return false if not
*/
extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd)
{
mysql_mutex_assert_owner(&thd->LOCK_thd_data);

const wsrep::client_state& cs(thd->wsrep_cs());
const enum wsrep::transaction::state tx_state(cs.transaction().state());

switch (tx_state)
{
case wsrep::transaction::s_must_abort:
Expand All @@ -277,7 +293,7 @@ extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd)
case wsrep::transaction::s_aborting:
return true;
default:
return false;
break;
}

return false;
Expand Down
31 changes: 23 additions & 8 deletions sql/sql_bootstrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,35 @@ extern "C" int read_bootstrap_query(char *query, int *query_length,
fgets_input_t input, fgets_fn_t fgets_fn,
int preserve_delimiter, int *error)
{
char line_buffer[MAX_BOOTSTRAP_LINE_SIZE];
char *line_buffer;
const char *line;
size_t len;
size_t query_len= 0;
int fgets_error= 0;
int exit_code= 0;
*error= 0;

line_buffer= (char*) malloc(MAX_BOOTSTRAP_LINE_SIZE);

*query_length= 0;
for ( ; ; )
{
line= (*fgets_fn)(line_buffer, sizeof(line_buffer), input, &fgets_error);
line= (*fgets_fn)(line_buffer, MAX_BOOTSTRAP_LINE_SIZE, input, &fgets_error);

if (error)
*error= fgets_error;

if (fgets_error != 0)
return READ_BOOTSTRAP_ERROR;
{
exit_code= READ_BOOTSTRAP_ERROR;
break;
}

if (line == NULL)
return (query_len == 0) ? READ_BOOTSTRAP_EOF : READ_BOOTSTRAP_ERROR;
{
exit_code= (query_len == 0) ? READ_BOOTSTRAP_EOF : READ_BOOTSTRAP_ERROR;
break;
}

len= strlen(line);

Expand Down Expand Up @@ -98,15 +107,17 @@ extern "C" int read_bootstrap_query(char *query, int *query_length,
if (!p || !p[1])
{
/* Invalid DELIMITER specifier */
return READ_BOOTSTRAP_ERROR;
exit_code= READ_BOOTSTRAP_ERROR;
break;
}
delimiter.assign(p+1);
if (preserve_delimiter)
{
memcpy(query,line,len);
query[len]=0;
*query_length = (int)len;
return READ_BOOTSTRAP_SUCCESS;
exit_code= READ_BOOTSTRAP_SUCCESS;
break;
}
continue;
}
Expand All @@ -125,7 +136,8 @@ extern "C" int read_bootstrap_query(char *query, int *query_length,
}
query[query_len]= '\0';
*query_length= (int)query_len;
return READ_BOOTSTRAP_QUERY_SIZE;
exit_code= READ_BOOTSTRAP_QUERY_SIZE;
break;
}

if (query_len != 0)
Expand All @@ -152,8 +164,11 @@ extern "C" int read_bootstrap_query(char *query, int *query_length,
}
query[query_len]= 0;
*query_length= (int)query_len;
return READ_BOOTSTRAP_SUCCESS;
exit_code= READ_BOOTSTRAP_SUCCESS;
break;
}
}
free(line_buffer);
return exit_code;
}

12 changes: 12 additions & 0 deletions sql/sql_statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2906,6 +2906,9 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
After having been updated the statistical system tables are closed.
*/

/* Stack usage 20248 from clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME

int update_statistics_for_table(THD *thd, TABLE *table)
{
TABLE_LIST tables[STATISTICS_TABLES];
Expand Down Expand Up @@ -2990,6 +2993,7 @@ int update_statistics_for_table(THD *thd, TABLE *table)
new_trans.restore_old_transaction();
DBUG_RETURN(rc);
}
PRAGMA_REENABLE_CHECK_STACK_FRAME


/**
Expand Down Expand Up @@ -3397,6 +3401,9 @@ read_statistics_for_tables(THD *thd, TABLE_LIST *tables, bool force_reload)
The function is called when executing the statement DROP TABLE 'tab'.
*/

/* Stack size 20248 with clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME

int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db,
const LEX_CSTRING *tab)
{
Expand Down Expand Up @@ -3465,6 +3472,7 @@ int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db,
new_trans.restore_old_transaction();
DBUG_RETURN(rc);
}
PRAGMA_REENABLE_CHECK_STACK_FRAME


/**
Expand Down Expand Up @@ -4009,6 +4017,9 @@ int rename_indexes_in_stat_table(THD *thd, TABLE *tab,
The function is called when executing any statement that renames a table
*/

/* Stack size 20968 with clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME

int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db,
const LEX_CSTRING *tab,
const LEX_CSTRING *new_db,
Expand Down Expand Up @@ -4086,6 +4097,7 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db,
new_trans.restore_old_transaction();
DBUG_RETURN(rc);
}
PRAGMA_REENABLE_CHECK_STACK_FRAME


/**
Expand Down
3 changes: 3 additions & 0 deletions sql/sql_yacc.yy
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
#pragma GCC diagnostic ignored "-Wunused-label" /* yyexhaustedlab: */
#endif

/* Stack size 28200 with clang for MYSQLparse() and ORAparse() */
PRAGMA_DISABLE_CHECK_STACK_FRAME

int yylex(void *yylval, void *yythd);

#define yyoverflow(A,B,C,D,E,F) \
Expand Down
Loading

0 comments on commit c9b1ebe

Please sign in to comment.