List:Internals« Previous MessageNext Message »
From:Marko Mäkelä Date:April 21 2005 12:03pm
Subject:bk commit into 5.0 tree (marko:1.1854)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of marko. When marko does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1854 05/04/21 15:02:54 marko@stripped +3 -0
  InnoDB: Reduce memcpy() load in row_sel_pop_cached_row_for_mysql()
  by copying only a prefix of the row that covers the requested
  columns.

  sql/ha_innodb.cc
    1.195 05/04/21 15:02:46 marko@stripped +8 -0
    build_template(): Initialize prebuilt->mysql_prefix_len.

  innobase/row/row0sel.c
    1.89 05/04/21 15:02:46 marko@stripped +3 -2
    row_sel_pop_cached_row_for_mysql(): memcpy() only
    mysql_prefix_len bytes instead of mysql_row_len.

  innobase/include/row0mysql.h
    1.40 05/04/21 15:02:46 marko@stripped +2 -0
    row_prebuilt_struct: Add field mysql_prefix_len
    in order to reduce memcpy() time in
    row_sel_pop_cached_row_for_mysql().

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	marko
# Host:	hundin.mysql.fi
# Root:	/home/marko/mysql-5.0

--- 1.39/innobase/include/row0mysql.h	Wed Mar 16 00:00:02 2005
+++ 1.40/innobase/include/row0mysql.h	Thu Apr 21 15:02:46 2005
@@ -599,6 +599,8 @@
 					that was decided in ha_innodb.cc,
 					::store_lock(), ::external_lock(),
 					etc. */
+	ulint		mysql_prefix_len;/* byte offset of the end of
+					the last requested column */
 	ulint		mysql_row_len;	/* length in bytes of a row in the
 					MySQL format */
 	ulint		n_rows_fetched;	/* number of rows fetched after

--- 1.88/innobase/row/row0sel.c	Thu Apr 21 14:23:18 2005
+++ 1.89/innobase/row/row0sel.c	Thu Apr 21 15:02:46 2005
@@ -2849,8 +2849,9 @@
 	mysql_row_templ_t*	templ;
 	byte*			cached_rec;
         ut_ad(prebuilt->n_fetch_cached > 0);
+	ut_ad(prebuilt->mysql_prefix_len <= prebuilt->mysql_row_len);
 	
-	if (prebuilt->keep_other_fields_on_keyread)
+	if (UNIV_UNLIKELY(prebuilt->keep_other_fields_on_keyread))
 	{
 		/* Copy cache record field by field, don't touch fields that 
 		are not covered by current key */
@@ -2877,7 +2878,7 @@
 	else
 	{
 		ut_memcpy(buf, prebuilt->fetch_cache[prebuilt->fetch_cache_first],
-				prebuilt->mysql_row_len);
+				prebuilt->mysql_prefix_len);
 	}
 	prebuilt->n_fetch_cached--;
 	prebuilt->fetch_cache_first++;

--- 1.194/sql/ha_innodb.cc	Wed Apr 20 17:38:56 2005
+++ 1.195/sql/ha_innodb.cc	Thu Apr 21 15:02:46 2005
@@ -2618,6 +2618,8 @@
 	ibool		fetch_all_in_key	= FALSE;
 	ibool		fetch_primary_key_cols	= FALSE;
 	ulint		i;
+	/* byte offset of the end of last requested column */
+	ulint		mysql_prefix_len	= 0;
 
 	if (prebuilt->select_lock_type == LOCK_X) {
 		/* We always retrieve the whole clustered index record if we
@@ -2738,6 +2740,11 @@
 					get_field_offset(table, field);
 
 		templ->mysql_col_len = (ulint) field->pack_length();
+		if (mysql_prefix_len < templ->mysql_col_offset
+				+ templ->mysql_col_len) {
+			mysql_prefix_len = templ->mysql_col_offset
+				+ templ->mysql_col_len;
+		}
 		templ->type = index->table->cols[i].type.mtype;
 		templ->mysql_type = (ulint)field->type();
 
@@ -2760,6 +2767,7 @@
 	}
 
 	prebuilt->n_template = n_requested_fields;
+	prebuilt->mysql_prefix_len = mysql_prefix_len;
 
 	if (index != clust_index && prebuilt->need_to_access_clustered) {
 		/* Change rec_field_no's to correspond to the clustered index
Thread
bk commit into 5.0 tree (marko:1.1854)Marko Mäkelä21 Apr