Commit 9dc0942a authored by unknown's avatar unknown

Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into lmy004.:/work/mysql-5.1-tt-copy-works

parents af6d4026 0966a189
......@@ -1661,3 +1661,12 @@ zlib/*.vcproj
client/mysqlslap
storage/archive/archive_test
item_xmlfunc.cc
storage/ndb/test/ndbapi/DbAsyncGenerator
storage/ndb/test/ndbapi/DbCreate
storage/ndb/test/ndbapi/ndbapi_slow_select
storage/ndb/test/ndbapi/testBitfield
storage/ndb/test/ndbapi/testLcp
storage/ndb/test/ndbapi/testPartitioning
storage/ndb/test/ndbapi/testReadPerf
storage/ndb/test/ndbapi/test_event_merge
storage/ndb/test/tools/listen_event
......@@ -4,21 +4,23 @@ ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
alter logfile group lg1
add undofile 'undofile02.dat'
initial_size 4M engine=ndb;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
alter tablespace ts1
add datafile 'datafile02.dat'
initial_size 4M engine=ndb;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB;
CREATE TABLE t1
(pk1 int not null primary key, b int not null, c int not null)
tablespace ts1 storage disk
engine ndb;
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
TABLESPACE ts1 STORAGE DISK
ENGINE=NDB;
INSERT INTO t1 VALUES (0, 0, 0);
SELECT * FROM t1;
pk1 b c
......@@ -130,225 +132,225 @@ COUNT(*)
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'x.dat'
INITIAL_SIZE 10y
engine = ndb;
ENGINE = NDB;
ERROR HY000: A size parameter was incorrectly specified, either number or on the form 10M
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'x.dat'
INITIAL_SIZE 10MB
engine=ndb;
ENGINE = NDB;
ERROR HY000: A size parameter was incorrectly specified, either number or on the form 10M
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'x.dat'
INITIAL_SIZE 10 MB
engine=ndb;
ENGINE = NDB;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MB
engine=ndb' at line 3
ENGINE = NDB' at line 3
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'x.dat'
INITIAL_SIZE 10 M
engine=ndb;
ENGINE = NDB;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'M
engine=ndb' at line 3
ENGINE = NDB' at line 3
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'x.dat'
INITIAL_SIZE 1000000000000K
engine=ndb;
ENGINE = NDB;
ERROR HY000: The size number was correct but we don't allow the digit part to be more than 2 billion
DROP TABLE t1;
create table t1 (a int primary key, b char(4) not null, c char(4) not null, key(b)) tablespace ts1 storage disk engine ndb;
insert into t1 values (1,'1','1'), (2,'2','2'), (3,'3','3');
begin;
update t1 set b = '2' where a = 1;
select b from t1 where a = 1;
CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE = NDB;
INSERT INTO t1 VALUES (1,'1','1'), (2,'2','2'), (3,'3','3');
BEGIN;
UPDATE t1 SET b = '2' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
2
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 2 1
update t1 set c = '2' where a = 1;
select b from t1 where a = 1;
UPDATE t1 SET c = '2' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
2
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 2 2
update t1 set b = '3' where a = 1;
select b from t1 where a = 1;
UPDATE t1 SET b = '3' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
3
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 3 2
commit;
select * from t1 order by 1;
COMMIT;
SELECT * FROM t1 ORDER BY 1;
a b c
1 3 2
2 2 2
3 3 3
begin;
update t1 set c = '3' where a = 1;
select b from t1 where a = 1;
BEGIN;
UPDATE t1 SET c = '3' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
3
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 3 3
update t1 set b = '4' where a = 1;
select b from t1 where a = 1;
UPDATE t1 SET b = '4' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
4
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 4 3
update t1 set c = '4' where a = 1;
select b from t1 where a = 1;
UPDATE t1 SET c = '4' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
4
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 4 4
commit;
select * from t1 order by 1;
COMMIT;
SELECT * FROM t1 ORDER BY 1;
a b c
1 4 4
2 2 2
3 3 3
update t1 set b = '5' where a = 1;
select * from t1 order by 1;
UPDATE t1 SET b = '5' WHERE a = 1;
SELECT * FROM t1 ORDER BY 1;
a b c
1 5 4
2 2 2
3 3 3
update t1 set b = '6' where b = '5';
select * from t1 order by 1;
UPDATE t1 SET b = '6' WHERE b = '5';
SELECT * FROM t1 ORDER BY 1;
a b c
1 6 4
2 2 2
3 3 3
update t1 set b = '7' where c = '4';
select * from t1 order by 1;
UPDATE t1 SET b = '7'WHERE c = '4';
SELECT * FROM t1 ORDER BY 1;
a b c
1 7 4
2 2 2
3 3 3
update t1 set c = '5' where a = 1;
select * from t1 order by 1;
UPDATE t1 SET c = '5' WHERE a = 1;
SELECT * FROM t1 ORDER BY 1;
a b c
1 7 5
2 2 2
3 3 3
update t1 set c = '6' where b = '7';
select * from t1 order by 1;
UPDATE t1 SET c = '6' WHERE b = '7';
SELECT * FROM t1 ORDER BY 1;
a b c
1 7 6
2 2 2
3 3 3
update t1 set c = '7' where c = '6';
select * from t1 order by 1;
UPDATE t1 SET c = '7' WHERE c = '6';
SELECT * FROM t1 ORDER BY 1;
a b c
1 7 7
2 2 2
3 3 3
drop table t1;
create table t1 (a int primary key, b varchar(4) not null, c char(4) not null, key(b)) tablespace ts1 storage disk engine ndb;
insert into t1 values (1,'1','1'), (2,'2','2'), (3,'3','3');
begin;
update t1 set b = '2' where a = 1;
select b from t1 where a = 1;
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE NDB;
INSERT INTO t1 VALUE (1,'1','1'), (2,'2','2'), (3,'3','3');
BEGIN;
UPDATE t1 SET b = '2' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
2
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 2 1
update t1 set c = '2' where a = 1;
select b from t1 where a = 1;
UPDATE t1 SET c = '2' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
2
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 2 2
update t1 set b = '3' where a = 1;
select b from t1 where a = 1;
UPDATE t1 SET b = '3' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
3
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 3 2
commit;
select * from t1 order by 1;
COMMIT;
SELECT * FROM t1 ORDER BY 1;
a b c
1 3 2
2 2 2
3 3 3
begin;
update t1 set c = '3' where a = 1;
select b from t1 where a = 1;
BEGIN;
UPDATE t1 SET c = '3' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
3
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 3 3
update t1 set b = '4' where a = 1;
select b from t1 where a = 1;
UPDATE t1 SET b = '4' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
4
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 4 3
update t1 set c = '4' where a = 1;
select b from t1 where a = 1;
UPDATE t1 SET c = '4' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
b
4
select * from t1 where a = 1;
SELECT * FROM t1 WHERE a = 1;
a b c
1 4 4
commit;
select * from t1 order by 1;
COMMIT;
SELECT * FROM t1 ORDER BY 1;
a b c
1 4 4
2 2 2
3 3 3
update t1 set b = '5' where a = 1;
select * from t1 order by 1;
UPDATE t1 SET b = '5' WHERE a = 1;
SELECT * FROM t1 ORDER BY 1;
a b c
1 5 4
2 2 2
3 3 3
update t1 set b = '6' where b = '5';
select * from t1 order by 1;
UPDATE t1 SET b = '6' WHERE b = '5';
SELECT * FROM t1 ORDER BY 1;
a b c
1 6 4
2 2 2
3 3 3
update t1 set b = '7' where c = '4';
select * from t1 order by 1;
UPDATE t1 SET b = '7' WHERE c = '4';
SELECT * FROM t1 ORDER BY 1;
a b c
1 7 4
2 2 2
3 3 3
update t1 set c = '5' where a = 1;
select * from t1 order by 1;
UPDATE t1 SET c = '5' WHERE a = 1;
SELECT * FROM t1 ORDER BY 1;
a b c
1 7 5
2 2 2
3 3 3
update t1 set c = '6' where b = '7';
select * from t1 order by 1;
UPDATE t1 SET c = '6' WHERE b = '7';
SELECT * FROM t1 ORDER BY 1;
a b c
1 7 6
2 2 2
3 3 3
update t1 set c = '7' where c = '6';
select * from t1 order by 1;
UPDATE t1 SET c = '7' WHERE c = '6';
SELECT * FROM t1 ORDER BY 1;
a b c
1 7 7
2 2 2
3 3 3
drop table t1;
create table t1 (
a int not null primary key,
b text not null
) tablespace ts1 storage disk engine=ndbcluster;
DROP TABLE t1;
CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY,
b TEXT NOT NULL
) TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER;
set @x0 = '01234567012345670123456701234567';
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
set @b1 = 'b1';
......@@ -361,37 +363,43 @@ set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
insert into t1 values(1,@b1);
insert into t1 values(2,@b2);
select a,length(b),substr(b,1+2*900,2) from t1 where a=1;
INSERT INTO t1 VALUES(1,@b1);
INSERT INTO t1 VALUES(2,@b2);
SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=1;
a length(b) substr(b,1+2*900,2)
1 2256 b1
select a,length(b),substr(b,1+2*9000,2) from t1 where a=2;
SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=2;
a length(b) substr(b,1+2*9000,2)
2 20000 b2
update t1 set b=@b2 where a=1;
update t1 set b=@b1 where a=2;
select a,length(b),substr(b,1+2*9000,2) from t1 where a=1;
UPDATE t1 SET b=@b2 WHERE a=1;
UPDATE t1 SET b=@b1 WHERE a=2;
SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=1;
a length(b) substr(b,1+2*9000,2)
1 20000 b2
select a,length(b),substr(b,1+2*900,2) from t1 where a=2;
SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=2;
a length(b) substr(b,1+2*900,2)
2 2256 b1
update t1 set b=concat(b,b) where a=1;
update t1 set b=concat(b,b) where a=2;
select a,length(b),substr(b,1+4*9000,2) from t1 where a=1;
UPDATE t1 SET b=concat(b,b) WHERE a=1;
UPDATE t1 SET b=concat(b,b) WHERE a=2;
SELECT a,length(b),substr(b,1+4*9000,2) FROM t1 WHERE a=1;
a length(b) substr(b,1+4*9000,2)
1 40000 b2
select a,length(b),substr(b,1+4*900,2) from t1 where a=2;
SELECT a,length(b),substr(b,1+4*900,2) FROM t1 WHERE a=2;
a length(b) substr(b,1+4*900,2)
2 4512 b1
delete from t1 where a=1;
delete from t1 where a=2;
select count(*) from t1;
count(*)
DELETE FROM t1 WHERE a=1;
DELETE FROM t1 WHERE a=2;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
drop table t1;
alter tablespace ts1 drop datafile 'datafile.dat' engine = ndb;
alter tablespace ts1 drop datafile 'datafile02.dat' engine = ndb;
drop tablespace ts1 engine = ndb;
drop logfile group lg1 engine = ndb;
DROP TABLE t1;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE = NDB;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile02.dat'
ENGINE = NDB;
DROP TABLESPACE ts1
ENGINE = NDB;
DROP LOGFILE GROUP lg1
ENGINE =NDB;
DROP TABLE IF EXISTS t1;
**** Begin Duplicate Statement Testing ****
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
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;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M ENGINE=NDB;
ERROR HY000: Failed to alter: CREATE UNDOFILE
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
ERROR HY000: Failed to create TABLESPACE
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
ENGINE=NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
ENGINE=NDB;
ERROR HY000: Failed to alter: CREATE DATAFILE
CREATE TABLE t1
(pk1 int not null primary key, b int not null, c int not null)
tablespace ts1 storage disk
engine ndb;
CREATE TABLE t1
(pk1 int not null primary key, b int not null, c int not null)
tablespace ts1 storage disk
engine ndb;
ERROR 42S01: Table 't1' already exists
DROP TABLE t1;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile2.dat'
ENGINE=NDB;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile2.dat'
ENGINE=NDB;
ERROR HY000: Failed to alter: NO SUCH FILE
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE=NDB;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE=NDB;
ERROR HY000: Failed to alter: NO SUCH FILE
DROP TABLESPACE ts1
ENGINE=NDB;
DROP TABLESPACE ts1
ENGINE=NDB;
ERROR HY000: Failed to drop TABLESPACE
DROP LOGFILE GROUP lg1
ENGINE=NDB;
DROP LOGFILE GROUP lg1
ENGINE=NDB;
ERROR HY000: Failed to drop LOGFILE GROUP
**** End Duplicate Statement Testing ****
**** Begin Statment CaSe Testing ****
creaTE LOgfilE GrOuP lg1
adD undoFILE 'undofile.dat'
initiAL_siZE 16M
UnDo_BuFfEr_SiZe = 1M
ENGInE=NDb;
altER LOgFiLE GrOUp lg1
AdD UnDOfILe 'undofile02.dat'
INItIAl_SIzE 4M ENgINE nDB;
CrEAtE TABLEspaCE ts1
ADD DATAfilE 'datafile.dat'
UsE LoGFiLE GRoUP lg1
INITiaL_SizE 12M
ENGiNe NDb;
AlTeR tAbLeSpAcE ts1
AdD DaTaFiLe 'datafile2.dat'
InItIaL_SiZe 12M
EnGiNe=NDB;
CREATE TABLE t1
(pk1 int not null primary key, b int not null, c int not null)
TABLEspace ts1 storAGE dISk
ENGine nDb;
DROP TABLE t1;
AlteR TAblespaCE ts1
droP DATAfile 'datafile2.dat'
ENGINE=NDB;
ALter tablesPACE ts1
dROp dAtAfIlE 'datafile.dat'
ENGine=Ndb;
DrOp TaBleSpAcE ts1
engINE=ndB;
DrOp lOgFiLe GrOuP lg1
EnGiNe=nDb;
**** End Statment CaSe Testing ****
**** Begin = And No = Testing ****
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE=16M
UNDO_BUFFER_SIZE=1M
ENGINE=NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE=4M
ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE=12M
ENGINE=NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE=12M
ENGINE=NDB;
CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
TABLESPACE ts1 STORAGE DISK
ENGINE=NDB;
DROP TABLE t1;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile2.dat'
ENGINE=NDB;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE=NDB;
DROP TABLESPACE ts1
ENGINE=NDB;
DROP LOGFILE GROUP lg1
ENGINE=NDB;
**** End of = ****
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M
ENGINE NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
ENGINE NDB;
CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
TABLESPACE ts1 STORAGE DISK
ENGINE NDB;
DROP TABLE t1;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile2.dat'
ENGINE NDB;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE NDB;
DROP TABLESPACE ts1
ENGINE NDB;
DROP LOGFILE GROUP lg1
ENGINE NDB;
**** End = And No = ****
#################################
# Author: JO
# Org Date: ?
# Purpose: To test basic Cluster Disk Data
#################################
# Change Author: JBM
# Change Date: 2006-01-11
# Change: Cleanup and test rename
#################################
-- source include/have_ndb.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
#
##################################
# Basic test of disk tables for NDB
#
#
# Start by creating a logfile group
#
##################################
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
......@@ -18,13 +25,14 @@ INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
alter logfile group lg1
add undofile 'undofile02.dat'
initial_size 4M engine=ndb;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB;
#
###################################################
# Create a tablespace connected to the logfile group
#
###################################################
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
......@@ -32,18 +40,19 @@ USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
alter tablespace ts1
add datafile 'datafile02.dat'
initial_size 4M engine=ndb;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB;
#
########################################
# Create a table using this tablespace
#
########################################
CREATE TABLE t1
(pk1 int not null primary key, b int not null, c int not null)
tablespace ts1 storage disk
engine ndb;
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
TABLESPACE ts1 STORAGE DISK
ENGINE=NDB;
INSERT INTO t1 VALUES (0, 0, 0);
SELECT * FROM t1;
......@@ -152,128 +161,138 @@ INSERT INTO t1 VALUES
SELECT COUNT(*) FROM t1;
#
####################################
# Test error cases with size numbers
#
####################################
--error ER_WRONG_SIZE_NUMBER
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'x.dat'
INITIAL_SIZE 10y
engine = ndb;
ENGINE = NDB;
--error ER_WRONG_SIZE_NUMBER
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'x.dat'
INITIAL_SIZE 10MB
engine=ndb;
ENGINE = NDB;
--error 1064
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'x.dat'
INITIAL_SIZE 10 MB
engine=ndb;
ENGINE = NDB;
--error 1064
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'x.dat'
INITIAL_SIZE 10 M
engine=ndb;
ENGINE = NDB;
--error ER_SIZE_OVERFLOW_ERROR
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'x.dat'
INITIAL_SIZE 1000000000000K
engine=ndb;
ENGINE = NDB;
DROP TABLE t1;
############################
# Test update of mm/dd part
create table t1 (a int primary key, b char(4) not null, c char(4) not null, key(b)) tablespace ts1 storage disk engine ndb;
insert into t1 values (1,'1','1'), (2,'2','2'), (3,'3','3');
begin;
update t1 set b = '2' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
update t1 set c = '2' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
update t1 set b = '3' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
commit;
select * from t1 order by 1;
begin;
update t1 set c = '3' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
update t1 set b = '4' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
update t1 set c = '4' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
commit;
select * from t1 order by 1;
update t1 set b = '5' where a = 1;
select * from t1 order by 1;
update t1 set b = '6' where b = '5';
select * from t1 order by 1;
update t1 set b = '7' where c = '4';
select * from t1 order by 1;
update t1 set c = '5' where a = 1;
select * from t1 order by 1;
update t1 set c = '6' where b = '7';
select * from t1 order by 1;
update t1 set c = '7' where c = '6';
select * from t1 order by 1;
drop table t1;
create table t1 (a int primary key, b varchar(4) not null, c char(4) not null, key(b)) tablespace ts1 storage disk engine ndb;
insert into t1 values (1,'1','1'), (2,'2','2'), (3,'3','3');
begin;
update t1 set b = '2' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
update t1 set c = '2' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
update t1 set b = '3' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
commit;
select * from t1 order by 1;
begin;
update t1 set c = '3' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
update t1 set b = '4' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
update t1 set c = '4' where a = 1;
select b from t1 where a = 1;
select * from t1 where a = 1;
commit;
select * from t1 order by 1;
update t1 set b = '5' where a = 1;
select * from t1 order by 1;
update t1 set b = '6' where b = '5';
select * from t1 order by 1;
update t1 set b = '7' where c = '4';
select * from t1 order by 1;
update t1 set c = '5' where a = 1;
select * from t1 order by 1;
update t1 set c = '6' where b = '7';
select * from t1 order by 1;
update t1 set c = '7' where c = '6';
select * from t1 order by 1;
drop table t1;
############################
CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE = NDB;
INSERT INTO t1 VALUES (1,'1','1'), (2,'2','2'), (3,'3','3');
BEGIN;
UPDATE t1 SET b = '2' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
UPDATE t1 SET c = '2' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
UPDATE t1 SET b = '3' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
COMMIT;
SELECT * FROM t1 ORDER BY 1;
BEGIN;
UPDATE t1 SET c = '3' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
UPDATE t1 SET b = '4' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
UPDATE t1 SET c = '4' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
COMMIT;
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET b = '5' WHERE a = 1;
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET b = '6' WHERE b = '5';
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET b = '7'WHERE c = '4';
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET c = '5' WHERE a = 1;
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET c = '6' WHERE b = '7';
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET c = '7' WHERE c = '6';
SELECT * FROM t1 ORDER BY 1;
DROP TABLE t1;
#####
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE NDB;
INSERT INTO t1 VALUE (1,'1','1'), (2,'2','2'), (3,'3','3');
BEGIN;
UPDATE t1 SET b = '2' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
UPDATE t1 SET c = '2' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
UPDATE t1 SET b = '3' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
COMMIT;
SELECT * FROM t1 ORDER BY 1;
BEGIN;
UPDATE t1 SET c = '3' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
UPDATE t1 SET b = '4' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
UPDATE t1 SET c = '4' WHERE a = 1;
SELECT b FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 1;
COMMIT;
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET b = '5' WHERE a = 1;
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET b = '6' WHERE b = '5';
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET b = '7' WHERE c = '4';
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET c = '5' WHERE a = 1;
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET c = '6' WHERE b = '7';
SELECT * FROM t1 ORDER BY 1;
UPDATE t1 SET c = '7' WHERE c = '6';
SELECT * FROM t1 ORDER BY 1;
DROP TABLE t1;
########################
# Test for blobs...
create table t1 (
a int not null primary key,
b text not null
) tablespace ts1 storage disk engine=ndbcluster;
########################
CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY,
b TEXT NOT NULL
) TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER;
# b1 length 2000+256 (blob part aligned)
#########################################
set @x0 = '01234567012345670123456701234567';
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
set @b1 = 'b1';
......@@ -282,31 +301,46 @@ set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@x0);
# b2 length 20000
##########################################
set @b2 = 'b2';
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
insert into t1 values(1,@b1);
insert into t1 values(2,@b2);
select a,length(b),substr(b,1+2*900,2) from t1 where a=1;
select a,length(b),substr(b,1+2*9000,2) from t1 where a=2;
update t1 set b=@b2 where a=1;
update t1 set b=@b1 where a=2;
select a,length(b),substr(b,1+2*9000,2) from t1 where a=1;
select a,length(b),substr(b,1+2*900,2) from t1 where a=2;
update t1 set b=concat(b,b) where a=1;
update t1 set b=concat(b,b) where a=2;
select a,length(b),substr(b,1+4*9000,2) from t1 where a=1;
select a,length(b),substr(b,1+4*900,2) from t1 where a=2;
delete from t1 where a=1;
delete from t1 where a=2;
select count(*) from t1;
drop table t1;
alter tablespace ts1 drop datafile 'datafile.dat' engine = ndb;
alter tablespace ts1 drop datafile 'datafile02.dat' engine = ndb;
drop tablespace ts1 engine = ndb;
drop logfile group lg1 engine = ndb;
INSERT INTO t1 VALUES(1,@b1);
INSERT INTO t1 VALUES(2,@b2);
SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=1;
SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=2;
UPDATE t1 SET b=@b2 WHERE a=1;
UPDATE t1 SET b=@b1 WHERE a=2;
SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=1;
SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=2;
UPDATE t1 SET b=concat(b,b) WHERE a=1;
UPDATE t1 SET b=concat(b,b) WHERE a=2;
SELECT a,length(b),substr(b,1+4*9000,2) FROM t1 WHERE a=1;
SELECT a,length(b),substr(b,1+4*900,2) FROM t1 WHERE a=2;
DELETE FROM t1 WHERE a=1;
DELETE FROM t1 WHERE a=2;
SELECT COUNT(*) FROM t1;
DROP TABLE t1;
###################
# Test Cleanup
###################
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE = NDB;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile02.dat'
ENGINE = NDB;
DROP TABLESPACE ts1
ENGINE = NDB;
DROP LOGFILE GROUP lg1
ENGINE =NDB;
#End 5.1 test case
#########################################
# Author: JBM
# Date: 2006-01-03
# Purpose: Test the NDB engine reaction to duplicate
# Table spaces and log groups. Also to test
# Statement mixed case.
############################################
-- source include/have_ndb.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
############## Duplcate Statement Testing #########
--echo **** Begin Duplicate Statement Testing ****
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
--error 1502
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M ENGINE NDB;
--error 1507
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
--error 1502 # Bug 16158
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
# Currently a bug, bug#16158
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
ENGINE=NDB;
--error 1507 # Currently a bug, bug#16158
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
ENGINE=NDB;
CREATE TABLE t1
(pk1 int not null primary key, b int not null, c int not null)
tablespace ts1 storage disk
engine ndb;
--error 1050
CREATE TABLE t1
(pk1 int not null primary key, b int not null, c int not null)
tablespace ts1 storage disk
engine ndb;
DROP TABLE t1;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile2.dat'
ENGINE=NDB;
--error 1507
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile2.dat'
ENGINE=NDB;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE=NDB;
--error 1507
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE=NDB;
DROP TABLESPACE ts1
ENGINE=NDB;
--error 1503
DROP TABLESPACE ts1
ENGINE=NDB;
DROP LOGFILE GROUP lg1
ENGINE=NDB;
--error 1503
DROP LOGFILE GROUP lg1
ENGINE=NDB;
--echo **** End Duplicate Statement Testing ****
############# End Duplicate Statments ############
--echo
############ Begin CaSe Testing ##################
--echo **** Begin Statment CaSe Testing ****
creaTE LOgfilE GrOuP lg1
adD undoFILE 'undofile.dat'
initiAL_siZE 16M
UnDo_BuFfEr_SiZe = 1M
ENGInE=NDb;
altER LOgFiLE GrOUp lg1
AdD UnDOfILe 'undofile02.dat'
INItIAl_SIzE 4M ENgINE nDB;
CrEAtE TABLEspaCE ts1
ADD DATAfilE 'datafile.dat'
UsE LoGFiLE GRoUP lg1
INITiaL_SizE 12M
ENGiNe NDb;
AlTeR tAbLeSpAcE ts1
AdD DaTaFiLe 'datafile2.dat'
InItIaL_SiZe 12M
EnGiNe=NDB;
CREATE TABLE t1
(pk1 int not null primary key, b int not null, c int not null)
TABLEspace ts1 storAGE dISk
ENGine nDb;
DROP TABLE t1;
AlteR TAblespaCE ts1
droP DATAfile 'datafile2.dat'
ENGINE=NDB;
ALter tablesPACE ts1
dROp dAtAfIlE 'datafile.dat'
ENGine=Ndb;
DrOp TaBleSpAcE ts1
engINE=ndB;
DrOp lOgFiLe GrOuP lg1
EnGiNe=nDb;
--echo **** End Statment CaSe Testing ****
############ End CaSe Testing ##################
--echo
############ Begin = and no = Testing ##########
--echo **** Begin = And No = Testing ****
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE=16M
UNDO_BUFFER_SIZE=1M
ENGINE=NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE=4M
ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE=12M
ENGINE=NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE=12M
ENGINE=NDB;
CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
TABLESPACE ts1 STORAGE DISK
ENGINE=NDB;
DROP TABLE t1;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile2.dat'
ENGINE=NDB;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE=NDB;
DROP TABLESPACE ts1
ENGINE=NDB;
DROP LOGFILE GROUP lg1
ENGINE=NDB;
--echo
--echo **** End of = ****
--echo
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M
ENGINE NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
ENGINE NDB;
CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
TABLESPACE ts1 STORAGE DISK
ENGINE NDB;
DROP TABLE t1;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile2.dat'
ENGINE NDB;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE NDB;
DROP TABLESPACE ts1
ENGINE NDB;
DROP LOGFILE GROUP lg1
ENGINE NDB;
--echo **** End = And No = ****
############ End = And No = ##################
# End 5.1 test
......@@ -30,7 +30,8 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
*/
hton= ha_resolve_by_legacy_type(thd, ts_info->storage_engine);
if (hton->alter_tablespace && (error= hton->alter_tablespace(thd, ts_info)))
if (hton->state == SHOW_OPTION_YES &&
hton->alter_tablespace && (error= hton->alter_tablespace(thd, ts_info)))
{
if (error == HA_ADMIN_NOT_IMPLEMENTED)
{
......@@ -46,5 +47,10 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
}
DBUG_RETURN(error);
}
if (mysql_bin_log.is_open())
{
thd->binlog_query(THD::STMT_QUERY_TYPE,
thd->query, thd->query_length, FALSE, TRUE);
}
DBUG_RETURN(FALSE);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment