From: Date: January 4 2007 5:27pm Subject: bk commit into 5.1 tree (mskold:1.2381) BUG#25296 List-Archive: http://lists.mysql.com/commits/17636 X-Bug: 25296 Message-Id: <20070104162705.31C1821BF03@linux.site> Below is the list of changes that have just been committed into a local 5.1 repository of marty. When marty 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@stripped, 2007-01-04 17:26:53+01:00, mskold@stripped +3 -0 ha_ndbcluster.h, ndb_dd_alter.result, ha_ndbcluster.cc: bug#25296 Truncate table converts NDB disk based tables to in-memory tables: Changed fix to use get_tablespace_name directly instead mysql-test/r/ndb_dd_alter.result@stripped, 2007-01-04 17:26:02+01:00, mskold@stripped +2 -2 bug#25296 Truncate table converts NDB disk based tables to in-memory tables: Changed fix to use get_tablespace_name directly instead sql/ha_ndbcluster.cc@stripped, 2007-01-04 17:26:02+01:00, mskold@stripped +16 -14 bug#25296 Truncate table converts NDB disk based tables to in-memory tables: Changed fix to use get_tablespace_name directly instead sql/ha_ndbcluster.h@stripped, 2007-01-04 17:26:01+01:00, mskold@stripped +0 -1 bug#25296 Truncate table converts NDB disk based tables to in-memory tables: Changed fix to use get_tablespace_name directly instead # 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: mskold # Host: linux.site # Root: /windows/Linux_space/MySQL/mysql-5.1-new-ndb --- 1.4/mysql-test/r/ndb_dd_alter.result 2007-01-04 17:27:04 +01:00 +++ 1.5/mysql-test/r/ndb_dd_alter.result 2007-01-04 17:27:04 +01:00 @@ -439,7 +439,7 @@ t1 CREATE TABLE `t1` ( `a14` blob, PRIMARY KEY (`a1`), KEY `a3_i` (`a3`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 ALTER TABLE test.t1 DROP a14; ALTER TABLE test.t1 DROP a13; ALTER TABLE test.t1 DROP a12; @@ -459,7 +459,7 @@ t1 CREATE TABLE `t1` ( `a4` bit(1) DEFAULT NULL, `a5` tinyint(4) DEFAULT NULL, KEY `a3_i` (`a3`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 DROP TABLE test.t1; ALTER TABLESPACE ts DROP DATAFILE './table_space/datafile.dat' --- 1.388/sql/ha_ndbcluster.cc 2007-01-04 17:27:04 +01:00 +++ 1.389/sql/ha_ndbcluster.cc 2007-01-04 17:27:04 +01:00 @@ -4734,6 +4734,7 @@ int ha_ndbcluster::create(const char *na const void *data, *pack_data; bool create_from_engine= (info->table_options & HA_OPTION_CREATE_FROM_ENGINE); bool is_truncate= (thd->lex->sql_command == SQLCOM_TRUNCATE); + char tablespace[FN_LEN]; DBUG_ENTER("ha_ndbcluster::create"); DBUG_PRINT("enter", ("name: %s", name)); @@ -4742,8 +4743,22 @@ int ha_ndbcluster::create(const char *na set_dbname(name); set_tabname(name); + if ((my_errno= check_ndb_connection())) + DBUG_RETURN(my_errno); + + Ndb *ndb= get_ndb(); + NDBDICT *dict= ndb->getDictionary(); + if (is_truncate) { + { + Ndb_table_guard ndbtab_g(dict, m_tabname); + if (!(m_table= ndbtab_g.get_table())) + ERR_RETURN(dict->getNdbError()); + if ((get_tablespace_name(thd, tablespace, FN_LEN))) + info->tablespace= tablespace; + m_table= NULL; + } DBUG_PRINT("info", ("Dropping and re-creating table for TRUNCATE")); if ((my_errno= delete_table(name))) DBUG_RETURN(my_errno); @@ -4903,12 +4918,7 @@ int ha_ndbcluster::create(const char *na DBUG_RETURN(my_errno); } - if ((my_errno= check_ndb_connection())) - DBUG_RETURN(my_errno); - // Create the table in NDB - Ndb *ndb= get_ndb(); - NDBDICT *dict= ndb->getDictionary(); if (dict->createTable(tab) != 0) { const NdbError err= dict->getNdbError(); @@ -8309,15 +8319,6 @@ ha_ndbcluster::setup_recattr(const NdbRe DBUG_RETURN(0); } -void ha_ndbcluster::update_create_info(HA_CREATE_INFO *create_info) -{ - THD *thd= current_thd; - - if (thd->lex->sql_command == SQLCOM_TRUNCATE && - get_tablespace_name(thd,0,0)) - create_info->storage_media= HA_SM_DISK; -} - char* ha_ndbcluster::update_table_comment( /* out: table comment + additional */ @@ -10016,6 +10017,7 @@ char* ha_ndbcluster::get_tablespace_name ndberr= ndbdict->getNdbError(); if(ndberr.classification != NdbError::NoError) goto err; + DBUG_PRINT("info", ("Found tablespace '%s'", ts.getName())); if (name) { strxnmov(name, name_len, ts.getName(), NullS); --- 1.163/sql/ha_ndbcluster.h 2007-01-04 17:27:05 +01:00 +++ 1.164/sql/ha_ndbcluster.h 2007-01-04 17:27:05 +01:00 @@ -884,7 +884,6 @@ private: ulonglong *nb_reserved_values); bool uses_blob_value(); - void update_create_info(HA_CREATE_INFO *create_info); char *update_table_comment(const char * comment); int write_ndb_file(const char *name);