Fix broken embedded build (broken by the patch for Bug#12713, first part).

client/mysqltest.c:
  Remove a call to my_message() (server call) in case of a client error.
  It asserts in the embedded build now, since is called after send_ok().
libmysqld/emb_qcache.cc:
  Use net_send_eof (embedded implementation) in embedded query cache/
  send result to client, since send_eof currently does not
  send anything.
libmysqld/emb_qcache.h:
  Declare net_send_eof.
libmysqld/lib_sql.cc:
  Fix the main loop of the embedded server to use the new Diagnostics_area
  API.
sql/log.cc:
  Silence errors of open_performance_schema_table. This function
  is called for general logging, and it happens after the error
  has been sent to the client, and thus triggers an assert.
storage/myisam/ha_myisam.cc:
  Remove an old hack that broke repair.test in embedded build:
  unless we clear an error here, the server attempts to send OK after
  ERROR. This currently asserts.
This commit is contained in:
unknown 2007-12-13 23:58:55 +03:00
parent a3a0d4359f
commit 37a2c4590a
6 changed files with 40 additions and 29 deletions

View file

@ -8018,7 +8018,6 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
if (!len)
{
errno=EINVAL;
my_message(0,"No to-string for last from-string",MYF(ME_BELL));
DBUG_RETURN(0);
}
states+=len+1;

View file

@ -447,7 +447,7 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
*prev_row= NULL;
data->embedded_info->prev_ptr= prev_row;
return_ok:
send_eof(thd);
net_send_eof(thd, thd->server_status, thd->total_warn_count);
DBUG_RETURN(0);
err:
DBUG_RETURN(1);

View file

@ -79,3 +79,4 @@ public:
uint emb_count_querycache_size(THD *thd);
int emb_load_querycache_result(THD *thd, Querycache_stream *src);
void emb_store_querycache_result(Querycache_stream *dst, THD* thd);
void net_send_eof(THD *thd, uint server_status, uint total_warn_count);

View file

@ -87,6 +87,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
/* Clear result variables */
thd->clear_error();
thd->main_da.reset_diagnostics_area();
mysql->affected_rows= ~(my_ulonglong) 0;
mysql->field_count= 0;
net_clear_error(net);
@ -625,6 +626,7 @@ int check_embedded_connection(MYSQL *mysql, const char *db)
strmake(sctx->priv_host, (char*) my_localhost, MAX_HOSTNAME-1);
sctx->priv_user= sctx->user= my_strdup(mysql->user, MYF(0));
result= check_user(thd, COM_CONNECT, NULL, 0, db, true);
net_end_statement(thd);
emb_read_query_result(mysql);
return result;
}

View file

@ -280,29 +280,34 @@ void Log_to_csv_event_handler::cleanup()
/* log event handlers */
/*
/**
Log command to the general log table
SYNOPSIS
log_general()
Log given command to the general log table.
event_time command start timestamp
user_host the pointer to the string with user@host info
user_host_len length of the user_host string. this is computed once
and passed to all general log event handlers
thread_id Id of the thread, issued a query
command_type the type of the command being logged
command_type_len the length of the string above
sql_text the very text of the query being executed
sql_text_len the length of sql_text string
@param event_time command start timestamp
@param user_host the pointer to the string with user@host info
@param user_host_len length of the user_host string. this is computed
once and passed to all general log event handlers
@param thread_id Id of the thread, issued a query
@param command_type the type of the command being logged
@param command_type_len the length of the string above
@param sql_text the very text of the query being executed
@param sql_text_len the length of sql_text string
DESCRIPTION
Log given command to the general log table
@return This function attempts to never call my_error(). This is
necessary, because general logging happens already after a statement
status has been sent to the client, so the client can not see the
error anyway. Besides, the error is not related to the statement
being executed and is internal, and thus should be handled
internally (@todo: how?).
If a write to the table has failed, the function attempts to
write to a short error message to the file. The failure is also
indicated in the return value.
RETURN
FALSE - OK
TRUE - error occured
@retval FALSE OK
@retval TRUE error occured
*/
bool Log_to_csv_event_handler::
@ -342,6 +347,20 @@ bool Log_to_csv_event_handler::
table_list.db= MYSQL_SCHEMA_NAME.str;
table_list.db_length= MYSQL_SCHEMA_NAME.length;
/*
1) open_performance_schema_table generates an error of the
table can not be opened or is corrupted.
2) "INSERT INTO general_log" can generate warning sometimes.
Suppress these warnings and errors, they can't be dealt with
properly anyway.
QQ: this problem needs to be studied in more detail.
Comment this 2 lines and run "cast.test" to see what's happening.
*/
thd->push_internal_handler(& error_handler);
need_pop= TRUE;
if (!(table= open_performance_schema_table(thd, & table_list,
& open_tables_backup)))
goto err;
@ -357,14 +376,6 @@ bool Log_to_csv_event_handler::
/* Honor next number columns if present */
table->next_number_field= table->found_next_number_field;
/*
"INSERT INTO general_log" can generate warning sometimes.
QQ: this problem needs to be studied in more details.
Comment this 2 lines and run "cast.test" to see what's happening:
*/
thd->push_internal_handler(& error_handler);
need_pop= TRUE;
/*
NOTE: we do not call restore_record() here, as all fields are
filled by the Logger (=> no need to load default ones).

View file

@ -1407,10 +1407,8 @@ int ha_myisam::enable_indexes(uint mode)
might have been set by the first repair. They can still be seen
with SHOW WARNINGS then.
*/
#ifndef EMBEDDED_LIBRARY
if (! error)
thd->clear_error();
#endif /* EMBEDDED_LIBRARY */
}
info(HA_STATUS_CONST);
thd->proc_info=save_proc_info;