[Commits] Rev 2877: Optimize use of SEARCH_SAVE_BUFF (less not-needed copies of key pages) in http://bazaar.launchpad.net/~maria-captains/maria/5.3/

serg at askmonty.org serg at askmonty.org
Thu Jan 13 16:29:24 EET 2011


At http://bazaar.launchpad.net/~maria-captains/maria/5.3/

------------------------------------------------------------
revno: 2877
revision-id: sergii at pisem.net-20110113142920-1dxzs2zivni4p476
parent: sergii at pisem.net-20110113141108-hfrhzi1zu74dzj8g
committer: Sergei Golubchik <sergii at pisem.net>
branch nick: 5.3-monty
timestamp: Thu 2011-01-13 15:29:20 +0100
message:
  Optimize use of SEARCH_SAVE_BUFF (less not-needed copies of key pages)
-------------- next part --------------
=== modified file 'storage/maria/ma_rkey.c'
--- a/storage/maria/ma_rkey.c	2010-03-20 12:01:47 +0000
+++ b/storage/maria/ma_rkey.c	2011-01-13 14:29:20 +0000
@@ -83,10 +83,11 @@ int maria_rkey(MARIA_HA *info, uchar *bu
     rw_rdlock(&keyinfo->root_lock);
 
   nextflag= maria_read_vec[search_flag] | key.flag;
-  if (search_flag != HA_READ_KEY_EXACT ||
-      ((keyinfo->flag & (HA_NOSAME | HA_NULL_PART)) != HA_NOSAME))
+  if (search_flag != HA_READ_KEY_EXACT)
+  {
+    /* Assume we will get a read next/previous call after this one */
     nextflag|= SEARCH_SAVE_BUFF;
-
+  }
   switch (keyinfo->key_alg) {
 #ifdef HAVE_RTREE_KEYS
   case HA_KEY_ALG_RTREE:
@@ -103,8 +104,6 @@ int maria_rkey(MARIA_HA *info, uchar *bu
     if (!_ma_search(info, &key, nextflag, info->s->state.key_root[inx]))
     {      
       MARIA_KEY lastkey;
-      lastkey.keyinfo= keyinfo;
-      lastkey.data= info->lastkey_buff;
       /*
         Found a key, but it might not be usable. We cannot use rows that
         are inserted by other threads after we got our table lock
@@ -129,6 +128,8 @@ int maria_rkey(MARIA_HA *info, uchar *bu
         break;
       }
       
+      lastkey.keyinfo= keyinfo;
+      lastkey.data= info->lastkey_buff;
       do
       {
         uint not_used[2];

=== modified file 'storage/maria/ma_unique.c'
--- a/storage/maria/ma_unique.c	2010-09-07 20:57:00 +0000
+++ b/storage/maria/ma_unique.c	2011-01-13 14:29:20 +0000
@@ -45,7 +45,8 @@ my_bool _ma_check_unique(MARIA_HA *info,
   info->update&= ~HA_STATE_RNEXT_SAME;
 
   DBUG_ASSERT(key.data_length == MARIA_UNIQUE_HASH_LENGTH);
-  if (_ma_search(info, &key, SEARCH_FIND, info->s->state.key_root[def->key]))
+  if (_ma_search(info, &key, SEARCH_FIND | SEARCH_SAVE_BUFF,
+                 info->s->state.key_root[def->key]))
   {
     info->page_changed=1;                       /* Can't optimize read next */
     info->cur_row.lastpos= lastpos;



More information about the commits mailing list