MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:tomas Date:April 24 2006 4:26pm
Subject:bk commit into 5.1 tree (tomas:1.2360) BUG#18604
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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.2360 06/04/24 18:26:30 tomas@stripped +5 -0
  bug#18604 create logfile for MyISAM tables
  - changed alter tablespace truct to work with handlerton pointer (to avoid crash in parser on unknown db type"
  - pushed warnings when default storage engine is used and/or tablespace stuff is not supported by storage engine

  sql/sql_yacc.yy
    1.471 06/04/24 18:26:21 tomas@stripped +2 -2
    bug#18604 create logfile for MyISAM tables
    - changed alter tablespace truct to work with handlerton pointer (to avoid crash in parser on unknown db type"
    - pushed warnings when default storage engine is used and/or tablespace stuff is not supported by storage engine

  sql/sql_tablespace.cc
    1.4 06/04/24 18:26:21 tomas@stripped +35 -16
    bug#18604 create logfile for MyISAM tables
    - changed alter tablespace truct to work with handlerton pointer (to avoid crash in parser on unknown db type"
    - pushed warnings when default storage engine is used and/or tablespace stuff is not supported by storage engine

  sql/handler.h
    1.205 06/04/24 18:26:21 tomas@stripped +5 -4
    bug#18604 create logfile for MyISAM tables
    - changed alter tablespace truct to work with handlerton pointer (to avoid crash in parser on unknown db type"
    - pushed warnings when default storage engine is used and/or tablespace stuff is not supported by storage engine

  mysql-test/t/ndb_dd_basic.test
    1.6 06/04/24 18:26:21 tomas@stripped +20 -2
    bug#18604 create logfile for MyISAM tables

  mysql-test/r/ndb_dd_basic.result
    1.7 06/04/24 18:26:21 tomas@stripped +22 -1
    bug#18604 create logfile for MyISAM tables

# 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:	tomas
# Host:	poseidon.ndb.mysql.com
# Root:	/home/tomas/mysql-5.1-new

--- 1.204/sql/handler.h	2006-04-21 21:49:06 +02:00
+++ 1.205/sql/handler.h	2006-04-24 18:26:21 +02:00
@@ -402,6 +402,7 @@
   TS_NOT_ACCESSIBLE = 2
 };
 
+struct handlerton;
 class st_alter_tablespace : public Sql_alloc
 {
   public:
@@ -419,7 +420,7 @@
   ulonglong autoextend_size;
   ulonglong max_size;
   uint nodegroup_id;
-  enum legacy_db_type storage_engine;
+  const handlerton *storage_engine;
   bool wait_until_completed;
   const char *ts_comment;
   enum tablespace_access_mode ts_access_mode;
@@ -437,7 +438,7 @@
     initial_size= 128*1024*1024;   //Default 128 MByte
     autoextend_size= 0;            //No autoextension as default
     max_size= 0;                   //Max size == initial size => no extension
-    storage_engine= DB_TYPE_UNKNOWN;
+    storage_engine= NULL;
     nodegroup_id= UNDEF_NODEGROUP;
     wait_until_completed= TRUE;
     ts_comment= NULL;
@@ -468,7 +469,7 @@
 
   savepoint_*, prepare, recover, and *_by_xid pointers can be 0.
 */
-typedef struct
+struct handlerton
 {
   /*
     handlerton structure version
@@ -581,7 +582,7 @@
                             const char *query, uint query_length,
                             const char *db, const char *table_name);
    int (*release_temporary_latches)(THD *thd);
-} handlerton;
+};
 
 extern const handlerton default_hton;
 

--- 1.470/sql/sql_yacc.yy	2006-04-23 02:00:05 +02:00
+++ 1.471/sql/sql_yacc.yy	2006-04-24 18:26:21 +02:00
@@ -3187,13 +3187,13 @@
           opt_storage ENGINE_SYM opt_equal storage_engines
           {
             LEX *lex= Lex;
-            if (lex->alter_tablespace_info->storage_engine != DB_TYPE_UNKNOWN)
+            if (lex->alter_tablespace_info->storage_engine != NULL)
             {
               my_error(ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),
                        "STORAGE ENGINE");
               YYABORT;
             }
-            lex->alter_tablespace_info->storage_engine= $4->db_type;
+            lex->alter_tablespace_info->storage_engine= $4 ? $4 : &default_hton;
           };
 
 opt_ts_wait:

--- 1.6/mysql-test/r/ndb_dd_basic.result	2006-02-17 23:41:53 +01:00
+++ 1.7/mysql-test/r/ndb_dd_basic.result	2006-04-24 18:26:21 +02:00
@@ -3,11 +3,32 @@
 ADD UNDOFILE 'undofile.dat'
 INITIAL_SIZE 16M
 UNDO_BUFFER_SIZE = 1M
-ENGINE=NDB;
+ENGINE=MYISAM;
+Warnings:
+Error	1539	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:
+Error	1266	Using storage engine MyISAM for table 'lg1'
+Error	1539	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	1539	Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+set storage_engine=ndb;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M;
 ALTER LOGFILE GROUP lg1
 ADD UNDOFILE 'undofile02.dat'
 INITIAL_SIZE = 4M 
 ENGINE=NDB;
+set storage_engine=myisam;
 CREATE TABLESPACE ts1
 ADD DATAFILE 'datafile.dat'
 USE LOGFILE GROUP lg1

--- 1.5/mysql-test/t/ndb_dd_basic.test	2006-02-01 11:56:12 +01:00
+++ 1.6/mysql-test/t/ndb_dd_basic.test	2006-04-24 18:26:21 +02:00
@@ -14,16 +14,33 @@
 DROP TABLE IF EXISTS t1;
 --enable_warnings
 
+# some negative tests
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=MYISAM;
+
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M 
+ENGINE=XYZ;
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M;
+
 ##################################
 # Basic test of disk tables for NDB
 # Start by creating a logfile group
 ##################################
 
+set storage_engine=ndb;
 CREATE LOGFILE GROUP lg1
 ADD UNDOFILE 'undofile.dat'
 INITIAL_SIZE 16M
-UNDO_BUFFER_SIZE = 1M
-ENGINE=NDB;
+UNDO_BUFFER_SIZE = 1M;
 
 ALTER LOGFILE GROUP lg1
 ADD UNDOFILE 'undofile02.dat'
@@ -34,6 +51,7 @@
 # Create a tablespace connected to the logfile group
 ###################################################
 
+set storage_engine=myisam;
 CREATE TABLESPACE ts1
 ADD DATAFILE 'datafile.dat'
 USE LOGFILE GROUP lg1

--- 1.3/sql/sql_tablespace.cc	2006-04-24 13:31:17 +02:00
+++ 1.4/sql/sql_tablespace.cc	2006-04-24 18:26:21 +02:00
@@ -21,32 +21,51 @@
 int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
 {
   int error= HA_ADMIN_NOT_IMPLEMENTED;
-  handlerton *hton;
+  const handlerton *hton= ts_info->storage_engine;
 
   DBUG_ENTER("mysql_alter_tablespace");
   /*
     If the user haven't defined an engine, this will fallback to using the
     default storage engine.
   */
-  hton= ha_resolve_by_legacy_type(thd, ts_info->storage_engine != DB_TYPE_UNKNOWN ?
-                                  ts_info->storage_engine : DB_TYPE_DEFAULT);
+  if (hton == NULL || hton == &default_hton || hton->state != SHOW_OPTION_YES)
+  {
+    hton= ha_resolve_by_legacy_type(thd, DB_TYPE_DEFAULT);
+    if (ts_info->storage_engine != 0)
+      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+                          ER_WARN_USING_OTHER_HANDLER,
+                          ER(ER_WARN_USING_OTHER_HANDLER),
+                          hton->name,
+                          ts_info->tablespace_name
+                          ? ts_info->tablespace_name : ts_info->logfile_group_name);
+  }
 
-  if (hton->state == SHOW_OPTION_YES &&
-      hton->alter_tablespace && (error= hton->alter_tablespace(thd, ts_info)))
+  if (hton->alter_tablespace)
   {
-    if (error == HA_ADMIN_NOT_IMPLEMENTED)
-    {
-      my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "");
-    }
-    else if (error == 1)
+    if ((error= hton->alter_tablespace(thd, ts_info)))
     {
-      DBUG_RETURN(1);
+      if (error == HA_ADMIN_NOT_IMPLEMENTED)
+      {
+        my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "");
+      }
+      else if (error == 1)
+      {
+        DBUG_RETURN(1);
+      }
+      else
+      {
+        my_error(error, MYF(0));
+      }
+      DBUG_RETURN(error);
     }
-    else
-    {
-      my_error(error, MYF(0));
-    }
-    DBUG_RETURN(error);
+  }
+  else
+  {
+    push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+                        ER_ILLEGAL_HA_CREATE_OPTION,
+                        ER(ER_ILLEGAL_HA_CREATE_OPTION),
+                        hton->name,
+                        "TABLESPACE or LOGFILE GROUP");
   }
   if (mysql_bin_log.is_open())
   {
Thread
bk commit into 5.1 tree (tomas:1.2360) BUG#18604tomas24 Apr