MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:pekka Date:May 25 2006 10:14am
Subject:bk commit into 5.1 tree (pekka:1.2401) BUG#14509
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of pekka. When pekka does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2401 06/05/25 12:13:47 pekka@stripped +4 -0
  ndb - bug#14509 v5.1 part 2/2 : handler level

  sql/ha_ndbcluster.h
    1.134 06/05/25 12:12:07 pekka@stripped +14 -1
    put auto-incr range under NDB_SHARE until otherwise decided..
    makes auto-incr process-global per table.  each use requires mutex

  sql/ha_ndbcluster.cc
    1.306 06/05/25 12:12:07 pekka@stripped +9 -5
    put auto-incr range under NDB_SHARE until otherwise decided..
    makes auto-incr process-global per table.  each use requires mutex

  mysql-test/t/ndb_alter_table.test
    1.33 06/05/25 12:12:07 pekka@stripped +15 -15
    put auto-incr range under NDB_SHARE until otherwise decided..
    makes auto-incr process-global per table.  each use requires mutex

  mysql-test/r/ndb_basic.result
    1.41 06/05/25 12:12:07 pekka@stripped +24 -24
    put auto-incr range under NDB_SHARE until otherwise decided..
    makes auto-incr process-global per table.  each use requires mutex

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	pekka
# Host:	orca.ndb.mysql.com
# Root:	/space/pekka/ndb/version/my51-bug14509

--- 1.40/mysql-test/r/ndb_basic.result	2006-05-04 05:28:20 +02:00
+++ 1.41/mysql-test/r/ndb_basic.result	2006-05-25 12:12:07 +02:00
@@ -649,30 +649,30 @@
 6	newval
 7	newval
 8	newval
-35	newval
-36	newval
-37	newval
-38	newval
-39	newval
-40	newval
-41	newval
-42	newval
-43	newval
-44	newval
-45	newval
-46	newval
-47	newval
-48	newval
-49	newval
-50	newval
-51	newval
-52	newval
-53	newval
-54	newval
-55	newval
-56	newval
-57	newval
-58	newval
+9	newval
+10	newval
+11	newval
+12	newval
+13	newval
+14	newval
+15	newval
+16	newval
+17	newval
+18	newval
+19	newval
+20	newval
+21	newval
+22	newval
+23	newval
+24	newval
+25	newval
+26	newval
+27	newval
+28	newval
+29	newval
+30	newval
+31	newval
+32	newval
 drop table t1;
 CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
 select * from t1;

--- 1.32/mysql-test/t/ndb_alter_table.test	2006-05-15 23:47:48 +02:00
+++ 1.33/mysql-test/t/ndb_alter_table.test	2006-05-25 12:12:07 +02:00
@@ -325,21 +325,6 @@
 
 drop table t1;
 
-# simple test that auto incr is not lost at rename or alter
-create table t1 (a int primary key auto_increment, b int) engine=ndb;
-insert into t1 (b) values (101),(102),(103);
-select * from t1 where a = 3;
-alter table t1 rename t2;
-insert into t2 (b) values (201),(202),(203);
-select * from t2 where a = 6;
-alter table t2 add c int;
-insert into t2 (b) values (301),(302),(303);
-select * from t2 where a = 9;
-alter table t2 rename t1;
-insert into t1 (b) values (401),(402),(403);
-select * from t1 where a = 12;
-drop table t1;
-
 # End of 4.1 tests
 
 # On-line alter table
@@ -398,3 +383,18 @@
 select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
 
 DROP TABLE t1, ndb_show_tables;
+
+# simple test that auto incr is not lost at rename or alter
+create table t1 (a int primary key auto_increment, b int) engine=ndb;
+insert into t1 (b) values (101),(102),(103);
+select * from t1 where a = 3;
+alter table t1 rename t2;
+insert into t2 (b) values (201),(202),(203);
+select * from t2 where a = 6;
+alter table t2 add c int;
+insert into t2 (b) values (301),(302),(303);
+select * from t2 where a = 9;
+alter table t2 rename t1;
+insert into t1 (b) values (401),(402),(403);
+select * from t1 where a = 12;
+drop table t1;

--- 1.305/sql/ha_ndbcluster.cc	2006-05-17 12:50:35 +02:00
+++ 1.306/sql/ha_ndbcluster.cc	2006-05-25 12:12:07 +02:00
@@ -2464,7 +2464,8 @@
     Uint64 auto_value;
     uint retries= NDB_AUTO_INCREMENT_RETRIES;
     do {
-      ret= ndb->getAutoIncrementValue(m_table, auto_value, 1);
+      Ndb_tuple_id_range_guard g(m_share);
+      ret= ndb->getAutoIncrementValue(m_table, g.range, auto_value, 1);
     } while (ret == -1 && 
              --retries &&
              ndb->getNdbError().status == NdbError::TemporaryError);
@@ -2565,7 +2566,8 @@
     DBUG_PRINT("info", 
                ("Trying to set next auto increment value to %llu",
                 (ulonglong) next_val));
-    if (ndb->setAutoIncrementValue(m_table, next_val, TRUE)
+    Ndb_tuple_id_range_guard g(m_share);
+    if (ndb->setAutoIncrementValue(m_table, g.range, next_val, TRUE)
         == -1)
       ERR_RETURN(ndb->getNdbError());
   }
@@ -3528,8 +3530,9 @@
     if (m_table)
     {
       Ndb *ndb= get_ndb();
+      Ndb_tuple_id_range_guard g(m_share);
       
-      if (ndb->readAutoIncrementValue(m_table,
+      if (ndb->readAutoIncrementValue(m_table, g.range,
                                       auto_increment_value) == -1)
       {
         const NdbError err= ndb->getNdbError();
@@ -5231,10 +5234,11 @@
   int ret;
   uint retries= NDB_AUTO_INCREMENT_RETRIES;
   do {
+    Ndb_tuple_id_range_guard g(m_share);
     ret=
       m_skip_auto_increment ? 
-      ndb->readAutoIncrementValue(m_table, auto_value) :
-      ndb->getAutoIncrementValue(m_table, auto_value, cache_size);
+      ndb->readAutoIncrementValue(m_table, g.range, auto_value) :
+      ndb->getAutoIncrementValue(m_table, g.range, auto_value, cache_size);
   } while (ret == -1 && 
            --retries &&
            ndb->getNdbError().status == NdbError::TemporaryError);

--- 1.133/sql/ha_ndbcluster.h	2006-05-04 15:55:30 +02:00
+++ 1.134/sql/ha_ndbcluster.h	2006-05-25 12:12:07 +02:00
@@ -106,6 +106,7 @@
   ulonglong commit_count;
   char *db;
   char *table_name;
+  Ndb::TupleIdRange tuple_id_range;
 #ifdef HAVE_NDB_BINLOG
   uint32 flags;
   NdbEventOperation *op;
@@ -138,6 +139,19 @@
   pthread_mutex_unlock(&share->mutex);
 }
 
+struct Ndb_tuple_id_range_guard {
+  Ndb_tuple_id_range_guard(NDB_SHARE* _share) :
+    share(_share),
+    range(share->tuple_id_range) {
+    pthread_mutex_lock(&share->mutex);
+  }
+  ~Ndb_tuple_id_range_guard() {
+    pthread_mutex_unlock(&share->mutex);
+  }
+  NDB_SHARE* share;
+  Ndb::TupleIdRange& range;
+};
+
 #ifdef HAVE_NDB_BINLOG
 /* NDB_SHARE.flags */
 #define NSF_HIDDEN_PK 1 /* table has hidden primary key */
@@ -725,7 +739,6 @@
   int drop_indexes(Ndb *ndb, TABLE *tab);
   int add_index_handle(THD *thd, NdbDictionary::Dictionary *dict,
                        KEY *key_info, const char *index_name, uint index_no);
-  int initialize_autoincrement(const void *table);
   int get_metadata(const char* path);
   void release_metadata(THD *thd, Ndb *ndb);
   NDB_INDEX_TYPE get_index_type(uint idx_no) const;
Thread
bk commit into 5.1 tree (pekka:1.2401) BUG#14509pekka25 May