[Commits] Rev 4303: MDEV-6473 - main.statistics fails on PPC64 in lp:maria/10.0

Sergey Vojtovich svoj at mariadb.org
Wed Jul 23 11:55:36 EEST 2014


At lp:maria/10.0

------------------------------------------------------------
revno: 4303
revision-id: svoj at mariadb.org-20140723085526-i0v39faneybs7m4p
parent: jplindst at mariadb.org-20140722163145-c2hibh40f3jjj2yc
committer: Sergey Vojtovich <svoj at mariadb.org>
branch nick: 10.0
timestamp: Wed 2014-07-23 12:55:26 +0400
message:
  MDEV-6473 - main.statistics fails on PPC64
  
  mysql.column_stats wasn't stored/restored properly on big-endian
  with histogram_type=DOUBLE_PREC_HB.
  
  Store histogram values using int2store()/uint2korr().
  
  Note that this patch invalidates previously calculated histogram
  values on big-endian.
=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2014-06-10 18:20:33 +0000
+++ b/sql/item_strfunc.cc	2014-07-23 08:55:26 +0000
@@ -602,7 +602,7 @@ String *Item_func_decode_histogram::val_
       val= p[i] / ((double)((1 << 8) - 1));
       break;
     case DOUBLE_PREC_HB:
-      val= ((uint16 *)(p + i))[0] / ((double)((1 << 16) - 1));
+      val= uint2korr(p + i) / ((double)((1 << 16) - 1));
       i++;
       break;
     default:

=== modified file 'sql/sql_statistics.h'
--- a/sql/sql_statistics.h	2014-03-27 09:08:00 +0000
+++ b/sql/sql_statistics.h	2014-07-23 08:55:26 +0000
@@ -147,7 +147,7 @@ class Histogram
     case SINGLE_PREC_HB:
       return (uint) (((uint8 *) values)[i]);
     case DOUBLE_PREC_HB:
-      return (uint) (((uint16 *) values)[i]);
+      return (uint) uint2korr(values + i * 2);
     }
     return 0;
   }
@@ -214,7 +214,7 @@ class Histogram
       ((uint8 *) values)[i]= (uint8) (val * prec_factor());
       return;
     case DOUBLE_PREC_HB:
-      ((uint16 *) values)[i]= (uint16) (val * prec_factor());
+      int2store(values + i * 2, val * prec_factor());
       return;
     }
   }
@@ -226,7 +226,7 @@ class Histogram
       ((uint8 *) values)[i]= ((uint8 *) values)[i-1];
       return;
     case DOUBLE_PREC_HB:
-      ((uint16 *) values)[i]= ((uint16 *) values)[i-1];
+      int2store(values + i * 2, uint2korr(values + i * 2 - 2));
       return;
     }
   }



More information about the commits mailing list