Merge branch '10.6' into 10.11

This commit is contained in:
Oleksandr Byelkin 2024-04-26 08:02:49 +02:00
commit c9b1ebee2f
34 changed files with 317 additions and 114 deletions

View file

@ -267,6 +267,12 @@ if test `$CC -v 2>&1 | tail -1 | sed 's/ .*$//'` = 'gcc' ; then
fi fi
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) # If ccache (a compiler cache which reduces build time)
# (http://samba.org/ccache) is installed, use it. # (http://samba.org/ccache) is installed, use it.

View file

@ -897,6 +897,7 @@ static int disable_binlog()
return run_query("SET SQL_LOG_BIN=0", 0); return run_query("SET SQL_LOG_BIN=0", 0);
} }
static int handle_request_for_tables(char *tables, size_t length, static int handle_request_for_tables(char *tables, size_t length,
my_bool view, my_bool dont_quote) my_bool view, my_bool dont_quote)
{ {
@ -1028,7 +1029,10 @@ static void insert_table_name(DYNAMIC_ARRAY *arr, char *in, size_t dblen)
insert_dynamic(arr, (uchar*) buf); 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_RES *res;
MYSQL_ROW row; MYSQL_ROW row;
@ -1119,6 +1123,7 @@ static void print_result()
mysql_free_result(res); mysql_free_result(res);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
static int dbConnect(char *host, char *user, char *passwd) static int dbConnect(char *host, char *user, char *passwd)

View file

@ -1649,6 +1649,9 @@ drop_primary_key_list(void)
return 0; return 0;
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
static int static int
create_schema(MYSQL *mysql, const char *db, statement *stmt, create_schema(MYSQL *mysql, const char *db, statement *stmt,
option_string *engine_stmt) option_string *engine_stmt)
@ -1744,6 +1747,7 @@ limit_not_met:
DBUG_RETURN(0); DBUG_RETURN(0);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
static int static int
drop_schema(MYSQL *mysql, const char *db) drop_schema(MYSQL *mysql, const char *db)

View file

@ -78,7 +78,7 @@ static my_bool non_blocking_api_enabled= 0;
#define MAX_DELIMITER_LENGTH 16 #define MAX_DELIMITER_LENGTH 16
#define DEFAULT_MAX_CONN 64 #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_INIT_MEM 2048
#define RESULT_STRING_INCREMENT_MEM 2048 #define RESULT_STRING_INCREMENT_MEM 2048

View file

@ -236,6 +236,9 @@ xb_fil_cur_open(
return(XB_FIL_CUR_SUCCESS); 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, static bool page_is_corrupted(const byte *page, ulint page_no,
const xb_fil_cur_t *cursor, const xb_fil_cur_t *cursor,
const fil_space_t *space) const fil_space_t *space)
@ -339,6 +342,7 @@ static bool page_is_corrupted(const byte *page, ulint page_no,
return buf_page_is_corrupted(true, page, space->flags); 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 /** Reads and verifies the next block of pages from the source
file. Positions the cursor after the last read non-corrupted page. file. Positions the cursor after the last read non-corrupted page.

View file

@ -70,5 +70,19 @@
# endif /* GNUC >= 3.1 */ # endif /* GNUC >= 3.1 */
#endif #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
#endif /* _my_attribute_h */

View file

@ -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 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 it under the terms of the GNU General Public License as published by
@ -263,12 +263,28 @@ extern "C" my_bool wsrep_thd_order_before(const THD *left, const THD *right)
return FALSE; 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) 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 wsrep::client_state& cs(thd->wsrep_cs());
const enum wsrep::transaction::state tx_state(cs.transaction().state()); const enum wsrep::transaction::state tx_state(cs.transaction().state());
switch (tx_state) switch (tx_state)
{ {
case wsrep::transaction::s_must_abort: case wsrep::transaction::s_must_abort:
@ -277,7 +293,7 @@ extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd)
case wsrep::transaction::s_aborting: case wsrep::transaction::s_aborting:
return true; return true;
default: default:
return false; break;
} }
return false; return false;

View file

@ -33,26 +33,35 @@ extern "C" int read_bootstrap_query(char *query, int *query_length,
fgets_input_t input, fgets_fn_t fgets_fn, fgets_input_t input, fgets_fn_t fgets_fn,
int preserve_delimiter, int *error) int preserve_delimiter, int *error)
{ {
char line_buffer[MAX_BOOTSTRAP_LINE_SIZE]; char *line_buffer;
const char *line; const char *line;
size_t len; size_t len;
size_t query_len= 0; size_t query_len= 0;
int fgets_error= 0; int fgets_error= 0;
int exit_code= 0;
*error= 0; *error= 0;
line_buffer= (char*) malloc(MAX_BOOTSTRAP_LINE_SIZE);
*query_length= 0; *query_length= 0;
for ( ; ; ) 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) if (error)
*error= fgets_error; *error= fgets_error;
if (fgets_error != 0) if (fgets_error != 0)
return READ_BOOTSTRAP_ERROR; {
exit_code= READ_BOOTSTRAP_ERROR;
break;
}
if (line == NULL) 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); len= strlen(line);
@ -98,7 +107,8 @@ extern "C" int read_bootstrap_query(char *query, int *query_length,
if (!p || !p[1]) if (!p || !p[1])
{ {
/* Invalid DELIMITER specifier */ /* Invalid DELIMITER specifier */
return READ_BOOTSTRAP_ERROR; exit_code= READ_BOOTSTRAP_ERROR;
break;
} }
delimiter.assign(p+1); delimiter.assign(p+1);
if (preserve_delimiter) if (preserve_delimiter)
@ -106,7 +116,8 @@ extern "C" int read_bootstrap_query(char *query, int *query_length,
memcpy(query,line,len); memcpy(query,line,len);
query[len]=0; query[len]=0;
*query_length = (int)len; *query_length = (int)len;
return READ_BOOTSTRAP_SUCCESS; exit_code= READ_BOOTSTRAP_SUCCESS;
break;
} }
continue; continue;
} }
@ -125,7 +136,8 @@ extern "C" int read_bootstrap_query(char *query, int *query_length,
} }
query[query_len]= '\0'; query[query_len]= '\0';
*query_length= (int)query_len; *query_length= (int)query_len;
return READ_BOOTSTRAP_QUERY_SIZE; exit_code= READ_BOOTSTRAP_QUERY_SIZE;
break;
} }
if (query_len != 0) if (query_len != 0)
@ -152,8 +164,11 @@ extern "C" int read_bootstrap_query(char *query, int *query_length,
} }
query[query_len]= 0; query[query_len]= 0;
*query_length= (int)query_len; *query_length= (int)query_len;
return READ_BOOTSTRAP_SUCCESS; exit_code= READ_BOOTSTRAP_SUCCESS;
break;
} }
} }
free(line_buffer);
return exit_code;
} }

View file

@ -2906,6 +2906,9 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
After having been updated the statistical system tables are closed. 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) int update_statistics_for_table(THD *thd, TABLE *table)
{ {
TABLE_LIST tables[STATISTICS_TABLES]; TABLE_LIST tables[STATISTICS_TABLES];
@ -2990,6 +2993,7 @@ int update_statistics_for_table(THD *thd, TABLE *table)
new_trans.restore_old_transaction(); new_trans.restore_old_transaction();
DBUG_RETURN(rc); DBUG_RETURN(rc);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/** /**
@ -3397,6 +3401,9 @@ end:
The function is called when executing the statement DROP TABLE 'tab'. 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, int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db,
const LEX_CSTRING *tab) const LEX_CSTRING *tab)
{ {
@ -3465,6 +3472,7 @@ int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db,
new_trans.restore_old_transaction(); new_trans.restore_old_transaction();
DBUG_RETURN(rc); DBUG_RETURN(rc);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/** /**
@ -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 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, int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db,
const LEX_CSTRING *tab, const LEX_CSTRING *tab,
const LEX_CSTRING *new_db, const LEX_CSTRING *new_db,
@ -4086,6 +4097,7 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db,
new_trans.restore_old_transaction(); new_trans.restore_old_transaction();
DBUG_RETURN(rc); DBUG_RETURN(rc);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/** /**

View file

@ -80,6 +80,9 @@
#pragma GCC diagnostic ignored "-Wunused-label" /* yyexhaustedlab: */ #pragma GCC diagnostic ignored "-Wunused-label" /* yyexhaustedlab: */
#endif #endif
/* Stack size 28200 with clang for MYSQLparse() and ORAparse() */
PRAGMA_DISABLE_CHECK_STACK_FRAME
int yylex(void *yylval, void *yythd); int yylex(void *yylval, void *yythd);
#define yyoverflow(A,B,C,D,E,F) \ #define yyoverflow(A,B,C,D,E,F) \

View file

@ -1273,15 +1273,21 @@ int Wsrep_schema::replay_transaction(THD* orig_thd,
DBUG_ENTER("Wsrep_schema::replay_transaction"); DBUG_ENTER("Wsrep_schema::replay_transaction");
DBUG_ASSERT(!fragments.empty()); DBUG_ASSERT(!fragments.empty());
THD thd(next_thread_id(), true); THD *thd= new THD(next_thread_id(), true);
thd.thread_stack= (orig_thd ? orig_thd->thread_stack : if (!thd)
(char*) &thd); {
wsrep_assign_from_threadvars(&thd); WSREP_WARN("Could not open allocate memory for THD");
DBUG_RETURN(1);
}
Wsrep_schema_impl::wsrep_off wsrep_off(&thd); thd->thread_stack= (orig_thd ? orig_thd->thread_stack :
Wsrep_schema_impl::binlog_off binlog_off(&thd); (char*) &thd);
Wsrep_schema_impl::sql_safe_updates sql_safe_updates(&thd); wsrep_assign_from_threadvars(thd);
Wsrep_schema_impl::thd_context_switch thd_context_switch(orig_thd, &thd);
Wsrep_schema_impl::wsrep_off wsrep_off(thd);
Wsrep_schema_impl::binlog_off binlog_off(thd);
Wsrep_schema_impl::sql_safe_updates sql_safe_updates(thd);
Wsrep_schema_impl::thd_context_switch thd_context_switch(orig_thd, thd);
int ret= 1; int ret= 1;
int error; int error;
@ -1293,11 +1299,12 @@ int Wsrep_schema::replay_transaction(THD* orig_thd,
for (std::vector<wsrep::seqno>::const_iterator i= fragments.begin(); for (std::vector<wsrep::seqno>::const_iterator i= fragments.begin();
i != fragments.end(); ++i) i != fragments.end(); ++i)
{ {
Wsrep_schema_impl::init_stmt(&thd); Wsrep_schema_impl::init_stmt(thd);
if ((error= Wsrep_schema_impl::open_for_read(&thd, sr_table_str.c_str(), &frag_table_l))) if ((error= Wsrep_schema_impl::open_for_read(thd, sr_table_str.c_str(), &frag_table_l)))
{ {
WSREP_WARN("Could not open SR table for read: %d", error); WSREP_WARN("Could not open SR table for read: %d", error);
Wsrep_schema_impl::finish_stmt(&thd); Wsrep_schema_impl::finish_stmt(thd);
my_free(thd);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
frag_table= frag_table_l.table; frag_table= frag_table_l.table;
@ -1329,7 +1336,7 @@ int Wsrep_schema::replay_transaction(THD* orig_thd,
frag_table->field[4]->val_str(&buf); frag_table->field[4]->val_str(&buf);
{ {
Wsrep_schema_impl::thd_context_switch thd_context_switch(&thd, orig_thd); Wsrep_schema_impl::thd_context_switch thd_context_switch(thd, orig_thd);
ret= wsrep_apply_events(orig_thd, rli, buf.ptr(), buf.length()); ret= wsrep_apply_events(orig_thd, rli, buf.ptr(), buf.length());
if (ret) if (ret)
@ -1340,17 +1347,18 @@ int Wsrep_schema::replay_transaction(THD* orig_thd,
} }
Wsrep_schema_impl::end_index_scan(frag_table); Wsrep_schema_impl::end_index_scan(frag_table);
Wsrep_schema_impl::finish_stmt(&thd); Wsrep_schema_impl::finish_stmt(thd);
Wsrep_schema_impl::init_stmt(&thd); Wsrep_schema_impl::init_stmt(thd);
if ((error= Wsrep_schema_impl::open_for_write(&thd, if ((error= Wsrep_schema_impl::open_for_write(thd,
sr_table_str.c_str(), sr_table_str.c_str(),
&frag_table_l))) &frag_table_l)))
{ {
WSREP_WARN("Could not open SR table for write: %d", error); WSREP_WARN("Could not open SR table for write: %d", error);
Wsrep_schema_impl::finish_stmt(&thd); Wsrep_schema_impl::finish_stmt(thd);
DBUG_RETURN(1); ret= 1;
break;
} }
frag_table= frag_table_l.table; frag_table= frag_table_l.table;
@ -1376,60 +1384,68 @@ int Wsrep_schema::replay_transaction(THD* orig_thd,
break; break;
} }
Wsrep_schema_impl::end_index_scan(frag_table); Wsrep_schema_impl::end_index_scan(frag_table);
Wsrep_schema_impl::finish_stmt(&thd); Wsrep_schema_impl::finish_stmt(thd);
my_free(key); my_free(key);
key= NULL; key= NULL;
} }
if (key) if (key)
my_free(key); my_free(key);
delete thd;
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
int Wsrep_schema::recover_sr_transactions(THD *orig_thd) int Wsrep_schema::recover_sr_transactions(THD *orig_thd)
{ {
DBUG_ENTER("Wsrep_schema::recover_sr_transactions"); DBUG_ENTER("Wsrep_schema::recover_sr_transactions");
THD storage_thd(next_thread_id(), true);
storage_thd.thread_stack= (orig_thd ? orig_thd->thread_stack : THD *storage_thd= new THD(next_thread_id(), true);
if (!storage_thd)
{
WSREP_WARN("Could not open allocate memory for THD");
DBUG_RETURN(1);
}
storage_thd->thread_stack= (orig_thd ? orig_thd->thread_stack :
(char*) &storage_thd); (char*) &storage_thd);
wsrep_assign_from_threadvars(&storage_thd); wsrep_assign_from_threadvars(storage_thd);
TABLE* frag_table= 0; TABLE* frag_table= 0;
TABLE_LIST frag_table_l; TABLE_LIST frag_table_l;
TABLE* cluster_table= 0; TABLE* cluster_table= 0;
TABLE_LIST cluster_table_l; TABLE_LIST cluster_table_l;
Wsrep_storage_service storage_service(&storage_thd); Wsrep_storage_service storage_service(storage_thd);
Wsrep_schema_impl::binlog_off binlog_off(&storage_thd); Wsrep_schema_impl::binlog_off binlog_off(storage_thd);
Wsrep_schema_impl::wsrep_off wsrep_off(&storage_thd); Wsrep_schema_impl::wsrep_off wsrep_off(storage_thd);
Wsrep_schema_impl::sql_safe_updates sql_safe_updates(&storage_thd); Wsrep_schema_impl::sql_safe_updates sql_safe_updates(storage_thd);
Wsrep_schema_impl::thd_context_switch thd_context_switch(orig_thd, Wsrep_schema_impl::thd_context_switch thd_context_switch(orig_thd,
&storage_thd); storage_thd);
Wsrep_server_state& server_state(Wsrep_server_state::instance()); Wsrep_server_state& server_state(Wsrep_server_state::instance());
int ret= 1; int ret= 1;
int error; int error;
wsrep::id cluster_id; wsrep::id cluster_id;
Wsrep_schema_impl::init_stmt(&storage_thd); Wsrep_schema_impl::init_stmt(storage_thd);
storage_thd.wsrep_skip_locking= FALSE; storage_thd->wsrep_skip_locking= FALSE;
if (Wsrep_schema_impl::open_for_read(&storage_thd, cluster_table_str.c_str(), if (Wsrep_schema_impl::open_for_read(storage_thd, cluster_table_str.c_str(),
&cluster_table_l)) &cluster_table_l))
{ {
Wsrep_schema_impl::finish_stmt(&storage_thd); Wsrep_schema_impl::finish_stmt(storage_thd);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
cluster_table= cluster_table_l.table; cluster_table= cluster_table_l.table;
if (Wsrep_schema_impl::init_for_scan(cluster_table)) if (Wsrep_schema_impl::init_for_scan(cluster_table))
{ {
Wsrep_schema_impl::finish_stmt(&storage_thd); Wsrep_schema_impl::finish_stmt(storage_thd);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if ((error= Wsrep_schema_impl::next_record(cluster_table))) if ((error= Wsrep_schema_impl::next_record(cluster_table)))
{ {
Wsrep_schema_impl::end_scan(cluster_table); Wsrep_schema_impl::end_scan(cluster_table);
Wsrep_schema_impl::finish_stmt(&storage_thd); Wsrep_schema_impl::finish_stmt(storage_thd);
trans_commit(&storage_thd); trans_commit(storage_thd);
if (error == HA_ERR_END_OF_FILE) if (error == HA_ERR_END_OF_FILE)
{ {
WSREP_INFO("Cluster table is empty, not recovering transactions"); WSREP_INFO("Cluster table is empty, not recovering transactions");
@ -1444,20 +1460,20 @@ int Wsrep_schema::recover_sr_transactions(THD *orig_thd)
Wsrep_schema_impl::scan(cluster_table, 0, cluster_id); Wsrep_schema_impl::scan(cluster_table, 0, cluster_id);
Wsrep_schema_impl::end_scan(cluster_table); Wsrep_schema_impl::end_scan(cluster_table);
Wsrep_schema_impl::finish_stmt(&storage_thd); Wsrep_schema_impl::finish_stmt(storage_thd);
std::ostringstream os; std::ostringstream os;
os << cluster_id; os << cluster_id;
WSREP_INFO("Recovered cluster id %s", os.str().c_str()); WSREP_INFO("Recovered cluster id %s", os.str().c_str());
storage_thd.wsrep_skip_locking= TRUE; storage_thd->wsrep_skip_locking= TRUE;
Wsrep_schema_impl::init_stmt(&storage_thd); Wsrep_schema_impl::init_stmt(storage_thd);
/* /*
Open the table for reading and writing so that fragments without Open the table for reading and writing so that fragments without
valid seqno can be deleted. valid seqno can be deleted.
*/ */
if (Wsrep_schema_impl::open_for_write(&storage_thd, sr_table_str.c_str(), if (Wsrep_schema_impl::open_for_write(storage_thd, sr_table_str.c_str(),
&frag_table_l)) &frag_table_l))
{ {
WSREP_ERROR("Failed to open SR table for write"); WSREP_ERROR("Failed to open SR table for write");
@ -1513,7 +1529,7 @@ int Wsrep_schema::recover_sr_transactions(THD *orig_thd)
transaction_id))) transaction_id)))
{ {
DBUG_ASSERT(wsrep::starts_transaction(flags)); DBUG_ASSERT(wsrep::starts_transaction(flags));
applier = wsrep_create_streaming_applier(&storage_thd, "recovery"); applier = wsrep_create_streaming_applier(storage_thd, "recovery");
server_state.start_streaming_applier(server_id, transaction_id, server_state.start_streaming_applier(server_id, transaction_id,
applier); applier);
applier->start_transaction(wsrep::ws_handle(transaction_id, 0), applier->start_transaction(wsrep::ws_handle(transaction_id, 0),
@ -1541,10 +1557,11 @@ int Wsrep_schema::recover_sr_transactions(THD *orig_thd)
} }
} }
Wsrep_schema_impl::end_scan(frag_table); Wsrep_schema_impl::end_scan(frag_table);
Wsrep_schema_impl::finish_stmt(&storage_thd); Wsrep_schema_impl::finish_stmt(storage_thd);
trans_commit(&storage_thd); trans_commit(storage_thd);
storage_thd.set_mysys_var(0); storage_thd->set_mysys_var(0);
out: out:
delete storage_thd;
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }

View file

@ -267,6 +267,9 @@ ha_archive::ha_archive(handlerton *hton, TABLE_SHARE *table_arg)
archive_reader_open= FALSE; archive_reader_open= FALSE;
} }
/* Stack size 50264 with clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share) int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share)
{ {
DBUG_ENTER("archive_discover"); DBUG_ENTER("archive_discover");
@ -308,6 +311,7 @@ ret:
my_free(frm_ptr); my_free(frm_ptr);
DBUG_RETURN(my_errno); DBUG_RETURN(my_errno);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/** /**
@brief Read version 1 meta file (5.0 compatibility routine). @brief Read version 1 meta file (5.0 compatibility routine).
@ -478,6 +482,10 @@ int ha_archive::read_data_header(azio_stream *file_to_read)
See ha_example.cc for a longer description. See ha_example.cc for a longer description.
*/ */
/* Stack size 49608 with clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
Archive_share *ha_archive::get_share(const char *table_name, int *rc) Archive_share *ha_archive::get_share(const char *table_name, int *rc)
{ {
Archive_share *tmp_share; Archive_share *tmp_share;
@ -540,6 +548,7 @@ err:
DBUG_RETURN(tmp_share); DBUG_RETURN(tmp_share);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
int Archive_share::init_archive_writer() int Archive_share::init_archive_writer()
@ -761,6 +770,9 @@ int ha_archive::frm_compare(azio_stream *s)
of creation. of creation.
*/ */
/* Stack size 49608 with clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
int ha_archive::create(const char *name, TABLE *table_arg, int ha_archive::create(const char *name, TABLE *table_arg,
HA_CREATE_INFO *create_info) HA_CREATE_INFO *create_info)
{ {
@ -878,6 +890,7 @@ error:
/* Return error number, if we got one */ /* Return error number, if we got one */
DBUG_RETURN(error ? error : -1); DBUG_RETURN(error ? error : -1);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/* /*
This is where the actual row is written out. This is where the actual row is written out.
@ -1496,6 +1509,10 @@ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt)
The table can become fragmented if data was inserted, read, and then The table can become fragmented if data was inserted, read, and then
inserted again. What we do is open up the file and recompress it completely. inserted again. What we do is open up the file and recompress it completely.
*/ */
/* Stack size 50152 with clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
{ {
int rc= 0; int rc= 0;
@ -1621,6 +1638,7 @@ error:
DBUG_RETURN(rc); DBUG_RETURN(rc);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/* /*
Below is an example of how to setup row level locking. Below is an example of how to setup row level locking.

View file

@ -6454,6 +6454,9 @@ char *ha_connect::GetDBfromName(const char *name)
ha_create_table() in handle.cc ha_create_table() in handle.cc
*/ */
/* Stack size 25608 in clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
int ha_connect::create(const char *name, TABLE *table_arg, int ha_connect::create(const char *name, TABLE *table_arg,
HA_CREATE_INFO *create_info) HA_CREATE_INFO *create_info)
{ {
@ -6998,6 +7001,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
table= st; table= st;
DBUG_RETURN(rc); DBUG_RETURN(rc);
} // end of create } // end of create
PRAGMA_REENABLE_CHECK_STACK_FRAME
/** /**
Used to check whether a file based outward table can be populated by Used to check whether a file based outward table can be populated by
@ -7005,6 +7009,10 @@ int ha_connect::create(const char *name, TABLE *table_arg,
- file does not exist or is void - file does not exist or is void
- user has file privilege - user has file privilege
*/ */
/* Stack size 16664 in clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
bool ha_connect::FileExists(const char *fn, bool bf) bool ha_connect::FileExists(const char *fn, bool bf)
{ {
if (!fn || !*fn) if (!fn || !*fn)
@ -7055,6 +7063,7 @@ bool ha_connect::FileExists(const char *fn, bool bf)
return true; return true;
} // end of FileExists } // end of FileExists
PRAGMA_REENABLE_CHECK_STACK_FRAME
// Called by SameString and NoFieldOptionChange // Called by SameString and NoFieldOptionChange
bool ha_connect::CheckString(PCSZ str1, PCSZ str2) bool ha_connect::CheckString(PCSZ str1, PCSZ str2)

View file

@ -125,8 +125,11 @@ PTDB TDBMUL::Duplicate(PGLOBAL g)
/* have a LRECL that is the sum of the lengths of all components. */ /* have a LRECL that is the sum of the lengths of all components. */
/* This is why we use a big filename array to take care of that. */ /* This is why we use a big filename array to take care of that. */
/***********************************************************************/ /***********************************************************************/
PRAGMA_DISABLE_CHECK_STACK_FRAME
bool TDBMUL::InitFileNames(PGLOBAL g) bool TDBMUL::InitFileNames(PGLOBAL g)
{ {
#define PFNZ 4096 #define PFNZ 4096
#define FNSZ (_MAX_DRIVE+_MAX_DIR+_MAX_FNAME+_MAX_EXT) #define FNSZ (_MAX_DRIVE+_MAX_DIR+_MAX_FNAME+_MAX_EXT)
PTDBDIR dirp; PTDBDIR dirp;
@ -234,6 +237,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
NumFiles = n; NumFiles = n;
return false; return false;
} // end of InitFileNames } // end of InitFileNames
PRAGMA_REENABLE_CHECK_STACK_FRAME
/***********************************************************************/ /***********************************************************************/
/* The table column list is the sub-table column list. */ /* The table column list is the sub-table column list. */

View file

@ -814,71 +814,66 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit) {
/************************************************************/ /************************************************************/
extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) { extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) {
zip64_internal ziinit;
zip64_internal* zi; zip64_internal* zi;
int err=ZIP_OK; int err=ZIP_OK;
ziinit.z_filefunc.zseek32_file = NULL; if (!(zi = (zip64_internal*)ALLOC(sizeof(zip64_internal))))
ziinit.z_filefunc.ztell32_file = NULL; return NULL;
if (pzlib_filefunc64_32_def==NULL)
fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
else
ziinit.z_filefunc = *pzlib_filefunc64_32_def;
ziinit.filestream = ZOPEN64(ziinit.z_filefunc, zi->z_filefunc.zseek32_file = NULL;
zi->z_filefunc.ztell32_file = NULL;
if (pzlib_filefunc64_32_def==NULL)
fill_fopen64_filefunc(&zi->z_filefunc.zfile_func64);
else
zi->z_filefunc = *pzlib_filefunc64_32_def;
zi->filestream = ZOPEN64(zi->z_filefunc,
pathname, pathname,
(append == APPEND_STATUS_CREATE) ? (append == APPEND_STATUS_CREATE) ?
(ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) : (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) :
(ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING)); (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING));
if (ziinit.filestream == NULL) if (zi->filestream == NULL)
return NULL;
if (append == APPEND_STATUS_CREATEAFTER)
ZSEEK64(ziinit.z_filefunc,ziinit.filestream,0,SEEK_END);
ziinit.begin_pos = ZTELL64(ziinit.z_filefunc,ziinit.filestream);
ziinit.in_opened_file_inzip = 0;
ziinit.ci.stream_initialised = 0;
ziinit.number_entry = 0;
ziinit.add_position_when_writing_offset = 0;
init_linkedlist(&(ziinit.central_dir));
zi = (zip64_internal*)ALLOC(sizeof(zip64_internal));
if (zi==NULL)
{ {
ZCLOSE64(ziinit.z_filefunc,ziinit.filestream); free(zi);
return NULL; return NULL;
} }
if (append == APPEND_STATUS_CREATEAFTER)
ZSEEK64(zi->z_filefunc,zi->filestream,0,SEEK_END);
zi->begin_pos = ZTELL64(zi->z_filefunc,zi->filestream);
zi->in_opened_file_inzip = 0;
zi->ci.stream_initialised = 0;
zi->number_entry = 0;
zi->add_position_when_writing_offset = 0;
init_linkedlist(&(zi->central_dir));
/* now we add file in a zipfile */ /* now we add file in a zipfile */
# ifndef NO_ADDFILEINEXISTINGZIP # ifndef NO_ADDFILEINEXISTINGZIP
ziinit.globalcomment = NULL; zi->globalcomment = NULL;
if (append == APPEND_STATUS_ADDINZIP) if (append == APPEND_STATUS_ADDINZIP)
{ {
// Read and Cache Central Directory Records // Read and Cache Central Directory Records
err = LoadCentralDirectoryRecord(&ziinit); err = LoadCentralDirectoryRecord(zi);
} }
if (globalcomment) if (globalcomment)
{ {
*globalcomment = ziinit.globalcomment; *globalcomment = zi->globalcomment;
} }
# endif /* !NO_ADDFILEINEXISTINGZIP*/ # endif /* !NO_ADDFILEINEXISTINGZIP*/
if (err != ZIP_OK) if (err != ZIP_OK)
{ {
# ifndef NO_ADDFILEINEXISTINGZIP # ifndef NO_ADDFILEINEXISTINGZIP
free(ziinit.globalcomment); free(zi->globalcomment);
# endif /* !NO_ADDFILEINEXISTINGZIP*/ # endif /* !NO_ADDFILEINEXISTINGZIP*/
free(zi); free(zi);
return NULL; return NULL;
} }
else else
{ {
*zi = ziinit;
return (zipFile)zi; return (zipFile)zi;
} }
} }

View file

@ -3269,7 +3269,6 @@ page_zip_validate_low(
ibool sloppy) /*!< in: FALSE=strict, ibool sloppy) /*!< in: FALSE=strict,
TRUE=ignore the MIN_REC_FLAG */ TRUE=ignore the MIN_REC_FLAG */
{ {
page_zip_des_t temp_page_zip;
ibool valid; ibool valid;
if (memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV, if (memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV,
@ -3310,7 +3309,7 @@ page_zip_validate_low(
MEM_CHECK_DEFINED(page, srv_page_size); MEM_CHECK_DEFINED(page, srv_page_size);
MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip)); MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
temp_page_zip = *page_zip; page_zip_des_t temp_page_zip(*page_zip);
valid = page_zip_decompress_low(&temp_page_zip, temp_page, TRUE); valid = page_zip_decompress_low(&temp_page_zip, temp_page, TRUE);
if (!valid) { if (!valid) {
fputs("page_zip_validate(): failed to decompress\n", stderr); fputs("page_zip_validate(): failed to decompress\n", stderr);

View file

@ -431,6 +431,10 @@ row_quiesce_write_header(
/*********************************************************************//** /*********************************************************************//**
Write the table meta data after quiesce. Write the table meta data after quiesce.
@return DB_SUCCESS or error code */ @return DB_SUCCESS or error code */
/* Stack size 20904 with clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
static MY_ATTRIBUTE((nonnull, warn_unused_result)) static MY_ATTRIBUTE((nonnull, warn_unused_result))
dberr_t dberr_t
row_quiesce_write_cfg( row_quiesce_write_cfg(
@ -488,6 +492,7 @@ row_quiesce_write_cfg(
return(err); return(err);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/*********************************************************************//** /*********************************************************************//**
Check whether a table has an FTS index defined on it. Check whether a table has an FTS index defined on it.

View file

@ -3601,6 +3601,9 @@ static my_bool translog_is_LSN_chunk(uchar type)
@retval 1 Error @retval 1 Error
*/ */
/* Stack size 26120 from clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
my_bool translog_init_with_table(const char *directory, my_bool translog_init_with_table(const char *directory,
uint32 log_file_max_size, uint32 log_file_max_size,
uint32 server_version, uint32 server_version,
@ -4234,6 +4237,7 @@ err:
ma_message_no_user(0, "log initialization failed"); ma_message_no_user(0, "log initialization failed");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/* /*

View file

@ -1558,6 +1558,9 @@ uint _ma_state_info_write(MARIA_SHARE *share, uint pWrite)
@retval 1 Error @retval 1 Error
*/ */
/* Stack size 26376 from clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite) uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite)
{ {
uchar buff[MARIA_STATE_INFO_SIZE + MARIA_STATE_EXTRA_SIZE]; uchar buff[MARIA_STATE_INFO_SIZE + MARIA_STATE_EXTRA_SIZE];
@ -1632,6 +1635,7 @@ uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite)
MYF(MY_NABP)); MYF(MY_NABP));
DBUG_RETURN(res != 0); DBUG_RETURN(res != 0);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
static uchar *_ma_state_info_read(uchar *ptr, MARIA_STATE_INFO *state, myf flag) static uchar *_ma_state_info_read(uchar *ptr, MARIA_STATE_INFO *state, myf flag)

View file

@ -1163,11 +1163,12 @@ end:
/* /*
The record may come from REPAIR, ALTER TABLE ENABLE KEYS, OPTIMIZE. The record may come from REPAIR, ALTER TABLE ENABLE KEYS, OPTIMIZE.
*/ */
prototype_redo_exec_hook(REDO_REPAIR_TABLE) prototype_redo_exec_hook(REDO_REPAIR_TABLE)
{ {
int error= 1; int error= 1;
MARIA_HA *info; MARIA_HA *info;
HA_CHECK param; HA_CHECK *param;
char *name; char *name;
my_bool quick_repair; my_bool quick_repair;
DBUG_ENTER("exec_REDO_LOGREC_REDO_REPAIR_TABLE"); DBUG_ENTER("exec_REDO_LOGREC_REDO_REPAIR_TABLE");
@ -1199,35 +1200,39 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE)
*/ */
tprint(tracef, " repairing...\n"); tprint(tracef, " repairing...\n");
maria_chk_init(&param); if (!(param= my_malloc(PSI_INSTRUMENT_ME, sizeof(*param), MYF(MY_WME))))
param.isam_file_name= name= info->s->open_file_name.str; DBUG_RETURN(0);
param.testflag= uint8korr(rec->header + FILEID_STORE_SIZE);
param.tmpdir= maria_tmpdir; maria_chk_init(param);
param.max_trid= max_long_trid; param->isam_file_name= name= info->s->open_file_name.str;
param->testflag= uint8korr(rec->header + FILEID_STORE_SIZE);
param->tmpdir= maria_tmpdir;
param->max_trid= max_long_trid;
DBUG_ASSERT(maria_tmpdir); DBUG_ASSERT(maria_tmpdir);
info->s->state.key_map= uint8korr(rec->header + FILEID_STORE_SIZE + 8); info->s->state.key_map= uint8korr(rec->header + FILEID_STORE_SIZE + 8);
quick_repair= MY_TEST(param.testflag & T_QUICK); quick_repair= MY_TEST(param->testflag & T_QUICK);
if (param.testflag & T_REP_PARALLEL) if (param->testflag & T_REP_PARALLEL)
{ {
if (maria_repair_parallel(&param, info, name, quick_repair)) if (maria_repair_parallel(param, info, name, quick_repair))
goto end; goto end;
} }
else if (param.testflag & T_REP_BY_SORT) else if (param->testflag & T_REP_BY_SORT)
{ {
if (maria_repair_by_sort(&param, info, name, quick_repair)) if (maria_repair_by_sort(param, info, name, quick_repair))
goto end; goto end;
} }
else if (maria_repair(&param, info, name, quick_repair)) else if (maria_repair(param, info, name, quick_repair))
goto end; goto end;
if (_ma_update_state_lsns(info->s, rec->lsn, trnman_get_min_safe_trid(), if (_ma_update_state_lsns(info->s, rec->lsn, trnman_get_min_safe_trid(),
TRUE, !(param.testflag & T_NO_CREATE_RENAME_LSN))) TRUE, !(param->testflag & T_NO_CREATE_RENAME_LSN)))
goto end; goto end;
error= 0; error= 0;
end: end:
my_free(param);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
@ -2579,6 +2584,8 @@ prototype_undo_exec_hook(UNDO_BULK_INSERT)
return error; return error;
} }
/* Stack size 18776 in clang. Ok as this is during recover */
PRAGMA_DISABLE_CHECK_STACK_FRAME
static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply) static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply)
{ {
@ -2822,6 +2829,7 @@ err:
translog_free_record_header(&rec); translog_free_record_header(&rec);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/** /**

View file

@ -143,6 +143,8 @@ static my_bool read_and_check_content(TRANSLOG_HEADER_BUFFER *rec,
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
int main(int argc __attribute__((unused)), char *argv[]) int main(int argc __attribute__((unused)), char *argv[])
{ {
uint32 i; uint32 i;
@ -664,5 +666,6 @@ err:
my_end(0); my_end(0);
return(MY_TEST(exit_status())); return(MY_TEST(exit_status()));
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
#include "../ma_check_standalone.h" #include "../ma_check_standalone.h"

View file

@ -200,6 +200,7 @@ endif()
include_directories( include_directories(
BEFORE BEFORE
${CMAKE_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/lib

View file

@ -38,6 +38,7 @@
#include "grn_util.h" #include "grn_util.h"
#include "grn_cache.h" #include "grn_cache.h"
#include "grn_window_functions.h" #include "grn_window_functions.h"
#include <my_attribute.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
@ -1060,6 +1061,8 @@ grn_table_create_validate(grn_ctx *ctx, const char *name, unsigned int name_size
return ctx->rc; return ctx->rc;
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
static grn_obj * static grn_obj *
grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name, grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name,
unsigned int name_size, const char *path, unsigned int name_size, const char *path,
@ -1238,6 +1241,7 @@ grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name,
} }
return res; return res;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
grn_obj * grn_obj *
grn_table_create(grn_ctx *ctx, const char *name, unsigned int name_size, grn_table_create(grn_ctx *ctx, const char *name, unsigned int name_size,
@ -4776,6 +4780,9 @@ _grn_table_key(grn_ctx *ctx, grn_obj *table, grn_id id, uint32_t *key_size)
/* column */ /* column */
PRAGMA_DISABLE_CHECK_STACK_FRAME
grn_obj * grn_obj *
grn_column_create(grn_ctx *ctx, grn_obj *table, grn_column_create(grn_ctx *ctx, grn_obj *table,
const char *name, unsigned int name_size, const char *name, unsigned int name_size,
@ -4978,6 +4985,7 @@ exit :
if (!res && id) { grn_obj_delete_by_id(ctx, db, id, GRN_TRUE); } if (!res && id) { grn_obj_delete_by_id(ctx, db, id, GRN_TRUE); }
GRN_API_RETURN(res); GRN_API_RETURN(res);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
grn_obj * grn_obj *
grn_column_open(grn_ctx *ctx, grn_obj *table, grn_column_open(grn_ctx *ctx, grn_obj *table,
@ -8540,6 +8548,8 @@ grn_obj_spec_save(grn_ctx *ctx, grn_db_obj *obj)
grn_obj_close(ctx, &v); grn_obj_close(ctx, &v);
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
inline static void inline static void
grn_obj_set_info_source_invalid_lexicon_error(grn_ctx *ctx, grn_obj_set_info_source_invalid_lexicon_error(grn_ctx *ctx,
const char *message, const char *message,
@ -8590,6 +8600,8 @@ grn_obj_set_info_source_invalid_lexicon_error(grn_ctx *ctx,
source_name_size, source_name); source_name_size, source_name);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
inline static grn_rc inline static grn_rc
grn_obj_set_info_source_validate(grn_ctx *ctx, grn_obj *obj, grn_obj *value) grn_obj_set_info_source_validate(grn_ctx *ctx, grn_obj *obj, grn_obj *value)
{ {
@ -8597,7 +8609,7 @@ grn_obj_set_info_source_validate(grn_ctx *ctx, grn_obj *obj, grn_obj *value)
grn_obj *lexicon = NULL; grn_obj *lexicon = NULL;
grn_id lexicon_domain_id; grn_id lexicon_domain_id;
grn_obj *lexicon_domain = NULL; grn_obj *lexicon_domain = NULL;
grn_bool lexicon_domain_is_table; grn_bool lexicon_domain_is_table __attribute__((unused));
grn_bool lexicon_have_tokenizer; grn_bool lexicon_have_tokenizer;
grn_id *source_ids; grn_id *source_ids;
int i, n_source_ids; int i, n_source_ids;
@ -9330,7 +9342,7 @@ remove_reference_tables(grn_ctx *ctx, grn_obj *table, grn_obj *db)
grn_bool is_close_opened_object_mode = GRN_FALSE; grn_bool is_close_opened_object_mode = GRN_FALSE;
grn_id table_id; grn_id table_id;
char table_name[GRN_TABLE_MAX_KEY_SIZE]; char table_name[GRN_TABLE_MAX_KEY_SIZE];
int table_name_size; int table_name_size __attribute__((unused));
grn_table_cursor *cursor; grn_table_cursor *cursor;
if (grn_thread_get_limit() == 1) { if (grn_thread_get_limit() == 1) {
@ -10317,12 +10329,10 @@ grn_db_spec_unpack(grn_ctx *ctx,
const char *error_message_tag) const char *error_message_tag)
{ {
grn_obj *db; grn_obj *db;
grn_db *db_raw;
grn_rc rc; grn_rc rc;
uint32_t spec_size; uint32_t spec_size;
db = ctx->impl->db; db = ctx->impl->db;
db_raw = (grn_db *)db;
rc = grn_vector_decode(ctx, rc = grn_vector_decode(ctx,
decoded_spec, decoded_spec,

View file

@ -20,6 +20,9 @@
#include "grn_ctx_impl.h" #include "grn_ctx_impl.h"
#include "grn_db.h" #include "grn_db.h"
#include "grn_util.h" #include "grn_util.h"
#include <my_attribute.h>
PRAGMA_DISABLE_CHECK_STACK_FRAME
static void static void
grn_loader_save_error(grn_ctx *ctx, grn_loader *loader) grn_loader_save_error(grn_ctx *ctx, grn_loader *loader)
@ -1228,3 +1231,5 @@ grn_load(grn_ctx *ctx, grn_content_type input_type,
} }
GRN_API_RETURN(ctx->rc); GRN_API_RETURN(ctx->rc);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME

View file

@ -20,6 +20,7 @@
#include "grn_db.h" #include "grn_db.h"
#include "grn_str.h" #include "grn_str.h"
#include "grn_normalizer.h" #include "grn_normalizer.h"
#include <my_attribute.h>
#include <string.h> #include <string.h>
@ -31,6 +32,8 @@
# include <onigmo.h> # include <onigmo.h>
#endif #endif
PRAGMA_DISABLE_CHECK_STACK_FRAME
static const char *operator_names[] = { static const char *operator_names[] = {
"push", "push",
"pop", "pop",
@ -1360,3 +1363,5 @@ grn_operator_exec_regexp(grn_ctx *ctx, grn_obj *target, grn_obj *pattern)
} }
GRN_API_RETURN(matched); GRN_API_RETURN(matched);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME

View file

@ -18,6 +18,7 @@
#include "../grn_proc.h" #include "../grn_proc.h"
#include "../grn_db.h" #include "../grn_db.h"
#include <my_attribute.h>
#include <groonga/plugin.h> #include <groonga/plugin.h>
@ -73,6 +74,8 @@ command_object_list_dump_flags(grn_ctx *ctx, grn_obj_spec *spec)
GRN_OBJ_FIN(ctx, &flags); GRN_OBJ_FIN(ctx, &flags);
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
static grn_obj * static grn_obj *
command_object_list(grn_ctx *ctx, command_object_list(grn_ctx *ctx,
int nargs, int nargs,
@ -401,6 +404,7 @@ command_object_list(grn_ctx *ctx,
return NULL; return NULL;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
void void
grn_proc_init_object_list(grn_ctx *ctx) grn_proc_init_object_list(grn_ctx *ctx)

View file

@ -17,9 +17,8 @@
*/ */
#include "../grn_proc.h" #include "../grn_proc.h"
#include "../grn_db.h" #include "../grn_db.h"
#include <my_attribute.h>
#include <groonga/plugin.h> #include <groonga/plugin.h>
typedef struct { typedef struct {
@ -572,6 +571,8 @@ command_schema_table_output_token_filters(grn_ctx *ctx, grn_obj *table)
GRN_OBJ_FIN(ctx, &token_filters); GRN_OBJ_FIN(ctx, &token_filters);
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
static void static void
command_schema_table_command_collect_arguments(grn_ctx *ctx, command_schema_table_command_collect_arguments(grn_ctx *ctx,
grn_obj *table, grn_obj *table,
@ -692,6 +693,7 @@ command_schema_table_command_collect_arguments(grn_ctx *ctx,
#undef ADD_OBJECT_NAME #undef ADD_OBJECT_NAME
#undef ADD #undef ADD
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
static void static void
command_schema_table_output_command(grn_ctx *ctx, grn_obj *table) command_schema_table_output_command(grn_ctx *ctx, grn_obj *table)
@ -875,6 +877,8 @@ command_schema_output_indexes(grn_ctx *ctx, grn_obj *object)
} }
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
static void static void
command_schema_column_command_collect_arguments(grn_ctx *ctx, command_schema_column_command_collect_arguments(grn_ctx *ctx,
grn_obj *table, grn_obj *table,
@ -973,6 +977,7 @@ command_schema_column_command_collect_arguments(grn_ctx *ctx,
#undef ADD_OBJECT_NAME #undef ADD_OBJECT_NAME
#undef ADD #undef ADD
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
static void static void
command_schema_column_output_command(grn_ctx *ctx, command_schema_column_output_command(grn_ctx *ctx,

View file

@ -24,6 +24,7 @@
#include "../grn_util.h" #include "../grn_util.h"
#include "../grn_cache.h" #include "../grn_cache.h"
#include "../grn_ii.h" #include "../grn_ii.h"
#include <my_attribute.h>
#include "../grn_ts.h" #include "../grn_ts.h"
@ -2912,7 +2913,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
uint32_t nhits; uint32_t nhits;
grn_obj *outbuf = ctx->impl->output.buf; grn_obj *outbuf = ctx->impl->output.buf;
grn_content_type output_type = ctx->impl->output.type; grn_content_type output_type = ctx->impl->output.type;
char cache_key[GRN_CACHE_MAX_KEY_SIZE]; char *cache_key_buffer= 0;
uint32_t cache_key_size; uint32_t cache_key_size;
long long int threshold, original_threshold = 0; long long int threshold, original_threshold = 0;
grn_cache *cache_obj = grn_cache_current_get(ctx); grn_cache *cache_obj = grn_cache_current_get(ctx);
@ -2985,8 +2986,9 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
} GRN_HASH_EACH_END(ctx, cursor); } GRN_HASH_EACH_END(ctx, cursor);
} }
#undef DRILLDOWN_CACHE_SIZE #undef DRILLDOWN_CACHE_SIZE
if (cache_key_size <= GRN_CACHE_MAX_KEY_SIZE) { if (cache_key_size <= GRN_CACHE_MAX_KEY_SIZE &&
char *cp = cache_key; (cache_key_buffer= (char*) malloc(cache_key_size+1))) {
char *cp = cache_key_buffer;
#define PUT_CACHE_KEY(string) \ #define PUT_CACHE_KEY(string) \
if ((string).value) \ if ((string).value) \
@ -3066,11 +3068,12 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
{ {
grn_rc rc; grn_rc rc;
rc = grn_cache_fetch(ctx, cache_obj, cache_key, cache_key_size, outbuf); rc = grn_cache_fetch(ctx, cache_obj, cache_key_buffer, cache_key_size, outbuf);
if (rc == GRN_SUCCESS) { if (rc == GRN_SUCCESS) {
GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_CACHE, GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_CACHE,
":", "cache(%" GRN_FMT_LLD ")", ":", "cache(%" GRN_FMT_LLD ")",
(long long int)GRN_TEXT_LEN(outbuf)); (long long int)GRN_TEXT_LEN(outbuf));
free(cache_key_buffer);
return ctx->rc; return ctx->rc;
} }
} }
@ -3119,7 +3122,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
data->cache.length != 2 || data->cache.length != 2 ||
data->cache.value[0] != 'n' || data->cache.value[0] != 'n' ||
data->cache.value[1] != 'o')) { data->cache.value[1] != 'o')) {
grn_cache_update(ctx, cache_obj, cache_key, cache_key_size, outbuf); grn_cache_update(ctx, cache_obj, cache_key_buffer, cache_key_size, outbuf);
} }
goto exit; goto exit;
} }
@ -3186,7 +3189,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
data->cache.length != 2 || data->cache.length != 2 ||
data->cache.value[0] != 'n' || data->cache.value[0] != 'n' ||
data->cache.value[1] != 'o')) { data->cache.value[1] != 'o')) {
grn_cache_update(ctx, cache_obj, cache_key, cache_key_size, outbuf); grn_cache_update(ctx, cache_obj, cache_key_buffer, cache_key_size, outbuf);
} }
if (data->taintable > 0) { if (data->taintable > 0) {
grn_db_touch(ctx, DB_OBJ(data->tables.target)->db); grn_db_touch(ctx, DB_OBJ(data->tables.target)->db);
@ -3200,6 +3203,7 @@ exit :
/* GRN_LOG(ctx, GRN_LOG_NONE, "%d", ctx->seqno); */ /* GRN_LOG(ctx, GRN_LOG_NONE, "%d", ctx->seqno); */
free(cache_key_buffer);
return ctx->rc; return ctx->rc;
} }
@ -3424,6 +3428,9 @@ grn_select_data_fill_drilldown_columns(grn_ctx *ctx,
strlen(prefix)); strlen(prefix));
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
static grn_bool static grn_bool
grn_select_data_fill_drilldowns(grn_ctx *ctx, grn_select_data_fill_drilldowns(grn_ctx *ctx,
grn_user_data *user_data, grn_user_data *user_data,
@ -3562,6 +3569,7 @@ grn_select_data_fill_drilldowns(grn_ctx *ctx,
return succeeded; return succeeded;
} }
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
static grn_obj * static grn_obj *
command_select(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) command_select(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)

View file

@ -86,6 +86,8 @@ void test_no_instruments()
cleanup_instruments(); cleanup_instruments();
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
void test_no_instances() void test_no_instances()
{ {
int rc; int rc;
@ -245,6 +247,7 @@ void test_no_instances()
cleanup_file_hash(); cleanup_file_hash();
cleanup_instruments(); cleanup_instruments();
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
void test_with_instances() void test_with_instances()
{ {

View file

@ -9130,6 +9130,9 @@ int spider_db_udf_ping_table_append_select(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/* Stack size 33032 with clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
int spider_db_udf_ping_table_mon_next( int spider_db_udf_ping_table_mon_next(
THD *thd, THD *thd,
SPIDER_TABLE_MON *table_mon, SPIDER_TABLE_MON *table_mon,
@ -9276,6 +9279,7 @@ int spider_db_udf_ping_table_mon_next(
delete res; delete res;
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
int spider_db_udf_copy_key_row( int spider_db_udf_copy_key_row(
spider_string *str, spider_string *str,

View file

@ -358,6 +358,7 @@ handle_option(const struct my_option *opt, const char *arg,
return 0; return 0;
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
@ -433,3 +434,4 @@ main(int argc, char *argv[])
return 0; return 0;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME

View file

@ -568,6 +568,9 @@ static int my_process_result(MYSQL *mysql_arg)
#define MAX_RES_FIELDS 50 #define MAX_RES_FIELDS 50
#define MAX_FIELD_DATA_SIZE 255 #define MAX_FIELD_DATA_SIZE 255
/* Stack usage 18888 with clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
static int my_process_stmt_result(MYSQL_STMT *stmt) static int my_process_stmt_result(MYSQL_STMT *stmt)
{ {
int field_count; int field_count;
@ -656,6 +659,7 @@ static int my_process_stmt_result(MYSQL_STMT *stmt)
mysql_free_result(result); mysql_free_result(result);
return row_count; return row_count;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/* Prepare statement, execute, and process result set for given query */ /* Prepare statement, execute, and process result set for given query */

View file

@ -123,6 +123,8 @@ error6:
return TRUE; return TRUE;
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
my_bool test_compare_operators(MY_BITMAP *map, uint bitsize) my_bool test_compare_operators(MY_BITMAP *map, uint bitsize)
{ {
uint i, j, test_bit1, test_bit2, test_bit3,test_bit4; uint i, j, test_bit1, test_bit2, test_bit3,test_bit4;
@ -228,6 +230,8 @@ error5:
test_bit1); test_bit1);
return TRUE; return TRUE;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
my_bool test_count_bits_set(MY_BITMAP *map, uint bitsize) my_bool test_count_bits_set(MY_BITMAP *map, uint bitsize)
{ {

View file

@ -96,6 +96,8 @@ void sql_print_error(const char *format, ...)
/*** end of encryption tweaks and stubs ****************************/ /*** end of encryption tweaks and stubs ****************************/
PRAGMA_DISABLE_CHECK_STACK_FRAME
static IO_CACHE info; static IO_CACHE info;
#define CACHE_SIZE 16384 #define CACHE_SIZE 16384
@ -472,3 +474,4 @@ int main(int argc __attribute__((unused)),char *argv[])
return exit_status(); return exit_status();
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME