List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:September 3 2010 6:07am
Subject:bzr push into mysql-5.1-telco-7.1 branch (jonas:3790 to 3791)
View as plain text  
 3791 Jonas Oreland	2010-09-03 [merge]
      ndb - merge 70 to 71

    modified:
      mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result
      mysql-test/suite/ndb_binlog/t/ndb_binlog_multi.test
      storage/ndb/include/util/Bitmask.hpp
      storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp
      storage/ndb/test/ndbapi/testBitfield.cpp
 3790 Frazer Clement	2010-09-02 [merge]
      Merge 7.0->7.1

    modified:
      sql/ha_ndbcluster.cc
=== modified file 'mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result'
--- a/mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result	2009-09-11 10:34:36 +0000
+++ b/mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result	2010-09-03 05:30:17 +0000
@@ -78,3 +78,18 @@ SELECT inserts,updates,deletes,schemaops
 mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>;
 inserts	updates	deletes	schemaops
 2	0	0	0
+create table t1 (
+col0 int, col1 int, col2 int, col3 int,
+col4 int, col5 int, col6 int, col7 int,
+col8 int, col9 int, col10 int, col11 int,
+col12 int, col13 int, col14 int, col15 int,
+col16 int, col17 int, col18 int, col19 int,
+col20 int, col21 int, col22 int, col23 int,
+col24 int, col25 int, col26 int, col27 int,
+col28 int, col29 int, col30 int, col31 int,
+primary key(col0)) engine = ndb;
+begin;
+insert into t1 (col0) values (1);
+alter online table t1 add column col32 int COLUMN_FORMAT DYNAMIC;
+commit;
+drop table t1;

=== modified file 'mysql-test/suite/ndb_binlog/t/ndb_binlog_multi.test'
--- a/mysql-test/suite/ndb_binlog/t/ndb_binlog_multi.test	2008-02-25 13:50:20 +0000
+++ b/mysql-test/suite/ndb_binlog/t/ndb_binlog_multi.test	2010-09-03 05:30:17 +0000
@@ -80,3 +80,28 @@ drop table t1;
 --replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
 eval SELECT inserts,updates,deletes,schemaops FROM
    mysql.ndb_binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2;
+
+#
+# bug#XXX
+#
+create table t1 (
+  col0 int, col1 int, col2 int, col3 int,
+  col4 int, col5 int, col6 int, col7 int,
+  col8 int, col9 int, col10 int, col11 int,
+  col12 int, col13 int, col14 int, col15 int,
+  col16 int, col17 int, col18 int, col19 int,
+  col20 int, col21 int, col22 int, col23 int,
+  col24 int, col25 int, col26 int, col27 int,
+  col28 int, col29 int, col30 int, col31 int,
+  primary key(col0)) engine = ndb;
+
+connection server1;
+begin;
+insert into t1 (col0) values (1);
+
+connection server2;
+alter online table t1 add column col32 int COLUMN_FORMAT DYNAMIC;
+
+connection server1;
+commit;
+drop table t1;

=== modified file 'storage/ndb/include/util/Bitmask.hpp'
--- a/storage/ndb/include/util/Bitmask.hpp	2010-08-30 09:51:49 +0000
+++ b/storage/ndb/include/util/Bitmask.hpp	2010-09-03 05:35:51 +0000
@@ -50,9 +50,10 @@ public:
   static void set(unsigned size, Uint32 data[]);
 
   /**
-   * set bit from <em>start</em> to <em>last</em>
+   * set <em>len</em> bist from <em>start</em>
    */
-  static void set_range(unsigned size, Uint32 data[], unsigned start, unsigned last);
+  static void setRange(unsigned size, Uint32 data[], unsigned start,
+                       unsigned len);
 
   /**
    * assign - Set all bits in <em>dst</em> to corresponding in <em>src/<em>
@@ -216,9 +217,10 @@ BitmaskImpl::set(unsigned size, Uint32 d
 }
 
 inline void
-BitmaskImpl::set_range(unsigned size, Uint32 data[], 
-		       unsigned start, unsigned last)
+BitmaskImpl::setRange(unsigned size, Uint32 data[],
+                      unsigned start, unsigned len)
 {
+  Uint32 last = start + len - 1;
   Uint32 *ptr = data + (start >> 5);
   Uint32 *end =  data + (last >> 5);
   assert(start <= last);
@@ -545,6 +547,12 @@ public:
   void set();
 
   /**
+   * set - set a range of bits
+   */
+  static void setRange(Uint32 data[], Uint32 pos, Uint32 len);
+  void setRange(Uint32 pos, Uint32 len);
+
+  /**
    * clear - Clear bit n.
    */
   static void clear(Uint32 data[], unsigned n);
@@ -744,6 +752,21 @@ BitmaskPOD<size>::set()
 
 template <unsigned size>
 inline void
+BitmaskPOD<size>::setRange(Uint32 data[], Uint32 pos, Uint32 len)
+{
+  BitmaskImpl::setRange(size, data, pos, len);
+}
+
+
+template <unsigned size>
+inline void
+BitmaskPOD<size>::setRange(Uint32 pos, Uint32 len)
+{
+  BitmaskPOD<size>::setRange(rep.data, pos, len);
+}
+
+template <unsigned size>
+inline void
 BitmaskPOD<size>::clear(Uint32 data[], unsigned n)
 {
   BitmaskImpl::clear(size, data, n);

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2010-07-04 16:28:36 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2010-09-03 05:35:51 +0000
@@ -3148,25 +3148,37 @@ private:
   Uint32 get_len(Ptr<Page>* pagePtr, Var_part_ref ref);
 
   Tuple_header* alloc_copy_tuple(const Tablerec* tabPtrP, Local_key* ptr){
-    Uint32 * dst = c_undo_buffer.alloc_copy_tuple(ptr, tabPtrP->total_rec_size);
+    Uint32 * dst = c_undo_buffer.alloc_copy_tuple(ptr,
+                                                  tabPtrP->total_rec_size);
     if (unlikely(dst == 0))
       return 0;
 #ifdef HAVE_purify
     bzero(dst, tabPtrP->total_rec_size);
 #endif
-    dst += ((tabPtrP->m_no_of_attributes + 31) >> 5);
+    Uint32 count = tabPtrP->m_no_of_attributes;
+    * dst = count;
+    dst += 1 + ((count + 31) >> 5);
     return (Tuple_header*)dst;
   }
 
-  Tuple_header* get_copy_tuple(const Tablerec* tabPtrP, const Local_key* ptr){
-    Uint32 mask = (tabPtrP->m_no_of_attributes + 31) >> 5;
-    return (Tuple_header*)(c_undo_buffer.get_ptr(ptr) + mask);
+  Uint32 * get_copy_tuple_raw(const Local_key* ptr) {
+    return c_undo_buffer.get_ptr(ptr);
+  }
+
+  Tuple_header * get_copy_tuple(Uint32 * rawptr) {
+    Uint32 masksz = ((* rawptr) + 31) >> 5;
+    return (Tuple_header*)(rawptr + 1 + masksz);
+  }
+
+  Tuple_header* get_copy_tuple(const Local_key* ptr){
+    return get_copy_tuple(get_copy_tuple_raw(ptr));
   }
 
   Uint32* get_change_mask_ptr(const Tablerec* tabP, Tuple_header* copy_tuple){
     Uint32 * tmp = (Uint32*)copy_tuple;
-    tmp -= ((tabP->m_no_of_attributes + 31) >> 5);
-    return tmp;
+    tmp -= 1 + ((tabP->m_no_of_attributes + 31) >> 5);
+    assert(get_copy_tuple(tmp) == copy_tuple);
+    return tmp + 1;
   }
 
   /**
@@ -3511,8 +3523,21 @@ void
 Dbtup::copy_change_mask_info(const Tablerec* tablePtrP,
                              Uint32* dst, const Uint32* src)
 {
-  Uint32 len = (tablePtrP->m_no_of_attributes + 31) >> 5;
-  memcpy(dst, src, 4*len);
+  Uint32 dst_cols = tablePtrP->m_no_of_attributes;
+  Uint32 src_cols = * src;
+  const Uint32 * src_ptr = src + 1;
+
+  if (dst_cols == src_cols)
+  {
+    memcpy(dst, src_ptr, 4 * ((dst_cols + 31) >> 5));
+  }
+  else
+  {
+    ndbassert(dst_cols > src_cols); // drop column not supported
+    memcpy(dst, src_ptr, 4 * ((src_cols + 31) >> 5));
+    BitmaskImpl::setRange((dst_cols + 31) >> 5, dst,
+                          src_cols,  (dst_cols - src_cols));
+  }
 }
 
 // Dbtup_client provides proxying similar to Page_cache_client

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp	2009-12-14 22:14:34 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp	2010-09-03 05:35:51 +0000
@@ -44,8 +44,7 @@ Dbtup::do_tup_abort_operation(Signal* si
   Uint32 bits= tuple_ptr->m_header_bits;  
   if (opPtrP->op_struct.op_type != ZDELETE)
   {
-    Tuple_header *copy=
-      get_copy_tuple(tablePtrP, &opPtrP->m_copy_tuple_location);
+    Tuple_header *copy= get_copy_tuple(&opPtrP->m_copy_tuple_location);
     
     if (opPtrP->op_struct.m_disk_preallocated)
     {

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp	2010-08-20 11:10:25 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp	2010-09-03 05:35:51 +0000
@@ -241,8 +241,7 @@ Dbtup::commit_operation(Signal* signal,
   Uint32 bits= tuple_ptr->m_header_bits;
 
   Tuple_header *disk_ptr= 0;
-  Tuple_header *copy=
-    get_copy_tuple(regTabPtr, &regOperPtr->m_copy_tuple_location);
+  Tuple_header *copy= get_copy_tuple(&regOperPtr->m_copy_tuple_location);
   
   Uint32 copy_bits= copy->m_header_bits;
 
@@ -606,8 +605,7 @@ void Dbtup::execTUP_COMMITREQ(Signal* si
     if(!regOperPtr.p->m_copy_tuple_location.isNull())
     {
       jam();
-      Tuple_header* tmp=
-        get_copy_tuple(regTabPtr.p, &regOperPtr.p->m_copy_tuple_location);
+      Tuple_header* tmp= get_copy_tuple(&regOperPtr.p->m_copy_tuple_location);
       
       memcpy(&req.m_page, 
 	     tmp->get_disk_ref_ptr(regTabPtr.p), sizeof(Local_key));
@@ -795,9 +793,18 @@ Dbtup::set_commit_change_mask_info(const
   else
   {
     Uint32 * dst = req_struct->changeMask.rep.data;
-    Tuple_header* ptr = get_copy_tuple(regTabPtr,
-                                       &regOperPtr->m_copy_tuple_location);
-    const Uint32 * maskptr = get_change_mask_ptr(regTabPtr, ptr);
-    memcpy(dst, maskptr, 4*masklen);
+    Uint32 * maskptr = get_copy_tuple_raw(&regOperPtr->m_copy_tuple_location);
+    Uint32 cols = * maskptr;
+    if (cols == regTabPtr->m_no_of_attributes)
+    {
+      memcpy(dst, maskptr + 1, 4*masklen);
+    }
+    else
+    {
+      ndbassert(regTabPtr->m_no_of_attributes > cols); // no drop column
+      memcpy(dst, maskptr + 1, 4*((cols + 31) >> 5));
+      req_struct->changeMask.setRange(cols,
+                                      regTabPtr->m_no_of_attributes - cols);
+    }
   }
 }

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2010-08-17 09:54:53 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2010-09-03 05:35:51 +0000
@@ -300,7 +300,7 @@ Dbtup::setup_read(KeyReqStruct *req_stru
     else
     {
       req_struct->m_tuple_ptr=
-        get_copy_tuple(regTabPtr, &currOpPtr.p->m_copy_tuple_location);
+        get_copy_tuple(&currOpPtr.p->m_copy_tuple_location);
     }
 
     if (regTabPtr->need_expand(disk))
@@ -1004,10 +1004,11 @@ int Dbtup::handleUpdateReq(Signal* signa
   {
     Operationrec* prevOp= req_struct->prevOpPtr.p;
     tup_version= prevOp->tupVersion;
-    org= get_copy_tuple(regTabPtr, &prevOp->m_copy_tuple_location);
+    Uint32 * rawptr = get_copy_tuple_raw(&prevOp->m_copy_tuple_location);
+    org= get_copy_tuple(rawptr);
     copy_change_mask_info(regTabPtr,
                           change_mask_ptr,
-                          get_change_mask_ptr(regTabPtr, org));
+                          rawptr);
   }
 
   /**
@@ -1412,7 +1413,7 @@ int Dbtup::handleInsertReq(Signal* signa
     tup_version= prevOp->tupVersion + 1;
     
     if(!prevOp->is_first_operation())
-      org= get_copy_tuple(regTabPtr, &prevOp->m_copy_tuple_location);
+      org= get_copy_tuple(&prevOp->m_copy_tuple_location);
     if (regTabPtr->need_expand())
     {
       expand_tuple(req_struct, sizes, org, regTabPtr, !disk_insert);
@@ -1766,8 +1767,7 @@ int Dbtup::handleDeleteReq(Signal* signa
     Operationrec* prevOp= req_struct->prevOpPtr.p;
     regOperPtr->tupVersion= prevOp->tupVersion;
     // make copy since previous op is committed before this one
-    const Tuple_header* org = get_copy_tuple(regTabPtr,
-                                             &prevOp->m_copy_tuple_location);
+    const Tuple_header* org = get_copy_tuple(&prevOp->m_copy_tuple_location);
     Tuple_header* dst = alloc_copy_tuple(regTabPtr,
                                          &regOperPtr->m_copy_tuple_location);
     if (dst == 0) {
@@ -3747,7 +3747,7 @@ Dbtup::nr_read_pk(Uint32 fragPtrI, 
       Operationrec* opPtrP= c_operation_pool.getPtr(opPtrI);
       ndbassert(!opPtrP->m_copy_tuple_location.isNull());
       req_struct.m_tuple_ptr=
-        get_copy_tuple(tablePtr.p, &opPtrP->m_copy_tuple_location);
+        get_copy_tuple(&opPtrP->m_copy_tuple_location);
       copy = true;
     }
     req_struct.check_offset[MM]= tablePtr.p->get_check_offset(MM);

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp	2010-01-13 13:28:03 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp	2010-09-03 05:35:51 +0000
@@ -164,7 +164,7 @@ Dbtup::tuxReadAttrs(EmulatedJamBuffer * 
 	jam();
 	if (!opPtr.p->m_copy_tuple_location.isNull()) {
 	  req_struct.m_tuple_ptr=
-	    get_copy_tuple(tablePtr.p, &opPtr.p->m_copy_tuple_location);
+            get_copy_tuple(&opPtr.p->m_copy_tuple_location);
         }
 	break;
       }
@@ -231,7 +231,7 @@ Dbtup::tuxReadPk(Uint32 fragPtrI, Uint32
       Operationrec* opPtrP= c_operation_pool.getPtr(opPtrI);
       ndbassert(!opPtrP->m_copy_tuple_location.isNull());
       req_struct.m_tuple_ptr=
-	get_copy_tuple(tablePtr.p, &opPtrP->m_copy_tuple_location);
+	get_copy_tuple(&opPtrP->m_copy_tuple_location);
     }
     prepare_read(&req_struct, tablePtr.p, false);
     

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2010-06-11 06:45:37 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2010-09-03 05:35:51 +0000
@@ -1554,7 +1554,7 @@ Dbtup::computeTableMetaData(Tablerec *re
     total_rec_size+= Tuple_header::HeaderSize;
 
   /* Room for changemask */
-  total_rec_size += (regTabPtr->m_no_of_attributes + 31) >> 5;
+  total_rec_size += 1 + ((regTabPtr->m_no_of_attributes + 31) >> 5);
 
   regTabPtr->total_rec_size= total_rec_size;
 

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp	2010-06-02 09:14:39 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp	2010-09-03 05:35:51 +0000
@@ -619,8 +619,7 @@ void Dbtup::checkDetachedTriggers(KeyReq
   switch (save_type) {
   case ZUPDATE:
   case ZINSERT:
-    req_struct->m_tuple_ptr =
-      get_copy_tuple(regTablePtr, &regOperPtr->m_copy_tuple_location);
+    req_struct->m_tuple_ptr =get_copy_tuple(&regOperPtr->m_copy_tuple_location);
     break;
   }
 
@@ -1259,8 +1258,7 @@ bool Dbtup::readTriggerInfo(TupTriggerDa
   {
     jam();
     req_struct->m_tuple_ptr=
-      get_copy_tuple(regTabPtr,
-                     &req_struct->prevOpPtr.p->m_copy_tuple_location);
+      get_copy_tuple(&req_struct->prevOpPtr.p->m_copy_tuple_location);
   }
 
   if (regTabPtr->need_expand(disk)) 
@@ -1354,8 +1352,7 @@ bool Dbtup::readTriggerInfo(TupTriggerDa
     else
     {
       req_struct->m_tuple_ptr =
-        get_copy_tuple(regTabPtr,
-                       &req_struct->prevOpPtr.p->m_copy_tuple_location);
+        get_copy_tuple(&req_struct->prevOpPtr.p->m_copy_tuple_location);
     }
 
     if (regTabPtr->need_expand(disk)) 

=== modified file 'storage/ndb/test/ndbapi/testBitfield.cpp'
--- a/storage/ndb/test/ndbapi/testBitfield.cpp	2010-05-05 09:30:08 +0000
+++ b/storage/ndb/test/ndbapi/testBitfield.cpp	2010-09-03 05:35:51 +0000
@@ -587,7 +587,7 @@ testRanges(Uint32 bitmask_size)
 	BitmaskImpl::set(sz32, check.getBase(), j);
     }
 
-    BitmaskImpl::set_range(sz32, map.getBase(), start, stop);
+    BitmaskImpl::setRange(sz32, map.getBase(), start, stop - start + 1);
     if (!BitmaskImpl::equal(sz32, map.getBase(), check.getBase()))
     {
       ndbout_c(" FAIL 1 sz: %d [ %d %d ]", sz, start, stop);


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20100903060712-ajrq8raveav8kamc.bundle
Thread
bzr push into mysql-5.1-telco-7.1 branch (jonas:3790 to 3791) Jonas Oreland3 Sep