List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:April 20 2011 1:24pm
Subject:bzr push into mysql-5.1-telco-7.0 branch (pekka:4315 to 4328)
View as plain text  
 4328 jonas oreland	2011-04-20
      ndb - remove accidently left debug-printout

    modified:
      storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
 4327 Pekka Nousiainen	2011-04-20 [merge]
      merge from wl4163

    modified:
      storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp
      storage/ndb/test/ndbapi/testDict.cpp
      storage/ndb/test/run-test/daily-basic-tests.txt
      storage/ndb/test/src/HugoCalculator.cpp
 4326 jonas oreland	2011-04-20
      ndb - work-around attempt II

    modified:
      storage/ndb/src/kernel/vm/mt.cpp
 4325 jonas oreland	2011-04-19
      ndb - work-around for Sun CC-5.9 bug

    modified:
      storage/ndb/src/kernel/vm/mt.cpp
 4324 Magnus Blåudd	2011-04-19 [merge]
      Merge

    renamed:
      mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test => mysql-test/suite/rpl_ndb/t/rpl_ndb_xxx_innodb.inc
      mysql-test/extra/rpl_tests/select_ndb_apply_status.inc => mysql-test/suite/rpl_ndb/t/select_ndb_apply_status.inc
    modified:
      mysql-test/suite/rpl_ndb/t/rpl_ndb_mix_innodb.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_xxx_innodb.inc
 4323 Magnus Blåudd	2011-04-19
      ndb
        - backport change of DefaultOperationRedoProblemAction to queue in 7.2

    modified:
      storage/ndb/src/mgmsrv/ConfigInfo.cpp
 4322 Magnus Blåudd	2011-04-19 [merge]
      Merge

    modified:
      mysql-test/mysql-test-run.pl
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster.h
 4321 Jonas Oreland	2011-04-19
      ndb - refactor local-key handling in LDM (LQH/ACC/TUP/TUX)

    modified:
      storage/ndb/include/kernel/kernel_types.h
      storage/ndb/include/kernel/signaldata/AccLock.hpp
      storage/ndb/include/kernel/signaldata/NextScan.hpp
      storage/ndb/src/common/debugger/signaldata/AccLock.cpp
      storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp
      storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
      storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
      storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
      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/DbtupScan.cpp
      storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
 4320 Magnus Blåudd	2011-04-18
      Remove C++ comment  from C file

    modified:
      storage/ndb/src/common/util/ndbzio.c
 4319 Magnus Blåudd	2011-04-18
      Bug #58758 Ndb Internal : Defaults for enum type config values not supported
       - Make ConfigInfo::getDefaultString retrive the default value as string by
        double  storing the default value as string with the key "DefaultString"

    modified:
      storage/ndb/src/mgmsrv/ConfigInfo.cpp
 4318 Magnus Blåudd	2011-04-18
      ndbapi
       - fix warning about unused variable idx by using the variable also
         in release compile

    modified:
      storage/ndb/src/ndbapi/NdbScanOperation.cpp
 4317 Magnus Blåudd	2011-04-18 [merge]
      Merge 7.0-ndbzio -> 7.0

    renamed:
      storage/ndb/include/util/azlib.h => storage/ndb/include/util/ndbzio.h
      storage/ndb/src/common/util/azio.c => storage/ndb/src/common/util/ndbzio.c
    modified:
      storage/ndb/src/common/util/CMakeLists.txt
      storage/ndb/src/common/util/Makefile.am
      storage/ndb/src/kernel/blocks/backup/read.cpp
      storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.cpp
      storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.hpp
      storage/ndb/tools/restore/Restore.cpp
      storage/ndb/tools/restore/Restore.hpp
      storage/ndb/include/util/ndbzio.h
      storage/ndb/src/common/util/ndbzio.c
 4316 Magnus Blåudd	2011-04-18
      Bug #58758 Ndb Internal : Defaults for enum type config values not supported
       - Convert the default value given as string to Uint32 before storing it
         internally.
       - Make Arbitration and DefaultOperationRedoProblemAction use a string
        as default value instead of int as before.
       - Fix DBUG crash when retrieving the internal value for ENUM as string
        instead of int

    modified:
      storage/ndb/src/mgmsrv/ConfigInfo.cpp
 4315 jonas oreland	2011-04-15
      ndb - bug#59213 / bug#11766167
        Add better support for nodes configured with Nodegroup=65536
          (i.e added to config to later be added)
      
        Add new config variable StartNoNodegroupTimeout(default=15s) 
          which determines to to wait for node wo/ nodegroup, 
          before treating them as if they had been added to "nowait-nodes"
      
        E.g 1) initial start will wait this amout of time, before doing a start
               Note: in an initial start, the values from config.ini is used to 
                     determine that nodes have no nodegroup
      
            2) system restart will wait this amout of time, before continueing
               with other timeouts (such as StartPartial/StartPartitioned-timeout)
               Note: in an system restart, the values read from disk is used to 
                     determine that nodes have nodegroup (since they can have been
                     added to a nodegroup after initial start)
       

    added:
      storage/ndb/include/kernel/signaldata/DihRestart.hpp
    modified:
      storage/ndb/include/mgmapi/mgmapi_config_parameters.h
      storage/ndb/src/common/debugger/EventLogger.cpp
      storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
      storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
      storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
      storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp
      storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
      storage/ndb/src/mgmsrv/ConfigInfo.cpp
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-04-08 13:59:44 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-04-19 09:51:53 +0000
@@ -383,10 +383,13 @@ sub main {
     my $sys_info= My::SysInfo->new();
 
     $opt_parallel= $sys_info->num_cpus();
+    print "num_cpus: $opt_parallel, min_bogomips: " .
+      $sys_info->min_bogomips(). "\n";
     for my $limit (2000, 1500, 1000, 500){
       $opt_parallel-- if ($sys_info->min_bogomips() < $limit);
     }
     my $max_par= $ENV{MTR_MAX_PARALLEL} || 8;
+    print "max_par: $max_par\n";
     $opt_parallel= $max_par if ($opt_parallel > $max_par);
     $opt_parallel= $num_tests if ($opt_parallel > $num_tests);
     $opt_parallel= 1 if (IS_WINDOWS and $sys_info->isvm());

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_mix_innodb.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mix_innodb.test	2011-04-08 11:06:53 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mix_innodb.test	2011-04-19 14:34:27 +0000
@@ -12,6 +12,6 @@
 --enable_query_log
 let $off_set = 9;
 let $rpl_format = 'MIX';
---source extra/rpl_tests/rpl_ndb_apply_status.test
+--source suite/rpl_ndb/t/rpl_ndb_xxx_innodb.inc
 
 --source include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test	2011-04-08 11:06:53 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test	2011-04-19 14:34:27 +0000
@@ -16,5 +16,5 @@
 SET binlog_format = STATEMENT;
 let $off_set = 6;
 let $rpl_format = 'SBR';
---source extra/rpl_tests/rpl_ndb_apply_status.test
+--source suite/rpl_ndb/t/rpl_ndb_xxx_innodb.inc
 --source include/rpl_end.inc

=== renamed file 'mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test' => 'mysql-test/suite/rpl_ndb/t/rpl_ndb_xxx_innodb.inc'
--- a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test	2011-04-08 11:06:53 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_xxx_innodb.inc	2011-04-19 14:34:27 +0000
@@ -45,7 +45,7 @@ insert into t1 values (1,2);
 --echo
 
 --sync_slave_with_master
---source extra/rpl_tests/select_ndb_apply_status.inc
+--source suite/rpl_ndb/t/select_ndb_apply_status.inc
 
 --echo
 
@@ -85,7 +85,7 @@ commit;
 --echo
 
 --sync_slave_with_master
---source extra/rpl_tests/select_ndb_apply_status.inc
+--source suite/rpl_ndb/t/select_ndb_apply_status.inc
 
 connection master;
 --let $binlog_start= $start_pos
@@ -158,7 +158,7 @@ SET AUTOCOMMIT=1;
 --enable_query_log
 
 --sync_slave_with_master
---source extra/rpl_tests/select_ndb_apply_status.inc
+--source suite/rpl_ndb/t/select_ndb_apply_status.inc
 
 --echo
 
@@ -208,7 +208,7 @@ SET AUTOCOMMIT=1;
 --echo
 
 --sync_slave_with_master
---source extra/rpl_tests/select_ndb_apply_status.inc
+--source suite/rpl_ndb/t/select_ndb_apply_status.inc
 
 --echo
 
@@ -256,7 +256,7 @@ SET AUTOCOMMIT=1;
 --enable_query_log
 
 --sync_slave_with_master
---source extra/rpl_tests/select_ndb_apply_status.inc
+--source suite/rpl_ndb/t/select_ndb_apply_status.inc
 
 --echo
 
@@ -281,7 +281,7 @@ DROP DATABASE tpcb;
 
 ####### Commenting out until decision on Bug#27960 ###########
 
-#--source extra/rpl_tests/select_ndb_apply_status.inc
+#--source suite/rpl_ndb/t/select_ndb_apply_status.inc
 
 #connection master;
 #--eval SHOW BINLOG EVENTS in '$log_name' from $start_pos

=== renamed file 'mysql-test/extra/rpl_tests/select_ndb_apply_status.inc' => 'mysql-test/suite/rpl_ndb/t/select_ndb_apply_status.inc'
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-04-11 13:36:12 +0000
+++ b/sql/ha_ndbcluster.cc	2011-04-12 16:14:41 +0000
@@ -8182,7 +8182,6 @@ int ha_ndbcluster::create(const char *na
   bool use_disk= FALSE;
   NdbDictionary::Table::SingleUserMode single_user_mode= NdbDictionary::Table::SingleUserModeLocked;
   bool ndb_sys_table= FALSE;
-  partition_info *part_info;
   int result= 0;
   NdbDictionary::ObjectId objId;
 
@@ -8225,7 +8224,7 @@ int ha_ndbcluster::create(const char *na
     */
     if ((my_errno= write_ndb_file(name)))
       DBUG_RETURN(my_errno);
-    ndbcluster_create_binlog_setup(thd, get_ndb(thd), name, strlen(name),
+    ndbcluster_create_binlog_setup(thd, ndb, name, strlen(name),
                                    m_dbname, m_tabname, FALSE);
     DBUG_RETURN(my_errno);
   }
@@ -8504,8 +8503,7 @@ int ha_ndbcluster::create(const char *na
   }
 
   // Check partition info
-  part_info= form->part_info;
-  if ((my_errno= set_up_partition_info(part_info, form, (void*)&tab)))
+  if ((my_errno= set_up_partition_info(form->part_info, tab)))
     goto abort;
 
   if (tab.getFragmentType() == NDBTAB::HashMapPartition && 
@@ -13713,10 +13711,11 @@ void ha_ndbcluster::set_auto_partitions(
 }
 
 
-int ha_ndbcluster::set_range_data(void *tab_ref, partition_info *part_info)
+int
+ha_ndbcluster::set_range_data(const partition_info *part_info,
+                              NdbDictionary::Table& ndbtab) const
 {
   const uint num_parts = partition_info_num_parts(part_info);
-  NDBTAB *tab= (NDBTAB*)tab_ref;
   int error= 0;
   bool unsigned_flag= part_info->part_expr->unsigned_flag;
   DBUG_ENTER("set_range_data");
@@ -13745,16 +13744,18 @@ int ha_ndbcluster::set_range_data(void *
     }
     range_data[i]= (int32)range_val;
   }
-  tab->setRangeListData(range_data, num_parts);
+  ndbtab.setRangeListData(range_data, num_parts);
 error:
   my_free((char*)range_data, MYF(0));
   DBUG_RETURN(error);
 }
 
-int ha_ndbcluster::set_list_data(void *tab_ref, partition_info *part_info)
+
+int
+ha_ndbcluster::set_list_data(const partition_info *part_info,
+                             NdbDictionary::Table& ndbtab) const
 {
   const uint num_list_values = partition_info_num_list_values(part_info);
-  NDBTAB *tab= (NDBTAB*)tab_ref;
   int32 *list_data= (int32*)my_malloc(num_list_values*2*sizeof(int32), MYF(0));
   int error= 0;
   bool unsigned_flag= part_info->part_expr->unsigned_flag;
@@ -13780,7 +13781,7 @@ int ha_ndbcluster::set_list_data(void *t
     list_data[2*i]= (int32)list_val;
     list_data[2*i+1]= list_entry->partition_id;
   }
-  tab->setRangeListData(list_data, 2*num_list_values);
+  ndbtab.setRangeListData(list_data, 2*num_list_values);
 error:
   my_free((char*)list_data, MYF(0));
   DBUG_RETURN(error);
@@ -13799,18 +13800,15 @@ error:
   implement the function to map to a partition.
 */
 
-uint ha_ndbcluster::set_up_partition_info(partition_info *part_info,
-                                          TABLE *table,
-                                          void *tab_par)
+int
+ha_ndbcluster::set_up_partition_info(partition_info *part_info,
+                                     NdbDictionary::Table& ndbtab) const
 {
   uint32 frag_data[MAX_PARTITIONS];
   char *ts_names[MAX_PARTITIONS];
   ulong fd_index= 0, i, j;
-  NDBTAB *tab= (NDBTAB*)tab_par;
   NDBTAB::FragmentType ftype= NDBTAB::UserDefined;
   partition_element *part_elem;
-  bool first= TRUE;
-  uint tot_ts_name_len;
   List_iterator<partition_element> part_it(part_info->partitions);
   int error;
   DBUG_ENTER("ha_ndbcluster::set_up_partition_info");
@@ -13824,7 +13822,7 @@ uint ha_ndbcluster::set_up_partition_inf
 
     for (i= 0; i < part_info->part_field_list.elements; i++)
     {
-      NDBCOL *col= tab->getColumn(fields[i]->field_index);
+      NDBCOL *col= ndbtab.getColumn(fields[i]->field_index);
       DBUG_PRINT("info",("setting dist key on %s", col->getName()));
       col->setPartitionKey(TRUE);
     }
@@ -13856,25 +13854,24 @@ uint ha_ndbcluster::set_up_partition_inf
     col.setNullable(FALSE);
     col.setPrimaryKey(FALSE);
     col.setAutoIncrement(FALSE);
-    tab->addColumn(col);
+    ndbtab.addColumn(col);
     if (part_info->part_type == RANGE_PARTITION)
     {
-      if ((error= set_range_data((void*)tab, part_info)))
+      if ((error= set_range_data(part_info, ndbtab)))
       {
         DBUG_RETURN(error);
       }
     }
     else if (part_info->part_type == LIST_PARTITION)
     {
-      if ((error= set_list_data((void*)tab, part_info)))
+      if ((error= set_list_data(part_info, ndbtab)))
       {
         DBUG_RETURN(error);
       }
     }
   }
-  tab->setFragmentType(ftype);
+  ndbtab.setFragmentType(ftype);
   i= 0;
-  tot_ts_name_len= 0;
   do
   {
     uint ng;
@@ -13897,13 +13894,12 @@ uint ha_ndbcluster::set_up_partition_inf
         frag_data[fd_index++]= ng;
       } while (++j < partition_info_num_subparts(part_info));
     }
-    first= FALSE;
   } while (++i < partition_info_num_parts(part_info));
 
   const bool use_default_num_parts =
     partition_info_use_default_num_partitions(part_info);
-  tab->setDefaultNoPartitionsFlag(use_default_num_parts);
-  tab->setLinearFlag(part_info->linear_hash_ind);
+  ndbtab.setDefaultNoPartitionsFlag(use_default_num_parts);
+  ndbtab.setLinearFlag(part_info->linear_hash_ind);
   {
     ha_rows max_rows= table_share->max_rows;
     ha_rows min_rows= table_share->min_rows;
@@ -13911,12 +13907,12 @@ uint ha_ndbcluster::set_up_partition_inf
       max_rows= min_rows;
     if (max_rows != (ha_rows)0) /* default setting, don't set fragmentation */
     {
-      tab->setMaxRows(max_rows);
-      tab->setMinRows(min_rows);
+      ndbtab.setMaxRows(max_rows);
+      ndbtab.setMinRows(min_rows);
     }
   }
-  tab->setFragmentCount(fd_index);
-  tab->setFragmentData(frag_data, fd_index);
+  ndbtab.setFragmentCount(fd_index);
+  ndbtab.setFragmentData(frag_data, fd_index);
   DBUG_RETURN(0);
 }
 

=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h	2011-03-07 14:06:01 +0000
+++ b/sql/ha_ndbcluster.h	2011-04-12 16:06:13 +0000
@@ -640,11 +640,12 @@ private:
   bool has_null_in_unique_index(uint idx_no) const;
   bool check_index_fields_not_null(KEY *key_info);
 
-  uint set_up_partition_info(partition_info *part_info,
-                             TABLE *table,
-                             void *tab);
-  int set_range_data(void *tab, partition_info* part_info);
-  int set_list_data(void *tab, partition_info* part_info);
+  int set_up_partition_info(partition_info *part_info,
+                            NdbDictionary::Table&) const;
+  int set_range_data(const partition_info* part_info,
+                     NdbDictionary::Table&) const;
+  int set_list_data(const partition_info* part_info,
+                    NdbDictionary::Table&) const;
   int ndb_pk_update_row(THD *thd, 
                         const uchar *old_data, uchar *new_data,
                         uint32 old_part_id);

=== modified file 'storage/ndb/include/kernel/kernel_types.h'
--- a/storage/ndb/include/kernel/kernel_types.h	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/include/kernel/kernel_types.h	2011-04-19 09:01:07 +0000
@@ -61,13 +61,24 @@ struct Local_key
   bool isNull() const { return m_page_no == RNIL; }
   void setNull() { m_page_no= RNIL; m_file_no= m_page_idx= ~0;}
 
-  Uint32 ref() const { return (m_page_no << MAX_TUPLES_BITS) | m_page_idx ;}
+  Uint32 ref() const { return ref(m_page_no,m_page_idx) ;}
   
-  Local_key& assref (Uint32 ref) { 
-    m_page_no =ref >> MAX_TUPLES_BITS;
-    m_page_idx = ref & MAX_TUPLES_PER_PAGE;
+  Local_key& assref (Uint32 ref) {
+    m_page_no = ref2page_id(ref);
+    m_page_idx = ref2page_idx(ref);
     return *this;
   }
+
+  static Uint32 ref(Uint32 lk1, Uint32 lk2) {
+    return (lk1 << MAX_TUPLES_BITS) | lk2;
+  }
+
+  static Uint32 ref2page_id(Uint32 ref) { return ref >> MAX_TUPLES_BITS; }
+  static Uint32 ref2page_idx(Uint32 ref) { return ref & MAX_TUPLES_PER_PAGE; }
+
+  static bool isInvalid(Uint32 lk1, Uint32 lk2) {
+    return ref(lk1, lk2) == ~Uint32(0);
+  }
 };
 
 class NdbOut&

=== modified file 'storage/ndb/include/kernel/signaldata/AccLock.hpp'
--- a/storage/ndb/include/kernel/signaldata/AccLock.hpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/include/kernel/signaldata/AccLock.hpp	2011-04-19 09:01:07 +0000
@@ -47,12 +47,12 @@ public:
     Refused = 3,
     NoFreeOp = 4
   };
-  STATIC_CONST( LockSignalLength = 12 );
+  STATIC_CONST( LockSignalLength = 13 );
   STATIC_CONST( UndoSignalLength = 3 );
 private:
   Uint32 returnCode;
   Uint32 requestInfo;
-  Uint32 accOpPtr; 
+  Uint32 accOpPtr;
   // rest only if lock request
   Uint32 userPtr;
   Uint32 userRef;
@@ -60,7 +60,8 @@ private:
   Uint32 fragId;
   Uint32 fragPtrI;
   Uint32 hashValue;
-  Uint32 tupAddr;
+  Uint32 page_id;
+  Uint32 page_idx;
   Uint32 transId1;
   Uint32 transId2;
 };

=== modified file 'storage/ndb/include/kernel/signaldata/NextScan.hpp'
--- a/storage/ndb/include/kernel/signaldata/NextScan.hpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/include/kernel/signaldata/NextScan.hpp	2011-04-19 09:01:07 +0000
@@ -49,13 +49,12 @@ class NextScanConf {
 public:
   // length is less if no keyinfo or no next result
   STATIC_CONST( SignalLength = 11 );
-  STATIC_CONST( SignalLengthNoKeyInfo = 7 );
+  STATIC_CONST( SignalLengthNoKeyInfo = 6 );
 private:
   Uint32 scanPtr;               // scan record in LQH
   Uint32 accOperationPtr;
   Uint32 fragId;
   Uint32 localKey[2];
-  Uint32 localKeyLength;
   Uint32 gci;
 };
 

=== renamed file 'storage/ndb/include/util/azlib.h' => 'storage/ndb/include/util/ndbzio.h'
--- a/storage/ndb/include/util/azlib.h	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/include/util/ndbzio.h	2011-04-04 09:37:59 +0000
@@ -1,4 +1,26 @@
 /*
+   Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+/*
+  This library has been brought into the 21st century.
+   - Magnus Bl�y the MySQL Archive Engine.
      -Brian Aker
 */
@@ -6,7 +28,7 @@
 /* zlib.h -- interface of the 'zlib' general purpose compression library
   version 1.2.3, July 18th, 2005
 
-  Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+  Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -38,166 +60,16 @@
 #ifdef  __cplusplus
 extern "C" {
 #endif
-/* Start of MySQL Specific Information */
-
 
-#define AZHEADER_SIZE 29
-#define AZMETA_BUFFER_SIZE 512-AZHEADER_SIZE
-
-#define AZ_MAGIC_POS 0
-#define AZ_VERSION_POS 1
-#define AZ_MINOR_VERSION_POS 2
-#define AZ_BLOCK_POS 3
-#define AZ_STRATEGY_POS 4
-#define AZ_FRM_POS 5
-#define AZ_FRM_LENGTH_POS 9
-#define AZ_META_POS 13
-#define AZ_META_LENGTH_POS 17
-#define AZ_START_POS 21
-#define AZ_ROW_POS 29
-#define AZ_FLUSH_POS 37
-#define AZ_CHECK_POS 45
-#define AZ_AUTOINCREMENT_POS 53
-#define AZ_LONGEST_POS 61
-#define AZ_SHORTEST_POS 65
-#define AZ_COMMENT_POS 69
-#define AZ_COMMENT_LENGTH_POS 73
-#define AZ_DIRTY_POS 77
-
-
-/*
-  Flags for state
-*/
-#define AZ_STATE_CLEAN 0
-#define AZ_STATE_DIRTY 1
-#define AZ_STATE_SAVED 2
-#define AZ_STATE_CRASHED 3
-
-size_t az_inflate_mem_size();
-size_t az_deflate_mem_size();
-struct az_alloc_rec {
+size_t ndbz_inflate_mem_size();
+size_t ndbz_deflate_mem_size();
+struct ndbz_alloc_rec {
   size_t size;
   size_t mfree;
   char *mem;
 };
 
-/*
-     The 'zlib' compression library provides in-memory compression and
-  decompression functions, including integrity checks of the uncompressed
-  data.  This version of the library supports only one compression method
-  (deflation) but other algorithms will be added later and will have the same
-  stream interface.
-
-     Compression can be done in a single step if the buffers are large
-  enough (for example if an input file is mmap'ed), or can be done by
-  repeated calls of the compression function.  In the latter case, the
-  application must provide more input and/or consume the output
-  (providing more output space) before each call.
-
-     The compressed data format used by default by the in-memory functions is
-  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
-  around a deflate stream, which is itself documented in RFC 1951.
-
-     The library also supports reading and writing files in gzip (.gz) format
-  with an interface similar to that of stdio using the functions that start
-  with "gz".  The gzip format is different from the zlib format.  gzip is a
-  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
-
-     This library can optionally read and write gzip streams in memory as well.
-
-     The zlib format was designed to be compact and fast for use in memory
-  and on communications channels.  The gzip format was designed for single-
-  file compression on file systems, has a larger header than zlib to maintain
-  directory information, and uses a different, slower check method than zlib.
-
-     The library does not install any signal handler. The decoder checks
-  the consistency of the compressed data, so the library should never
-  crash even in case of corrupted input.
-*/
-
-
-/*
-   The application must update next_in and avail_in when avail_in has
-   dropped to zero. It must update next_out and avail_out when avail_out
-   has dropped to zero. The application must initialize zalloc, zfree and
-   opaque before calling the init function. All other fields are set by the
-   compression library and must not be updated by the application.
-
-   The opaque value provided by the application will be passed as the first
-   parameter for calls of zalloc and zfree. This can be useful for custom
-   memory management. The compression library attaches no meaning to the
-   opaque value.
-
-   zalloc must return Z_NULL if there is not enough memory for the object.
-   If zlib is used in a multi-threaded application, zalloc and zfree must be
-   thread safe.
-
-   On 16-bit systems, the functions zalloc and zfree must be able to allocate
-   exactly 65536 bytes, but will not be required to allocate more than this
-   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
-   pointers returned by zalloc for objects of exactly 65536 bytes *must*
-   have their offset normalized to zero. The default allocation function
-   provided by this library ensures this (see zutil.c). To reduce memory
-   requirements and avoid any allocation of 64K objects, at the expense of
-   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
-
-   The fields total_in and total_out can be used for statistics or
-   progress reports. After compression, total_in holds the total size of
-   the uncompressed data and may be saved for use in the decompressor
-   (particularly if the decompressor wants to decompress everything in
-   a single step).
-*/
-
-                        /* constants */
-
-#define Z_NO_FLUSH      0
-#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
-#define Z_SYNC_FLUSH    2
-#define Z_FULL_FLUSH    3
-#define Z_FINISH        4
-#define Z_BLOCK         5
-/* Allowed flush values; see deflate() and inflate() below for details */
-
-#define Z_OK            0
-#define Z_STREAM_END    1
-#define Z_NEED_DICT     2
-#define Z_ERRNO        (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR   (-3)
-#define Z_MEM_ERROR    (-4)
-#define Z_BUF_ERROR    (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative
- * values are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION         0
-#define Z_BEST_SPEED             1
-#define Z_BEST_COMPRESSION       9
-#define Z_DEFAULT_COMPRESSION  (-1)
-/* compression levels */
-
-#define Z_FILTERED            1
-#define Z_HUFFMAN_ONLY        2
-#define Z_RLE                 3
-#define Z_FIXED               4
-#define Z_DEFAULT_STRATEGY    0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY   0
-#define Z_TEXT     1
-#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */
-#define Z_UNKNOWN  2
-/* Possible values of the data_type field (though see inflate()) */
-
-#define Z_DEFLATED   8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
-#define AZ_BUFSIZE_READ 32768
-#define AZ_BUFSIZE_WRITE 16384
-
-typedef struct azio_stream {
+typedef struct ndbzio_stream {
   z_stream stream;
   int      z_err;   /* error code for last stream operation */
   int      z_eof;   /* set if end of input file */
@@ -208,7 +80,7 @@ typedef struct azio_stream {
   char     *msg;    /* error message */
   int      transparent; /* 1 if input file is not a .gz file */
   char     mode;    /* 'w' or 'r' */
-  char     bufalloced; /* true if azio allocated buffers */
+  char     bufalloced; /* true if ndbzio allocated buffers */
   my_off_t  start;   /* start of compressed data in file (header skipped) */
   my_off_t  in;      /* bytes into deflate or inflate */
   my_off_t  out;     /* bytes out of deflate or inflate */
@@ -228,10 +100,16 @@ typedef struct azio_stream {
   unsigned int frm_length;   /* Position for start of FRM */
   unsigned int comment_start_pos;   /* Position for start of comment */
   unsigned int comment_length;   /* Position for start of comment */
-} azio_stream;
+} ndbzio_stream;
+
+/* Return the size in bytes used for reading */
+size_t ndbz_bufsize_read(void);
+
+/* Return the size in bytes used for writing */
+size_t ndbz_bufsize_write(void);
 
                         /* basic functions */
-extern int azopen(azio_stream *s, const char *path, int Flags);
+extern int ndbzopen(ndbzio_stream *s, const char *path, int Flags);
 /*
      Opens a gzip (.gz) file for reading or writing. The mode parameter
    is as in fopen ("rb" or "wb") but can also include a compression level
@@ -240,29 +118,30 @@ extern int azopen(azio_stream *s, const
    as in "wb1R". (See the description of deflateInit2 for more information
    about the strategy parameter.)
 
-     azopen can be used to read a file which is not in gzip format; in this
+     ndbzopen can be used to read a file which is not in gzip format; in this
    case gzread will directly read from the file without decompression.
 
-     azopen returns NULL if the file could not be opened or if there was
+     ndbzopen returns NULL if the file could not be opened or if there was
    insufficient memory to allocate the (de)compression state; errno
    can be checked to distinguish the two cases (if errno is zero, the
    zlib error is Z_MEM_ERROR).  */
 
-int azdopen(azio_stream *s,File fd, int Flags); 
+int ndbzdopen(ndbzio_stream *s, File fd, int Flags);
 /*
-     azdopen() associates a azio_stream with the file descriptor fd.  File
+     ndbzdopen() associates a ndbzio_stream with the file descriptor fd.  File
    descriptors are obtained from calls like open, dup, creat, pipe or
    fileno (in the file has been previously opened with fopen).
-   The mode parameter is as in azopen.
-     The next call of gzclose on the returned azio_stream will also close the
+   The mode parameter is as in ndbzopen.
+     The next call of gzclose on the returned ndbzio_stream will also close the
    file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
-   descriptor fd. If you want to keep fd open, use azdopen(dup(fd), mode).
-     azdopen returns NULL if there was insufficient memory to allocate
+   descriptor fd. If you want to keep fd open, use ndbzdopen(dup(fd), mode).
+     ndbzdopen returns NULL if there was insufficient memory to allocate
    the (de)compression state.
 */
 
 
-extern unsigned int azread ( azio_stream *s, voidp buf, unsigned int len, int *error);
+extern unsigned int ndbzread (ndbzio_stream *s, voidp buf,
+                              unsigned int len, int *error);
 /*
      Reads the given number of uncompressed bytes from the compressed file.
    If the input file was not in gzip format, gzread copies the given number
@@ -270,15 +149,16 @@ extern unsigned int azread ( azio_stream
      gzread returns the number of uncompressed bytes actually read (0 for
    end of file, -1 for error). */
 
-extern unsigned int azwrite (azio_stream *s, const void* buf, unsigned int len);
+extern unsigned int ndbzwrite (ndbzio_stream *s, const void* buf,
+                               unsigned int len);
 /*
      Writes the given number of uncompressed bytes into the compressed file.
-   azwrite returns the number of uncompressed bytes actually written
+   ndbzwrite returns the number of uncompressed bytes actually written
    (0 in case of error).
 */
 
 
-extern int azflush(azio_stream *file, int flush);
+extern int ndbzflush(ndbzio_stream *file, int flush);
 /*
      Flushes all pending output into the compressed file. The parameter
    flush is as in the deflate() function. The return value is the zlib
@@ -288,8 +168,8 @@ extern int azflush(azio_stream *file, in
    degrade compression.
 */
 
-extern my_off_t azseek (azio_stream *file,
-                                      my_off_t offset, int whence);
+extern my_off_t ndbzseek (ndbzio_stream *file,
+                          my_off_t offset, int whence);
 /*
       Sets the starting position for the next gzread or gzwrite on the
    given compressed file. The offset represents a number of bytes in the
@@ -306,14 +186,14 @@ extern my_off_t azseek (azio_stream *fil
    would be before the current position.
 */
 
-extern int azrewind(azio_stream *file);
+extern int ndbzrewind(ndbzio_stream *file);
 /*
      Rewinds the given file. This function is supported only for reading.
 
    gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
 */
 
-extern my_off_t aztell(azio_stream *file);
+extern my_off_t ndbztell(ndbzio_stream *file);
 /*
      Returns the starting position for the next gzread or gzwrite on the
    given compressed file. This position represents a number of bytes in the
@@ -322,17 +202,17 @@ extern my_off_t aztell(azio_stream *file
    gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
 */
 
-extern int azclose(azio_stream *file);
+extern int ndbzclose(ndbzio_stream *file);
 /*
      Flushes all pending output if necessary, closes the compressed file
    and deallocates all the (de)compression state. The return value is the zlib
    error number (see function gzerror below).
 */
 
-extern int azwrite_frm (azio_stream *s, char *blob, unsigned int length);
-extern int azread_frm (azio_stream *s, char *blob);
-extern int azwrite_comment (azio_stream *s, char *blob, unsigned int length);
-extern int azread_comment (azio_stream *s, char *blob);
+/*
+  Return file size of the open ndbzio_stream
+*/
+extern int ndbz_file_size(ndbzio_stream *file, size_t *size);
 
 #ifdef	__cplusplus
 }

=== modified file 'storage/ndb/src/common/debugger/signaldata/AccLock.cpp'
--- a/storage/ndb/src/common/debugger/signaldata/AccLock.cpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/common/debugger/signaldata/AccLock.cpp	2011-04-19 09:01:07 +0000
@@ -70,7 +70,7 @@ printACC_LOCKREQ(FILE* output, const Uin
     fprintf(output, " userPtr: 0x%x userRef: 0x%x\n", sig->userPtr, sig->userRef);
     fprintf(output, " table: id=%u", sig->tableId);
     fprintf(output, " fragment: id=%u ptr=0x%x\n", sig->fragId, sig->fragPtrI);
-    fprintf(output, " tuple: addr=0x%x hashValue=%x\n", sig->tupAddr, sig->hashValue);
+    fprintf(output, " tuple: addr=%u/%u hashValue=%x\n", sig->page_id, sig->page_idx, sig->hashValue);
     fprintf(output, " transid: %08x %08x\n", sig->transId1, sig->transId2);
   }
   return true;

=== modified file 'storage/ndb/src/common/util/CMakeLists.txt'
--- a/storage/ndb/src/common/util/CMakeLists.txt	2011-02-02 00:40:07 +0000
+++ b/storage/ndb/src/common/util/CMakeLists.txt	2011-04-01 11:46:04 +0000
@@ -26,7 +26,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOUR
 
 ADD_DEFINITIONS(-DNO_DUMMY_DECL)
 ADD_LIBRARY(ndbgeneral STATIC
-            azio.c
+            ndbzio.c
             File.cpp
             md5_hash.cpp
             Properties.cpp

=== modified file 'storage/ndb/src/common/util/Makefile.am'
--- a/storage/ndb/src/common/util/Makefile.am	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/common/util/Makefile.am	2011-04-01 11:46:04 +0000
@@ -31,7 +31,7 @@ libgeneral_la_SOURCES = \
 
 INCLUDES_LOC = @ZLIB_INCLUDES@
 
-libndbazio_la_SOURCES = azio.c
+libndbazio_la_SOURCES = ndbzio.c
 libndbazio_la_LIBADD = @ZLIB_LIBS@
 
 noinst_PROGRAMS = BaseString-t HashMap-t Bitmask-t SparseBitmask-t ndb_version-t

=== renamed file 'storage/ndb/src/common/util/azio.c' => 'storage/ndb/src/common/util/ndbzio.c'
--- a/storage/ndb/src/common/util/azio.c	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/common/util/ndbzio.c	2011-04-18 14:15:23 +0000
@@ -1,4 +1,27 @@
 /*
+   Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+/*
+  ndbzio is a modified version of azio with a cleaner interface.
+
+    - Magnus Bl� makes use of mysys and removes mallocs.
     -Brian Aker
 */
@@ -11,7 +34,7 @@
  */
 
 /* gzio.c -- IO on .gz files
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  *
  */
@@ -28,7 +51,7 @@
 #include "../../../../zlib/inflate.h"
 #include "../../../../zlib/deflate.h"
 
-#include <util/azlib.h>
+#include <util/ndbzio.h>
 
 #include <my_sys.h>
 
@@ -39,6 +62,42 @@
 #define VALGRIND_MAKE_MEM_NOACCESS(a,b) do {} while(0);
 #endif
 
+/* Start of MySQL Specific Information */
+
+
+#define AZHEADER_SIZE 29
+#define AZMETA_BUFFER_SIZE 512-AZHEADER_SIZE
+
+#define AZ_MAGIC_POS 0
+#define AZ_VERSION_POS 1
+#define AZ_MINOR_VERSION_POS 2
+#define AZ_BLOCK_POS 3
+#define AZ_STRATEGY_POS 4
+#define AZ_FRM_POS 5
+#define AZ_FRM_LENGTH_POS 9
+#define AZ_META_POS 13
+#define AZ_META_LENGTH_POS 17
+#define AZ_START_POS 21
+#define AZ_ROW_POS 29
+#define AZ_FLUSH_POS 37
+#define AZ_CHECK_POS 45
+#define AZ_AUTOINCREMENT_POS 53
+#define AZ_LONGEST_POS 61
+#define AZ_SHORTEST_POS 65
+#define AZ_COMMENT_POS 69
+#define AZ_COMMENT_LENGTH_POS 73
+#define AZ_DIRTY_POS 77
+
+
+/*
+  Flags for state
+*/
+#define AZ_STATE_CLEAN 0
+#define AZ_STATE_DIRTY 1
+#define AZ_STATE_SAVED 2
+#define AZ_STATE_CRASHED 3
+
+
 static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
 static int const az_magic[3] = {0xfe, 0x03, 0x01}; /* az magic header */
 
@@ -52,24 +111,24 @@ static int const az_magic[3] = {0xfe, 0x
 
 #define AZ_MEMLEVEL 8
 
-int az_open(azio_stream *s, const char *path, int Flags, File  fd);
-int do_flush(azio_stream *file, int flush);
-int    get_byte(azio_stream *s);
-unsigned char* get_block(azio_stream *s, int blksz);
-int   check_header(azio_stream *s);
-int write_header(azio_stream *s);
-int    destroy(azio_stream *s);
-void putLong(azio_stream *s, uLong x);
-uLong  getLong(azio_stream *s);
-void read_header(azio_stream *s, unsigned char *buffer);
+static int ndbz_open(ndbzio_stream *s, const char *path, int Flags, File  fd);
+static int do_flush(ndbzio_stream *file, int flush);
+static int get_byte(ndbzio_stream *s);
+static unsigned char* get_block(ndbzio_stream *s, int blksz);
+static int check_header(ndbzio_stream *s);
+static int write_header(ndbzio_stream *s);
+static int destroy(ndbzio_stream *s);
+static void putLong(ndbzio_stream *s, uLong x);
+static uLong getLong(ndbzio_stream *s);
+static void read_header(ndbzio_stream *s, unsigned char *buffer);
 
-size_t az_inflate_mem_size()
+size_t ndbz_inflate_mem_size()
 {
   return sizeof(struct inflate_state)            /* state */
     + ((1U << MAX_WBITS)*sizeof(unsigned char)); /* window */
 }
 
-size_t az_deflate_mem_size()
+size_t ndbz_deflate_mem_size()
 {
   return sizeof(deflate_state)
     + ((1U << MAX_WBITS)*(2*sizeof(Byte)))      /* window = wsize,2*|Byte| */
@@ -79,10 +138,10 @@ size_t az_deflate_mem_size()
 						*/
 }
 
-voidpf az_alloc(voidpf opaque, uInt items, uInt size)
+voidpf ndbz_alloc(voidpf opaque, uInt items, uInt size)
 {
   void * retval;
-  struct az_alloc_rec *r = (struct az_alloc_rec*)opaque;
+  struct ndbz_alloc_rec *r = (struct ndbz_alloc_rec*)opaque;
 
   if((items * size) > r->mfree || r->mfree==0)
     abort();
@@ -96,12 +155,12 @@ voidpf az_alloc(voidpf opaque, uInt item
 
   return retval;
 }
-void az_free(voidpf opaque, voidpf address)
+void ndbz_free(voidpf opaque, voidpf address)
 {
-  struct az_alloc_rec *r;
+  struct ndbz_alloc_rec *r;
   (void)address;
   /* Oh how we hack. */
-  r = (struct az_alloc_rec*)opaque;
+  r = (struct ndbz_alloc_rec*)opaque;
   r->mfree= r->size;
   if(r->mfree==r->size)
     VALGRIND_MAKE_MEM_NOACCESS(r->mem,r->size);
@@ -136,11 +195,24 @@ static inline int posix_memalign(void **
 }
 #endif
 
+#define AZ_BUFSIZE_READ 32768
+#define AZ_BUFSIZE_WRITE 16384
+
+size_t ndbz_bufsize_read(void)
+{
+  return AZ_BUFSIZE_READ;
+}
+
+size_t ndbz_bufsize_write(void)
+{
+  return AZ_BUFSIZE_WRITE;
+}
+
 /* ===========================================================================
   Opens a gzip (.gz) file for reading or writing. The mode parameter
   is as in fopen ("rb" or "wb"). The file is given either by file descriptor
   or path name (if fd == -1).
-  az_open returns NULL if the file could not be opened or if there was
+  ndbz_open returns NULL if the file could not be opened or if there was
   insufficient memory to allocate the (de)compression state; errno
   can be checked to distinguish the two cases (if errno is zero, the
   zlib error is Z_MEM_ERROR).
@@ -149,7 +221,7 @@ static inline int posix_memalign(void **
 
   NOTE: If called without a fd, my_open *WILL* malloc()
 */
-int az_open (azio_stream *s, const char *path, int Flags, File fd)
+int ndbz_open (ndbzio_stream *s, const char *path, int Flags, File fd)
 {
   int err;
   int level = Z_DEFAULT_COMPRESSION; /* compression level */
@@ -157,10 +229,9 @@ int az_open (azio_stream *s, const char
 
   if(s->stream.opaque)
   {
-    s->stream.zalloc = (alloc_func)az_alloc;
-    s->stream.zfree = (free_func)az_free;
+    s->stream.zalloc = (alloc_func)ndbz_alloc;
+    s->stream.zfree = (free_func)ndbz_free;
   }
-/*  s->stream.opaque = (voidpf)r; */
   s->bufalloced = 0;
   if(!s->inbuf)
   {
@@ -196,8 +267,8 @@ int az_open (azio_stream *s, const char
     We do our own version of append by nature. 
     We must always have write access to take card of the header.
   */
-  DBUG_ASSERT(Flags | O_APPEND);
-  DBUG_ASSERT(Flags | O_WRONLY);
+  assert(Flags | O_APPEND);
+  assert(Flags | O_WRONLY);
 
   if (Flags & O_RDWR || Flags & O_WRONLY)
     s->mode = 'w';
@@ -279,7 +350,7 @@ int az_open (azio_stream *s, const char
 }
 
 
-int write_header(azio_stream *s)
+int write_header(ndbzio_stream *s)
 {
   char *buffer= (char*)s->outbuf;
   char *ptr= buffer;
@@ -325,31 +396,31 @@ int write_header(azio_stream *s)
 /* ===========================================================================
   Opens a gzip (.gz) file for reading or writing.
 */
-int azopen(azio_stream *s, const char *path, int Flags)
+int ndbzopen(ndbzio_stream *s, const char *path, int Flags)
 {
-  return az_open(s, path, Flags, -1);
+  return ndbz_open(s, path, Flags, -1);
 }
 
 /* ===========================================================================
   Associate a gzFile with the file descriptor fd. fd is not dup'ed here
   to mimic the behavio(u)r of fdopen.
 */
-int azdopen(azio_stream *s, File fd, int Flags)
+int ndbzdopen(ndbzio_stream *s, File fd, int Flags)
 {
   if (fd < 0) return 0;
 
-  return az_open (s, NULL, Flags, fd);
+  return ndbz_open (s, NULL, Flags, fd);
 }
 
 /*
-  Read from azio_stream into buffer.
+  Read from ndbzio_stream into buffer.
   Reads up to AZ_BUFSIZE_READ bytes.
 
   Number of Bytes read is in: s->stream.avail_in
 
   return 0 on success
  */
-int read_buffer(azio_stream *s)
+int read_buffer(ndbzio_stream *s)
 {
   if (s->z_eof) return EOF;
   my_errno= 0;
@@ -368,12 +439,11 @@ int read_buffer(azio_stream *s)
 }
 
 /*
-  Read a byte from a azio_stream; update next_in and avail_in.
+  Read a byte from a ndbzio_stream; update next_in and avail_in.
 
   returns EOF on error;
 */
-int get_byte(s)
-  azio_stream *s;
+int get_byte(ndbzio_stream *s)
 {
   if (s->stream.avail_in == 0)
     if(read_buffer(s))
@@ -387,7 +457,7 @@ int get_byte(s)
  * *MUST* be < buffer size
  * *MUST* be aligned to IO size (i.e. not be only partially in buffer)
  */
-unsigned char* get_block(azio_stream *s,int blksz)
+unsigned char* get_block(ndbzio_stream *s,int blksz)
 {
   unsigned char *r= s->stream.next_in;
   if (s->stream.avail_in == 0)
@@ -400,7 +470,7 @@ unsigned char* get_block(azio_stream *s,
 }
 
 /* ===========================================================================
-  Check the gzip header of a azio_stream opened for reading. Set the stream
+  Check the gzip header of a ndbzio_stream opened for reading. Set the stream
   mode to transparent if the gzip magic header is not present; set s->err
   to Z_DATA_ERROR if the magic header is present but the rest of the header
   is incorrect.
@@ -408,7 +478,7 @@ unsigned char* get_block(azio_stream *s,
   s->stream.avail_in is zero for the first time, but may be non-zero
   for concatenated .gz files.
 */
-int check_header(azio_stream *s)
+int check_header(ndbzio_stream *s)
 {
   int method; /* method uchar */
   int flags;  /* flags uchar */
@@ -476,7 +546,7 @@ int check_header(azio_stream *s)
   else
   {
     s->transparent = 1;
-    azseek(s,0,SEEK_SET);
+    ndbzseek(s,0,SEEK_SET);
     s->z_err = Z_OK;
 
     return 0;
@@ -485,7 +555,7 @@ int check_header(azio_stream *s)
   return 0;
 }
 
-void read_header(azio_stream *s, unsigned char *buffer)
+void read_header(ndbzio_stream *s, unsigned char *buffer)
 {
   if (buffer[0] == az_magic[0]  && buffer[1] == az_magic[1])
   {
@@ -507,17 +577,16 @@ void read_header(azio_stream *s, unsigne
   }
   else
   {
-    DBUG_ASSERT(buffer[0] == az_magic[0]  && buffer[1] == az_magic[1]);
+    assert(buffer[0] == az_magic[0]  && buffer[1] == az_magic[1]);
     return;
   }
 }
 
 /* ===========================================================================
- * Cleanup then free the given azio_stream. Return a zlib error code.
+ * Cleanup then free the given ndbzio_stream. Return a zlib error code.
  Try freeing in the reverse order of allocations.
  */
-int destroy (s)
-  azio_stream *s;
+int destroy (ndbzio_stream *s)
 {
   int err = Z_OK;
 
@@ -547,9 +616,9 @@ int destroy (s)
 
 /* ===========================================================================
   Reads the given number of uncompressed bytes from the compressed file.
-  azread returns the number of bytes actually read (0 for end of file).
+  ndbzread returns the number of bytes actually read (0 for end of file).
 */
-unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned int len, int *error)
+unsigned int ZEXPORT ndbzread ( ndbzio_stream *s, voidp buf, unsigned int len, int *error)
 {
   Bytef *start = (Bytef*)buf; /* starting point for crc computation */
   Byte  *next_out; /* == stream.next_out but not forced far (for MSDOS) */
@@ -677,7 +746,7 @@ unsigned int ZEXPORT azread ( azio_strea
 /*
   Write last remaining 512 byte block of write buffer, 0 padded.
  */
-int flush_write_buffer(azio_stream *s)
+int flush_write_buffer(ndbzio_stream *s)
 {
   uInt real_len = AZ_BUFSIZE_WRITE - s->stream.avail_out;
   uInt len = ((real_len+0x1FF)>>9)<<9;
@@ -693,7 +762,7 @@ int flush_write_buffer(azio_stream *s)
   return 0;
 }
 
-int write_buffer(azio_stream *s)
+int write_buffer(ndbzio_stream *s)
 {
   if (s->stream.avail_out == 0)
   {
@@ -711,9 +780,9 @@ int write_buffer(azio_stream *s)
 
 /* ===========================================================================
   Writes the given number of uncompressed bytes into the compressed file.
-  azwrite returns the number of bytes actually written (0 in case of error).
+  ndbzwrite returns the number of bytes actually written (0 in case of error).
 */
-unsigned int azwrite (azio_stream *s, const void*  buf, unsigned int len)
+unsigned int ndbzwrite (ndbzio_stream *s, const void*  buf, unsigned int len)
 {
   unsigned int i;
   s->stream.next_in = (Bytef*)buf;
@@ -751,7 +820,7 @@ unsigned int azwrite (azio_stream *s, co
   Flushes all pending output into the compressed file. The parameter
   flush is as in the deflate() function.
 */
-int do_flush (azio_stream *s, int flush)
+int do_flush (ndbzio_stream *s, int flush)
 {
   uInt len;
   int done = 0;
@@ -786,20 +855,10 @@ int do_flush (azio_stream *s, int flush)
   else
     s->dirty= AZ_STATE_SAVED; /* Mark it clean, we should be good now */
 
-/*  afterwrite_pos= my_tell(s->file, MYF(0));
-  if(afterwrite_pos == -1)
-    return Z_ERRNO;
-  if(write_header(s) == -1)
-    return Z_ERRNO;
-  if(my_seek(s->file, afterwrite_pos, SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR)
-    return Z_ERRNO;
-*/
   return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
 }
 
-int ZEXPORT azflush (s, flush)
-  azio_stream *s;
-  int flush;
+int ZEXPORT ndbzflush (ndbzio_stream *s, int flush)
 {
   int err;
 
@@ -828,8 +887,7 @@ int ZEXPORT azflush (s, flush)
 /* ===========================================================================
   Rewinds input file.
 */
-int azrewind (s)
-  azio_stream *s;
+int ndbzrewind (ndbzio_stream *s)
 {
   if (s == NULL || s->mode != 'r') return -1;
 
@@ -846,17 +904,14 @@ int azrewind (s)
 }
 
 /* ===========================================================================
-  Sets the starting position for the next azread or azwrite on the given
+  Sets the starting position for the next ndbzread or ndbzwrite on the given
   compressed file. The offset represents a number of bytes in the
-  azseek returns the resulting offset location as measured in bytes from
+  ndbzseek returns the resulting offset location as measured in bytes from
   the beginning of the uncompressed stream, or -1 in case of error.
   SEEK_END is not implemented, returns error.
-  In this version of the library, azseek can be extremely slow.
+  In this version of the library, ndbzseek can be extremely slow.
 */
-my_off_t azseek (s, offset, whence)
-  azio_stream *s;
-  my_off_t offset;
-  int whence;
+my_off_t ndbzseek (ndbzio_stream *s, my_off_t offset, int whence)
 {
 
   if (s == NULL || whence == SEEK_END ||
@@ -876,7 +931,7 @@ my_off_t azseek (s, offset, whence)
       uInt size = AZ_BUFSIZE_WRITE;
       if (offset < AZ_BUFSIZE_WRITE) size = (uInt)offset;
 
-      size = azwrite(s, s->inbuf, size);
+      size = ndbzwrite(s, s->inbuf, size);
       if (size == 0) return -1L;
 
       offset -= size;
@@ -904,7 +959,7 @@ my_off_t azseek (s, offset, whence)
   /* For a negative seek, rewind and use positive seek */
   if (offset >= s->out) {
     offset -= s->out;
-  } else if (azrewind(s)) {
+  } else if (ndbzrewind(s)) {
     return -1L;
   }
   /* offset is now the number of bytes to skip. */
@@ -920,7 +975,7 @@ my_off_t azseek (s, offset, whence)
     unsigned int size = AZ_BUFSIZE_READ;
     if (offset < AZ_BUFSIZE_READ) size = (int)offset;
 
-    size = azread(s, s->outbuf, size, &error);
+    size = ndbzread(s, s->outbuf, size, &error);
     if (error <= 0) return -1L;
     offset -= size;
   }
@@ -928,21 +983,20 @@ my_off_t azseek (s, offset, whence)
 }
 
 /* ===========================================================================
-  Returns the starting position for the next azread or azwrite on the
+  Returns the starting position for the next ndbzread or ndbzwrite on the
   given compressed file. This position represents a number of bytes in the
   uncompressed data stream.
 */
-my_off_t ZEXPORT aztell (file)
-  azio_stream *file;
+my_off_t ZEXPORT ndbztell (ndbzio_stream *file)
 {
-  return azseek(file, 0L, SEEK_CUR);
+  return ndbzseek(file, 0L, SEEK_CUR);
 }
 
 
 /* ===========================================================================
-  Outputs a long in LSB order to the given azio_stream
+  Outputs a long in LSB order to the given ndbzio_stream
 */
-void putLong (azio_stream *s, uLong x)
+void putLong (ndbzio_stream *s, uLong x)
 {
   int n;
 
@@ -957,10 +1011,10 @@ void putLong (azio_stream *s, uLong x)
 }
 
 /* ===========================================================================
-  Reads a long in LSB order from the given azio_stream. Sets z_err in case
+  Reads a long in LSB order from the given ndbzio_stream. Sets z_err in case
   of error.
 */
-uLong getLong (azio_stream *s)
+uLong getLong (ndbzio_stream *s)
 {
   uLong x = (uLong)get_byte(s);
   int c;
@@ -977,7 +1031,7 @@ uLong getLong (azio_stream *s)
   Flushes all pending output if necessary, closes the compressed file
   and deallocates all the (de)compression state.
 */
-int azclose (azio_stream *s)
+int ndbzclose (ndbzio_stream *s)
 {
 
   if (s == NULL) return Z_STREAM_ERROR;
@@ -997,73 +1051,23 @@ int azclose (azio_stream *s)
     putLong(s, 0x4E444244);
 
     flush_write_buffer(s);
-
-/*    write_header(s); */
   }
 
   return destroy(s);
 }
 
-/*
-  Though this was added to support MySQL's FRM file, anything can be 
-  stored in this location.
-*/
-int azwrite_frm(azio_stream *s, char *blob, unsigned int length)
-{
-  if (s->mode == 'r') 
-    return 1;
-
-  if (s->rows > 0) 
-    return 1;
-
-  s->frm_start_pos= (uint) s->start;
-  s->frm_length= length;
-  s->start+= length;
-
-  my_pwrite(s->file, (uchar*) blob, s->frm_length, s->frm_start_pos, MYF(0));
-
-  write_header(s);
-  my_seek(s->file, 0, MY_SEEK_END, MYF(0));
-
-  return 0;
-}
-
-int azread_frm(azio_stream *s, char *blob)
-{
-  my_pread(s->file, (uchar*) blob, s->frm_length, s->frm_start_pos, MYF(0));
-
-  return 0;
-}
+#include <my_dir.h>  // MY_STAT, my_fstat
 
-
-/*
-  Simple comment field
-*/
-int azwrite_comment(azio_stream *s, char *blob, unsigned int length)
+int ndbz_file_size(ndbzio_stream *s, size_t *size)
 {
-  if (s->mode == 'r') 
-    return 1;
-
-  if (s->rows > 0) 
-    return 1;
-
-  s->comment_start_pos= (uint) s->start;
-  s->comment_length= length;
-  s->start+= length;
-
-  my_pwrite(s->file, (uchar*) blob, s->comment_length, s->comment_start_pos,
-            MYF(0));
-
-  write_header(s);
-  my_seek(s->file, 0, MY_SEEK_END, MYF(0));
+  MY_STAT stat_buf;
 
-  return 0;
-}
+  if (s == NULL || size == NULL)
+    return -1;
 
-int azread_comment(azio_stream *s, char *blob)
-{
-  my_pread(s->file, (uchar*) blob, s->comment_length, s->comment_start_pos,
-           MYF(0));
+  if (my_fstat(s->file, &stat_buf, 0) != 0)
+    return -1;
 
-  return 0;
+  *size = stat_buf.st_size;
+  return 0; /* OK */
 }

=== modified file 'storage/ndb/src/kernel/blocks/backup/read.cpp'
--- a/storage/ndb/src/kernel/blocks/backup/read.cpp	2011-02-01 21:05:11 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/read.cpp	2011-04-04 08:30:10 +0000
@@ -24,26 +24,26 @@
 #include <AttributeHeader.hpp>
 #include <SimpleProperties.hpp>
 #include <ndb_version.h>
-#include <util/azlib.h>
+#include <util/ndbzio.h>
 
-bool readHeader(azio_stream*, BackupFormat::FileHeader *);
-bool readFragHeader(azio_stream*, BackupFormat::DataFile::FragmentHeader *);
-bool readFragFooter(azio_stream*, BackupFormat::DataFile::FragmentFooter *);
-Int32 readRecord(azio_stream*, Uint32 **);
+bool readHeader(ndbzio_stream*, BackupFormat::FileHeader *);
+bool readFragHeader(ndbzio_stream*, BackupFormat::DataFile::FragmentHeader *);
+bool readFragFooter(ndbzio_stream*, BackupFormat::DataFile::FragmentFooter *);
+Int32 readRecord(ndbzio_stream*, Uint32 **);
 
 NdbOut & operator<<(NdbOut&, const BackupFormat::FileHeader &); 
 NdbOut & operator<<(NdbOut&, const BackupFormat::DataFile::FragmentHeader &); 
 NdbOut & operator<<(NdbOut&, const BackupFormat::DataFile::FragmentFooter &); 
 
-bool readTableList(azio_stream*, BackupFormat::CtlFile::TableList **);
-bool readTableDesc(azio_stream*, BackupFormat::CtlFile::TableDescription **);
-bool readGCPEntry(azio_stream*, BackupFormat::CtlFile::GCPEntry **);
+bool readTableList(ndbzio_stream*, BackupFormat::CtlFile::TableList **);
+bool readTableDesc(ndbzio_stream*, BackupFormat::CtlFile::TableDescription **);
+bool readGCPEntry(ndbzio_stream*, BackupFormat::CtlFile::GCPEntry **);
 
 NdbOut & operator<<(NdbOut&, const BackupFormat::CtlFile::TableList &); 
 NdbOut & operator<<(NdbOut&, const BackupFormat::CtlFile::TableDescription &); 
 NdbOut & operator<<(NdbOut&, const BackupFormat::CtlFile::GCPEntry &); 
 
-Int32 readLogEntry(azio_stream*, Uint32**);
+Int32 readLogEntry(ndbzio_stream*, Uint32**);
 
 static Uint32 recNo;
 static Uint32 logEntryNo;
@@ -57,18 +57,18 @@ main(int argc, const char * argv[]){
     exit(1);
   }
 
-  azio_stream fo;
+  ndbzio_stream fo;
   bzero(&fo, sizeof(fo));
-  int r= azopen(&fo,argv[1], O_RDONLY);
-  
-  if(fo.file < 0)
+  int r= ndbzopen(&fo,argv[1], O_RDONLY);
+
+  if(r != 1)
   {
-    ndbout << "Failed to open" << argv[1] << endl;
-    ndbout_c("file: %d r: %d", fo.file, r);
+    ndbout_c("Failed to open file '%s', error: %d",
+             argv[1], r);
     exit(1);
   }
 
-  azio_stream* f = &fo;
+  ndbzio_stream* f = &fo;
 
   BackupFormat::FileHeader fileHeader;
   if(!readHeader(f, &fileHeader)){
@@ -215,7 +215,7 @@ main(int argc, const char * argv[]){
 	   << fileHeader.FileType << endl;
     break;
   }
-  azclose(f);
+  ndbzclose(f);
   return 0;
 }
 
@@ -226,10 +226,10 @@ static bool endian = false;
 static
 inline
 size_t
-aread(void * buf, size_t sz, size_t n, azio_stream* f)
+aread(void * buf, size_t sz, size_t n, ndbzio_stream* f)
 {
   int error = 0;
-  unsigned r = azread(f, buf, (sz * n), &error);
+  unsigned r = ndbzread(f, buf, (sz * n), &error);
   if (error || r != (sz * n))
   {
     printf("Failed to read!!");
@@ -239,7 +239,7 @@ aread(void * buf, size_t sz, size_t n, a
 }
 
 bool 
-readHeader(azio_stream* f, BackupFormat::FileHeader * dst){
+readHeader(ndbzio_stream* f, BackupFormat::FileHeader * dst){
   if(aread(dst, 4, 3, f) != 3)
     RETURN_FALSE();
 
@@ -292,7 +292,7 @@ readHeader(azio_stream* f, BackupFormat:
 }
 
 bool 
-readFragHeader(azio_stream* f, BackupFormat::DataFile::FragmentHeader * dst){
+readFragHeader(ndbzio_stream* f, BackupFormat::DataFile::FragmentHeader * dst){
   if(aread(dst, 1, sizeof(* dst), f) != sizeof(* dst))
     return false;
 
@@ -314,7 +314,7 @@ readFragHeader(azio_stream* f, BackupFor
 }
 
 bool 
-readFragFooter(azio_stream* f, BackupFormat::DataFile::FragmentFooter * dst){
+readFragFooter(ndbzio_stream* f, BackupFormat::DataFile::FragmentFooter * dst){
   if(aread(dst, 1, sizeof(* dst), f) != sizeof(* dst))
     RETURN_FALSE();
   
@@ -343,7 +343,7 @@ static union {
 } theData;
 
 Int32
-readRecord(azio_stream* f, Uint32 **dst){
+readRecord(ndbzio_stream* f, Uint32 **dst){
   Uint32 len;
   if(aread(&len, 1, 4, f) != 4)
     RETURN_FALSE();
@@ -367,7 +367,7 @@ readRecord(azio_stream* f, Uint32 **dst)
 }
 
 Int32
-readLogEntry(azio_stream* f, Uint32 **dst){
+readLogEntry(ndbzio_stream* f, Uint32 **dst){
   Uint32 len;
   if(aread(&len, 1, 4, f) != 4)
     RETURN_FALSE();
@@ -435,7 +435,7 @@ NdbOut & operator<<(NdbOut& ndbout,
 } 
 
 bool 
-readTableList(azio_stream* f, BackupFormat::CtlFile::TableList **ret){
+readTableList(ndbzio_stream* f, BackupFormat::CtlFile::TableList **ret){
   BackupFormat::CtlFile::TableList * dst = &theData.TableList;
   
   if(aread(dst, 4, 2, f) != 2)
@@ -461,7 +461,7 @@ readTableList(azio_stream* f, BackupForm
 }
 
 bool 
-readTableDesc(azio_stream* f, BackupFormat::CtlFile::TableDescription **ret){
+readTableDesc(ndbzio_stream* f, BackupFormat::CtlFile::TableDescription **ret){
   BackupFormat::CtlFile::TableDescription * dst = &theData.TableDescription;
   
   if(aread(dst, 4, 3, f) != 3)
@@ -484,7 +484,7 @@ readTableDesc(azio_stream* f, BackupForm
 }
 
 bool 
-readGCPEntry(azio_stream* f, BackupFormat::CtlFile::GCPEntry **ret){
+readGCPEntry(ndbzio_stream* f, BackupFormat::CtlFile::GCPEntry **ret){
   BackupFormat::CtlFile::GCPEntry * dst = &theData.GcpEntry;
   
   if(aread(dst, 4, 4, f) != 4)

=== modified file 'storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp'
--- a/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp	2011-04-19 09:01:07 +0000
@@ -773,7 +773,7 @@ private:
   void increaselistcont(Signal* signal);
   void seizeLeftlist(Signal* signal);
   void seizeRightlist(Signal* signal);
-  Uint32 readTablePk(Uint32 localkey1, Uint32 eh, OperationrecPtr);
+  Uint32 readTablePk(Uint32 lkey1, Uint32 lkey2, Uint32 eh, OperationrecPtr);
   Uint32 getElement(Signal* signal, OperationrecPtr& lockOwner);
   void getdirindex(Signal* signal);
   void commitdelete(Signal* signal);

=== modified file 'storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	2011-04-20 07:32:39 +0000
@@ -1020,10 +1020,8 @@ void Dbacc::sendAcckeyconf(Signal* signa
   signal->theData[2] = operationRecPtr.p->fid;
   signal->theData[3] = operationRecPtr.p->localdata[0];
   signal->theData[4] = operationRecPtr.p->localdata[1];
-  signal->theData[5] = fragrecptr.p->localkeylen;
 }//Dbacc::sendAcckeyconf()
 
-
 void 
 Dbacc::ACCKEY_error(Uint32 fromWhere)
 {
@@ -1516,8 +1514,9 @@ Dbacc::accIsLockedLab(Signal* signal, Op
   } 
   else 
   {
-    if (!(lockOwnerPtr.p->m_op_bits & Operationrec::OP_ELEMENT_DISAPPEARED) &&
-	lockOwnerPtr.p->localdata[0] != ~(Uint32)0) 
+    if (! (lockOwnerPtr.p->m_op_bits & Operationrec::OP_ELEMENT_DISAPPEARED) &&
+	! Local_key::isInvalid(lockOwnerPtr.p->localdata[0],
+                               lockOwnerPtr.p->localdata[1]))
     {
       jam();
       /* ---------------------------------------------------------------
@@ -1591,7 +1590,9 @@ void Dbacc::insertelementLab(Signal* sig
   tidrForward = ZTRUE;
   idrOperationRecPtr = operationRecPtr;
   clocalkey[0] = localKey;
+  clocalkey[1] = localKey;
   operationRecPtr.p->localdata[0] = localKey;
+  operationRecPtr.p->localdata[1] = localKey;
   /* ----------------------------------------------------------------------- */
   /* WE SET THE LOCAL KEY TO MINUS ONE TO INDICATE IT IS NOT YET VALID.      */
   /* ----------------------------------------------------------------------- */
@@ -2281,6 +2282,7 @@ void Dbacc::execACCMINUPDATE(Signal* sig
   operationRecPtr.i = signal->theData[0];
   tlocalkey1 = signal->theData[1];
   tlocalkey2 = signal->theData[2];
+  Uint32 localref = Local_key::ref(tlocalkey1, tlocalkey2);
   ptrCheckGuard(operationRecPtr, coprecsize, operationrec);
   Uint32 opbits = operationRecPtr.p->m_op_bits;
   fragrecptr.i = operationRecPtr.p->fragptr;
@@ -2294,17 +2296,18 @@ void Dbacc::execACCMINUPDATE(Signal* sig
     ptrCheckGuard(ulkPageidptr, cpagesize, page8);
     dbgWord32(ulkPageidptr, tulkLocalPtr, tlocalkey1);
     arrGuard(tulkLocalPtr, 2048);
-    ulkPageidptr.p->word32[tulkLocalPtr] = tlocalkey1;
     operationRecPtr.p->localdata[0] = tlocalkey1;
+    operationRecPtr.p->localdata[1] = tlocalkey2;
     if (likely(fragrecptr.p->localkeylen == 1))
     {
+      ulkPageidptr.p->word32[tulkLocalPtr] = localref;
       return;
-    } 
-    else if (fragrecptr.p->localkeylen == 2) 
+    }
+    else if (fragrecptr.p->localkeylen == 2)
     {
       jam();
+      ulkPageidptr.p->word32[tulkLocalPtr] = tlocalkey1;
       tulkLocalPtr = tulkLocalPtr + operationRecPtr.p->elementIsforward;
-      operationRecPtr.p->localdata[1] = tlocalkey2;
       dbgWord32(ulkPageidptr, tulkLocalPtr, tlocalkey2);
       arrGuard(tulkLocalPtr, 2048);
       ulkPageidptr.p->word32[tulkLocalPtr] = tlocalkey2;
@@ -2486,8 +2489,9 @@ void Dbacc::execACC_LOCKREQ(Signal* sign
       signal->theData[5] = req->transId1;
       signal->theData[6] = req->transId2;
       // enter local key in place of PK
-      signal->theData[7] = req->tupAddr;
-      EXECUTE_DIRECT(DBACC, GSN_ACCKEYREQ, signal, 8);
+      signal->theData[7] = req->page_id;
+      signal->theData[8] = req->page_idx;
+      EXECUTE_DIRECT(DBACC, GSN_ACCKEYREQ, signal, 9);
       // translate the result
       if (signal->theData[0] < RNIL) {
         jam();
@@ -3195,7 +3199,8 @@ void Dbacc::getdirindex(Signal* signal)
 }//Dbacc::getdirindex()
 
 Uint32
-Dbacc::readTablePk(Uint32 localkey1, Uint32 eh, Ptr<Operationrec> opPtr)
+Dbacc::readTablePk(Uint32 localkey1, Uint32 localkey2,
+                   Uint32 eh, Ptr<Operationrec> opPtr)
 {
   int ret;
   Uint32 tableId = fragrecptr.p->myTableId;
@@ -3206,11 +3211,9 @@ Dbacc::readTablePk(Uint32 localkey1, Uin
   memset(ckeys, 0x1f, (fragrecptr.p->keyLength * MAX_XFRM_MULTIPLY) << 2);
 #endif
   
-  if (likely(localkey1 != ~(Uint32)0))
+  if (likely(! Local_key::isInvalid(localkey1, localkey2)))
   {
-    Uint32 fragPageId = localkey1 >> MAX_TUPLES_BITS;
-    Uint32 pageIndex = localkey1 & ((1 << MAX_TUPLES_BITS ) - 1);
-    ret = c_tup->accReadPk(tableId, fragId, fragPageId, pageIndex, 
+    ret = c_tup->accReadPk(tableId, fragId, localkey1, localkey2,
 			   ckeys, true);
   }
   else
@@ -3276,6 +3279,7 @@ Dbacc::getElement(Signal* signal, Operat
   register Uint32 tgeRemLen;
   register Uint32 TelemLen = fragrecptr.p->elementLength;
   register Uint32* Tkeydata = (Uint32*)&signal->theData[7];
+  const Uint32 localkeylen = fragrecptr.p->localkeylen;
 
   getdirindex(signal);
   tgePageindex = tgdiPageindex;
@@ -3287,7 +3291,7 @@ Dbacc::getElement(Signal* signal, Operat
    */
   const bool searchLocalKey = operationRecPtr.p->tupkeylen == 0;
 
-  ndbrequire(TelemLen == ZELEM_HEAD_SIZE + fragrecptr.p->localkeylen);
+  ndbrequire(TelemLen == ZELEM_HEAD_SIZE + localkeylen);
   tgeNextptrtype = ZLEFT;
 
   const Uint32 tmp = fragrecptr.p->k + fragrecptr.p->lhfragbits;
@@ -3298,7 +3302,7 @@ Dbacc::getElement(Signal* signal, Operat
       jam();
       tgeContainerptr = tgeContainerptr + ZHEAD_SIZE;
       tgeElementptr = tgeContainerptr + ZCON_HEAD_SIZE;
-      tgeKeyptr = (tgeElementptr + ZELEM_HEAD_SIZE) + fragrecptr.p->localkeylen;
+      tgeKeyptr = (tgeElementptr + ZELEM_HEAD_SIZE) + localkeylen;
       tgeElemStep = TelemLen;
       tgeForward = 1;
       if (unlikely(tgeContainerptr >= 2048)) 
@@ -3316,7 +3320,7 @@ Dbacc::getElement(Signal* signal, Operat
       jam();
       tgeContainerptr = tgeContainerptr + ((ZHEAD_SIZE + ZBUF_SIZE) - ZCON_HEAD_SIZE);
       tgeElementptr = tgeContainerptr - 1;
-      tgeKeyptr = (tgeElementptr - ZELEM_HEAD_SIZE) - fragrecptr.p->localkeylen;
+      tgeKeyptr = (tgeElementptr - ZELEM_HEAD_SIZE) - localkeylen;
       tgeElemStep = 0 - TelemLen;
       tgeForward = (Uint32)-1;
       if (unlikely(tgeContainerptr >= 2048)) 
@@ -3360,22 +3364,31 @@ Dbacc::getElement(Signal* signal, Operat
 	  localkey2 = lockOwnerPtr.p->localdata[1];
         } else {
           jam();
+          Uint32 pos = tgeElementptr + tgeForward;
           hashValuePart = ElementHeader::getHashValuePart(tgeElementHeader);
-          localkey1 = gePageptr.p->word32[tgeElementptr + tgeForward];
-          localkey2 = 0;
+          localkey1 = gePageptr.p->word32[pos];
+          if (likely(localkeylen == 1))
+          {
+            localkey2 = Local_key::ref2page_idx(localkey1);
+            localkey1 = Local_key::ref2page_id(localkey1);
+          }
+          else
+          {
+            localkey2 = gePageptr.p->word32[pos + tgeForward];
+          }
         }
         if (hashValuePart == opHashValuePart) {
           jam();
           bool found;
           if (! searchLocalKey) 
 	  {
-            Uint32 len = readTablePk(localkey1, tgeElementHeader, 
+            Uint32 len = readTablePk(localkey1, localkey2, tgeElementHeader,
 				     lockOwnerPtr);
             found = (len == operationRecPtr.p->xfrmtupkeylen) &&
 	      (memcmp(Tkeydata, ckeys, len << 2) == 0);
           } else {
             jam();
-            found = (localkey1 == Tkeydata[0]);
+            found = (localkey1 == Tkeydata[0] && localkey2 == Tkeydata[1]);
           }
           if (found) 
 	  {
@@ -3460,21 +3473,20 @@ error:
 void
 Dbacc::report_dealloc(Signal* signal, const Operationrec* opPtrP)
 {
-  Uint32 localKey = opPtrP->localdata[0];
+  Uint32 localKey1 = opPtrP->localdata[0];
+  Uint32 localKey2 = opPtrP->localdata[1];
   Uint32 opbits = opPtrP->m_op_bits;
   Uint32 userptr= opPtrP->userptr;
   Uint32 scanInd = 
     ((opbits & Operationrec::OP_MASK) == ZSCAN_OP) || 
     (opbits & Operationrec::OP_LOCK_REQ);
   
-  if (localKey != ~(Uint32)0)
+  if (! Local_key::isInvalid(localKey1, localKey2))
   {
     signal->theData[0] = fragrecptr.p->myfid;
     signal->theData[1] = fragrecptr.p->myTableId;
-    Uint32 pageId = localKey >> MAX_TUPLES_BITS;
-    Uint32 pageIndex = localKey & ((1 << MAX_TUPLES_BITS) - 1);
-    signal->theData[2] = pageId;
-    signal->theData[3] = pageIndex;
+    signal->theData[2] = localKey1;
+    signal->theData[3] = localKey2;
     signal->theData[4] = userptr;
     signal->theData[5] = scanInd;
     EXECUTE_DIRECT(DBLQH, GSN_TUP_DEALLOCREQ, signal, 6);
@@ -4686,6 +4698,7 @@ Dbacc::release_lockowner(Signal* signal,
 	  jam();
 	  report_dealloc(signal, opPtr.p);
 	  newOwner.p->localdata[0] = ~(Uint32)0;
+	  newOwner.p->localdata[1] = ~(Uint32)0;
 	}
 	else
 	{
@@ -4734,6 +4747,7 @@ Dbacc::release_lockowner(Signal* signal,
     {
       report_dealloc(signal, opPtr.p);
       newOwner.p->localdata[0] = ~(Uint32)0;
+      newOwner.p->localdata[1] = ~(Uint32)0;
     }
     else
     {
@@ -6553,7 +6567,8 @@ void Dbacc::checkNextBucketLab(Signal* s
       ElementHeader::getOpPtrI(nsPageptr.p->word32[tnsElementptr]);
     ptrCheckGuard(queOperPtr, coprecsize, operationrec);
     if (queOperPtr.p->m_op_bits & Operationrec::OP_ELEMENT_DISAPPEARED ||
-	queOperPtr.p->localdata[0] == ~(Uint32)0) 
+	Local_key::isInvalid(queOperPtr.p->localdata[0],
+                             queOperPtr.p->localdata[1]))
     {
       jam();
       /* ------------------------------------------------------------------ */
@@ -6983,9 +6998,8 @@ bool Dbacc::getScanElement(Signal* signa
 /* --------------------------------------------------------------------------------- */
 void Dbacc::initScanOpRec(Signal* signal) 
 {
-  Uint32 tisoTmp;
   Uint32 tisoLocalPtr;
-  Uint32 guard24;
+  Uint32 localkeylen = fragrecptr.p->localkeylen;
 
   scanPtr.p->scanOpsAllocated++;
 
@@ -7012,14 +7026,21 @@ void Dbacc::initScanOpRec(Signal* signal
   operationRecPtr.p->elementPage = isoPageptr.i;
   operationRecPtr.p->m_op_bits = opbits;
   tisoLocalPtr = tisoElementptr + tisoIsforward;
-  guard24 = fragrecptr.p->localkeylen - 1;
-  for (tisoTmp = 0; tisoTmp <= guard24; tisoTmp++) {
-    arrGuard(tisoTmp, 2);
-    arrGuard(tisoLocalPtr, 2048);
-    operationRecPtr.p->localdata[tisoTmp] = isoPageptr.p->word32[tisoLocalPtr];
-    tisoLocalPtr = tisoLocalPtr + tisoIsforward;
-  }//for
+
   arrGuard(tisoLocalPtr, 2048);
+  Uint32 Tkey1 = isoPageptr.p->word32[tisoLocalPtr];
+  tisoLocalPtr = tisoLocalPtr + tisoIsforward;
+  if (localkeylen == 1)
+  {
+    operationRecPtr.p->localdata[0] = Local_key::ref2page_id(Tkey1);
+    operationRecPtr.p->localdata[1] = Local_key::ref2page_idx(Tkey1);
+  }
+  else
+  {
+    arrGuard(tisoLocalPtr, 2048);
+    operationRecPtr.p->localdata[0] = Tkey1;
+    operationRecPtr.p->localdata[1] = isoPageptr.p->word32[tisoLocalPtr];
+  }
   operationRecPtr.p->tupkeylen = fragrecptr.p->keyLength;
   operationRecPtr.p->xfrmtupkeylen = 0; // not used
 }//Dbacc::initScanOpRec()
@@ -7369,6 +7390,7 @@ bool Dbacc::searchScanContainer(Signal*
 void Dbacc::sendNextScanConf(Signal* signal) 
 {
   Uint32 blockNo = refToMain(scanPtr.p->scanUserblockref);
+
   jam();
   /** ---------------------------------------------------------------------
    * LQH WILL NOT HAVE ANY USE OF THE TUPLE KEY LENGTH IN THIS CASE AND 
@@ -7379,8 +7401,7 @@ void Dbacc::sendNextScanConf(Signal* sig
   signal->theData[2] = operationRecPtr.p->fid;
   signal->theData[3] = operationRecPtr.p->localdata[0];
   signal->theData[4] = operationRecPtr.p->localdata[1];
-  signal->theData[5] = fragrecptr.p->localkeylen;
-  EXECUTE_DIRECT(blockNo, GSN_NEXT_SCANCONF, signal, 6);
+  EXECUTE_DIRECT(blockNo, GSN_NEXT_SCANCONF, signal, 5);
   return;
 }//Dbacc::sendNextScanConf()
 

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2011-04-05 09:38:31 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2011-04-19 09:01:07 +0000
@@ -2731,9 +2731,11 @@ public:
   Uint32 readPrimaryKeys(Uint32 opPtrI, Uint32 * dst, bool xfrm);
 private:
 
-  void acckeyconf_tupkeyreq(Signal*, TcConnectionrec*, Fragrecord*, Uint32, Uint32);
-  void acckeyconf_load_diskpage(Signal*,TcConnectionrecPtr,Fragrecord*,Uint32);
-  
+  void acckeyconf_tupkeyreq(Signal*, TcConnectionrec*, Fragrecord*,
+                            Uint32, Uint32, Uint32);
+  void acckeyconf_load_diskpage(Signal*,TcConnectionrecPtr,Fragrecord*,
+                                Uint32, Uint32);
+
   void handle_nr_copy(Signal*, Ptr<TcConnectionrec>);
   void exec_acckeyreq(Signal*, Ptr<TcConnectionrec>);
   int compare_key(const TcConnectionrec*, const Uint32 * ptr, Uint32 len);
@@ -3340,7 +3342,8 @@ Dblqh::accminupdate(Signal* signal, Uint
   regTcPtr.i= opId;
   ptrCheckGuard(regTcPtr, ctcConnectrecFileSize, tcConnectionrec);
   signal->theData[0] = regTcPtr.p->accConnectrec;
-  signal->theData[1] = key->m_page_no << MAX_TUPLES_BITS | key->m_page_idx;
+  signal->theData[1] = key->m_page_no;
+  signal->theData[2] = key->m_page_idx;
   c_acc->execACCMINUPDATE(signal);
 
   if (ERROR_INSERTED(5714))

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2011-04-07 07:22:49 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2011-04-19 09:01:07 +0000
@@ -5808,9 +5808,9 @@ void Dblqh::execACCKEYCONF(Signal* signa
   Uint32 ttcConnectrecFileSize = ctcConnectrecFileSize;
   Uint32 tcIndex = signal->theData[0];
   Uint32 localKey1 = signal->theData[3];
-  //Uint32 localKey2 = signal->theData[4];
-  Uint32 localKeyFlag = signal->theData[5];
+  Uint32 localKey2 = signal->theData[4];
   jamEntry();
+
   tcConnectptr.i = tcIndex;
   ptrCheckGuard(tcConnectptr, ttcConnectrecFileSize, regTcConnectionrec);
   TcConnectionrec * const regTcPtr = tcConnectptr.p;
@@ -5865,17 +5865,18 @@ void Dblqh::execACCKEYCONF(Signal* signa
   regFragptr.i = regTcPtr->fragmentptr;
   c_fragment_pool.getPtr(regFragptr);
 
-  ndbrequire(localKeyFlag == 1);
   if(!regTcPtr->m_disk_table)
-    acckeyconf_tupkeyreq(signal, regTcPtr, regFragptr.p, localKey1, RNIL);
+    acckeyconf_tupkeyreq(signal, regTcPtr, regFragptr.p,
+                         localKey1, localKey2, RNIL);
   else
-    acckeyconf_load_diskpage(signal, tcConnectptr, regFragptr.p, localKey1);
+    acckeyconf_load_diskpage(signal, tcConnectptr, regFragptr.p,
+                             localKey1, localKey2);
 }
 
 void
 Dblqh::acckeyconf_tupkeyreq(Signal* signal, TcConnectionrec* regTcPtr,
-			    Fragrecord* regFragptrP, 
-			    Uint32 local_key,
+			    Fragrecord* regFragptrP,
+			    Uint32 lkey1, Uint32 lkey2,
 			    Uint32 disk_page)
 {
   Uint32 op = regTcPtr->operation;
@@ -5888,8 +5889,8 @@ Dblqh::acckeyconf_tupkeyreq(Signal* sign
    * IS NEEDED SINCE TWO SCHEMA VERSIONS CAN BE ACTIVE SIMULTANEOUSLY ON A 
    * TABLE.
    * ----------------------------------------------------------------------- */
-  Uint32 page_idx = local_key & MAX_TUPLES_PER_PAGE;
-  Uint32 page_no = local_key >> MAX_TUPLES_BITS;
+  Uint32 page_idx = lkey2;
+  Uint32 page_no = lkey1;
   Uint32 Ttupreq = regTcPtr->dirtyOp;
   Ttupreq = Ttupreq + (regTcPtr->opSimple << 1);
   Ttupreq = Ttupreq + (op << 6);
@@ -5969,21 +5970,23 @@ Dblqh::acckeyconf_tupkeyreq(Signal* sign
 
 void
 Dblqh::acckeyconf_load_diskpage(Signal* signal, TcConnectionrecPtr regTcPtr,
-				Fragrecord* regFragptrP, Uint32 local_key)
+				Fragrecord* regFragptrP,
+                                Uint32 lkey1, Uint32 lkey2)
 {
   int res;
   if((res= c_tup->load_diskpage(signal, 
 				regTcPtr.p->tupConnectrec,
-				regFragptrP->tupFragptr, 
-				local_key, 
+				regFragptrP->tupFragptr,
+				lkey1, lkey2,
 				regTcPtr.p->operation)) > 0)
   {
-    acckeyconf_tupkeyreq(signal, regTcPtr.p, regFragptrP, local_key, res);
+    acckeyconf_tupkeyreq(signal, regTcPtr.p, regFragptrP, lkey1, lkey2, res);
   }
   else if(res == 0)
   {
     regTcPtr.p->transactionState = TcConnectionrec::WAIT_TUP;
-    regTcPtr.p->m_row_id.assref(local_key);
+    regTcPtr.p->m_row_id.m_page_no = lkey1;
+    regTcPtr.p->m_row_id.m_page_idx = lkey2;
   }
   else 
   {
@@ -6011,8 +6014,9 @@ Dblqh::acckeyconf_load_diskpage_callback
     FragrecordPtr fragPtr;
     c_fragment_pool.getPtr(fragPtr, regTcPtr->fragmentptr);
     
-    acckeyconf_tupkeyreq(signal, regTcPtr, fragPtr.p, 
-			 regTcPtr->m_row_id.ref(),
+    acckeyconf_tupkeyreq(signal, regTcPtr, fragPtr.p,
+			 regTcPtr->m_row_id.m_page_no,
+			 regTcPtr->m_row_id.m_page_idx,
 			 disk_page);
   }
   else if (state != TcConnectionrec::WAIT_TUP)
@@ -9351,18 +9355,9 @@ void Dblqh::execNEXT_SCANCONF(Signal* si
   jamEntry();
   scanptr.i = nextScanConf->scanPtr;
   c_scanRecordPool.getPtr(scanptr);
-  if (likely(nextScanConf->localKeyLength == 1)) //XXX signal length ?
-  {
-    jam();
-    scanptr.p->m_row_id.assref(nextScanConf->localKey[0]);
-  }
-  else
-  {
-    jam();
-    scanptr.p->m_row_id.m_page_no = nextScanConf->localKey[0];
-    scanptr.p->m_row_id.m_page_idx = nextScanConf->localKey[1]; 
-  }
-  
+  scanptr.p->m_row_id.m_page_no = nextScanConf->localKey[0];
+  scanptr.p->m_row_id.m_page_idx = nextScanConf->localKey[1];
+
 #ifdef VM_TRACE
   if (signal->getLength() > 2 && nextScanConf->accOperationPtr != RNIL)
   {
@@ -10792,14 +10787,14 @@ Dblqh::next_scanconf_load_diskpage(Signa
 				   Fragrecord* fragPtrP)
 {
   jam();
-  
+
   int res;
-  Uint32 local_key = scanPtr.p->m_row_id.ref();
-  
-  if((res= c_tup->load_diskpage_scan(signal, 
+
+  if((res= c_tup->load_diskpage_scan(signal,
 				     regTcPtr.p->tupConnectrec,
-				     fragPtrP->tupFragptr, 
-				     local_key, 
+				     fragPtrP->tupFragptr,
+				     scanPtr.p->m_row_id.m_page_no,
+				     scanPtr.p->m_row_id.m_page_idx,
 				     0)) > 0)
   {
     next_scanconf_tupkeyreq(signal, scanptr, regTcPtr.p, fragPtrP, res);

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2011-02-10 10:16:09 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2011-04-20 07:07:02 +0000
@@ -1364,12 +1364,12 @@ typedef Ptr<HostBuffer> HostBufferPtr;
     STATIC_CONST( SZ32 = 1 );
 
     void copyout(Local_key* dst) const {
-      dst->m_page_no = m_ref >> MAX_TUPLES_BITS;
-      dst->m_page_idx = m_ref & MAX_TUPLES_PER_PAGE;
+      dst->m_page_no = Local_key::ref2page_id(m_ref);
+      dst->m_page_idx = Local_key::ref2page_idx(m_ref);
     }
 
     void assign(const Local_key* src) {
-      m_ref = (src->m_page_no << MAX_TUPLES_BITS) | src->m_page_idx;
+      m_ref = Local_key::ref(src->m_page_no, src->m_page_idx);
     }
 #else
     Uint32 m_page_no;
@@ -1671,7 +1671,8 @@ public:
   /*
    * TUX uses logical tuple address when talking to ACC and LQH.
    */
-  void tuxGetTupAddr(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32& tupAddr);
+  void tuxGetTupAddr(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset,
+                     Uint32& lkey1, Uint32& lkey2);
 
   /*
    * TUX index in TUP has single Uint32 array attribute which stores an
@@ -1711,11 +1712,11 @@ public:
    */
   bool tuxQueryTh(Uint32 fragPtrI, Uint32 pageId, Uint32 pageIndex, Uint32 tupVersion, Uint32 transId1, Uint32 transId2, bool dirty, Uint32 savepointId);
 
-  int load_diskpage(Signal*, Uint32 opRec, Uint32 fragPtrI, 
-		    Uint32 local_key, Uint32 flags);
+  int load_diskpage(Signal*, Uint32 opRec, Uint32 fragPtrI,
+		    Uint32 lkey1, Uint32 lkey2, Uint32 flags);
 
-  int load_diskpage_scan(Signal*, Uint32 opRec, Uint32 fragPtrI, 
-			 Uint32 local_key, Uint32 flags);
+  int load_diskpage_scan(Signal*, Uint32 opRec, Uint32 fragPtrI,
+			 Uint32 lkey1, Uint32 lkey2, Uint32 flags);
 
   void start_restore_lcp(Uint32 tableId, Uint32 fragmentId);
   void complete_restore_lcp(Signal*, Uint32 ref, Uint32 data,
@@ -2933,7 +2934,7 @@ private:
   void   removeTdArea(Uint32 tabDesRef, Uint32 list);
   void   insertTdArea(Uint32 tabDesRef, Uint32 list);
   void   itdaMergeTabDescr(Uint32& retRef, Uint32& retNo, bool normal);
-#ifdef VM_TRACE
+#if defined VM_TRACE || defined ERROR_INSERT
   void verifytabdes();
 #endif
 

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp	2011-02-10 10:16:09 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp	2011-04-19 09:01:07 +0000
@@ -42,7 +42,7 @@ void Dbtup::execTUP_DEALLOCREQ(Signal* s
   getFragmentrec(regFragPtr, frag_id, regTabPtr.p);
   ndbassert(regFragPtr.p != NULL);
   
-  if (! (((frag_page_id << MAX_TUPLES_BITS) + page_index) == ~ (Uint32) 0))
+  if (! Local_key::isInvalid(frag_page_id, page_index))
   {
     Local_key tmp;
     tmp.m_page_no= getRealpid(regFragPtr.p, frag_page_id); 

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2011-04-04 08:03:41 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2011-04-19 09:01:07 +0000
@@ -325,9 +325,9 @@ Dbtup::setup_read(KeyReqStruct *req_stru
 }
 
 int
-Dbtup::load_diskpage(Signal* signal, 
-		     Uint32 opRec, Uint32 fragPtrI, 
-		     Uint32 local_key, Uint32 flags)
+Dbtup::load_diskpage(Signal* signal,
+		     Uint32 opRec, Uint32 fragPtrI,
+		     Uint32 lkey1, Uint32 lkey2, Uint32 flags)
 {
   Ptr<Tablerec> tabptr;
   Ptr<Fragrecord> fragptr;
@@ -336,15 +336,15 @@ Dbtup::load_diskpage(Signal* signal,
   c_operation_pool.getPtr(operPtr, opRec);
   fragptr.i= fragPtrI;
   ptrCheckGuard(fragptr, cnoOfFragrec, fragrecord);
-  
+
   Operationrec *  regOperPtr= operPtr.p;
   Fragrecord * regFragPtr= fragptr.p;
-  
+
   tabptr.i = regFragPtr->fragTableId;
   ptrCheckGuard(tabptr, cnoOfTablerec, tablerec);
   Tablerec* regTabPtr = tabptr.p;
-  
-  if(local_key == ~(Uint32)0)
+
+  if (Local_key::ref(lkey1, lkey2) == ~(Uint32)0)
   {
     jam();
     regOperPtr->op_struct.m_wait_log_buffer= 1;
@@ -353,8 +353,8 @@ Dbtup::load_diskpage(Signal* signal,
   }
   
   jam();
-  Uint32 page_idx= local_key & MAX_TUPLES_PER_PAGE;
-  Uint32 frag_page_id= local_key >> MAX_TUPLES_BITS;
+  Uint32 page_idx= lkey2;
+  Uint32 frag_page_id= lkey1;
   regOperPtr->m_tuple_location.m_page_no= getRealpid(regFragPtr,
 						     frag_page_id);
   regOperPtr->m_tuple_location.m_page_idx= page_idx;
@@ -424,9 +424,9 @@ Dbtup::disk_page_load_callback(Signal* s
 }
 
 int
-Dbtup::load_diskpage_scan(Signal* signal, 
-			  Uint32 opRec, Uint32 fragPtrI, 
-			  Uint32 local_key, Uint32 flags)
+Dbtup::load_diskpage_scan(Signal* signal,
+			  Uint32 opRec, Uint32 fragPtrI,
+			  Uint32 lkey1, Uint32 lkey2, Uint32 flags)
 {
   Ptr<Tablerec> tabptr;
   Ptr<Fragrecord> fragptr;
@@ -435,17 +435,17 @@ Dbtup::load_diskpage_scan(Signal* signal
   c_operation_pool.getPtr(operPtr, opRec);
   fragptr.i= fragPtrI;
   ptrCheckGuard(fragptr, cnoOfFragrec, fragrecord);
-  
+
   Operationrec *  regOperPtr= operPtr.p;
   Fragrecord * regFragPtr= fragptr.p;
-  
+
   tabptr.i = regFragPtr->fragTableId;
   ptrCheckGuard(tabptr, cnoOfTablerec, tablerec);
   Tablerec* regTabPtr = tabptr.p;
-  
+
   jam();
-  Uint32 page_idx= local_key & MAX_TUPLES_PER_PAGE;
-  Uint32 frag_page_id= local_key >> MAX_TUPLES_BITS;
+  Uint32 page_idx= lkey2;
+  Uint32 frag_page_id= lkey1;
   regOperPtr->m_tuple_location.m_page_no= getRealpid(regFragPtr,
 						     frag_page_id);
   regOperPtr->m_tuple_location.m_page_idx= page_idx;
@@ -627,8 +627,7 @@ void Dbtup::execTUPKEYREQ(Signal* signal
                 req_struct.attrinfo_len,
                 attrInfoIVal);
    
-   Uint32 localkey = (pageid << MAX_TUPLES_BITS) + pageidx;
-   if (Roptype == ZINSERT && localkey == ~ (Uint32) 0)
+   if (Roptype == ZINSERT && Local_key::isInvalid(pageid, pageidx))
    {
      // No tuple allocatated yet
      goto do_insert;

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp	2011-04-19 09:01:07 +0000
@@ -34,13 +34,14 @@ void
 Dbtup::tuxGetTupAddr(Uint32 fragPtrI,
                      Uint32 pageId,
                      Uint32 pageIndex,
-                     Uint32& tupAddr)
+                     Uint32& lkey1,
+                     Uint32& lkey2)
 {
   jamEntry();
   PagePtr pagePtr;
   c_page_pool.getPtr(pagePtr, pageId);
-  Uint32 fragPageId= pagePtr.p->frag_page_id;
-  tupAddr= (fragPageId << MAX_TUPLES_BITS) | pageIndex;
+  lkey1 = pagePtr.p->frag_page_id;
+  lkey2 = pageIndex;
 }
 
 int

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2011-04-07 07:22:49 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2011-04-18 15:36:25 +0000
@@ -1809,7 +1809,7 @@ Dbtup::execDROP_TAB_REQ(Signal* signal)
 {
   jamEntry();
   if (ERROR_INSERTED(4013)) {
-#ifdef VM_TRACE
+#if defined VM_TRACE || defined ERROR_INSERT
     verifytabdes();
 #endif
   }
@@ -2565,7 +2565,7 @@ Dbtup::execDROP_FRAG_REQ(Signal* signal)
 {
   jamEntry();
   if (ERROR_INSERTED(4013)) {
-#ifdef VM_TRACE
+#if defined VM_TRACE || defined ERROR_INSERT
     verifytabdes();
 #endif
   }

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp	2011-04-05 09:12:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp	2011-04-19 09:01:07 +0000
@@ -354,7 +354,8 @@ Dbtup::scanReply(Signal* signal, ScanOpP
       lockReq->fragId = frag.fragmentId;
       lockReq->fragPtrI = RNIL; // no cached frag ptr yet
       lockReq->hashValue = md5_hash((Uint64*)pkData, pkSize);
-      lockReq->tupAddr = key_mm.ref();
+      lockReq->page_id = key_mm.m_page_no;
+      lockReq->page_idx = key_mm.m_page_idx;
       lockReq->transId1 = scan.m_transId1;
       lockReq->transId2 = scan.m_transId2;
       EXECUTE_DIRECT(DBACC, GSN_ACC_LOCKREQ,
@@ -432,10 +433,9 @@ Dbtup::scanReply(Signal* signal, ScanOpP
     const ScanPos& pos = scan.m_scanPos;
     conf->accOperationPtr = accLockOp;
     conf->fragId = frag.fragmentId;
-    conf->localKey[0] = pos.m_key_mm.ref();
-    conf->localKey[1] = 0;
-    conf->localKeyLength = 1;
-    unsigned signalLength = 6;
+    conf->localKey[0] = pos.m_key_mm.m_page_no;
+    conf->localKey[1] = pos.m_key_mm.m_page_idx;
+    unsigned signalLength = 5;
     if (scan.m_bits & ScanOp::SCAN_LOCK) {
       sendSignal(scan.m_userRef, GSN_NEXT_SCANCONF,
           signal, signalLength, JBB);
@@ -478,17 +478,9 @@ Dbtup::execACCKEYCONF(Signal* signal)
 
   Uint32 localKey1 = signal->theData[3];
   Uint32 localKey2 = signal->theData[4];
-  Uint32 localKeyFlag = signal->theData[5];
   Local_key tmp;
-  if (localKeyFlag == 1)
-  {
-    tmp.assref(localKey1);
-  }
-  else
-  {
-    tmp.m_page_no = localKey1;
-    tmp.m_page_idx = localKey2;
-  }
+  tmp.m_page_no = localKey1;
+  tmp.m_page_idx = localKey2;
 
   c_scanOpPool.getPtr(scanPtr);
   ScanOp& scan = *scanPtr.p;
@@ -1107,12 +1099,11 @@ Dbtup::scanNext(Signal* signal, ScanOpPt
 	conf->scanPtr = scan.m_userPtr;
 	conf->accOperationPtr = RNIL;
 	conf->fragId = frag.fragmentId;
-	conf->localKey[0] = pos.m_key_mm.ref();
-	conf->localKey[1] = 0;
-	conf->localKeyLength = 1;
+	conf->localKey[0] = pos.m_key_mm.m_page_no;
+	conf->localKey[1] = pos.m_key_mm.m_page_idx;
 	conf->gci = foundGCI;
 	Uint32 blockNo = refToMain(scan.m_userRef);
-	EXECUTE_DIRECT(blockNo, GSN_NEXT_SCANCONF, signal, 7);
+	EXECUTE_DIRECT(blockNo, GSN_NEXT_SCANCONF, signal, 6);
 	jamEntry();
 
 	// TUPKEYREQ handles savepoint stuff
@@ -1170,12 +1161,11 @@ Dbtup::handle_lcp_keep(Signal* signal,
   conf->scanPtr = scanPtrP->m_userPtr;
   conf->accOperationPtr = (Uint32)-1;
   conf->fragId = fragPtrP->fragmentId;
-  conf->localKey[0] = lcp_list;
-  conf->localKey[1] = 0;
-  conf->localKeyLength = 1;
+  conf->localKey[0] = Local_key::ref2page_id(lcp_list);
+  conf->localKey[1] = Local_key::ref2page_idx(lcp_list);
   conf->gci = 0;
   Uint32 blockNo = refToMain(scanPtrP->m_userRef);
-  EXECUTE_DIRECT(blockNo, GSN_NEXT_SCANCONF, signal, 7);
+  EXECUTE_DIRECT(blockNo, GSN_NEXT_SCANCONF, signal, 6);
   
   fragPtrP->m_lcp_keep_list = next;
   ptr->m_header_bits |= Tuple_header::FREED; // RESTORE free flag

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp	2011-02-07 13:21:49 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp	2011-04-19 15:59:06 +0000
@@ -28,6 +28,9 @@
  * TABLE DESCRIPTOR MEMORY MANAGER
  *
  * Each table has a descriptor which is a contiguous array of words.
+ * Newer NDB versions also have additional "dynamic descriptors"
+ * which are allocated separately using the same method.
+ *
  * The descriptor is allocated from a global array using a buddy
  * algorithm.  Free lists exist for each power of 2 words.  Freeing
  * a piece first merges with free right and left neighbours and then
@@ -257,14 +260,15 @@ void Dbtup::removeTdArea(Uint32 tabDesRe
   }//if
 }//Dbtup::removeTdArea()
 
-#ifdef VM_TRACE
+#if defined VM_TRACE || defined ERROR_INSERT
 void
 Dbtup::verifytabdes()
 {
   struct WordType {
     short fl;   // free list 0-15
     short ti;   // table id
-    WordType() : fl(-1), ti(-1) {}
+    short td;   // table descriptor area 0 or >0 for dynamic
+    WordType() : fl(-1), ti(-1), td(-1) {}
   };
   WordType* wt = new WordType [cnoOfTabDescrRec];
   uint free_words = 0;
@@ -339,14 +343,16 @@ Dbtup::verifytabdes()
         for (uint j = 0; j < size; j++) {
           ndbrequire(wt[desc + j].ti == -1);
           wt[desc + j].ti = i;
+          wt[desc + j].td = 0;
         }
         used_words += size;
       }
+      for (uint k = 0; k < NO_DYNAMICS; k++)
       {
         Uint32 offset[3];
-        Uint32 MaskSize = (ptr.p->m_dyn_null_bits[MM] + 31) >> 5;
+        Uint32 MaskSize = (ptr.p->m_dyn_null_bits[k] + 31) >> 5;
         const Uint32 alloc = getDynTabDescrOffsets(MaskSize, offset);
-        const Uint32 desc = ptr.p->dynTabDescriptor[MM];
+        const Uint32 desc = ptr.p->dynTabDescriptor[k];
         Uint32 size = alloc;
         if (size % ZTD_FREE_SIZE != 0)
           size += ZTD_FREE_SIZE - size % ZTD_FREE_SIZE;
@@ -366,6 +372,7 @@ Dbtup::verifytabdes()
         for (uint j = 0; j < size; j++) {
           ndbrequire(wt[desc + j].ti == -1);
           wt[desc + j].ti = i;
+          wt[desc + j].td = 1 + k;
         }
         used_words += size;
       }

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2011-04-19 09:01:07 +0000
@@ -776,7 +776,7 @@ private:
 
   // inlined utils
   DescEnt& getDescEnt(Uint32 descPage, Uint32 descOff);
-  Uint32 getTupAddr(const Frag& frag, TreeEnt ent);
+  void getTupAddr(const Frag& frag, TreeEnt ent, Uint32& lkey1, Uint32& lkey2);
   static unsigned min(unsigned x, unsigned y);
   static unsigned max(unsigned x, unsigned y);
 
@@ -1242,15 +1242,15 @@ Dbtux::getDescEnt(Uint32 descPage, Uint3
   return *descEnt;
 }
 
-inline Uint32
-Dbtux::getTupAddr(const Frag& frag, TreeEnt ent)
+inline
+void
+Dbtux::getTupAddr(const Frag& frag, TreeEnt ent, Uint32& lkey1, Uint32& lkey2)
 {
   const Uint32 tableFragPtrI = frag.m_tupTableFragPtrI;
   const TupLoc tupLoc = ent.m_tupLoc;
-  Uint32 tupAddr = NullTupAddr;
-  c_tup->tuxGetTupAddr(tableFragPtrI, tupLoc.getPageId(), tupLoc.getPageOffset(), tupAddr);
+  c_tup->tuxGetTupAddr(tableFragPtrI, tupLoc.getPageId(),tupLoc.getPageOffset(),
+                       lkey1, lkey2);
   jamEntry();
-  return tupAddr;
 }
 
 inline unsigned

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp	2011-04-19 09:01:07 +0000
@@ -511,7 +511,10 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal
       const Uint32* const buf32 = static_cast<Uint32*>(pkData);
       const Uint64* const buf64 = reinterpret_cast<const Uint64*>(buf32);
       lockReq->hashValue = md5_hash(buf64, pkSize);
-      lockReq->tupAddr = getTupAddr(frag, ent);
+      Uint32 lkey1, lkey2;
+      getTupAddr(frag, ent, lkey1, lkey2);
+      lockReq->page_id = lkey1;
+      lockReq->page_idx = lkey2;
       lockReq->transId1 = scan.m_transId1;
       lockReq->transId2 = scan.m_transId2;
       // execute
@@ -599,10 +602,11 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal
     }
     conf->accOperationPtr = accLockOp;
     conf->fragId = frag.m_fragId;
-    conf->localKey[0] = getTupAddr(frag, ent);
-    conf->localKey[1] = 0;
-    conf->localKeyLength = 1;
-    unsigned signalLength = 6;
+    Uint32 lkey1, lkey2;
+    getTupAddr(frag, ent, lkey1, lkey2);
+    conf->localKey[0] = lkey1;
+    conf->localKey[1] = lkey2;
+    unsigned signalLength = 5;
     // add key info
     if (! scan.m_readCommitted) {
       sendSignal(scan.m_userRef, GSN_NEXT_SCANCONF,

=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.cpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.cpp	2011-04-01 13:03:45 +0000
@@ -46,29 +46,35 @@ PosixAsyncFile::PosixAsyncFile(Simulated
   theFd(-1),
   use_gz(0)
 {
-  memset(&azf,0,sizeof(azf));
+  memset(&nzf,0,sizeof(nzf));
   init_mutex();
 }
 
 int PosixAsyncFile::init()
 {
-  // Create write buffer for bigger writes
-  azfBufferUnaligned= (Byte*)ndbd_malloc((AZ_BUFSIZE_READ+AZ_BUFSIZE_WRITE)
-                                         +NDB_O_DIRECT_WRITE_ALIGNMENT-1);
-
-  azf.inbuf= (Byte*)(((UintPtr)azfBufferUnaligned
+  /*
+    Preallocate read and write buffers for ndbzio to workaround
+    default behaviour of alloc/free at open/close
+  */
+  const size_t read_size = ndbz_bufsize_read();
+  const size_t write_size = ndbz_bufsize_write();
+
+  nzfBufferUnaligned= ndbd_malloc(read_size + write_size +
+                                  NDB_O_DIRECT_WRITE_ALIGNMENT-1);
+  nzf.inbuf= (Byte*)(((UintPtr)nzfBufferUnaligned
                       + NDB_O_DIRECT_WRITE_ALIGNMENT - 1) &
                      ~(UintPtr)(NDB_O_DIRECT_WRITE_ALIGNMENT - 1));
+  nzf.outbuf= nzf.inbuf + read_size;
 
-  azf.outbuf= azf.inbuf + AZ_BUFSIZE_READ;
-
-  az_mempool.size = az_mempool.mfree = az_inflate_mem_size()+az_deflate_mem_size();
+  /* Preallocate inflate/deflate buffers for ndbzio */
+  nz_mempool.size = nz_mempool.mfree =
+    ndbz_inflate_mem_size() + ndbz_deflate_mem_size();
 
   ndbout_c("NDBFS/AsyncFile: Allocating %u for In/Deflate buffer",
-           (unsigned int)az_mempool.size);
-  az_mempool.mem = (char*) ndbd_malloc(az_mempool.size);
+           (unsigned int)nz_mempool.size);
+  nz_mempool.mem = (char*) ndbd_malloc(nz_mempool.size);
 
-  azf.stream.opaque= &az_mempool;
+  nzf.stream.opaque= &nz_mempool;
 
   return 0;
 }
@@ -359,7 +365,7 @@ no_odirect:
 #endif
         int n;
 	if(use_gz)
-          n= azwrite(&azf,buf,size);
+          n= ndbzwrite(&nzf, buf, size);
         else
           n= write(theFd, buf, size);
 	if(n == -1 && errno == EINTR)
@@ -368,7 +374,7 @@ no_odirect:
 	}
 	if(n == -1 || n == 0)
 	{
-          ndbout_c("azwrite|write returned %d: errno: %d my_errno: %d",n,errno,my_errno);
+          ndbout_c("ndbzwrite|write returned %d: errno: %d my_errno: %d",n,errno,my_errno);
 	  break;
 	}
 	size -= n;
@@ -480,7 +486,7 @@ no_odirect:
   if(use_gz)
   {
     int err;
-    if((err= azdopen(&azf, theFd, new_flags)) < 1)
+    if((err= ndbzdopen(&nzf, theFd, new_flags)) < 1)
     {
       ndbout_c("Stewart's brain broke: %d %d %s",
                err, my_errno, theFileName.c_str());
@@ -509,7 +515,7 @@ int PosixAsyncFile::readBuffer(Request *
 #endif
   if(use_gz)
   {
-    while((seek_val= azseek(&azf, offset, SEEK_SET)) == (off_t)-1
+    while((seek_val= ndbzseek(&nzf, offset, SEEK_SET)) == (off_t)-1
           && errno == EINTR) {};
     if(seek_val == (off_t)-1)
     {
@@ -524,14 +530,14 @@ int PosixAsyncFile::readBuffer(Request *
 
 #if  ! defined(HAVE_PREAD)
     if(use_gz)
-      return_value = azread(&azf, buf, size, &error);
+      return_value = ndbzread(&nzf, buf, size, &error);
     else
       return_value = ::read(theFd, buf, size);
 #else // UNIX
     if(!use_gz)
       return_value = ::pread(theFd, buf, size, offset);
     else
-      return_value = azread(&azf, buf, size, &error);
+      return_value = ndbzread(&nzf, buf, size, &error);
 #endif
     if (return_value == -1 && errno == EINTR) {
       DEBUG(ndbout_c("EINTR in read"));
@@ -540,13 +546,13 @@ int PosixAsyncFile::readBuffer(Request *
       if (return_value == -1)
         return errno;
     }
-    else if (return_value < 1 && azf.z_eof!=1)
+    else if (return_value < 1 && nzf.z_eof!=1)
     {
-      if(my_errno==0 && errno==0 && error==0 && azf.z_err==Z_STREAM_END)
+      if(my_errno==0 && errno==0 && error==0 && nzf.z_err==Z_STREAM_END)
         break;
       DEBUG(ndbout_c("ERROR DURING %sRead: %d off: %d from %s",(use_gz)?"gz":"",size,offset,theFileName.c_str()));
       ndbout_c("ERROR IN PosixAsyncFile::readBuffer %d %d %d %d",
-               my_errno, errno, azf.z_err, error);
+               my_errno, errno, nzf.z_err, error);
       if(use_gz)
         return my_errno;
       return errno;
@@ -629,12 +635,12 @@ int PosixAsyncFile::writeBuffer(const ch
 
 #if ! defined(HAVE_PWRITE)
     if(use_gz)
-      return_value= azwrite(&azf, buf, bytes_to_write);
+      return_value= ndbzwrite(&nzf, buf, bytes_to_write);
     else
       return_value = ::write(theFd, buf, bytes_to_write);
 #else // UNIX
     if(use_gz)
-      return_value= azwrite(&azf, buf, bytes_to_write);
+      return_value= ndbzwrite(&nzf, buf, bytes_to_write);
     else
       return_value = ::pwrite(theFd, buf, bytes_to_write, offset);
 #endif
@@ -643,7 +649,7 @@ int PosixAsyncFile::writeBuffer(const ch
       DEBUG(ndbout_c("EINTR in write"));
     } else if (return_value == -1 || return_value < 1){
       ndbout_c("ERROR IN PosixAsyncFile::writeBuffer %d %d %d",
-               my_errno, errno, azf.z_err);
+               my_errno, errno, nzf.z_err);
       if(use_gz)
         return my_errno;
       return errno;
@@ -678,17 +684,17 @@ void PosixAsyncFile::closeReq(Request *r
   }
   int r;
   if(use_gz)
-    r= azclose(&azf);
+    r= ndbzclose(&nzf);
   else
     r= ::close(theFd);
   use_gz= 0;
   Byte *a,*b;
-  a= azf.inbuf;
-  b= azf.outbuf;
-  memset(&azf,0,sizeof(azf));
-  azf.inbuf= a;
-  azf.outbuf= b;
-  azf.stream.opaque = (void*)&az_mempool;
+  a= nzf.inbuf;
+  b= nzf.outbuf;
+  memset(&nzf,0,sizeof(nzf));
+  nzf.inbuf= a;
+  nzf.outbuf= b;
+  nzf.stream.opaque = (void*)&nz_mempool;
 
   if (-1 == r) {
 #ifndef DBUG_OFF
@@ -729,7 +735,7 @@ void PosixAsyncFile::appendReq(Request *
   while(size > 0){
     int n;
     if(use_gz)
-      n= azwrite(&azf,buf,size);
+      n= ndbzwrite(&nzf,buf,size);
     else
       n= write(theFd, buf, size);
     if(n == -1 && errno == EINTR){
@@ -823,15 +829,19 @@ loop:
 
 PosixAsyncFile::~PosixAsyncFile()
 {
-  if (azfBufferUnaligned)
-    ndbd_free(azfBufferUnaligned, (AZ_BUFSIZE_READ*AZ_BUFSIZE_WRITE)
-              +NDB_O_DIRECT_WRITE_ALIGNMENT-1);
-
-  if(az_mempool.mem)
-    ndbd_free(az_mempool.mem,az_mempool.size);
+  /* Free the read and write buffer memory used by ndbzio */
+  if (nzfBufferUnaligned)
+    ndbd_free(nzfBufferUnaligned,
+              ndbz_bufsize_read() +
+              ndbz_bufsize_write() +
+              NDB_O_DIRECT_WRITE_ALIGNMENT-1);
+  nzfBufferUnaligned = NULL;
+
+  /* Free the inflate/deflate buffers for ndbzio */
+  if(nz_mempool.mem)
+    ndbd_free(nz_mempool.mem, nz_mempool.size);
+  nz_mempool.mem = NULL;
 
-  az_mempool.mem = NULL;
-  azfBufferUnaligned = NULL;
   destroy_mutex();
 }
 

=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.hpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.hpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/PosixAsyncFile.hpp	2011-04-01 12:30:27 +0000
@@ -25,7 +25,7 @@
  * Also does direct IO, preallocation.
  */
 
-#include <azlib.h>
+#include <ndbzio.h>
 
 /**
  * PREAD/PWRITE is needed to use file != thread
@@ -66,9 +66,9 @@ private:
   int theFd;
 
   int use_gz;
-  azio_stream azf;
-  struct az_alloc_rec az_mempool;
-  void* azfBufferUnaligned;
+  ndbzio_stream nzf;
+  struct ndbz_alloc_rec nz_mempool;
+  void* nzfBufferUnaligned;
 
   int check_odirect_read(Uint32 flags, int&new_flags, int mode);
   int check_odirect_write(Uint32 flags, int&new_flags, int mode);

=== modified file 'storage/ndb/src/kernel/vm/mt.cpp'
--- a/storage/ndb/src/kernel/vm/mt.cpp	2011-02-23 19:28:26 +0000
+++ b/storage/ndb/src/kernel/vm/mt.cpp	2011-04-20 05:46:35 +0000
@@ -401,7 +401,7 @@ struct thr_safe_pool
 
   T* m_free_list;
   Uint32 m_cnt;
-  thr_spin_lock<NDB_CL - (sizeof(T*) + sizeof(Uint32))> m_lock;
+  thr_spin_lock<NDB_CL - (sizeof(void*) + sizeof(Uint32))> m_lock;
 
   T* seize(Ndbd_mem_manager *mm, Uint32 rg) {
     T* ret = 0;

=== modified file 'storage/ndb/src/mgmsrv/ConfigInfo.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2011-04-15 13:52:53 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2011-04-19 13:47:33 +0000
@@ -1307,7 +1307,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_ENUM,
-    0,
+    "Default", /* Default value */
     (const char*)arbit_method_typelib,
     0
   },
@@ -2183,12 +2183,17 @@ const ConfigInfo::ParamInfo ConfigInfo::
     CFG_DEFAULT_OPERATION_REDO_PROBLEM_ACTION,
     "DefaultOperationRedoProblemAction",
     API_TOKEN,
-    "If Redo-log is having problem, should operation default (unless overridden on transaction/operation level) abort or be put on queue"
-    " in a row times, transactions will be aborted",
+    "If Redo-log is having problem, should operation default "
+    "(unless overridden on transaction/operation level) abort "
+    "or be put on queue",
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_ENUM,
-    0, /* default for ENUM doesnt seem to work... */
+#if NDB_VERSION_D < NDB_MAKE_VERSION(7,2,0)
+    "abort", /* Default value */
+#else
+    "queue", /* Default value */
+#endif
     (const char*)default_operation_redo_problem_action_typelib,
     0
   },
@@ -3164,11 +3169,26 @@ ConfigInfo::ConfigInfo()
              entry->name != 0; entry++)
           values.put(entry->name, entry->value);
         require(pinfo.put("values", &values));
-        // fallthrough
+
+        if(param._default == MANDATORY)
+          pinfo.put("Mandatory", (Uint32)1);
+        else if(param._default)
+        {
+          /*
+            Map default value of enum from string to int since
+            enum is stored as int internally
+          */
+          Uint32 default_value;
+          require(values.get(param._default, &default_value));
+          require(pinfo.put("Default", default_value));
+
+          /* Also store the default as string */
+          require(pinfo.put("DefaultString", param._default));
+        }
+        break;
       }
       case CI_STRING:
-        assert(param._type == CI_ENUM || // Allow fallthrough from enum
-               param._min == 0); // String can't have min value
+        assert(param._min == 0); // String can't have min value
         assert(param._max == 0); // String can't have max value
 
         if(param._default == MANDATORY)
@@ -3218,7 +3238,6 @@ ConfigInfo::ConfigInfo()
         {
 	  case CI_SECTION:
 	    break;
-	  case CI_ENUM:
 	  case CI_STRING:
           case CI_BITMASK:
 	    require(p->put(param._fname, param._default));
@@ -3237,6 +3256,20 @@ ConfigInfo::ConfigInfo()
 	      require(p->put64(param._fname, Uint64(default_uint64)));
 	      break;
 	    }
+          case CI_ENUM:
+          {
+            /*
+              Map default value of enum from string to int since
+              enum is stored as int internally
+            */
+            Uint32 default_value;
+            require(verify_enum(getInfo(param._section),
+                                param._fname, param._default,
+                                default_value));
+            require(p->put(param._fname, default_value));
+            break;
+          }
+
 	}
       }
       require(m_systemDefaults.put(param._section, p, true));
@@ -3264,7 +3297,7 @@ ConfigInfo::ConfigInfo()
       ndbout << "Edit file " << __FILE__ << "." << endl;
       require(false);
     }
-  }
+   }
 
 }
 
@@ -3350,8 +3383,29 @@ ConfigInfo::getDefault(const Properties
 
 const char*
 ConfigInfo::getDefaultString(const Properties * section,
-                             const char* fname) const {
-  return getInfoString(section, fname, "Default");
+                             const char* fname) const
+{
+  switch (getType(section, fname))
+  {
+  case ConfigInfo::CI_BITMASK:
+  case ConfigInfo::CI_STRING:
+    return getInfoString(section, fname, "Default");
+
+  case ConfigInfo::CI_ENUM:
+  {
+    /*
+      Default value for enum are stored as int internally
+      but also stores the orignal string, use different
+      key to get at the default value as string
+     */
+    return getInfoString(section, fname, "DefaultString");
+  }
+
+  default:
+    require(false);
+  }
+
+  return NULL;
 }
 
 bool
@@ -4155,6 +4209,7 @@ applyDefaultValues(InitConfigFileParser:
       else
       {
         switch (ctx.m_info->getType(ctx.m_currentInfo, name)){
+        case ConfigInfo::CI_ENUM:
         case ConfigInfo::CI_INT:
         case ConfigInfo::CI_BOOL:{
           Uint32 val = 0;
@@ -4169,7 +4224,6 @@ applyDefaultValues(InitConfigFileParser:
           break;
         }
         case ConfigInfo::CI_BITMASK:
-        case ConfigInfo::CI_ENUM:
         case ConfigInfo::CI_STRING:{
           const char * val;
           require(ctx.m_currentSection->get(name, &val));

=== modified file 'storage/ndb/src/ndbapi/NdbScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp	2011-02-10 07:55:45 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp	2011-04-18 12:39:04 +0000
@@ -1771,9 +1771,9 @@ NdbScanOperation::nextResult(const char
     NdbRecAttr *getvalue_recattr= theReceiver.theFirstRecAttr;
     if (((UintPtr)tBlob | (UintPtr)getvalue_recattr) != 0)
     {
-      Uint32 idx= m_current_api_receiver;
+      const Uint32 idx= m_current_api_receiver;
       assert(idx < m_api_receivers_count);
-      const NdbReceiver *receiver= m_api_receivers[m_current_api_receiver];
+      const NdbReceiver *receiver= m_api_receivers[idx];
       Uint32 pos= 0;
 
       /* First take care of any getValue(). */

=== modified file 'storage/ndb/test/ndbapi/testDict.cpp'
--- a/storage/ndb/test/ndbapi/testDict.cpp	2011-04-07 07:22:49 +0000
+++ b/storage/ndb/test/ndbapi/testDict.cpp	2011-04-18 11:09:11 +0000
@@ -31,6 +31,7 @@
 #include <NdbSqlUtil.hpp>
 #include <NdbEnv.h>
 #include <ndb_rand.h>
+#include <Bitmask.hpp>
 
 #define ERR_INSERT_MASTER_FAILURE1 6013
 #define ERR_INSERT_MASTER_FAILURE2 6014
@@ -294,31 +295,45 @@ int runCreateAndDropAtRandom(NDBT_Contex
   Ndb* pNdb = GETNDB(step);
   NdbDictionary::Dictionary* pDic = pNdb->getDictionary();
   int loops = ctx->getNumLoops();
-  int numTables = NDBT_Tables::getNumTables();
-  bool* tabList = new bool [ numTables ];
-  int tabCount;
+  int records = ctx->getNumRecords();
 
-  {
-    for (int num = 0; num < numTables; num++) {
-      (void)pDic->dropTable(NDBT_Tables::getTable(num)->getName());
-      tabList[num] = false;
-    }
-    tabCount = 0;
+  int numAllTables = NDBT_Tables::getNumTables();
+  struct TabList {
+    int exists; // -1 = skip, 0 = no, 1 = yes
+    const NdbDictionary::Table* pTab; // retrieved
+    TabList() { exists = -1; pTab = 0; }
+  };
+  TabList* tabList = new TabList [ numAllTables ];
+  int numTables = 0;
+  int num;
+  for (num = 0; num < numAllTables; num++) {
+    const NdbDictionary::Table* pTab = NDBT_Tables::getTable(num);
+    if (pTab->checkColumns(0, 0) & 2) // skip disk
+      continue;
+    tabList[num].exists = 0;
+    (void)pDic->dropTable(pTab->getName());
+    numTables++;
   }
+  int numExists = 0;
+
+  const bool createIndexes = ctx->getProperty("CreateIndexes");
+  const bool loadData = ctx->getProperty("LoadData");
 
   NdbRestarter restarter;
   int result = NDBT_OK;
   int bias = 1; // 0-less 1-more
   int i = 0;
   
-  while (i < loops) {
-    g_info << "loop " << i << " tabs " << tabCount << "/" << numTables << endl;
-    int num = myRandom48(numTables);
+  while (i < loops && result == NDBT_OK) {
+    num = myRandom48(numAllTables);
+    if (tabList[num].exists == -1)
+      continue;
+    g_info << "loop " << i << " tabs " << numExists << "/" << numTables << endl;
     const NdbDictionary::Table* pTab = NDBT_Tables::getTable(num);
     char tabName[200];
     strcpy(tabName, pTab->getName());
 
-    if (tabList[num] == false) {
+    if (tabList[num].exists == 0) {
       if (bias == 0 && myRandom48(100) < 80)
         continue;
       g_info << tabName << ": create" << endl;
@@ -331,17 +346,110 @@ int runCreateAndDropAtRandom(NDBT_Contex
       const NdbDictionary::Table* pTab2 = pDic->getTable(tabName);
       if (pTab2 == NULL) {
         const NdbError err = pDic->getNdbError();
-        g_err << tabName << ": verify create: " << err << endl;
+        g_err << tabName << ": verify create failed: " << err << endl;
         result = NDBT_FAILED;
         break;
       }
-      tabList[num] = true;
-      assert(tabCount < numTables);
-      tabCount++;
-      if (tabCount == numTables)
+      tabList[num].pTab = pTab2;
+      if (loadData) {
+        g_info << tabName << ": load data" << endl;
+        HugoTransactions hugoTrans(*pTab2);
+        if (hugoTrans.loadTable(pNdb, records) != 0) {
+          g_err << tabName << ": loadTable failed" << endl;
+          result = NDBT_FAILED;
+          break;
+        }
+      }
+      if (createIndexes) {
+        int icount = myRandom48(10);
+        int inum;
+        for (inum = 0; inum < icount; inum++) {
+          const int tcols = pTab2->getNoOfColumns();
+          assert(tcols != 0);
+          int icols = 1 + myRandom48(tcols);
+          if (icols > NDB_MAX_ATTRIBUTES_IN_INDEX)
+            icols = NDB_MAX_ATTRIBUTES_IN_INDEX;
+          char indName[200];
+          sprintf(indName, "%s_X%d", tabName, inum);
+          NdbDictionary::Index ind(indName);
+          ind.setTable(tabName);
+          ind.setType(NdbDictionary::Index::OrderedIndex);
+          ind.setLogging(false);
+          Bitmask<MAX_ATTRIBUTES_IN_TABLE> mask;
+          char ilist[200];
+          ilist[0] = 0;
+          int ic;
+          for (ic = 0; ic < icols; ic++) {
+            int tc = myRandom48(tcols);
+            const NdbDictionary::Column* c = pTab2->getColumn(tc);
+            assert(c != 0);
+            if (mask.get(tc) ||
+                c->getType() == NdbDictionary::Column::Blob ||
+                c->getType() == NdbDictionary::Column::Text ||
+                c->getType() == NdbDictionary::Column::Bit ||
+                c->getStorageType() == NdbDictionary::Column::StorageTypeDisk)
+              continue;
+            ind.addColumn(*c);
+            mask.set(tc);
+            sprintf(ilist + strlen(ilist), " %d", tc);
+          }
+          if (mask.isclear())
+            continue;
+          g_info << indName << ": columns:" << ilist << endl;
+          if (pDic->createIndex(ind) == 0) {
+            g_info << indName << ": created" << endl;
+          } else {
+            const NdbError err = pDic->getNdbError();
+            g_err << indName << ": create index failed: " << err << endl;
+            if (err.code != 826 && // Too many tables and attributes..
+                err.code != 903 && // Too many ordered indexes..
+                err.code != 904 && // Out of fragment records..
+                err.code != 905 && // Out of attribute records..
+                err.code != 707 && // No more table metadata records..
+                err.code != 708)   // No more attribute metadata records..
+            {
+              result = NDBT_FAILED;
+              break;
+            }
+          }
+        }
+      }
+      if (loadData) {
+        // first update a random table to flush global variables
+        int num3 = 0;
+        while (1) {
+          num3 = myRandom48(numAllTables);
+          if (num == num3 || tabList[num3].exists == 1)
+            break;
+        }
+        const NdbDictionary::Table* pTab3 = tabList[num3].pTab;
+        assert(pTab3 != 0);
+        char tabName3[200];
+        strcpy(tabName3, pTab3->getName());
+        HugoTransactions hugoTrans(*pTab3);
+        g_info << tabName3 << ": update data" << endl;
+        if (hugoTrans.pkUpdateRecords(pNdb, records) != 0) {
+          g_err << tabName3 << ": pkUpdateRecords failed" << endl;
+          result = NDBT_FAILED;
+          break;
+        }
+      }
+      if (loadData) {
+        HugoTransactions hugoTrans(*pTab2);
+        g_info << tabName << ": update data" << endl;
+        if (hugoTrans.pkUpdateRecords(pNdb, records) != 0) {
+          g_err << "pkUpdateRecords failed" << endl;
+          result = NDBT_FAILED;
+          break;
+        }
+      }
+      tabList[num].exists = 1;
+      assert(numExists < numTables);
+      numExists++;
+      if (numExists == numTables)
         bias = 0;
     }
-    else {
+    else if (tabList[num].exists == 1) {
       if (bias == 1 && myRandom48(100) < 80)
         continue;
       g_info << tabName << ": drop" << endl;
@@ -369,19 +477,19 @@ int runCreateAndDropAtRandom(NDBT_Contex
         result = NDBT_FAILED;
         break;
       }
-      tabList[num] = false;
-      assert(tabCount > 0);
-      tabCount--;
-      if (tabCount == 0)
+      tabList[num].exists = 0;
+      assert(numExists > 0);
+      numExists--;
+      if (numExists == 0)
         bias = 1;
     }
     i++;
   }
-  
-  for (Uint32 i = 0; i<(Uint32)numTables; i++)
-    if (tabList[i])
-      pDic->dropTable(NDBT_Tables::getTable(i)->getName());
-  
+
+  for (num = 0; num < numAllTables; num++)
+    if (tabList[num].exists == 0)
+      pDic->dropTable(NDBT_Tables::getTable(num)->getName());
+
   delete [] tabList;
   return result;
 }
@@ -8737,6 +8845,13 @@ TESTCASE("CreateAndDropAtRandom",
          "Uses error insert 4013 to make TUP verify table descriptor"){
   INITIALIZER(runCreateAndDropAtRandom);
 }
+TESTCASE("CreateAndDropIndexes",
+	 "Like CreateAndDropAtRandom but also creates random ordered\n"
+         "indexes and loads data as a simple check of index operation"){
+  TC_PROPERTY("CreateIndexes", 1);
+  TC_PROPERTY("LoadData", 1);
+  INITIALIZER(runCreateAndDropAtRandom);
+}
 TESTCASE("CreateAndDropWithData", 
 	 "Try to create and drop the table when it's filled with data\n"
 	 "do this loop number of times\n"){

=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt	2011-04-14 16:29:07 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2011-04-18 12:48:10 +0000
@@ -715,6 +715,10 @@ args: -n CreateAndDropAtRandom -l 200 T1
 
 max-time: 1500
 cmd: testDict
+args: -n CreateAndDropIndexes -l 200 T1
+
+max-time: 1500
+cmd: testDict
 args: -n CreateAndDropWithData 
 
 max-time: 1500

=== modified file 'storage/ndb/test/src/HugoCalculator.cpp'
--- a/storage/ndb/test/src/HugoCalculator.cpp	2011-04-01 14:34:28 +0000
+++ b/storage/ndb/test/src/HugoCalculator.cpp	2011-04-18 11:09:11 +0000
@@ -196,8 +196,6 @@ HugoCalculator::calcValue(int record,
   case NdbDictionary::Column::Unsigned:
   case NdbDictionary::Column::Bigint:
   case NdbDictionary::Column::Bigunsigned:
-  case NdbDictionary::Column::Float:
-  case NdbDictionary::Column::Double:
   case NdbDictionary::Column::Olddecimal:
   case NdbDictionary::Column::Olddecimalunsigned:
   case NdbDictionary::Column::Decimal:
@@ -227,6 +225,22 @@ HugoCalculator::calcValue(int record,
       memcpy(((Uint32*)buf)+tmp, &copy, 4);
     }
     break;
+  case NdbDictionary::Column::Float:
+    {
+      float x = (float)myRand(&seed);
+      memcpy(buf+pos, &x, 4);
+      pos += 4;
+      len -= 4;
+    }
+    break;
+  case NdbDictionary::Column::Double:
+    {
+      double x = (double)myRand(&seed);
+      memcpy(buf+pos, &x, 8);
+      pos += 8;
+      len -= 8;
+    }
+    break;
   case NdbDictionary::Column::Varbinary:
   case NdbDictionary::Column::Varchar:
     len = calc_len(myRand(&seed), len - 1);

=== modified file 'storage/ndb/tools/restore/Restore.cpp'
--- a/storage/ndb/tools/restore/Restore.cpp	2011-02-03 14:20:36 +0000
+++ b/storage/ndb/tools/restore/Restore.cpp	2011-04-04 09:41:30 +0000
@@ -1297,7 +1297,6 @@ BackupFile::BackupFile(void (* _free_dat
   : free_data_callback(_free_data_callback)
 {
   memset(&m_file,0,sizeof(m_file));
-  m_file.file = -1;
   m_path[0] = 0;
   m_fileName[0] = 0;
 
@@ -1311,49 +1310,41 @@ BackupFile::BackupFile(void (* _free_dat
   m_is_undolog = false;
 }
 
-BackupFile::~BackupFile(){
-  if(m_file.file > 1)
-  {
-    azclose(&m_file);
-    memset(&m_file,0,sizeof(m_file));
-  }
+BackupFile::~BackupFile()
+{
+  (void)ndbzclose(&m_file);
+
   if(m_buffer != 0)
     free(m_buffer);
 }
 
 bool
 BackupFile::openFile(){
-  if(m_file.file > 1){
-    azclose(&m_file);
-    m_file.file = 0;
-    m_file_size = 0;
-    m_file_pos = 0;
-  }
+  (void)ndbzclose(&m_file);
+  m_file_size = 0;
+  m_file_pos = 0;
 
   info.setLevel(254);
   info << "Opening file '" << m_fileName << "'\n";
-  int r= azopen(&m_file,m_fileName, O_RDONLY);
+  int r= ndbzopen(&m_file, m_fileName, O_RDONLY);
 
-  if(m_file.file < 0)
-    r= -1;
+  if(r != 1)
+    return false;
 
-  if (r==0)
+  size_t size;
+  if (ndbz_file_size(&m_file, &size) == 0)
   {
-    struct stat buf;
-    if (fstat(m_file.file, &buf) == 0)
-    {
-      m_file_size = (Uint64)buf.st_size;
-      info << "File size " << m_file_size << " bytes\n";
-    }
-    else
-    {
-      info << "Progress reporting degraded output since fstat failed,"
-           << "errno: " << errno << endl;
-      m_file_size = 0;
-    }
+    m_file_size = (Uint64)size;
+    info << "File size " << m_file_size << " bytes\n";
+  }
+  else
+  {
+    info << "Progress reporting degraded output since fstat failed,"
+         << "errno: " << errno << endl;
+    m_file_size = 0;
   }
 
-  return r != 0;
+  return true;
 }
 
 Uint32 BackupFile::buffer_get_ptr_ahead(void **p_buf_ptr, Uint32 size, Uint32 nmemb)
@@ -1420,17 +1411,20 @@ Uint32 BackupFile::buffer_get_ptr_ahead(
 	   * Read data into buffer before existing data.
 	   */
           // Move to the start of data to be read
-          azseek(&m_file, sizeof(m_fileHeader), SEEK_SET);
-          r = azread(&m_file, (char *)buffer_data_start - file_left_entry_data, Uint32(file_left_entry_data), &error);
+          ndbzseek(&m_file, sizeof(m_fileHeader), SEEK_SET);
+          r = ndbzread(&m_file,
+                       (char *)buffer_data_start - file_left_entry_data,
+                       Uint32(file_left_entry_data),
+                       &error);
           //move back
-          azseek(&m_file, sizeof(m_fileHeader), SEEK_SET);
+          ndbzseek(&m_file, sizeof(m_fileHeader), SEEK_SET);
         }
         else
         {
 	  // Fill remaing space at start of buffer with data from file.
-          azseek(&m_file, m_file_pos-buffer_free_space, SEEK_SET);
-          r = azread(&m_file, ((char *)m_buffer), buffer_free_space, &error);
-          azseek(&m_file, m_file_pos-buffer_free_space, SEEK_SET);
+          ndbzseek(&m_file, m_file_pos-buffer_free_space, SEEK_SET);
+          r = ndbzread(&m_file, ((char *)m_buffer), buffer_free_space, &error);
+          ndbzseek(&m_file, m_file_pos-buffer_free_space, SEEK_SET);
         }
       }
       m_file_pos -= r;
@@ -1442,9 +1436,9 @@ Uint32 BackupFile::buffer_get_ptr_ahead(
     {
       memmove(m_buffer, m_buffer_ptr, m_buffer_data_left);
       int error;
-      Uint32 r = azread(&m_file,
-                        ((char *)m_buffer) + m_buffer_data_left,
-                        m_buffer_sz - m_buffer_data_left, &error);
+      Uint32 r = ndbzread(&m_file,
+                          ((char *)m_buffer) + m_buffer_data_left,
+                          m_buffer_sz - m_buffer_data_left, &error);
       m_file_pos += r;
       m_buffer_data_left += r;
       m_buffer_ptr = m_buffer;
@@ -1631,10 +1625,10 @@ BackupFile::readHeader(){
          because footer contain 4 bytes 0 at the end of file.
          we discard the remain data stored in m_buffer.
       */
-      struct stat buf;
-      if (fstat(m_file.file, &buf) == 0)
-        m_file_size = (Uint64)buf.st_size;
-      azseek(&m_file, 4, SEEK_END);  
+      size_t size;
+      if (ndbz_file_size(&m_file, &size) == 0)
+        m_file_size = (Uint64)size;
+      ndbzseek(&m_file, 4, SEEK_END);
       m_file_pos = m_file_size - 4;
       m_buffer_data_left = 0;
       m_buffer_ptr = m_buffer;

=== modified file 'storage/ndb/tools/restore/Restore.hpp'
--- a/storage/ndb/tools/restore/Restore.hpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/tools/restore/Restore.hpp	2011-04-01 12:30:27 +0000
@@ -24,7 +24,7 @@
 #include <NdbOut.hpp>
 #include "../src/kernel/blocks/backup/BackupFormat.hpp"
 #include <NdbApi.hpp>
-#include <util/azlib.h>
+#include <util/ndbzio.h>
 #include <util/UtilBuffer.hpp>
 
 #include <ndb_version.h>
@@ -311,7 +311,7 @@ class RestoreLogIterator;
 
 class BackupFile {
 protected:
-  azio_stream m_file;
+  ndbzio_stream m_file;
   char m_path[PATH_MAX];
   char m_fileName[PATH_MAX];
   bool m_hostByteOrder;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (pekka:4315 to 4328) Pekka Nousiainen20 Apr