[Commits] Rev 2834: DS-MRR improvements: remove write_size/read_size, have the same size in file:///home/psergey/dev2/maria-5.3-dsmrr-cpk-r5/

Sergey Petrunya psergey at askmonty.org
Mon Sep 20 12:23:52 EEST 2010


At file:///home/psergey/dev2/maria-5.3-dsmrr-cpk-r5/

------------------------------------------------------------
revno: 2834
revision-id: psergey at askmonty.org-20100920092351-0u5v48yarqz1rdcs
parent: psergey at askmonty.org-20100920090217-dw61ufsfx6ztmaec
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: maria-5.3-dsmrr-cpk-r5
timestamp: Mon 2010-09-20 13:23:51 +0400
message:
  DS-MRR improvements: remove write_size/read_size, have the same size 
    for writing and reading
=== modified file 'sql/multi_range_read.cc'
--- a/sql/multi_range_read.cc	2010-09-20 09:02:17 +0000
+++ b/sql/multi_range_read.cc	2010-09-20 09:23:51 +0000
@@ -291,22 +291,22 @@
                                  uchar **data2, size_t len2)
 {
   write_ptr1= data1;
-  write_size1= len1;
+  size1= len1;
 
   write_ptr2= data2;
-  write_size2= len2;
+  size2= len2;
 }
 
 
 void SimpleBuffer::write()
 {
   if (is_reverse() && write_ptr2)
-    write(*write_ptr2, write_size2);
+    write(*write_ptr2, size2);
 
-  write(*write_ptr1, write_size1);
+  write(*write_ptr1, size1);
 
   if (!is_reverse() && write_ptr2)
-    write(*write_ptr2, write_size2);
+    write(*write_ptr2, size2);
 }
 
 
@@ -326,7 +326,7 @@
 
 bool SimpleBuffer::can_write()
 {
-  return have_space_for(write_size1 + (write_ptr2? write_size2:0));
+  return have_space_for(size1 + (write_ptr2 ? size2 : 0));
 }
 
 
@@ -349,20 +349,20 @@
                                  uchar **data2, size_t len2)
 {
   read_ptr1= data1;
-  read_size1= len1;
+  DBUG_ASSERT(len1 == size1);
 
   read_ptr2= data2;
-  read_size2= len2;
+  DBUG_ASSERT(len2 == size2);
 }
 
 
 bool SimpleBuffer::read()
 {
-  if (!have_data(read_size1 + (read_ptr2? read_size2 : 0)))
+  if (!have_data(size1 + (read_ptr2 ? size2 : 0)))
     return TRUE;
-  *read_ptr1= read(read_size1);
+  *read_ptr1= read(size1);
   if (read_ptr2)
-    *read_ptr2= read(read_size2);
+    *read_ptr2= read(size2);
   return FALSE;
 }
 
@@ -731,7 +731,7 @@
 
 void SimpleBuffer::sort(qsort2_cmp cmp_func, void *cmp_func_arg)
 {
-  uint elem_size=write_size1 + (write_ptr2 ? write_size2 : 0);
+  uint elem_size= size1 + (write_ptr2 ? size2 : 0);
   uint n_elements= used_size() / elem_size;
   my_qsort2(used_area(), n_elements, elem_size, cmp_func, cmp_func_arg);
 }

=== modified file 'sql/multi_range_read.h'
--- a/sql/multi_range_read.h	2010-09-20 09:02:17 +0000
+++ b/sql/multi_range_read.h	2010-09-20 09:23:51 +0000
@@ -106,25 +106,22 @@
 
   /* 
     Data to be written. write() call will assume that (*write_ptr1) points to 
-    write_size1 bytes of data to be written.
-    If write_ptr2!=NULL then the buffer stores pairs, and (*write_ptr2) points
-    to write_size2 bytes of data that form the second component.
+    size1 bytes of data to be written.
+    If write_ptr2 != NULL then the buffer stores pairs, and (*write_ptr2) 
+    points to size2 bytes of data that form the second component.
   */
   uchar **write_ptr1;
-  size_t write_size1;
+  size_t size1;
   uchar **write_ptr2;
-  size_t write_size2;
+  size_t size2;
 
   /*
     read() will do reading by storing pointer to read data into *read_ptr1 (if
     the buffer stores atomic elements), or into {*read_ptr1, *read_ptr2} (if
     the buffer stores pairs).
   */
-  //TODO if write_size1 == read_size1 why have two variables??
   uchar **read_ptr1;
-  size_t read_size1;
   uchar **read_ptr2;
-  size_t read_size2;
 
 public:
   /* Write-mode functions */
@@ -243,11 +240,11 @@
         have written the second component first).
       */
       uchar *res;
-      if ((res= get_next(buf->read_size1)))
+      if ((res= get_next(buf->size1)))
       {
         *(buf->read_ptr1)= res;
         if (buf->read_ptr2)
-          *buf->read_ptr2= get_next(buf->read_size2);
+          *buf->read_ptr2= get_next(buf->size2);
         return FALSE;
       }
       return TRUE; /* EOF */



More information about the commits mailing list