summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <kostja@bodhi.(none)>2007-12-13 23:58:55 +0300
committerunknown <kostja@bodhi.(none)>2007-12-13 23:58:55 +0300
commit37a2c4590a7453d5c8e5b67c2f512162323ac738 (patch)
tree5b1e35ecfb3c06d25e3fab02b488f661e7c476d0
parenta3a0d4359fef580a30704797ceeed613600deedc (diff)
downloadmariadb-git-37a2c4590a7453d5c8e5b67c2f512162323ac738.tar.gz
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.
-rw-r--r--client/mysqltest.c1
-rw-r--r--libmysqld/emb_qcache.cc2
-rw-r--r--libmysqld/emb_qcache.h1
-rw-r--r--libmysqld/lib_sql.cc2
-rw-r--r--sql/log.cc69
-rw-r--r--storage/myisam/ha_myisam.cc2
6 files changed, 44 insertions, 33 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index cca2420d498..1876e2e0144 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -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;
diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc
index 17549bfa96b..07b7d82a0cc 100644
--- a/libmysqld/emb_qcache.cc
+++ b/libmysqld/emb_qcache.cc
@@ -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);
diff --git a/libmysqld/emb_qcache.h b/libmysqld/emb_qcache.h
index 6e320fbd967..e1c219ec461 100644
--- a/libmysqld/emb_qcache.h
+++ b/libmysqld/emb_qcache.h
@@ -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);
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index df6d68c7582..f13129cc52d 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -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;
}
diff --git a/sql/log.cc b/sql/log.cc
index 9fdede9ef2c..0cea59eed98 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -280,29 +280,34 @@ void Log_to_csv_event_handler::cleanup()
/* log event handlers */
-/*
+/**
Log command to the general log table
- SYNOPSIS
- log_general()
-
- 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
-
- DESCRIPTION
-
- Log given command to the general log table
-
- RETURN
- FALSE - OK
- TRUE - error occured
+ Log given command to the general log table.
+
+ @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
+
+
+ @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.
+
+ @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;
@@ -358,14 +377,6 @@ bool Log_to_csv_event_handler::
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).
*/
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index a557890a7b9..7710660f29e 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -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;