Commit 24c17aa3 authored by unknown's avatar unknown
Browse files

Merge perch.ndb.mysql.com:/home/jonas/src/51-work

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb


sql/ha_ndbcluster.cc:
  Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Auto merged
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Auto merged
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
  Auto merged
parents 66287269 8751d63e
Loading
Loading
Loading
Loading
+37 −21
Original line number Diff line number Diff line
@@ -4,12 +4,12 @@ CREATE DATABASE mysqltest;
**** Begin Duplicate Statement Testing ****
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'undofile2.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
ERROR HY000: Failed to create LOGFILE GROUP
@@ -19,35 +19,35 @@ Error 1296 Got error 1514 'Currently there is a limit of one logfile group' from
Error	1515	Failed to create LOGFILE GROUP
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
ERROR HY000: Failed to create LOGFILE GROUP
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M ENGINE NDB;
INITIAL_SIZE 1M ENGINE NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M ENGINE=NDB;
INITIAL_SIZE 1M ENGINE=NDB;
ERROR HY000: Failed to alter: CREATE UNDOFILE
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
ERROR HY000: Failed to create TABLESPACE
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE=NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE=NDB;
ERROR HY000: Failed to alter:  CREATE DATAFILE
CREATE TABLE mysqltest.t1
@@ -94,20 +94,20 @@ DROP DATABASE IF EXISTS mysqltest;
**** Begin Statment CaSe Testing ****
creaTE LOgfilE GrOuP lg1
adD undoFILE 'undofile.dat'
initiAL_siZE 16M
initiAL_siZE 1M
UnDo_BuFfEr_SiZe = 1M
ENGInE=NDb;
altER LOgFiLE GrOUp lg1
AdD UnDOfILe 'uNdOfiLe02.daT'
INItIAl_SIzE 4M ENgINE nDB;
INItIAl_SIzE 1M ENgINE nDB;
CrEAtE TABLEspaCE ts1
ADD DATAfilE 'datafile.dat'
UsE LoGFiLE GRoUP lg1
INITiaL_SizE 12M
INITiaL_SizE 1M
ENGiNe NDb;
AlTeR tAbLeSpAcE ts1
AdD DaTaFiLe 'dAtAfiLe2.daT'
InItIaL_SiZe 12M
InItIaL_SiZe 1M
EnGiNe=NDB;
CREATE TABLE t1
(pk1 int not null primary key, b int not null, c int not null)
@@ -129,21 +129,21 @@ EnGiNe=nDb;
**** Begin = And No = Testing ****
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE=16M
INITIAL_SIZE=1M
UNDO_BUFFER_SIZE=1M
ENGINE=NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE=4M 
INITIAL_SIZE=1M 
ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE=12M
INITIAL_SIZE=1M
ENGINE=NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE=12M
INITIAL_SIZE=1M
ENGINE=NDB;
CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
@@ -165,21 +165,21 @@ ENGINE=NDB;

CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M
INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
@@ -199,3 +199,19 @@ ENGINE NDB;
DROP LOGFILE GROUP lg1
ENGINE NDB;
**** End = And No =  ****
create table t1 (a int primary key) engine = myisam;
create logfile group lg1 add undofile '/home/jonas/src/51-work/mysql-test/var/master-data/test/t1.frm' initial_size 1M undo_buffer_size = 1M engine=ndb;;
ERROR HY000: Failed to create UNDOFILE
create logfile group lg1
add undofile 'undofile.dat'
initial_size 1M
undo_buffer_size = 1M
engine=ndb;
create tablespace ts1 add datafile '/home/jonas/src/51-work/mysql-test/var/master-data/test/t1.frm' use logfile group lg1 initial_size 1M engine ndb;;
ERROR HY000: Failed to create DATAFILE
drop tablespace ts1
engine ndb;
ERROR HY000: Failed to drop TABLESPACE
drop logfile group lg1
engine ndb;
drop table t1;
+47 −22
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ CREATE DATABASE mysqltest;

CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;

@@ -48,7 +48,7 @@ ENGINE=NDB;
--error ER_CREATE_FILEGROUP_FAILED
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'undofile2.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
SHOW WARNINGS;
@@ -56,42 +56,42 @@ SHOW WARNINGS;
--error ER_CREATE_FILEGROUP_FAILED
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;

ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M ENGINE NDB;
INITIAL_SIZE 1M ENGINE NDB;

--error ER_ALTER_FILEGROUP_FAILED
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M ENGINE=NDB;
INITIAL_SIZE 1M ENGINE=NDB;

CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;

--error ER_CREATE_FILEGROUP_FAILED
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;


ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE=NDB;

--error ER_ALTER_FILEGROUP_FAILED
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE=NDB;

CREATE TABLE mysqltest.t1
@@ -155,23 +155,23 @@ DROP DATABASE IF EXISTS mysqltest;

creaTE LOgfilE GrOuP lg1
adD undoFILE 'undofile.dat'
initiAL_siZE 16M
initiAL_siZE 1M
UnDo_BuFfEr_SiZe = 1M
ENGInE=NDb;

altER LOgFiLE GrOUp lg1
AdD UnDOfILe 'uNdOfiLe02.daT'
INItIAl_SIzE 4M ENgINE nDB;
INItIAl_SIzE 1M ENgINE nDB;

CrEAtE TABLEspaCE ts1
ADD DATAfilE 'datafile.dat'
UsE LoGFiLE GRoUP lg1
INITiaL_SizE 12M
INITiaL_SizE 1M
ENGiNe NDb;

AlTeR tAbLeSpAcE ts1
AdD DaTaFiLe 'dAtAfiLe2.daT'
InItIaL_SiZe 12M
InItIaL_SiZe 1M
EnGiNe=NDB;

CREATE TABLE t1
@@ -203,24 +203,24 @@ EnGiNe=nDb;

CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE=16M
INITIAL_SIZE=1M
UNDO_BUFFER_SIZE=1M
ENGINE=NDB;

ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE=4M 
INITIAL_SIZE=1M 
ENGINE=NDB;

CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE=12M
INITIAL_SIZE=1M
ENGINE=NDB;

ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE=12M
INITIAL_SIZE=1M
ENGINE=NDB;

CREATE TABLE t1
@@ -250,24 +250,24 @@ ENGINE=NDB;

CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;

ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M
INITIAL_SIZE 1M
ENGINE NDB;

CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;

ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;

CREATE TABLE t1
@@ -297,5 +297,30 @@ ENGINE NDB;
--echo **** End = And No =  ****
############ End = And No = ##################

# End 5.1 test
###
#
# bug#16341
create table t1 (a int primary key) engine = myisam;

--error ER_CREATE_FILEGROUP_FAILED
--eval create logfile group lg1 add undofile '$MYSQLTEST_VARDIR/master-data/test/t1.frm' initial_size 1M undo_buffer_size = 1M engine=ndb;

create logfile group lg1
add undofile 'undofile.dat'
initial_size 1M
undo_buffer_size = 1M
engine=ndb;

--error ER_CREATE_FILEGROUP_FAILED
--eval create tablespace ts1 add datafile '$MYSQLTEST_VARDIR/master-data/test/t1.frm' use logfile group lg1 initial_size 1M engine ndb;

--error ER_DROP_FILEGROUP_FAILED
drop tablespace ts1
engine ndb;

drop logfile group lg1
engine ndb;

drop table t1;

# End 5.1 test
+27 −6
Original line number Diff line number Diff line
@@ -9977,6 +9977,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
    DBUG_RETURN(HA_ERR_NO_CONNECTION);
  }

  NdbError err;
  NDBDICT *dict = ndb->getDictionary();
  int error;
  const char * errmsg;
@@ -9989,6 +9990,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
    
    NdbDictionary::Tablespace ndb_ts;
    NdbDictionary::Datafile ndb_df;
    NdbDictionary::ObjectId objid;
    if (set_up_tablespace(info, &ndb_ts))
    {
      DBUG_RETURN(1);
@@ -9998,7 +10000,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
      DBUG_RETURN(1);
    }
    errmsg= "TABLESPACE";
    if (dict->createTablespace(ndb_ts))
    if (dict->createTablespace(ndb_ts, &objid))
    {
      DBUG_PRINT("error", ("createTablespace returned %d", error));
      goto ndberror;
@@ -10007,8 +10009,17 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
    errmsg= "DATAFILE";
    if (dict->createDatafile(ndb_df))
    {
      err= dict->getNdbError();
      NdbDictionary::Tablespace tmp= dict->getTablespace(ndb_ts.getName());
      if (dict->getNdbError().code == 0 &&
	  tmp.getObjectId() == objid.getObjectId() &&
	  tmp.getObjectVersion() == objid.getObjectVersion())
      {
	dict->dropTablespace(tmp);
      }
      
      DBUG_PRINT("error", ("createDatafile returned %d", error));
      goto ndberror;
      goto ndberror2;
    }
    is_tablespace= 1;
    break;
@@ -10062,6 +10073,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
    error= ER_CREATE_FILEGROUP_FAILED;
    NdbDictionary::LogfileGroup ndb_lg;
    NdbDictionary::Undofile ndb_uf;
    NdbDictionary::ObjectId objid;
    if (info->undo_file_name == NULL)
    {
      /*
@@ -10074,7 +10086,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
      DBUG_RETURN(1);
    }
    errmsg= "LOGFILE GROUP";
    if (dict->createLogfileGroup(ndb_lg))
    if (dict->createLogfileGroup(ndb_lg, &objid))
    {
      goto ndberror;
    }
@@ -10086,7 +10098,15 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
    errmsg= "UNDOFILE";
    if (dict->createUndofile(ndb_uf))
    {
      goto ndberror;
      err= dict->getNdbError();
      NdbDictionary::LogfileGroup tmp= dict->getLogfileGroup(ndb_lg.getName());
      if (dict->getNdbError().code == 0 &&
	  tmp.getObjectId() == objid.getObjectId() &&
	  tmp.getObjectVersion() == objid.getObjectVersion())
      {
	dict->dropLogfileGroup(tmp);
      }
      goto ndberror2;
    }
    break;
  }
@@ -10163,7 +10183,8 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
  DBUG_RETURN(FALSE);

ndberror:
  const NdbError err= dict->getNdbError();
  err= dict->getNdbError();
ndberror2:
  ERR_PRINT(err);
  ndb_to_mysql_error(&err);
  
+1 −0
Original line number Diff line number Diff line
@@ -193,6 +193,7 @@ struct CreateFileConf {
  Uint32 senderData;
  Uint32 senderRef;
  Uint32 fileId;
  Uint32 fileVersion;
};

#endif
+29 −4
Original line number Diff line number Diff line
@@ -163,6 +163,31 @@ public:
    };
  };

  class Dictionary; // Forward declaration
  
  class ObjectId : public Object 
  {
  public:
    ObjectId();
    virtual ~ObjectId();
    
    /**
     * Get status of object
     */
    virtual Status getObjectStatus() const;
    
    /**
     * Get version of object
     */
    virtual int getObjectVersion() const;
    
    virtual int getObjectId() const;
    
  private:
    friend class Dictionary;
    class NdbDictObjectImpl & m_impl;
  };
  
  class Table; // forward declaration
  class Tablespace; // forward declaration
//  class NdbEventOperation; // forward declaration
@@ -1781,20 +1806,20 @@ public:
     * @{
     */
    
    int createLogfileGroup(const LogfileGroup &);
    int createLogfileGroup(const LogfileGroup &, ObjectId* = 0);
    int dropLogfileGroup(const LogfileGroup&);
    LogfileGroup getLogfileGroup(const char * name);

    int createTablespace(const Tablespace &);
    int createTablespace(const Tablespace &, ObjectId* = 0);
    int dropTablespace(const Tablespace&);
    Tablespace getTablespace(const char * name);
    Tablespace getTablespace(Uint32 tablespaceId);

    int createDatafile(const Datafile &, bool overwrite_existing = false);
    int createDatafile(const Datafile &, bool overwrite_existing = false, ObjectId* = 0);
    int dropDatafile(const Datafile&);
    Datafile getDatafile(Uint32 node, const char * path);
    
    int createUndofile(const Undofile &, bool overwrite_existing = false);
    int createUndofile(const Undofile &, bool overwrite_existing = false, ObjectId * = 0);
    int dropUndofile(const Undofile&);
    Undofile getUndofile(Uint32 node, const char * path);
    
Loading