← Back to team overview

maria-developers team mailing list archive

Re: Rev 4029: MDEV-4856 SQL_ERROR_LOG shows 1146 errors which didnt appear in mysql client

 

But I don't understand that. Do you mean, old code did *not* suppress
errors here? How could selects from I_S tables work without it?

Here's how it works today:

get_all_tables()
	Trigger_error_handler err_handler;
	thd->push_internal_handler(&err_handler);
	fill_schema_table_from_frm
		get_table_share
			.... /* here we get the error of file not found */
				my_message_sql
					THD::raise_condition
						/* here we test the err_handler */
						/* but it doesn't react on that kind of errors */
						mysql_audit_notify()
						stmt_da->set_error_status
						warning_info->push_warning
					/
				/
			.... /*error is returned back along the call stack */
		/
		thd->clear_error(); /*which erases all the fileopen errors*/
	/

So basically the error is launched and then erased. Which doesn't help with the plugin notifications.
To fix that i added one more error handler.

Best regards.
HF



03.02.2014 20:42, Sergei Golubchik wrote:
Hi, Holyfoot!

On Jan 31, holyfoot@xxxxxxxxxxxx wrote:
revno: 4029
revision-id: holyfoot@xxxxxxxxxxxx-20140131103303-1rx7ielo83f8iahe
parent: holyfoot@xxxxxxxxxxxx-20140124020722-dd5twtwlcc8o1xiy
committer: Alexey Botchkov <holyfoot@xxxxxxxxxxxx>
branch nick: mdev-4856
timestamp: Fri 2014-01-31 14:33:03 +0400
message:
   MDEV-4856 SQL_ERROR_LOG shows 1146 errors which didnt appear in mysql client.
   The fill_schema_table() function used to call get_table_share() for
   a table name in WHERE then clear the error list. That way plugins
   receive the superfluous error notification if it happens in it. Also
   the problem was that error handler didn't prevent the suppressed
   error message from logging anyway as the logging happens in
   THD::raise_condition before the handler call.
   Fixed by adding the No_table_error_handler before the call.
   raise_condition() also fixed.
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2014-01-23 18:21:02 +0000
+++ b/sql/sql_class.cc	2014-01-31 10:33:03 +0000
@@ -1145,7 +1145,6 @@ MYSQL_ERROR* THD::raise_condition(uint s
      got_warning= 1;
      break;
    case MYSQL_ERROR::WARN_LEVEL_ERROR:
-    mysql_audit_general(this, MYSQL_AUDIT_GENERAL_ERROR, sql_errno, msg);
      break;
    default:
      DBUG_ASSERT(FALSE);
@@ -1156,6 +1155,8 @@ MYSQL_ERROR* THD::raise_condition(uint s
if (level == MYSQL_ERROR::WARN_LEVEL_ERROR)
    {
+    mysql_audit_general(this, MYSQL_AUDIT_GENERAL_ERROR, sql_errno, msg);
+
This is good.

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2013-11-19 12:16:25 +0000
+++ b/sql/sql_show.cc	2014-01-31 10:33:03 +0000
@@ -4199,8 +4199,13 @@ static int fill_schema_table_from_frm(TH
    key_length= create_table_def_key(thd, key, &table_list, 0);
    hash_value= my_calc_hash(&table_def_cache, (uchar*) key, key_length);
    mysql_mutex_lock(&LOCK_open);
-  share= get_table_share(thd, &table_list, key,
-                         key_length, OPEN_VIEW, &not_used, hash_value);
+  {
+    No_such_table_error_handler no_such_table_handler;
+    thd->push_internal_handler(&no_such_table_handler);
+    share= get_table_share(thd, &table_list, key,
+        key_length, OPEN_VIEW, &not_used, hash_value);
+    thd->pop_internal_handler();
+  }
But I don't understand that. Do you mean, old code did *not* suppress
errors here? How could selects from I_S tables work without it?

Regards,
Sergei


_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : maria-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp



Follow ups

References