[Maria-developers] [s...@mariadb.org: [Commits] Rev 4006: MDEV-5674 - Performance: my_hash_sort_bin is called too often in lp:maria/10.0]

2014-02-14 Thread Sergey Vojtovich
Hi!

JFYI: we discussed this during the Barcelona meeting. I will submit table cache
part separately (not to overcomplicate this patch). Reviewers are very welcome.

Regards,
Sergey


- Forwarded message from Sergey Vojtovich s...@mariadb.org -

Date: Fri, 14 Feb 2014 12:25:50 + (UTC)
From: Sergey Vojtovich s...@mariadb.org
To: comm...@mariadb.org
Subject: [Commits] Rev 4006: MDEV-5674 - Performance: my_hash_sort_bin is 
called too often in lp:maria/10.0

At lp:maria/10.0


revno: 4006
revision-id: s...@mariadb.org-20140214122541-tenvcllk760deai8
parent: s...@mariadb.org-20140213071355-psk0jpsarx2u7myc
committer: Sergey Vojtovich s...@mariadb.org
branch nick: 10.0
timestamp: Fri 2014-02-14 16:25:41 +0400
message:
  MDEV-5674 - Performance: my_hash_sort_bin is called too often
  
  - reduced number of my_hash_sort_bin() calls from 4 to 2 per query.
Let MDL subsystem use pre-calculated hash value for hash
inserts and deletes.
  - reduced number of memory accesses done by my_hash_sort_bin()
=== modified file 'include/hash.h'
--- a/include/hash.h2013-09-14 01:09:36 +
+++ b/include/hash.h2014-02-14 12:25:41 +
@@ -86,7 +86,13 @@ uchar *my_hash_first_from_hash_value(con
 uchar *my_hash_next(const HASH *info, const uchar *key, size_t length,
 HASH_SEARCH_STATE *state);
 my_bool my_hash_insert(HASH *info, const uchar *data);
+my_bool my_hash_insert_using_hash_value(HASH *info,
+my_hash_value_type hash_value,
+const uchar *record);
 my_bool my_hash_delete(HASH *hash, uchar *record);
+my_bool my_hash_delete_using_hash_value(HASH *hash,
+my_hash_value_type hash_value,
+uchar *record);
 my_bool my_hash_update(HASH *hash, uchar *record, uchar *old_key,
size_t old_key_length);
 void my_hash_replace(HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row);

=== modified file 'mysys/hash.c'
--- a/mysys/hash.c  2013-09-14 01:09:36 +
+++ b/mysys/hash.c  2014-02-14 12:25:41 +
@@ -380,6 +380,15 @@ static int hashcmp(const HASH *hash, HAS
 
 my_bool my_hash_insert(HASH *info, const uchar *record)
 {
+  return my_hash_insert_using_hash_value(info, rec_hashnr(info, record),
+ record);
+}
+
+
+my_bool my_hash_insert_using_hash_value(HASH *info,
+my_hash_value_type hash_value,
+const uchar *record)
+{
   int flag;
   size_t idx,halfbuff,first_index;
   my_hash_value_type hash_nr;
@@ -480,7 +489,7 @@ my_bool my_hash_insert(HASH *info, const
   }
   /* Check if we are at the empty position */
 
-  idx= my_hash_mask(rec_hashnr(info, record), info-blength, info-records + 
1);
+  idx= my_hash_mask(hash_value, info-blength, info-records + 1);
   pos=data+idx;
   if (pos == empty)
   {
@@ -528,6 +537,15 @@ my_bool my_hash_insert(HASH *info, const
 
 my_bool my_hash_delete(HASH *hash, uchar *record)
 {
+  return my_hash_delete_using_hash_value(hash, rec_hashnr(hash, record),
+ record);
+}
+
+
+my_bool my_hash_delete_using_hash_value(HASH *hash,
+my_hash_value_type hash_value,
+uchar *record)
+{
   uint pos2,idx,empty_index;
   my_hash_value_type pos_hashnr, lastpos_hashnr;
   size_t blength;
@@ -539,7 +557,7 @@ my_bool my_hash_delete(HASH *hash, uchar
   blength=hash-blength;
   data=dynamic_element(hash-array,0,HASH_LINK*);
   /* Search after record with key */
-  pos= data + my_hash_mask(rec_hashnr(hash, record), blength, hash-records);
+  pos= data + my_hash_mask(hash_value, blength, hash-records);
   gpos = 0;
 
   while (pos-data != record)

=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc2013-12-10 15:31:04 +
+++ b/sql/mdl.cc2014-02-14 12:25:41 +
@@ -124,15 +124,9 @@ class MDL_map_partition
 public:
   MDL_map_partition();
   ~MDL_map_partition();
-  inline MDL_lock *find_or_insert(const MDL_key *mdl_key,
-  my_hash_value_type hash_value);
-  unsigned long get_lock_owner(const MDL_key *key,
-   my_hash_value_type hash_value);
+  inline MDL_lock *find_or_insert(const MDL_key *mdl_key);
+  unsigned long get_lock_owner(const MDL_key *key);
   inline void remove(MDL_lock *lock);
-  my_hash_value_type get_key_hash(const MDL_key *mdl_key) const
-  {
-return my_calc_hash(m_locks, mdl_key-ptr(), mdl_key-length());
-  }
 private:
   bool move_from_hash_to_lock_mutex(MDL_lock *lock);
   /** A partition of all acquired locks in the server. */
@@ -846,11 +840,10 @@ MDL_lock* MDL_map::find_or_insert(const
 return lock;
   }
 
-  my_hash_value_type hash_value= m_partitions.at(0)-get_key_hash(mdl_key);
-  uint 

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

2014-02-14 Thread Alexey Botchkov

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, holyf...@askmonty.org wrote:

revno: 4029
revision-id: holyf...@askmonty.org-20140131103303-1rx7ielo83f8iahe
parent: holyf...@askmonty.org-20140124020722-dd5twtwlcc8o1xiy
committer: Alexey Botchkov holyf...@askmonty.org
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 +
+++ b/sql/sql_class.cc  2014-01-31 10:33:03 +
@@ -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 +
+++ b/sql/sql_show.cc   2014-01-31 10:33:03 +
@@ -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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp



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


[Maria-developers] Potential participation in Google Summer of Code 2014

2014-02-14 Thread Colin Charles
Hi!

We have applied to be part of the Google Summer of Code 2014 project, and hope 
to gain some new contributors. If you are on this list and think you can be a 
mentor for a project, please consider writing a note at:
https://mariadb.com/kb/en/google-summer-of-code-2014/

I think the aim for the GSoC students code should be for 10.1 inclusion

If you have any queries, don't hesitate to ask me about them, I'm happy to 
help. Typically mentors need about 4 hours or so per week to assist the student 
in seeing their project become a reality

I encourage many to participate as its a rewarding experience. In 2013, we did 
participate, and got 3 features out of it: SQL ROLES, PCRE regular expressions, 
and a Kerberos authentication plugin

Looking forward to seeing more happen in 2014!
(here's hoping we get accepted into GSoC 2014 of course!)

cheers,
-colin

--
Colin Charles, Chief Evangelist
MariaDB | t: +6-012-204-3201 | Skype: colincharles


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