Fixed compiler warnings and other bugs found by buildbot.
client/mysqltest.cc: Free mutex after usage (fixes valgrind warnings in embedded server) mysql-test/include/gis_keys.inc: Fixed failure in innodb.gis_test mysql-test/r/gis.result: Updated result mysql-test/suite/innodb/r/innodb_gis.result: Updated results mysql-test/suite/innodb/t/innodb_bug38231.test: Added handling of timeouts (happend on some servers in buildbot) mysql-test/suite/innodb_plugin/r/innodb_gis.result: Updated results mysql-test/suite/innodb_plugin/t/innodb.test: Use error names instead of numbers mysql-test/suite/innodb_plugin/t/innodb_misc1.test: This test requires utf8 mysql-test/suite/innodb_plugin/t/innodb_mysql.test: This test requires Xtradb sql/sql_base.cc: Don't print table names for placeholders. sql/sql_show.cc: Temporary fix: Save and restore db and table_name in mysqld_show_create (to get rid of valgrind warning) A better solution that needs to be investgated is to not change these fields in mysql_derived_prepare() sql/sql_view.cc: Fixed valgrind warning storage/xtradb/handler/ha_innodb.cc: Don't access THD directly
This commit is contained in:
parent
ca5b1b5431
commit
692fcba403
@ -262,7 +262,7 @@ struct st_connection
|
||||
pthread_cond_t cond;
|
||||
pthread_t tid;
|
||||
int query_done;
|
||||
my_bool has_thread;
|
||||
my_bool has_thread, mutex_inited;
|
||||
#endif /*EMBEDDED_LIBRARY*/
|
||||
};
|
||||
|
||||
@ -776,10 +776,12 @@ static int do_send_query(struct st_connection *cn, const char *q, int q_len,
|
||||
if (flags & QUERY_REAP_FLAG)
|
||||
return mysql_send_query(cn->mysql, q, q_len);
|
||||
|
||||
if (pthread_mutex_init(&cn->mutex, NULL) ||
|
||||
pthread_cond_init(&cn->cond, NULL))
|
||||
if (!cn->mutex_inited &&
|
||||
(pthread_mutex_init(&cn->mutex, NULL) ||
|
||||
pthread_cond_init(&cn->cond, NULL)))
|
||||
die("Error in the thread library");
|
||||
|
||||
cn->mutex_inited= 1;
|
||||
cn->cur_query= q;
|
||||
cn->cur_query_len= q_len;
|
||||
cn->query_done= 0;
|
||||
@ -809,9 +811,20 @@ static void wait_query_thread_end(struct st_connection *con)
|
||||
}
|
||||
}
|
||||
|
||||
static void free_embedded_data(struct st_connection *con)
|
||||
{
|
||||
if (con->mutex_inited)
|
||||
{
|
||||
con->mutex_inited= 0;
|
||||
pthread_mutex_destroy(&con->mutex);
|
||||
pthread_cond_destroy(&con->cond);
|
||||
}
|
||||
}
|
||||
|
||||
#else /*EMBEDDED_LIBRARY*/
|
||||
|
||||
#define do_send_query(cn,q,q_len,flags) mysql_send_query(cn->mysql, q, q_len)
|
||||
#define free_embedded_data(next_con) do { } while(0)
|
||||
|
||||
#endif /*EMBEDDED_LIBRARY*/
|
||||
|
||||
@ -1165,6 +1178,7 @@ void close_connections()
|
||||
if (next_con->util_mysql)
|
||||
mysql_close(next_con->util_mysql);
|
||||
my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR));
|
||||
free_embedded_data(next_con);
|
||||
}
|
||||
my_free(connections, MYF(MY_WME));
|
||||
DBUG_VOID_RETURN;
|
||||
@ -4988,6 +5002,7 @@ void do_close_connection(struct st_command *command)
|
||||
|
||||
mysql_close(con->mysql);
|
||||
con->mysql= 0;
|
||||
free_embedded_data(con);
|
||||
|
||||
if (con->util_mysql)
|
||||
mysql_close(con->util_mysql);
|
||||
|
@ -33,6 +33,7 @@ EXPLAIN
|
||||
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
|
||||
--replace_column 9 #
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
|
@ -947,7 +947,7 @@ COUNT(*)
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref p p 28 const 1 Using where
|
||||
1 SIMPLE t2 ref p p 28 const # Using where
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
COUNT(*)
|
||||
2
|
||||
|
@ -572,7 +572,7 @@ COUNT(*)
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref p p 28 const 2 Using where
|
||||
1 SIMPLE t2 ref p p 28 const # Using where
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
COUNT(*)
|
||||
2
|
||||
|
@ -72,6 +72,7 @@ UNLOCK TABLES;
|
||||
# clean up
|
||||
|
||||
-- connection con2
|
||||
-- error 0, 1205
|
||||
-- reap
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
@ -572,7 +572,7 @@ COUNT(*)
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref p p 28 const 2 Using where
|
||||
1 SIMPLE t2 ref p p 28 const # Using where
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
COUNT(*)
|
||||
2
|
||||
|
@ -1034,11 +1034,11 @@ create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` )
|
||||
insert into `t2`values ( 1 ) ;
|
||||
create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
|
||||
insert into `t3`values ( 1 ) ;
|
||||
--error 1451
|
||||
--error ER_ROW_IS_REFERENCED_2
|
||||
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
|
||||
--error 1451
|
||||
--error ER_ROW_IS_REFERENCED_2
|
||||
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
|
||||
--error 1054
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
|
||||
drop table t3,t2,t1;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
-- source include/have_innodb_plugin.inc
|
||||
-- source include/have_utf8.inc
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
|
@ -8,6 +8,9 @@
|
||||
-- source include/have_innodb_plugin.inc
|
||||
-- source include/have_query_cache.inc
|
||||
|
||||
# We must run this with XtraDB as otherwise we will get different EXPLAIN's
|
||||
-- source include/have_xtradb.inc
|
||||
|
||||
let $engine_type= InnoDB;
|
||||
let $other_engine_type= MEMORY;
|
||||
# InnoDB does support FOREIGN KEYFOREIGN KEYs
|
||||
|
@ -4699,9 +4699,6 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
|
||||
*/
|
||||
for (tables= *start; tables ;tables= tables->next_global)
|
||||
{
|
||||
DBUG_PRINT("tcache", ("opening table: '%s'.'%s' item: 0x%lx",
|
||||
tables->db, tables->table_name, (long) tables));
|
||||
|
||||
safe_to_ignore_table= FALSE;
|
||||
|
||||
/*
|
||||
@ -4714,8 +4711,11 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
|
||||
{
|
||||
if (tables->view)
|
||||
goto process_view_routines;
|
||||
DBUG_PRINT("tcache", ("ignoring placeholder for derived table"));
|
||||
continue;
|
||||
}
|
||||
DBUG_PRINT("tcache", ("opening table: '%s'.'%s' item: 0x%lx",
|
||||
tables->db, tables->table_name, (long) tables));
|
||||
/*
|
||||
If this TABLE_LIST object is a placeholder for an information_schema
|
||||
table, create a temporary table to represent the information_schema
|
||||
|
@ -708,12 +708,30 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Return CREATE command for table or view
|
||||
|
||||
@param thd Thread handler
|
||||
@param table_list Table / view
|
||||
|
||||
@return
|
||||
@retval 0 OK
|
||||
@retval 1 Error
|
||||
|
||||
@notes
|
||||
table_list->db and table_list->table_name are kept unchanged to
|
||||
not cause problems with SP.
|
||||
*/
|
||||
|
||||
bool
|
||||
mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
||||
{
|
||||
Protocol *protocol= thd->protocol;
|
||||
char buff[2048];
|
||||
String buffer(buff, sizeof(buff), system_charset_info);
|
||||
char *save_db, *save_table_name;
|
||||
bool retval= TRUE; // Assume error
|
||||
List<Item> field_list;
|
||||
DBUG_ENTER("mysqld_show_create");
|
||||
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
|
||||
table_list->table_name));
|
||||
@ -721,13 +739,17 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
||||
/* We want to preserve the tree for views. */
|
||||
thd->lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW;
|
||||
|
||||
/* Store original names if called from SP */
|
||||
save_db= table_list->db;
|
||||
save_table_name= table_list->table_name;
|
||||
|
||||
{
|
||||
Show_create_error_handler view_error_suppressor(thd, table_list);
|
||||
thd->push_internal_handler(&view_error_suppressor);
|
||||
bool error= open_normal_and_derived_tables(thd, table_list, 0);
|
||||
thd->pop_internal_handler();
|
||||
if (error && (thd->killed || thd->main_da.is_error()))
|
||||
DBUG_RETURN(TRUE);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* TODO: add environment variables show when it become possible */
|
||||
@ -735,7 +757,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
||||
{
|
||||
my_error(ER_WRONG_OBJECT, MYF(0),
|
||||
table_list->db, table_list->table_name, "VIEW");
|
||||
DBUG_RETURN(TRUE);
|
||||
goto error;
|
||||
}
|
||||
|
||||
buffer.length(0);
|
||||
@ -747,9 +769,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
||||
view_store_create_info(thd, table_list, &buffer) :
|
||||
store_create_info(thd, table_list, &buffer, NULL,
|
||||
FALSE /* show_database */)))
|
||||
DBUG_RETURN(TRUE);
|
||||
goto error;
|
||||
|
||||
List<Item> field_list;
|
||||
if (table_list->view)
|
||||
{
|
||||
field_list.push_back(new Item_empty_string("View",NAME_CHAR_LEN));
|
||||
@ -770,7 +791,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
||||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(TRUE);
|
||||
goto error;
|
||||
protocol->prepare_for_resend();
|
||||
if (table_list->view)
|
||||
protocol->store(table_list->view_name.str, system_charset_info);
|
||||
@ -798,10 +819,17 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
||||
protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
|
||||
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(TRUE);
|
||||
goto error;
|
||||
|
||||
my_eof(thd);
|
||||
DBUG_RETURN(FALSE);
|
||||
retval= FALSE; // ok
|
||||
|
||||
error:
|
||||
/* Restore table list if called by stored procedure */
|
||||
table_list->db= save_db;
|
||||
table_list->table_name= save_table_name;
|
||||
DBUG_RETURN(retval);
|
||||
|
||||
}
|
||||
|
||||
bool mysqld_show_create_db(THD *thd, char *dbname,
|
||||
|
@ -848,7 +848,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
||||
|
||||
thd->variables.sql_mode|= sql_mode;
|
||||
}
|
||||
DBUG_PRINT("info", ("View: %s", view_query.ptr()));
|
||||
DBUG_PRINT("info", ("View: %.*s", view_query.length(), view_query.ptr()));
|
||||
|
||||
/* fill structure */
|
||||
view->source= thd->lex->create_view_select;
|
||||
|
@ -2735,7 +2735,7 @@ innobase_commit_low(
|
||||
#ifdef MYSQL_SERVER
|
||||
THD *thd=current_thd;
|
||||
|
||||
if (thd && thd->slave_thread) {
|
||||
if (thd && thd_is_replication_slave_thread(thd)) {
|
||||
/* Update the replication position info inside InnoDB.
|
||||
In embedded server, does nothing. */
|
||||
const char *log_file_name, *group_relay_log_name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user