3923 Pekka Nousiainen 2012-10-01 [merge]
merge
modified:
VERSION
packaging/WiX/create_msi.cmake.in
storage/ndb/VERSION
storage/ndb/clusterj/CMakeLists.txt
storage/ndb/clusterj/clusterj-api/CMakeLists.txt
=== modified file 'mysql-test/suite/ndb/r/ndb_fk_is.result'
--- a/mysql-test/suite/ndb/r/ndb_fk_is.result 2012-08-30 12:56:15 +0000
+++ b/mysql-test/suite/ndb/r/ndb_fk_is.result 2012-10-01 08:36:02 +0000
@@ -1,3 +1,46 @@
+# engine=innodb
+create table product (
+category int not null,
+id int not null,
+price decimal,
+primary key(category, id))
+engine=innodb;
+create table customer (
+id int not null,
+primary key (id))
+engine=innodb;
+create table product_order (
+no int not null auto_increment,
+product_category int not null,
+product_id int not null,
+customer_id int not null,
+primary key(no),
+index (product_category, product_id),
+foreign key fk1 (product_category, product_id) references product(category, id)
+on update restrict on delete cascade,
+index (customer_id),
+foreign key fk2 (customer_id) references customer(id))
+engine=innodb;
+create table emp (
+id int primary key auto_increment,
+manager int,
+key (manager),
+foreign key fk1 (manager) references emp (id))
+engine=innodb;
+select *
+from information_schema.table_constraints
+where table_schema = 'test'
+order by table_name, constraint_type, constraint_name;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
+def test PRIMARY test customer PRIMARY KEY
+def test emp_ibfk_1 test emp FOREIGN KEY
+def test PRIMARY test emp PRIMARY KEY
+def test PRIMARY test product PRIMARY KEY
+def test product_order_ibfk_1 test product_order FOREIGN KEY
+def test product_order_ibfk_2 test product_order FOREIGN KEY
+def test PRIMARY test product_order PRIMARY KEY
+drop table product_order, customer, product, emp;
+# engine=ndb
create table product (
category int not null,
id int not null,
@@ -15,21 +58,27 @@ product_id int not null,
customer_id int not null,
primary key(no),
index (product_category, product_id),
-foreign key (product_category, product_id) references product(category, id)
+foreign key fk1 (product_category, product_id) references product(category, id)
on update restrict on delete cascade,
index (customer_id),
-foreign key (customer_id) references customer(id))
+foreign key fk2 (customer_id) references customer(id))
+engine=ndb;
+create table emp (
+id int primary key auto_increment,
+manager int,
+key (manager),
+foreign key fk1 (manager) references emp (id))
engine=ndb;
select *
from information_schema.table_constraints
where table_schema = 'test'
-order by table_name, constraint_name;
+order by table_name, constraint_type, constraint_name;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
-def test FK_12_17 test customer FOREIGN KEY
def test PRIMARY test customer PRIMARY KEY
-def test FK_10_16 test product FOREIGN KEY
+def test fk1 test emp FOREIGN KEY
+def test PRIMARY test emp PRIMARY KEY
def test PRIMARY test product PRIMARY KEY
-def test FK_10_16 test product_order FOREIGN KEY
-def test FK_12_17 test product_order FOREIGN KEY
+def test fk1 test product_order FOREIGN KEY
+def test fk2 test product_order FOREIGN KEY
def test PRIMARY test product_order PRIMARY KEY
-drop table product, customer, product_order;
+drop table product_order, customer, product, emp;
=== added file 'mysql-test/suite/ndb/t/ndb_fk_is.inc'
--- a/mysql-test/suite/ndb/t/ndb_fk_is.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_fk_is.inc 2012-10-01 08:36:02 +0000
@@ -0,0 +1,42 @@
+eval
+create table product (
+ category int not null,
+ id int not null,
+ price decimal,
+ primary key(category, id))
+engine=$engine;
+
+eval
+create table customer (
+ id int not null,
+ primary key (id))
+engine=$engine;
+
+eval
+create table product_order (
+ no int not null auto_increment,
+ product_category int not null,
+ product_id int not null,
+ customer_id int not null,
+ primary key(no),
+ index (product_category, product_id),
+ foreign key fk1 (product_category, product_id) references product(category, id)
+ on update restrict on delete cascade,
+ index (customer_id),
+ foreign key fk2 (customer_id) references customer(id))
+engine=$engine;
+
+eval
+create table emp (
+ id int primary key auto_increment,
+ manager int,
+ key (manager),
+ foreign key fk1 (manager) references emp (id))
+engine=$engine;
+
+select *
+from information_schema.table_constraints
+where table_schema = 'test'
+order by table_name, constraint_type, constraint_name;
+
+drop table product_order, customer, product, emp;
=== modified file 'mysql-test/suite/ndb/t/ndb_fk_is.test'
--- a/mysql-test/suite/ndb/t/ndb_fk_is.test 2012-08-30 12:56:15 +0000
+++ b/mysql-test/suite/ndb/t/ndb_fk_is.test 2012-10-01 08:36:02 +0000
@@ -1,33 +1,9 @@
-- source include/have_ndb.inc
-create table product (
- category int not null,
- id int not null,
- price decimal,
- primary key(category, id))
-engine=ndb;
+--let $engine=innodb
+--echo # engine=innodb
+--source ndb_fk_is.inc
-create table customer (
- id int not null,
- primary key (id))
-engine=ndb;
-
-create table product_order (
- no int not null auto_increment,
- product_category int not null,
- product_id int not null,
- customer_id int not null,
- primary key(no),
- index (product_category, product_id),
- foreign key (product_category, product_id) references product(category, id)
- on update restrict on delete cascade,
- index (customer_id),
- foreign key (customer_id) references customer(id))
-engine=ndb;
-
-select *
-from information_schema.table_constraints
-where table_schema = 'test'
-order by table_name, constraint_name;
-
-drop table product, customer, product_order;
+--let $engine=ndb
+--echo # engine=ndb
+--source ndb_fk_is.inc
=== modified file 'sql/ha_ndb_ddl_fk.cc'
--- a/sql/ha_ndb_ddl_fk.cc 2012-09-25 09:58:34 +0000
+++ b/sql/ha_ndb_ddl_fk.cc 2012-10-01 08:36:02 +0000
@@ -608,6 +608,8 @@ ha_ndbcluster::get_foreign_key_list(THD
DBUG_RETURN(0);
}
+ DBUG_PRINT("info", ("%s: list dependent objects", m_table->getName()));
+
NDBDICT *dict= ndb->getDictionary();
NDBDICT::List obj_list;
dict->listDependentObjects(obj_list, *m_table);
@@ -616,6 +618,12 @@ ha_ndbcluster::get_foreign_key_list(THD
if (obj_list.elements[i].type != NdbDictionary::Object::ForeignKey)
continue;
+ // abuse temp to mark parent-only dependency
+ if (obj_list.elements[i].temp != 0)
+ continue;
+
+ DBUG_PRINT("info", ("FK %s", obj_list.elements[i].name));
+
FOREIGN_KEY_INFO f_key_info;
NdbDictionary::ForeignKey fk;
=== modified file 'storage/ndb/include/ndbapi/NdbDictionary.hpp'
--- a/storage/ndb/include/ndbapi/NdbDictionary.hpp 2012-07-13 11:27:11 +0000
+++ b/storage/ndb/include/ndbapi/NdbDictionary.hpp 2012-10-01 08:36:02 +0000
@@ -2291,6 +2291,7 @@ public:
* Fetch list of objects that table depend on
* @param list Reference to list where to store the listed objects
* @param table Reference to table that objects belongs to.
+ * @note For FK, Element::temp is set for parent-only dependency
* @return 0 if successful, otherwise -1
*/
int listDependentObjects(List & list, const Table &table) const;
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2012-07-09 12:22:46 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2012-10-01 08:36:02 +0000
@@ -10636,16 +10636,26 @@ void Dbdict::sendLIST_TABLES_CONF(Signal
Ptr<ForeignKeyRec> fk_ptr;
ndbrequire(find_object(fk_ptr, iter.curr.p->m_id));
- if (reqListDependent &&
- (reqTableId != fk_ptr.p->m_parentTableId &&
- reqTableId != fk_ptr.p->m_parentIndexId &&
- reqTableId != fk_ptr.p->m_childTableId &&
- reqTableId != fk_ptr.p->m_childIndexId ))
- goto flush;
+ // abuse temp to mark parent-only dependency
+ int temp = 0;
+ if (reqListDependent)
+ {
+ if (reqTableId == fk_ptr.p->m_childTableId ||
+ reqTableId == fk_ptr.p->m_childIndexId)
+ temp = 0;
+ else
+ if (reqTableId == fk_ptr.p->m_parentTableId ||
+ reqTableId == fk_ptr.p->m_parentIndexId)
+ temp = 1;
+ else
+ goto flush;
+ }
+ ltd.requestData = 0;
ltd.setTableId(iter.curr.p->m_id);
ltd.setTableType(type); // type
ltd.setTableState(DictTabInfo::StateOnline); // XXX todo
+ ltd.setTableTemp(temp);
}
tableDataWriter.putWords((Uint32 *) <d, listTablesDataSizeInWords);
count++;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5-cluster-7.3-fk branch (pekka.nousiainen:3923) | Pekka Nousiainen | 3 Oct |