3219 Magnus Blåudd 2011-03-04 [merge]
Merge 5.5-telco-7.0 -> 5.5-cluster
added:
mysql-test/r/tablespace.result
mysql-test/std_data/cluster_7022_table.MYD
mysql-test/std_data/cluster_7022_table.MYI
mysql-test/std_data/cluster_7022_table.frm
mysql-test/t/tablespace.test
modified:
include/mysql_com.h
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/mysqld--help-win.result
mysql-test/suite/ndb/r/ndb_column_properties.result
mysql-test/suite/ndb/r/ndb_dd_basic.result
mysql-test/suite/ndb/r/ndb_dd_restore_compat.result
mysql-test/suite/ndb/t/disabled.def
mysql-test/suite/ndb/t/ndb_column_properties.test
mysql-test/suite/ndb/t/ndb_dd_restore_compat.test
sql/field.h
sql/ha_ndbcluster.cc
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_binlog.h
sql/ha_ndbcluster_glue.h
sql/handler.cc
sql/handler.h
sql/lex.h
sql/sql_show.cc
sql/sql_table.cc
sql/sql_yacc.yy
sql/table.cc
sql/table.h
sql/unireg.cc
3218 Magnus Blåudd 2011-02-21 [merge]
Merge 5.5-telco-7.0 -> 5.5-cluster
added:
storage/ndb/include/util/NdbTypesUtil.hpp
modified:
client/mysqldump.c
mysql-test/r/mysqldump.result
mysql-test/suite/ndb/r/ndb_dd_restore_compat.result
mysql-test/suite/ndb/r/ndb_short_sigs.result
mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result
mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test
mysql-test/t/mysqldump.test
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.h
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_binlog.h
sql/log_event.cc
sql/sql_priv.h
sql/sys_vars.cc
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp
storage/ndb/include/ndb_constants.h
storage/ndb/include/ndbapi/NdbDictionary.hpp
storage/ndb/include/util/NdbSqlUtil.hpp
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
storage/ndb/src/kernel/blocks/lgman.cpp
storage/ndb/src/ndbapi/NdbDictionary.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
storage/ndb/test/ndbapi/testSystemRestart.cpp
storage/ndb/test/run-test/conf-dl145a.cnf
storage/ndb/test/run-test/conf-ndb07.cnf
storage/ndb/tools/restore/consumer_restore.cpp
storage/ndb/tools/restore/consumer_restore.hpp
=== modified file 'include/mysql_com.h'
--- a/include/mysql_com.h 2011-02-20 20:56:24 +0000
+++ b/include/mysql_com.h 2011-03-04 15:16:56 +0000
@@ -114,6 +114,10 @@ enum enum_server_command
#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */
#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */
+#define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23,
+ reserved by MySQL Cluster */
+#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25,
+ reserved by MySQL Cluster */
#define REFRESH_GRANT 1 /* Refresh grant tables */
#define REFRESH_LOG 2 /* Start on new log file */
=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result 2010-11-05 13:16:27 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result 2011-03-04 15:16:56 +0000
@@ -609,6 +609,8 @@ The following options may be given as th
Don't give threads different priorities. This option is
deprecated because it has no effect; the implied behavior
is already the default.
+ --slave-allow-batching
+ Allow slave to batch requests
--slave-compressed-protocol
Use compression on master/slave protocol
--slave-exec-mode=name
@@ -906,6 +908,7 @@ skip-name-resolve FALSE
skip-networking FALSE
skip-show-database FALSE
skip-slave-start FALSE
+slave-allow-batching FALSE
slave-compressed-protocol FALSE
slave-exec-mode STRICT
slave-net-timeout 3600
=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result 2010-11-05 13:16:27 +0000
+++ b/mysql-test/r/mysqld--help-win.result 2011-03-04 15:16:56 +0000
@@ -612,6 +612,8 @@ The following options may be given as th
Don't give threads different priorities. This option is
deprecated because it has no effect; the implied behavior
is already the default.
+ --slave-allow-batching
+ Allow slave to batch requests
--slave-compressed-protocol
Use compression on master/slave protocol
--slave-exec-mode=name
@@ -912,6 +914,7 @@ skip-name-resolve FALSE
skip-networking FALSE
skip-show-database FALSE
skip-slave-start FALSE
+slave-allow-batching FALSE
slave-compressed-protocol FALSE
slave-exec-mode STRICT
slave-net-timeout 3600
=== added file 'mysql-test/r/tablespace.result'
--- a/mysql-test/r/tablespace.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/tablespace.result 2011-03-04 11:56:57 +0000
@@ -0,0 +1,169 @@
+CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) TABLESPACE ts STORAGE MEMORY ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) STORAGE MEMORY ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) STORAGE DISK ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
+ALTER TABLE t1 ADD COLUMN b int;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
+ALTER TABLE t1 ADD COLUMN b int;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) ENGINE=MyISAM;
+ALTER TABLE t1 TABLESPACE ts;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 TABLESPACE ts2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts2 */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) ENGINE=MyISAM;
+ALTER TABLE t1 STORAGE MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 STORAGE DISK;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) ENGINE=MyISAM;
+ALTER TABLE t1 STORAGE MEMORY TABLESPACE ts;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 STORAGE DISK TABLESPACE ts2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) /*!50120 STORAGE DISK */ DEFAULT NULL,
+ `d` int(11) NOT NULL /*!50120 STORAGE MEMORY */,
+ `e` int(11) /*!50120 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+ `f` int(11) /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+ `g` int(11) DEFAULT NULL,
+ `h` int(11) NOT NULL /*!50120 STORAGE DISK */ /*!50120 COLUMN_FORMAT DYNAMIC */,
+ `i` int(11) /*!50120 STORAGE MEMORY */ /*!50120 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+ `j` int(11) /*!50120 STORAGE DISK */ /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+ `k` int(11) /*!50120 STORAGE MEMORY */ /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) /*!50100 TABLESPACE the_tablespacename STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (
+a int STORAGE DISK,
+b int STORAGE MEMORY NOT NULL,
+c int COLUMN_FORMAT DYNAMIC,
+d int COLUMN_FORMAT FIXED,
+e int COLUMN_FORMAT DEFAULT,
+f int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
+g int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
+h int STORAGE DISK COLUMN_FORMAT FIXED,
+i int STORAGE MEMORY COLUMN_FORMAT FIXED
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) /*!50120 STORAGE DISK */ DEFAULT NULL,
+ `b` int(11) NOT NULL /*!50120 STORAGE MEMORY */,
+ `c` int(11) /*!50120 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+ `d` int(11) /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+ `e` int(11) DEFAULT NULL,
+ `f` int(11) NOT NULL /*!50120 STORAGE DISK */ /*!50120 COLUMN_FORMAT DYNAMIC */,
+ `g` int(11) /*!50120 STORAGE MEMORY */ /*!50120 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+ `h` int(11) /*!50120 STORAGE DISK */ /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+ `i` int(11) /*!50120 STORAGE MEMORY */ /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1
+ADD COLUMN j int STORAGE DISK,
+ADD COLUMN k int STORAGE MEMORY NOT NULL,
+ADD COLUMN l int COLUMN_FORMAT DYNAMIC,
+ADD COLUMN m int COLUMN_FORMAT FIXED,
+ADD COLUMN n int COLUMN_FORMAT DEFAULT,
+ADD COLUMN o int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
+ADD COLUMN p int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
+ADD COLUMN q int STORAGE DISK COLUMN_FORMAT FIXED,
+ADD COLUMN r int STORAGE MEMORY COLUMN_FORMAT FIXED;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) /*!50120 STORAGE DISK */ DEFAULT NULL,
+ `b` int(11) NOT NULL /*!50120 STORAGE MEMORY */,
+ `c` int(11) /*!50120 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+ `d` int(11) /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+ `e` int(11) DEFAULT NULL,
+ `f` int(11) NOT NULL /*!50120 STORAGE DISK */ /*!50120 COLUMN_FORMAT DYNAMIC */,
+ `g` int(11) /*!50120 STORAGE MEMORY */ /*!50120 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+ `h` int(11) /*!50120 STORAGE DISK */ /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+ `i` int(11) /*!50120 STORAGE MEMORY */ /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+ `j` int(11) /*!50120 STORAGE DISK */ DEFAULT NULL,
+ `k` int(11) NOT NULL /*!50120 STORAGE MEMORY */,
+ `l` int(11) /*!50120 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+ `m` int(11) /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+ `n` int(11) DEFAULT NULL,
+ `o` int(11) NOT NULL /*!50120 STORAGE DISK */ /*!50120 COLUMN_FORMAT DYNAMIC */,
+ `p` int(11) /*!50120 STORAGE MEMORY */ /*!50120 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+ `q` int(11) /*!50120 STORAGE DISK */ /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+ `r` int(11) /*!50120 STORAGE MEMORY */ /*!50120 COLUMN_FORMAT FIXED */ DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
=== added file 'mysql-test/std_data/cluster_7022_table.MYD'
=== added file 'mysql-test/std_data/cluster_7022_table.MYI'
Binary files a/mysql-test/std_data/cluster_7022_table.MYI 1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/cluster_7022_table.MYI 2011-03-04 08:52:27 +0000 differ
=== added file 'mysql-test/std_data/cluster_7022_table.frm'
Binary files a/mysql-test/std_data/cluster_7022_table.frm 1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/cluster_7022_table.frm 2011-03-04 08:52:27 +0000 differ
=== modified file 'mysql-test/suite/ndb/r/ndb_column_properties.result'
--- a/mysql-test/suite/ndb/r/ndb_column_properties.result 2009-08-22 19:53:23 +0000
+++ b/mysql-test/suite/ndb/r/ndb_column_properties.result 2011-03-04 14:01:38 +0000
@@ -12,10 +12,6 @@ ENGINE NDB;
create table t1 (a int column_format DYNAMIC STORAGE DISK) TABLESPACE ts1 engine NDB;
Warnings:
Warning 1478 DYNAMIC column a with STORAGE DISK is not supported, column will become FIXED
-select column_name, storage, format from information_schema.columns
-where table_name = "t1";
-column_name storage format
-a Disk Dynamic
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -64,21 +60,6 @@ t1 CREATE TABLE `t1` (
`f1` char(100) NOT NULL /*!50120 STORAGE DISK */ /*!50120 COLUMN_FORMAT DYNAMIC */,
KEY `b` (`b`)
) /*!50100 TABLESPACE ts1 */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
-select column_name, storage, format from information_schema.columns
-where table_name = "t1";
-column_name storage format
-a Default Fixed
-a1 Default Fixed
-b Default Dynamic
-b1 Disk Fixed
-c Default Fixed
-c1 Memory Dynamic
-d Default Fixed
-d1 Default Dynamic
-e Default Fixed
-e1 Default Dynamic
-f Default Fixed
-f1 Disk Dynamic
alter table t1 change column a a int storage disk;
Warnings:
Warning 1478 DYNAMIC column f1 with STORAGE DISK is not supported, column will become FIXED
=== modified file 'mysql-test/suite/ndb/r/ndb_dd_basic.result'
--- a/mysql-test/suite/ndb/r/ndb_dd_basic.result 2011-02-01 14:58:18 +0000
+++ b/mysql-test/suite/ndb/r/ndb_dd_basic.result 2011-03-04 14:13:43 +0000
@@ -8,20 +8,20 @@ INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=MYISAM;
Warnings:
-Error 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=XYZ;
Warnings:
-Warning 1286 Unknown table engine 'XYZ'
-Error 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+Warning 1286 Unknown storage engine 'XYZ'
+Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M;
Warnings:
-Error 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 5K
=== modified file 'mysql-test/suite/ndb/r/ndb_dd_restore_compat.result'
--- a/mysql-test/suite/ndb/r/ndb_dd_restore_compat.result 2011-02-21 09:43:59 +0000
+++ b/mysql-test/suite/ndb/r/ndb_dd_restore_compat.result 2011-03-04 13:14:07 +0000
@@ -44,6 +44,40 @@ a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
+ALTER TABLE t1 ADD COLUMN c int;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` smallint(6) NOT NULL,
+ `a2` int(11) NOT NULL,
+ `a3` bigint(20) NOT NULL,
+ `a4` char(10) DEFAULT NULL,
+ `a5` decimal(5,1) DEFAULT NULL,
+ `a6` time DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` datetime DEFAULT NULL,
+ `a9` varchar(255) DEFAULT NULL,
+ `a10` blob,
+ `c` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a1`)
+) /*!50100 TABLESPACE ts */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+FLUSH TABLES;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` smallint(6) NOT NULL,
+ `a2` int(11) NOT NULL,
+ `a3` bigint(20) NOT NULL,
+ `a4` char(10) DEFAULT NULL,
+ `a5` decimal(5,1) DEFAULT NULL,
+ `a6` time DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` datetime DEFAULT NULL,
+ `a9` varchar(255) DEFAULT NULL,
+ `a10` blob,
+ `c` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a1`)
+) /*!50100 TABLESPACE ts */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
drop table t1;
ALTER TABLESPACE ts
DROP DATAFILE 'datafile.dat'
=== modified file 'mysql-test/suite/ndb/t/disabled.def'
--- a/mysql-test/suite/ndb/t/disabled.def 2011-02-07 13:36:01 +0000
+++ b/mysql-test/suite/ndb/t/disabled.def 2011-03-04 14:13:43 +0000
@@ -26,12 +26,8 @@ ndb_update_no_read : SEAGULL rbwr
ndb_condition_pushdown : SEAGULL
-ndb_column_properties : SEAGULL tablespace
-ndb_dd_basic : SEAGULL tablespace
-ndb_dd_dump : SEAGULL tablespace
-ndb_dd_sql_features : SEAGULL tablespace
-ndb_dd_disk2memory : SEAGULL tablespace
-ndb_dd_alter : SEAGULL tablespace
+ndb_dd_disk2memory : SEAGULL alter
+ndb_dd_alter : SEAGULL alter
ndb_index_ordered : SEAGULL alter in second connection deadlocks
=== modified file 'mysql-test/suite/ndb/t/ndb_column_properties.test'
--- a/mysql-test/suite/ndb/t/ndb_column_properties.test 2009-08-22 19:53:23 +0000
+++ b/mysql-test/suite/ndb/t/ndb_column_properties.test 2011-03-04 14:01:38 +0000
@@ -17,8 +17,8 @@ INITIAL_SIZE 6M
ENGINE NDB;
create table t1 (a int column_format DYNAMIC STORAGE DISK) TABLESPACE ts1 engine NDB;
-select column_name, storage, format from information_schema.columns
-where table_name = "t1";
+#select column_name, storage, format from information_schema.columns
+#where table_name = "t1";
show create table t1;
source show_attributes.inc;
drop table t1;
@@ -42,8 +42,8 @@ insert into t1 (b, b1, d,d1,f,f1) values
(3,3,"3","3","3","3");
alter table t1 change column a a int column_format FIXED;
show create table t1;
-select column_name, storage, format from information_schema.columns
-where table_name = "t1";
+#select column_name, storage, format from information_schema.columns
+#where table_name = "t1";
alter table t1 change column a a int storage disk;
show create table t1;
source show_attributes.inc;
=== modified file 'mysql-test/suite/ndb/t/ndb_dd_restore_compat.test'
--- a/mysql-test/suite/ndb/t/ndb_dd_restore_compat.test 2010-10-25 09:15:03 +0000
+++ b/mysql-test/suite/ndb/t/ndb_dd_restore_compat.test 2011-03-04 13:14:07 +0000
@@ -13,6 +13,15 @@ where table_name = "t1";
show create table t1;
source show_attributes.inc;
select * from t1 order by a1;
+
+# Since this is an _old_ table without tablespace
+# in .frm but with tablespace in engine -> do extra checks
+# that tablespace is still there after ALTER
+ALTER TABLE t1 ADD COLUMN c int;
+SHOW CREATE TABLE t1;
+FLUSH TABLES;
+SHOW CREATE TABLE t1;
+
drop table t1;
ALTER TABLESPACE ts
=== added file 'mysql-test/t/tablespace.test'
--- a/mysql-test/t/tablespace.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/tablespace.test 2011-03-04 09:53:26 +0000
@@ -0,0 +1,153 @@
+#
+# BUG#60111 storage type for table not saved in .frm
+#
+
+#
+# Check that the table options for TABLESPACE and STORAGE
+# are printed in SHOW CREATE TABLE
+#
+
+# TABLESPACE only
+CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+# TABLESPACE + STORAGE DISK
+CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+# TABLESPACE + STORAGE MEMORY
+CREATE TABLE t1(a int) TABLESPACE ts STORAGE MEMORY ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+# STORAGE MEMORY only
+CREATE TABLE t1(a int) STORAGE MEMORY ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+# STORAGE DISK only
+CREATE TABLE t1(a int) STORAGE DISK ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+#
+# Check that the table options for TABLESPACE and STORAGE
+# are kept in an ALTER
+#
+
+# TABLESPACE only
+CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
+ALTER TABLE t1 ADD COLUMN b int;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+# TABLESPACE and STORAGE DISK
+CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
+ALTER TABLE t1 ADD COLUMN b int;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+#
+# Check that the table options for TABLESPACE and STORAGE
+# can be changed with an ALTER
+#
+
+# TABLESPACE only
+CREATE TABLE t1(a int) ENGINE=MyISAM;
+
+ALTER TABLE t1 TABLESPACE ts;
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 TABLESPACE ts2;
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+# STORAGE only
+CREATE TABLE t1(a int) ENGINE=MyISAM;
+
+ALTER TABLE t1 STORAGE MEMORY;
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 STORAGE DISK;
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+# TABLESPACE and STORAGE
+CREATE TABLE t1(a int) ENGINE=MyISAM;
+
+ALTER TABLE t1 STORAGE MEMORY TABLESPACE ts;
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 STORAGE DISK TABLESPACE ts2;
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+#
+# Check that it's possible to read a .frm fle created
+# by MySQL Cluster 7.0(which introduced the new "format
+# section) with this statement:
+#
+# CREATE TABLE cluster_7022_table
+# (
+# a int primary key,
+# b int,
+# c int STORAGE DISK,
+# d int STORAGE MEMORY NOT NULL,
+# e int COLUMN_FORMAT DYNAMIC,
+# f int COLUMN_FORMAT FIXED,
+# g int COLUMN_FORMAT DEFAULT,
+# h int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
+# i int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
+# j int STORAGE DISK COLUMN_FORMAT FIXED,
+# k int STORAGE MEMORY COLUMN_FORMAT FIXED
+# ) STORAGE DISK TABLESPACE the_tablespacename ENGINE=MyISAM;
+#
+# NOTE! The column level properties will not yet show up
+# in SHOW CREATE TABLE of MySQL Server(although they are
+# visible in .trace file)
+#
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+copy_file std_data/cluster_7022_table.frm $MYSQLD_DATADIR/test/t1.frm;
+copy_file std_data/cluster_7022_table.MYD $MYSQLD_DATADIR/test/t1.MYD;
+copy_file std_data/cluster_7022_table.MYI $MYSQLD_DATADIR/test/t1.MYI;
+
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+#
+# WL#3627 Add COLUMN_FORMAT and STORAGE for fields
+#
+
+CREATE TABLE t1 (
+ a int STORAGE DISK,
+ b int STORAGE MEMORY NOT NULL,
+ c int COLUMN_FORMAT DYNAMIC,
+ d int COLUMN_FORMAT FIXED,
+ e int COLUMN_FORMAT DEFAULT,
+ f int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
+ g int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
+ h int STORAGE DISK COLUMN_FORMAT FIXED,
+ i int STORAGE MEMORY COLUMN_FORMAT FIXED
+);
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1
+ ADD COLUMN j int STORAGE DISK,
+ ADD COLUMN k int STORAGE MEMORY NOT NULL,
+ ADD COLUMN l int COLUMN_FORMAT DYNAMIC,
+ ADD COLUMN m int COLUMN_FORMAT FIXED,
+ ADD COLUMN n int COLUMN_FORMAT DEFAULT,
+ ADD COLUMN o int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
+ ADD COLUMN p int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
+ ADD COLUMN q int STORAGE DISK COLUMN_FORMAT FIXED,
+ ADD COLUMN r int STORAGE MEMORY COLUMN_FORMAT FIXED;
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
=== modified file 'sql/field.h'
--- a/sql/field.h 2011-02-20 20:56:24 +0000
+++ b/sql/field.h 2011-03-04 15:16:56 +0000
@@ -509,6 +509,31 @@ public:
DBUG_ASSERT(0);
return GEOM_GEOMETRY;
}
+
+#ifndef MCP_WL3627
+ ha_storage_media field_storage_type() const
+ {
+ return (ha_storage_media)
+ ((flags >> FIELD_FLAGS_STORAGE_MEDIA) & 3);
+ }
+
+ void set_storage_type(ha_storage_media storage_type)
+ {
+ flags |= (storage_type << FIELD_FLAGS_STORAGE_MEDIA);
+ }
+
+ column_format_type column_format() const
+ {
+ return (column_format_type)
+ ((flags >> FIELD_FLAGS_COLUMN_FORMAT) & 3);
+ }
+
+ void set_column_format(column_format_type column_format)
+ {
+ flags |= (column_format << FIELD_FLAGS_COLUMN_FORMAT);
+ }
+#endif
+
/* Hash value */
virtual void hash(ulong *nr, ulong *nr2);
friend int cre_myisam(char * name, register TABLE *form, uint options,
@@ -2186,6 +2211,20 @@ public:
{
return (flags & (BINCMP_FLAG | BINARY_FLAG)) != 0;
}
+
+#ifndef MCP_WL3627
+ ha_storage_media field_storage_type() const
+ {
+ return (ha_storage_media)
+ ((flags >> FIELD_FLAGS_STORAGE_MEDIA) & 3);
+ }
+
+ column_format_type column_format() const
+ {
+ return (column_format_type)
+ ((flags >> FIELD_FLAGS_COLUMN_FORMAT) & 3);
+ }
+#endif
};
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2011-02-21 14:23:02 +0000
+++ b/sql/ha_ndbcluster.cc 2011-03-04 15:16:56 +0000
@@ -2011,6 +2011,33 @@ int ha_ndbcluster::get_metadata(THD *thd
if ((error= open_indexes(thd, ndb, table, FALSE)) != 0)
goto err;
+ /*
+ Backward compatibility for tables created without tablespace
+ in .frm => read tablespace setting from engine
+ */
+ if (table_share->mysql_version < 50120 &&
+ !table_share->tablespace /* safety */)
+ {
+ Uint32 id;
+ if (tab->getTablespace(&id))
+ {
+ NdbDictionary::Tablespace ts= dict->getTablespace(id);
+ NdbError ndberr= dict->getNdbError();
+ if (ndberr.classification == NdbError::NoError)
+ {
+ const char *tablespace= ts.getName();
+ const size_t tablespace_len= strlen(tablespace);
+ if (tablespace_len != 0)
+ {
+ DBUG_PRINT("info", ("Found tablespace '%s'", tablespace));
+ table_share->tablespace= strmake_root(&table_share->mem_root,
+ tablespace,
+ tablespace_len);
+ }
+ }
+ }
+ }
+
ndbtab_g.release();
#ifdef HAVE_NDB_BINLOG
@@ -7957,47 +7984,6 @@ void ha_ndbcluster::update_create_info(H
}
}
-#ifndef NDB_WITHOUT_TABLESPACE_IN_FRM
- TABLE_SHARE *share= table->s;
- if (share->mysql_version < MYSQL_VERSION_TABLESPACE_IN_FRM)
- {
- DBUG_PRINT("info", ("Restored an old table %s, pre-frm_version 7",
- share->table_name.str));
- if (!create_info->tablespace && !share->tablespace)
- {
- DBUG_PRINT("info", ("Checking for tablespace in ndb"));
- NDBDICT *ndbdict= ndb->getDictionary();
- NdbError ndberr;
- Uint32 id;
- ndb->setDatabaseName(m_dbname);
- DBUG_ASSERT(ndbtab != NULL);
- if (!ndbtab->getTablespace(&id))
- {
- DBUG_VOID_RETURN;
- }
- {
- NdbDictionary::Tablespace ts= ndbdict->getTablespace(id);
- ndberr= ndbdict->getNdbError();
- if(ndberr.classification != NdbError::NoError)
- goto err;
- const char *tablespace= ts.getName();
- DBUG_PRINT("info", ("Found tablespace '%s'", tablespace));
- uint tablespace_len= strlen(tablespace);
- if (tablespace_len != 0)
- {
- share->tablespace= (char *) alloc_root(&share->mem_root,
- tablespace_len+1);
- strxmov(share->tablespace, tablespace, NullS);
- create_info->tablespace= share->tablespace;
- }
- DBUG_VOID_RETURN;
- }
-err:
- my_errno= ndb_to_mysql_error(&ndberr);
- }
- }
-#endif
-
DBUG_VOID_RETURN;
}
@@ -8105,7 +8091,6 @@ int ha_ndbcluster::create(const char *na
bool create_temporary= (create_info->options & HA_LEX_CREATE_TMP_TABLE);
bool create_from_engine= (create_info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
bool is_truncate= (thd->lex->sql_command == SQLCOM_TRUNCATE);
- const char *tablespace= create_info->tablespace;
bool use_disk= FALSE;
NdbDictionary::Table::SingleUserMode single_user_mode= NdbDictionary::Table::SingleUserModeLocked;
bool ndb_sys_table= FALSE;
@@ -8139,9 +8124,6 @@ int ha_ndbcluster::create(const char *na
Ndb *ndb= get_ndb(thd);
NDBDICT *dict= ndb->getDictionary();
-#ifndef NDB_WITHOUT_TABLESPACE_IN_FRM
- DBUG_PRINT("info", ("Tablespace %s,%s", form->s->tablespace, create_info->tablespace));
-#endif
table= form;
if (create_from_engine)
{
@@ -8318,8 +8300,8 @@ int ha_ndbcluster::create(const char *na
{
tab.setLogging(TRUE);
tab.setTemporary(FALSE);
- if (tablespace)
- tab.setTablespaceName(tablespace);
+ if (create_info->tablespace)
+ tab.setTablespaceName(create_info->tablespace);
else
tab.setTablespaceName("DEFAULT-TS");
}
@@ -11516,9 +11498,9 @@ static void print_share(const char* wher
if (event_data)
{
fprintf(DBUG_FILE,
- " - event_data->table: %p %s.%s\n",
- event_data->table, event_data->table->s->db.str,
- event_data->table->s->table_name.str);
+ " - event_data->shadow_table: %p %s.%s\n",
+ event_data->shadow_table, event_data->shadow_table->s->db.str,
+ event_data->shadow_table->s->table_name.str);
}
}
@@ -11751,14 +11733,14 @@ int ndbcluster_rename_share(THD *thd, ND
event_data= share->event_data;
else if (share->op)
event_data= (Ndb_event_data *) share->op->getCustomData();
- if (event_data && event_data->table)
+ if (event_data && event_data->shadow_table)
{
if (!IS_TMP_PREFIX(share->table_name))
{
- event_data->table->s->db.str= share->db;
- event_data->table->s->db.length= strlen(share->db);
- event_data->table->s->table_name.str= share->table_name;
- event_data->table->s->table_name.length= strlen(share->table_name);
+ event_data->shadow_table->s->db.str= share->db;
+ event_data->shadow_table->s->db.length= strlen(share->db);
+ event_data->shadow_table->s->table_name.str= share->table_name;
+ event_data->shadow_table->s->table_name.length= strlen(share->table_name);
}
else
{
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2011-02-21 12:09:15 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2011-03-04 10:35:37 +0000
@@ -303,19 +303,19 @@ ndbcluster_binlog_close_table(THD *thd,
/*
- Creates a TABLE object for the ndb cluster table
-
- NOTES
- This does not open the underlying table
+ Open a shadow table for the table given in share.
+ - The shadow table is (mainly) used when an event is
+ recieved from the data nodes which need to be written
+ to the binlog injector.
*/
static int
-ndbcluster_binlog_open_table(THD *thd, NDB_SHARE *share)
+ndb_binlog_open_shadow_table(THD *thd, NDB_SHARE *share)
{
int error;
DBUG_ASSERT(share->event_data == 0);
Ndb_event_data *event_data= share->event_data= new Ndb_event_data(share);
- DBUG_ENTER("ndbcluster_binlog_open_table");
+ DBUG_ENTER("ndb_binlog_open_shadow_table");
MEM_ROOT **root_ptr=
my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC);
@@ -323,42 +323,45 @@ ndbcluster_binlog_open_table(THD *thd, N
init_sql_alloc(&event_data->mem_root, 1024, 0);
*root_ptr= &event_data->mem_root;
- TABLE_SHARE *table_share= event_data->table_share=
+ TABLE_SHARE *shadow_table_share=
(TABLE_SHARE*)alloc_root(&event_data->mem_root, sizeof(TABLE_SHARE));
- TABLE *table= event_data->table=
+ TABLE *shadow_table=
(TABLE*)alloc_root(&event_data->mem_root, sizeof(TABLE));
- init_tmp_table_share(thd, table_share, share->db, 0, share->table_name,
+ init_tmp_table_share(thd, shadow_table_share,
+ share->db, 0,
+ share->table_name,
share->key);
- if ((error= open_table_def(thd, table_share, 0)) ||
- (error= open_table_from_share(thd, table_share, "", 0,
+ if ((error= open_table_def(thd, shadow_table_share, 0)) ||
+ (error= open_table_from_share(thd, shadow_table_share, "", 0,
(uint) (OPEN_FRM_FILE_ONLY | DELAYED_OPEN | READ_ALL),
- 0, table, OTM_OPEN)))
+ 0, shadow_table, OTM_OPEN)))
{
- DBUG_PRINT("error", ("open_table_def/open_table_from_share failed: %d my_errno: %d",
+ DBUG_PRINT("error", ("failed to open shadow table, error: %d my_errno: %d",
error, my_errno));
- free_table_share(table_share);
- event_data->table= 0;
- event_data->table_share= 0;
+ free_table_share(shadow_table_share);
delete event_data;
share->event_data= 0;
*root_ptr= old_root;
DBUG_RETURN(error);
}
+ event_data->shadow_table= shadow_table;
+
mysql_mutex_lock(&LOCK_open);
- assign_new_table_id(table_share);
+ assign_new_table_id(shadow_table_share);
mysql_mutex_unlock(&LOCK_open);
- table->in_use= injector_thd;
+ shadow_table->in_use= injector_thd;
- table->s->db.str= share->db;
- table->s->db.length= strlen(share->db);
- table->s->table_name.str= share->table_name;
- table->s->table_name.length= strlen(share->table_name);
+ shadow_table->s->db.str= share->db;
+ shadow_table->s->db.length= strlen(share->db);
+ shadow_table->s->table_name.str= share->table_name;
+ shadow_table->s->table_name.length= strlen(share->table_name);
/* We can't use 'use_all_columns()' as the file object is not setup yet */
- table->column_bitmaps_set_no_signal(&table->s->all_set, &table->s->all_set);
+ shadow_table->column_bitmaps_set_no_signal(&shadow_table->s->all_set,
+ &shadow_table->s->all_set);
#ifndef DBUG_OFF
- dbug_print_table("table", table);
+ dbug_print_table("table", shadow_table);
#endif
*root_ptr= old_root;
DBUG_RETURN(0);
@@ -423,11 +426,11 @@ int ndbcluster_binlog_init_share(THD *th
}
while (1)
{
- if ((error= ndbcluster_binlog_open_table(thd, share)))
+ if ((error= ndb_binlog_open_shadow_table(thd, share)))
break;
- if (share->event_data->table->s->primary_key == MAX_KEY)
+ if (share->event_data->shadow_table->s->primary_key == MAX_KEY)
share->flags|= NSF_HIDDEN_PK;
- if (share->event_data->table->s->blob_fields != 0)
+ if (share->event_data->shadow_table->s->blob_fields != 0)
share->flags|= NSF_BLOB_FLAG;
break;
}
@@ -1552,7 +1555,7 @@ print_could_not_discover_error(THD *thd,
static void ndbcluster_get_schema(Ndb_event_data *event_data,
Cluster_schema *s)
{
- TABLE *table= event_data->table;
+ TABLE *table= event_data->shadow_table;
Field **field;
/* unpack blob values */
uchar* blobs_buffer= 0;
@@ -2354,9 +2357,9 @@ ndb_handle_schema_change(THD *thd, Ndb *
{
DBUG_ENTER("ndb_handle_schema_change");
NDB_SHARE *share= event_data->share;
- TABLE_SHARE *table_share= event_data->table_share;
- const char *tabname= table_share->table_name.str;
- const char *dbname= table_share->db.str;
+ TABLE *shadow_table= event_data->shadow_table;
+ const char *tabname= shadow_table->s->table_name.str;
+ const char *dbname= shadow_table->s->db.str;
bool do_close_cached_tables= FALSE;
bool is_remote_change= !ndb_has_node_id(pOp->getReqNodeId());
@@ -3129,20 +3132,20 @@ ndb_binlog_thread_handle_schema_event_po
pthread_mutex_lock(&share->mutex);
ndbcluster_binlog_close_table(thd, share);
- if ((error= ndbcluster_binlog_open_table(thd, share)))
- sql_print_error("NDB Binlog: Failed to re-open table %s.%s",
+ if ((error= ndb_binlog_open_shadow_table(thd, share)))
+ sql_print_error("NDB Binlog: Failed to re-open shadow table %s.%s",
schema->db, schema->name);
if (error)
pthread_mutex_unlock(&share->mutex);
}
if (!error && share)
{
- if (share->event_data->table->s->primary_key == MAX_KEY)
+ if (share->event_data->shadow_table->s->primary_key == MAX_KEY)
share->flags|= NSF_HIDDEN_PK;
/*
Refresh share->flags to handle added BLOB columns
*/
- if (share->event_data->table->s->blob_fields != 0)
+ if (share->event_data->shadow_table->s->blob_fields != 0)
share->flags|= NSF_BLOB_FLAG;
/*
@@ -4666,7 +4669,7 @@ ndbcluster_create_event_ops(THD *thd, ND
}
DBUG_ASSERT(event_data != 0);
- TABLE *table= event_data->table;
+ TABLE *table= event_data->shadow_table;
int retries= 100;
/*
@@ -5315,7 +5318,7 @@ ndb_binlog_thread_handle_data_event(Ndb
unsigned &trans_slave_row_count)
{
Ndb_event_data *event_data= (Ndb_event_data *) pOp->getCustomData();
- TABLE *table= event_data->table;
+ TABLE *table= event_data->shadow_table;
NDB_SHARE *share= event_data->share;
if (pOp != share->op)
{
@@ -6291,7 +6294,7 @@ restart_cluster_failure:
(Ndb_event_data *) ndb_apply_status_share->op->getCustomData();
DBUG_ASSERT(event_data);
}
- apply_status_table= event_data->table;
+ apply_status_table= event_data->shadow_table;
/*
Intialize apply_status_table->record[0]
@@ -6398,7 +6401,7 @@ restart_cluster_failure:
continue;
}
// this should not happen
- if (share == NULL || event_data->table == NULL)
+ if (share == NULL || event_data->shadow_table == NULL)
{
DBUG_PRINT("info", ("no share or table %s!",
gci_op->getEvent()->getTable()->getName()));
@@ -6409,7 +6412,7 @@ restart_cluster_failure:
// skip this table, it is handled specially
continue;
}
- TABLE *table= event_data->table;
+ TABLE *table= event_data->shadow_table;
#ifndef DBUG_OFF
const LEX_STRING &name= table->s->table_name;
#endif
=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h 2011-02-21 12:09:15 +0000
+++ b/sql/ha_ndbcluster_binlog.h 2011-03-04 10:26:41 +0000
@@ -35,19 +35,19 @@ extern handlerton *ndbcluster_hton;
class Ndb_event_data
{
public:
- Ndb_event_data(NDB_SHARE *the_share) :
- table_share((TABLE_SHARE *)0), table((TABLE *)0), share(the_share)
+ Ndb_event_data(NDB_SHARE *the_share) :
+ shadow_table(0),
+ share(the_share)
{
ndb_value[0]= 0;
ndb_value[1]= 0;
}
~Ndb_event_data()
{
- if (table)
- closefrm(table, 1);
+ if (shadow_table)
+ closefrm(shadow_table, 1);
+ shadow_table= 0;
free_root(&mem_root, MYF(0));
- table_share= 0;
- table= 0;
share= 0;
/*
ndbvalue[] allocated with my_multi_malloc
@@ -56,8 +56,7 @@ public:
my_free(ndb_value[0], MYF(MY_WME|MY_ALLOW_ZERO_PTR));
}
MEM_ROOT mem_root;
- TABLE_SHARE *table_share;
- TABLE *table;
+ TABLE *shadow_table;
NDB_SHARE *share;
NdbValue *ndb_value[2];
};
=== modified file 'sql/ha_ndbcluster_glue.h'
--- a/sql/ha_ndbcluster_glue.h 2011-02-21 09:11:01 +0000
+++ b/sql/ha_ndbcluster_glue.h 2011-03-04 15:16:56 +0000
@@ -67,19 +67,6 @@ bool close_cached_tables(THD *thd, TABLE
/* Online alter table not supported */
#define NDB_WITHOUT_ONLINE_ALTER
-/* Column format not supported */
-#define NDB_WITHOUT_COLUMN_FORMAT
-
-enum column_format_type {
- COLUMN_FORMAT_TYPE_NOT_USED= -1,
- COLUMN_FORMAT_TYPE_DEFAULT= 0,
- COLUMN_FORMAT_TYPE_FIXED= 1,
- COLUMN_FORMAT_TYPE_DYNAMIC= 2
-};
-
-/* Tablespace in .frm and TABLE_SHARE->tablespace not supported */
-#define NDB_WITHOUT_TABLESPACE_IN_FRM
-
/* Read before write removal not supported */
#define NDB_WITHOUT_READ_BEFORE_WRITE_REMOVAL
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2011-02-20 20:56:24 +0000
+++ b/sql/handler.cc 2011-03-04 15:16:56 +0000
@@ -3610,6 +3610,22 @@ void handler::get_dynamic_partition_info
}
+char* handler::get_tablespace_name(THD *thd, char *buff, uint buff_len)
+{
+ char *ts= table->s->tablespace;
+ if (!ts)
+ return NULL;
+
+ if (!buff)
+ {
+ buff= my_strdup(ts, MYF(0));
+ return buff;
+ }
+
+ strnmov(buff, ts, buff_len);
+ return buff;
+}
+
/****************************************************************************
** Some general functions that isn't in the handler class
****************************************************************************/
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2011-02-20 20:56:24 +0000
+++ b/sql/handler.h 2011-03-04 15:16:56 +0000
@@ -324,6 +324,14 @@ enum row_type { ROW_TYPE_NOT_USED=-1, RO
/** Unused. Reserved for future versions. */
ROW_TYPE_PAGE };
+#ifndef MCP_WL3627
+enum column_format_type {
+ COLUMN_FORMAT_TYPE_DEFAULT= 0,
+ COLUMN_FORMAT_TYPE_FIXED= 1,
+ COLUMN_FORMAT_TYPE_DYNAMIC= 2
+};
+#endif
+
enum enum_binlog_func {
BFN_RESET_LOGS= 1,
BFN_RESET_SLAVE= 2,
@@ -1647,8 +1655,7 @@ public:
{ return FALSE; }
virtual char* get_foreign_key_create_info()
{ return(NULL);} /* gets foreign key create string from InnoDB */
- virtual char* get_tablespace_name(THD *thd, char *name, uint name_len)
- { return(NULL);} /* gets tablespace name from handler */
+ virtual char* get_tablespace_name(THD *thd, char *name, uint name_len);
/** used in ALTER TABLE; 1 if changing storage engine is allowed */
virtual bool can_switch_engines() { return 1; }
/**
=== modified file 'sql/lex.h'
--- a/sql/lex.h 2010-11-29 14:38:44 +0000
+++ b/sql/lex.h 2011-03-04 09:53:26 +0000
@@ -117,6 +117,9 @@ static SYMBOL symbols[] = {
{ "COLLATE", SYM(COLLATE_SYM)},
{ "COLLATION", SYM(COLLATION_SYM)},
{ "COLUMN", SYM(COLUMN_SYM)},
+#ifndef MCP_WL3627
+ { "COLUMN_FORMAT", SYM(COLUMN_FORMAT_SYM)},
+#endif
{ "COLUMN_NAME", SYM(COLUMN_NAME_SYM)},
{ "COLUMNS", SYM(COLUMNS)},
{ "COMMENT", SYM(COMMENT_SYM)},
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2011-02-20 20:56:24 +0000
+++ b/sql/sql_show.cc 2011-03-04 15:16:56 +0000
@@ -1272,6 +1272,30 @@ int store_create_info(THD *thd, TABLE_LI
packet->append(STRING_WITH_LEN(" NULL"));
}
+#ifndef MCP_WL3627
+ switch(field->field_storage_type()){
+ case HA_SM_DISK:
+ packet->append(STRING_WITH_LEN(" /*!50120 STORAGE DISK */"));
+ break;
+ case HA_SM_MEMORY:
+ packet->append(STRING_WITH_LEN(" /*!50120 STORAGE MEMORY */"));
+ break;
+ default:
+ break;
+ }
+
+ switch(field->column_format()){
+ case COLUMN_FORMAT_TYPE_FIXED:
+ packet->append(STRING_WITH_LEN(" /*!50120 COLUMN_FORMAT FIXED */"));
+ break;
+ case COLUMN_FORMAT_TYPE_DYNAMIC:
+ packet->append(STRING_WITH_LEN(" /*!50120 COLUMN_FORMAT DYNAMIC */"));
+ break;
+ default:
+ break;
+ }
+#endif
+
if (get_field_default_value(thd, table->timestamp_field,
field, &def_value, 1))
{
@@ -1378,17 +1402,24 @@ int store_create_info(THD *thd, TABLE_LI
if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode)
{
show_table_options= TRUE;
- /*
- Get possible table space definitions and append them
- to the CREATE TABLE statement
- */
- if ((for_str= file->get_tablespace_name(thd,0,0)))
+ /* TABLESPACE and STORAGE */
+ if (share->tablespace ||
+ share->default_storage_media != HA_SM_DEFAULT)
{
- packet->append(STRING_WITH_LEN(" /*!50100 TABLESPACE "));
- packet->append(for_str, strlen(for_str));
- packet->append(STRING_WITH_LEN(" STORAGE DISK */"));
- my_free(for_str);
+ packet->append(STRING_WITH_LEN(" /*!50100"));
+ if (share->tablespace)
+ {
+ packet->append(STRING_WITH_LEN(" TABLESPACE "));
+ packet->append(share->tablespace, strlen(share->tablespace));
+ }
+
+ if (share->default_storage_media == HA_SM_DISK)
+ packet->append(STRING_WITH_LEN(" STORAGE DISK"));
+ if (share->default_storage_media == HA_SM_MEMORY)
+ packet->append(STRING_WITH_LEN(" STORAGE MEMORY"));
+
+ packet->append(STRING_WITH_LEN(" */"));
}
/*
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2011-02-20 20:56:24 +0000
+++ b/sql/sql_table.cc 2011-03-04 15:16:56 +0000
@@ -5271,17 +5271,12 @@ mysql_prepare_alter_table(THD *thd, TABL
if (!(used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE))
create_info->key_block_size= table->s->key_block_size;
- if (!create_info->tablespace && create_info->storage_media != HA_SM_MEMORY)
- {
- char *tablespace= static_cast<char *>(thd->alloc(FN_LEN + 1));
- /*
- Regular alter table of disk stored table (no tablespace/storage change)
- Copy tablespace name
- */
- if (tablespace &&
- (table->file->get_tablespace_name(thd, tablespace, FN_LEN)))
- create_info->tablespace= tablespace;
- }
+ if (!create_info->tablespace)
+ create_info->tablespace= table->s->tablespace;
+
+ if (create_info->storage_media == HA_SM_DEFAULT)
+ create_info->storage_media= table->s->default_storage_media;
+
restore_record(table, s->default_values); // Empty record for DEFAULT
Create_field *def;
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2011-02-20 20:56:24 +0000
+++ b/sql/sql_yacc.yy 2011-03-04 15:16:56 +0000
@@ -871,6 +871,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
%token COLLATION_SYM /* SQL-2003-N */
%token COLUMNS
%token COLUMN_SYM /* SQL-2003-R */
+%token COLUMN_FORMAT_SYM /* MCP_WL3627 */
%token COLUMN_NAME_SYM /* SQL-2003-N */
%token COMMENT_SYM
%token COMMITTED_SYM /* SQL-2003-N */
@@ -5718,6 +5719,35 @@ attribute:
Lex->charset=$2;
}
}
+/* MCP_WL3627 -> */
+ | COLUMN_FORMAT_SYM DEFAULT
+ {
+ Lex->type|=
+ (COLUMN_FORMAT_TYPE_DEFAULT << FIELD_FLAGS_COLUMN_FORMAT);
+ }
+ | COLUMN_FORMAT_SYM FIXED_SYM
+ {
+ Lex->type|=
+ (COLUMN_FORMAT_TYPE_FIXED << FIELD_FLAGS_COLUMN_FORMAT);
+ }
+ | COLUMN_FORMAT_SYM DYNAMIC_SYM
+ {
+ Lex->type|=
+ (COLUMN_FORMAT_TYPE_DYNAMIC << FIELD_FLAGS_COLUMN_FORMAT);
+ }
+ | STORAGE_SYM DEFAULT
+ {
+ Lex->type|= (HA_SM_DEFAULT << FIELD_FLAGS_STORAGE_MEDIA);
+ }
+ | STORAGE_SYM DISK_SYM
+ {
+ Lex->type|= (HA_SM_DISK << FIELD_FLAGS_STORAGE_MEDIA);
+ }
+ | STORAGE_SYM MEMORY_SYM
+ {
+ Lex->type|= (HA_SM_MEMORY << FIELD_FLAGS_STORAGE_MEDIA);
+ }
+/* MCP_WL3627 <- */
;
@@ -12453,6 +12483,7 @@ keyword_sp:
| CODE_SYM {}
| COLLATION_SYM {}
| COLUMN_NAME_SYM {}
+ | COLUMN_FORMAT_SYM {} /* MCP_WL3627 */
| COLUMNS {}
| COMMITTED_SYM {}
| COMPACT_SYM {}
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2011-02-20 20:56:24 +0000
+++ b/sql/table.cc 2011-03-04 15:16:56 +0000
@@ -750,6 +750,9 @@ static int open_binary_frm(THD *thd, TAB
const char **interval_array;
enum legacy_db_type legacy_db_type;
my_bitmap_map *bitmaps;
+ uchar *extra_segment_buff= 0;
+ const uint format_section_header_size= 8;
+ uchar *format_section_fields= 0;
DBUG_ENTER("open_binary_frm");
new_field_pack_flag= head[27];
@@ -942,27 +945,27 @@ static int open_binary_frm(THD *thd, TAB
if ((n_length= uint4korr(head+55)))
{
/* Read extra data segment */
- uchar *buff, *next_chunk, *buff_end;
+ uchar *next_chunk, *buff_end;
DBUG_PRINT("info", ("extra segment size is %u bytes", n_length));
- if (!(next_chunk= buff= (uchar*) my_malloc(n_length, MYF(MY_WME))))
+ if (!(extra_segment_buff= (uchar*) my_malloc(n_length, MYF(MY_WME))))
goto err;
- if (mysql_file_pread(file, buff, n_length, record_offset + share->reclength,
+ next_chunk= extra_segment_buff;
+ if (mysql_file_pread(file, extra_segment_buff,
+ n_length, record_offset + share->reclength,
MYF(MY_NABP)))
{
- my_free(buff);
goto err;
}
- share->connect_string.length= uint2korr(buff);
+ share->connect_string.length= uint2korr(next_chunk);
if (!(share->connect_string.str= strmake_root(&share->mem_root,
(char*) next_chunk + 2,
share->connect_string.
length)))
{
- my_free(buff);
goto err;
}
next_chunk+= share->connect_string.length + 2;
- buff_end= buff + n_length;
+ buff_end= extra_segment_buff + n_length;
if (next_chunk + 2 < buff_end)
{
uint str_db_type_length= uint2korr(next_chunk);
@@ -979,7 +982,6 @@ static int open_binary_frm(THD *thd, TAB
plugin_data(tmp_plugin, handlerton *)))
{
/* bad file, legacy_db_type did not match the name */
- my_free(buff);
goto err;
}
/*
@@ -1009,7 +1011,6 @@ static int open_binary_frm(THD *thd, TAB
error= 8;
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
"--skip-partition");
- my_free(buff);
goto err;
}
plugin_unlock(NULL, share->db_plugin);
@@ -1025,7 +1026,6 @@ static int open_binary_frm(THD *thd, TAB
error= 8;
name.str[name.length]=0;
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), name.str);
- my_free(buff);
goto err;
/* purecov: end */
}
@@ -1042,7 +1042,6 @@ static int open_binary_frm(THD *thd, TAB
memdup_root(&share->mem_root, next_chunk + 4,
partition_info_str_len + 1)))
{
- my_free(buff);
goto err;
}
}
@@ -1050,7 +1049,6 @@ static int open_binary_frm(THD *thd, TAB
if (partition_info_str_len)
{
DBUG_PRINT("info", ("WITH_PARTITION_STORAGE_ENGINE is not defined"));
- my_free(buff);
goto err;
}
#endif
@@ -1088,7 +1086,6 @@ static int open_binary_frm(THD *thd, TAB
{
DBUG_PRINT("error",
("fulltext key uses parser that is not defined in .frm"));
- my_free(buff);
goto err;
}
parser_name.str= (char*) next_chunk;
@@ -1099,7 +1096,6 @@ static int open_binary_frm(THD *thd, TAB
if (! keyinfo->parser)
{
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), parser_name.str);
- my_free(buff);
goto err;
}
}
@@ -1111,19 +1107,68 @@ static int open_binary_frm(THD *thd, TAB
{
DBUG_PRINT("error",
("long table comment is not defined in .frm"));
- my_free(buff);
goto err;
}
share->comment.length = uint2korr(next_chunk);
if (! (share->comment.str= strmake_root(&share->mem_root,
(char*)next_chunk + 2, share->comment.length)))
{
- my_free(buff);
goto err;
}
next_chunk+= 2 + share->comment.length;
}
- my_free(buff);
+
+ if (next_chunk + format_section_header_size < buff_end)
+ {
+ /*
+ New extra data segment called "format section" with additional
+ table and column properties introduced by MySQL Cluster
+ based on 5.1.20
+
+ Table properties:
+ TABLESPACE <ts> and STORAGE [DISK|MEMORY]
+
+ Column properties:
+ COLUMN_FORMAT [DYNAMIC|FIXED] and STORAGE [DISK|MEMORY]
+ */
+ DBUG_PRINT("info", ("Found format section"));
+
+ /* header */
+ const uint format_section_length= uint2korr(next_chunk);
+ const uint format_section_flags= uint4korr(next_chunk+2);
+ /* 2 bytes unused */
+
+ if (next_chunk + format_section_length > buff_end)
+ {
+ DBUG_PRINT("error", ("format section length too long: %u",
+ format_section_length));
+ goto err;
+ }
+ DBUG_PRINT("info", ("format_section_length: %u, format_section_flags: %u",
+ format_section_length, format_section_flags));
+
+ share->default_storage_media=
+ (enum ha_storage_media) (format_section_flags & 0x7);
+
+ /* tablespace */
+ const char *tablespace=
+ (const char*)next_chunk + format_section_header_size;
+ const uint tablespace_length= strlen(tablespace);
+ if (tablespace_length &&
+ !(share->tablespace= strmake_root(&share->mem_root,
+ tablespace, tablespace_length+1)))
+ {
+ goto err;
+ }
+ DBUG_PRINT("info", ("tablespace: '%s'",
+ share->tablespace ? share->tablespace : "<null>"));
+
+ /* pointer to format section for fields */
+ format_section_fields=
+ next_chunk + format_section_header_size + tablespace_length + 1;
+
+ next_chunk+= format_section_length;
+ }
}
share->key_block_size= uint2korr(head+62);
@@ -1438,6 +1483,23 @@ static int open_binary_frm(THD *thd, TAB
error= 8;
goto err;
}
+
+ if (format_section_fields)
+ {
+ const uchar field_flags= format_section_fields[i];
+ const uchar field_storage= (field_flags & STORAGE_TYPE_MASK);
+ const uchar field_column_format=
+ ((field_flags >> COLUMN_FORMAT_SHIFT)& STORAGE_TYPE_MASK);
+ DBUG_PRINT("debug", ("field flags: %u, storage: %u, column_format: %u",
+ field_flags, field_storage, field_column_format));
+#ifndef MCP_WL3627
+ reg_field->set_storage_type((ha_storage_media)field_storage);
+ reg_field->set_column_format((column_format_type)field_column_format);
+#else
+ (void)field_storage; /* Reserved by and used in MySQL Cluster */
+ (void)field_column_format; /* Reserved by and used in MySQL Cluster */
+#endif
+ }
}
*field_ptr=0; // End marker
@@ -1705,6 +1767,7 @@ static int open_binary_frm(THD *thd, TAB
if (use_hash)
(void) my_hash_check(&share->name_hash);
#endif
+ my_free(extra_segment_buff);
DBUG_RETURN (0);
err:
@@ -1712,6 +1775,7 @@ static int open_binary_frm(THD *thd, TAB
share->open_errno= my_errno;
share->errarg= errarg;
my_free(disk_buff);
+ my_free(extra_segment_buff);
delete crypted;
delete handler_file;
my_hash_free(&share->name_hash);
@@ -2687,6 +2751,8 @@ void update_create_info_from_table(HA_CR
create_info->default_table_charset= share->table_charset;
create_info->table_charset= 0;
create_info->comment= share->comment;
+ create_info->storage_media= share->default_storage_media;
+ create_info->tablespace= share->tablespace;
DBUG_VOID_RETURN;
}
=== modified file 'sql/table.h'
--- a/sql/table.h 2011-02-20 20:56:24 +0000
+++ b/sql/table.h 2011-03-04 15:16:56 +0000
@@ -609,6 +609,8 @@ struct TABLE_SHARE
}
enum row_type row_type; /* How rows are stored */
enum tmp_table_type tmp_table;
+ enum ha_storage_media default_storage_media;
+ char *tablespace;
uint ref_count; /* How many TABLE objects uses this */
uint blob_ptr_size; /* 4 or 8 */
=== modified file 'sql/unireg.cc'
--- a/sql/unireg.cc 2010-10-27 11:32:32 +0000
+++ b/sql/unireg.cc 2011-03-04 09:53:26 +0000
@@ -124,6 +124,9 @@ bool mysql_create_frm(THD *thd, const ch
#endif
Pack_header_error_handler pack_header_error_handler;
int error;
+ const uint format_section_header_size= 8;
+ uint format_section_length;
+ uint tablespace_length= 0;
DBUG_ENTER("mysql_create_frm");
DBUG_ASSERT(*fn_rext((char*)file_name)); // Check .frm extension
@@ -256,6 +259,18 @@ bool mysql_create_frm(THD *thd, const ch
forminfo[46]=(uchar) create_info->comment.length;
}
+ /*
+ Add room in extra segment for "format section" with additional
+ table and column properties
+ */
+ if (create_info->tablespace)
+ tablespace_length= strlen(create_info->tablespace);
+ format_section_length=
+ format_section_header_size +
+ tablespace_length + 1 +
+ create_fields.elements;
+ create_info->extra_size+= format_section_length;
+
if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
create_info, keys, key_info)) < 0)
{
@@ -353,6 +368,60 @@ bool mysql_create_frm(THD *thd, const ch
goto err;
}
+ /* "Format section" with additional table and column properties */
+ {
+ uchar *ptr, *format_section_buff;
+ if (!(format_section_buff=(uchar*) my_malloc(format_section_length,
+ MYF(MY_WME))))
+ goto err;
+ ptr= format_section_buff;
+
+ /* header */
+ const uint format_section_flags=
+ create_info->storage_media; // 3 bits
+ const uint format_section_unused= 0;
+ int2store(ptr+0, format_section_length);
+ int4store(ptr+2, format_section_flags);
+ int2store(ptr+6, format_section_unused);
+ ptr+= format_section_header_size;
+
+ /* tablespace name */
+ if (tablespace_length > 0)
+ memcpy(ptr, create_info->tablespace, tablespace_length);
+ ptr+= tablespace_length;
+ *ptr= 0; /* tablespace string terminating zero */
+ ptr++;
+
+ /* column properties */
+ Create_field *field;
+ List_iterator<Create_field> it(create_fields);
+ while ((field=it++))
+ {
+#ifndef MCP_WL3627
+ const uchar field_storage= field->field_storage_type();
+ const uchar field_column_format= field->column_format();
+#else
+ const uchar field_storage= 0; /* Used in MySQL Cluster */
+ const uchar field_column_format= 0; /* Used in MySQL Cluster */
+#endif
+ const uchar field_flags=
+ field_storage + (field_column_format << COLUMN_FORMAT_SHIFT);
+ *ptr= field_flags;
+ ptr++;
+ }
+ DBUG_ASSERT(format_section_buff + format_section_length == ptr);
+
+ if (mysql_file_write(file, format_section_buff,
+ format_section_length, MYF_RW))
+ {
+ my_free(format_section_buff);
+ goto err;
+ }
+ DBUG_PRINT("info", ("wrote format section, length: %u",
+ format_section_length));
+ my_free(format_section_buff);
+ }
+
mysql_file_seek(file, filepos, MY_SEEK_SET, MYF(0));
if (mysql_file_write(file, forminfo, 288, MYF_RW) ||
mysql_file_write(file, screen_buff, info_length, MYF_RW) ||
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-5.5-cluster branch (magnus.blaudd:3218 to 3219) | Magnus Blåudd | 7 Mar |