Commit d0d7cc86 authored by unknown's avatar unknown
Browse files

bug#24667 After ALTER TABLE operation ndb_dd table becomes regular ndb: ALTER...

bug#24667  After ALTER TABLE operation ndb_dd table becomes regular ndb: ALTER TABLE must specify STORAGE explicitely to change it, + post review changes


parent 1e106724
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -96,6 +96,14 @@ enum ha_key_alg {
  HA_KEY_ALG_FULLTEXT=	4		/* FULLTEXT (MyISAM tables) */
};

        /* Storage media types */ 

enum ha_storage_media {
  HA_SM_DEFAULT=        0,		/* Not specified (engine default) */
  HA_SM_DISK=           1,		/* DISK storage */
  HA_SM_MEMORY=         2		/* MAIN MEMORY storage */
};

	/* The following is parameter to ha_extra() */

enum ha_extra_function {
+2 −2
Original line number Diff line number Diff line
@@ -237,7 +237,7 @@ t2 CREATE TABLE `t2` (
  `c2` int(11) NOT NULL,
  PRIMARY KEY (`pk2`)
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
ALTER TABLE test.t1 STORAGE MEMORY ENGINE=NDBCLUSTER;
SHOW CREATE TABLE test.t1;
Table	Create Table
t1	CREATE TABLE `t1` (
@@ -341,7 +341,7 @@ t1 CREATE TABLE `t1` (
  KEY `a2` (`a2`),
  KEY `a3` (`a3`),
  KEY `a8` (`a8`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
Table	Create Table
t2	CREATE TABLE `t2` (
  `b1` smallint(6) NOT NULL,
+6 −6
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ t1 CREATE TABLE `t1` (
  PRIMARY KEY (`c1`),
  KEY `t1_i` (`c2`,`c3`),
  KEY `c5` (`c5`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
**** Show first set of ALTERs on SLAVE ****
SHOW CREATE TABLE t1;
Table	Create Table
@@ -83,7 +83,7 @@ t1 CREATE TABLE `t1` (
  PRIMARY KEY (`c1`),
  KEY `t1_i` (`c2`,`c3`),
  KEY `c5` (`c5`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
**** Second set of alters test 1 ****
ALTER TABLE t1 RENAME t2;
ALTER TABLE t2 DROP INDEX c5;
@@ -102,7 +102,7 @@ t1 CREATE TABLE `t1` (
  `c5` double DEFAULT NULL,
  PRIMARY KEY (`c1`),
  KEY `t1_i` (`c2`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
**** Show second set of ALTERs on SLAVE ****
SHOW CREATE TABLE t1;
Table	Create Table
@@ -114,7 +114,7 @@ t1 CREATE TABLE `t1` (
  `c5` double DEFAULT NULL,
  PRIMARY KEY (`c1`),
  KEY `t1_i` (`c2`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
**** Third and last set of alters for test1  ****
ALTER TABLE t1 CHANGE c1 c1 DOUBLE;
ALTER TABLE t1 CHANGE c2 c2 DECIMAL(10,2);
@@ -136,7 +136,7 @@ t1 CREATE TABLE `t1` (
  `c5` double DEFAULT NULL,
  PRIMARY KEY (`c1`),
  KEY `t1_i` (`c2`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
c1	c2	c3	c5
1	2.00	b1b1b1b1b1b1b1b1b1b1	NULL
@@ -154,7 +154,7 @@ t1 CREATE TABLE `t1` (
  `c5` double DEFAULT NULL,
  PRIMARY KEY (`c1`),
  KEY `t1_i` (`c2`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
SELECT * FROM t1 where c1 = 1;
c1	c2	c3	c5
1	2.00	b1b1b1b1b1b1b1b1b1b1	NULL
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ SHOW CREATE TABLE test.t1;
ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
ENGINE=NDB;
SHOW CREATE TABLE test.t2;
ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
ALTER TABLE test.t1 STORAGE MEMORY ENGINE=NDBCLUSTER;
SHOW CREATE TABLE test.t1;
--echo
######################### End Test Section 2 #################
+5 −5
Original line number Diff line number Diff line
@@ -4807,7 +4807,7 @@ int ha_ndbcluster::create(const char *name,
    if ((my_errno= create_ndb_column(col, field, info)))
      DBUG_RETURN(my_errno);
 
    if (info->store_on_disk || getenv("NDB_DEFAULT_DISK"))
    if (info->storage_media == HA_SM_DISK || getenv("NDB_DEFAULT_DISK"))
      col.setStorageType(NdbDictionary::Column::StorageTypeDisk);
    else
      col.setStorageType(NdbDictionary::Column::StorageTypeMemory);
@@ -4827,7 +4827,7 @@ int ha_ndbcluster::create(const char *name,
                             NdbDictionary::Column::StorageTypeMemory);
  }

  if (info->store_on_disk)
  if (info->storage_media == HA_SM_DISK)
  { 
    if (info->tablespace)
      tab.setTablespace(info->tablespace);
@@ -4837,7 +4837,7 @@ int ha_ndbcluster::create(const char *name,
  else if (info->tablespace)
  {
    tab.setTablespace(info->tablespace);
    info->store_on_disk = true;  //if use tablespace, that also means store on disk
    info->storage_media = HA_SM_DISK;  //if use tablespace, that also means store on disk
  }

  // No primary key, create shadow key as 64 bit, auto increment  
@@ -9949,7 +9949,7 @@ int ha_ndbcluster::generate_scan_filter_from_key(NdbScanOperation *op,
/*
  get table space info for SHOW CREATE TABLE
*/
char* ha_ndbcluster::get_tablespace_name(THD *thd, char* name)
char* ha_ndbcluster::get_tablespace_name(THD *thd, char* name, uint name_len)
{
  Ndb *ndb= check_ndb_in_thd(thd);
  NDBDICT *ndbdict= ndb->getDictionary();
@@ -9969,7 +9969,7 @@ char* ha_ndbcluster::get_tablespace_name(THD *thd, char* name)
      goto err;
    if (name)
    {
      strxnmov(name, FN_LEN, ts.getName(), NullS);
      strxnmov(name, name_len, ts.getName(), NullS);
      return name;
    }
    else
Loading