Commit b75eeb27 authored by Rich Prohaska's avatar Rich Prohaska

#203 run clustering key tests on percona server

parent f02c041d
......@@ -2,8 +2,7 @@ SET DEFAULT_STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar;
set session tokudb_disable_slow_alter=ON;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (a), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
create table bar (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (a), key (b))engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d int default 20;
......@@ -141,8 +140,7 @@ a b c
drop table foo;
drop table bar;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (c), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
create table bar (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (c), key (b))engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d int default 20;
......
......@@ -2,8 +2,7 @@ SET DEFAULT_STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar;
set session tokudb_disable_slow_alter=ON;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (a), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
create table bar (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (a), key (b))engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d varchar(10) default 20;
......@@ -141,8 +140,7 @@ a b c
drop table foo;
drop table bar;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (c), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
create table bar (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (c), key (b))engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
alter table foo add column d varchar(10) default 20;
......
......@@ -2,8 +2,7 @@ SET DEFAULT_STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo,bar, foo_isam, bar_isam;
set session tokudb_disable_slow_alter=OFF;
create table foo (aa int, bb int, cc int, dd int, ee int, a int, b varchar(20), c int, d int, e int, primary key (e), key(d), unique key(c), clustering key (b))engine=TokuDB;
create table foo_isam like foo;
alter table foo_isam engine=MyISAM;
create table foo_isam (aa int, bb int, cc int, dd int, ee int, a int, b varchar(20), c int, d int, e int, primary key (e), key(d), unique key(c), key (b))engine=MyISAM;
create table bar (a int) engine=TokuDB;
create table bar_isam like bar;
alter table bar_isam engine=MyISAM;
......@@ -79,7 +78,7 @@ foo_isam CREATE TABLE `foo_isam` (
PRIMARY KEY (`a`),
UNIQUE KEY `c` (`c`),
KEY `d` (`d`),
CLUSTERING KEY `b` (`b`)
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table foo change column aa aa int NOT NULL;
alter table foo_isam change column aa aa int NOT NULL;
......
......@@ -10,8 +10,7 @@ set session tokudb_disable_slow_alter=ON;
let $diff_tables= test.foo, test.bar;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (a), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
create table bar (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (a), key (b))engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
......@@ -60,8 +59,7 @@ drop table foo;
drop table bar;
create table foo (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (c), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
create table bar (a int NOT NULL, b bigint NOT NULL, c mediumint NOT NULL, primary key (c), key (b))engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
......
......@@ -10,8 +10,7 @@ set session tokudb_disable_slow_alter=ON;
let $diff_tables= test.foo, test.bar;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (a), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
create table bar (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (a), key (b))engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
......@@ -60,8 +59,7 @@ drop table foo;
drop table bar;
create table foo (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (c), clustering key (b))engine=TokuDB;
create table bar like foo;
alter table bar engine=MyISAM;
create table bar (a varchar(10) NOT NULL, b varchar(10) NOT NULL, c varchar(10) NOT NULL, primary key (c), key (b))engine=MyISAM;
insert into foo values (1,10,100),(-1,-1,-1),(2,20,200);
insert into bar select * from foo;
......
......@@ -9,8 +9,7 @@ set session tokudb_disable_slow_alter=OFF;
let $diff_tables= test.foo, test.foo_isam;
create table foo (aa int, bb int, cc int, dd int, ee int, a int, b varchar(20), c int, d int, e int, primary key (e), key(d), unique key(c), clustering key (b))engine=TokuDB;
create table foo_isam like foo;
alter table foo_isam engine=MyISAM;
create table foo_isam (aa int, bb int, cc int, dd int, ee int, a int, b varchar(20), c int, d int, e int, primary key (e), key(d), unique key(c), key (b))engine=MyISAM;
create table bar (a int) engine=TokuDB;
create table bar_isam like bar;
alter table bar_isam engine=MyISAM;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -116,49 +116,6 @@ class Field_blob(Field):
self.idx += 1
return Field_blob(self.name, self.size, self.is_nullible, self.idx)
def main():
experiments = 1000
nrows = 10
seed = 0
for arg in sys.argv[1:]:
match = re.match("--(.*)=(.*)", arg)
if match:
exec("%s = %s" % (match.group(1),match.group(2)))
random.seed(seed)
header()
for experiment in range(experiments):
# generate a schema
fields = create_fields()
# create a table with the schema
print create_table(fields)
# insert some rows
for r in range(nrows):
print insert_row(fields) % ('t')
print "CREATE TABLE ti LIKE t;"
print "ALTER TABLE ti ENGINE=myisam;"
print "INSERT INTO ti SELECT * FROM t;"
# transform table schema and contents
for f in [ 0, 2, 3, 5, 6, 7 ]:
fields[f] = fields[f].next_field()
print "ALTER TABLE t CHANGE COLUMN %s %s %s;" % (fields[f].name, fields[f].name, fields[f].get_type())
print "ALTER TABLE ti CHANGE COLUMN %s %s %s;" % (fields[f].name, fields[f].name, fields[f].get_type())
new_row = insert_row(fields)
print new_row % ('t')
print new_row % ('ti')
# compare tables
print "let $diff_tables = test.t, test.ti;"
print "source include/diff_tables.inc;"
# cleanup
print "DROP TABLE t, ti;"
print
return 0
def create_fields():
fields = []
fields.append(create_int('a'))
......@@ -185,12 +142,16 @@ def create_varchar(name):
def create_blob(name):
return Field_blob(name, random.randint(1,2), random.randint(0,1), random.randint(0,3))
def create_table(fields):
t = "CREATE TABLE t ("
def create_table(fields, tablename, engine):
if engine == "tokudb":
key_type = "CLUSTERING KEY"
else:
key_type = "KEY"
t = "CREATE TABLE %s (" % (tablename)
for f in fields:
t += "%s %s, " % (f.name, f.get_type())
t += "KEY(b), CLUSTERING KEY(e), PRIMARY KEY(id)"
t += ");"
t += "KEY(b), %s(e), PRIMARY KEY(id)" % (key_type)
t += ") ENGINE=%s;" % (engine)
return t
def insert_row(fields):
......@@ -206,6 +167,7 @@ def insert_row(fields):
def header():
print "# generated from change_column_all.py"
print "# test random column change on wide tables"
print "source include/have_tokudb.inc;"
print "--disable_warnings"
print "DROP TABLE IF EXISTS t, ti;"
print "--enable_warnings"
......@@ -213,4 +175,47 @@ def header():
print "SET SESSION DEFAULT_STORAGE_ENGINE='TokuDB';"
print
def main():
experiments = 1000
nrows = 10
seed = 0
for arg in sys.argv[1:]:
match = re.match("--(.*)=(.*)", arg)
if match:
exec("%s = %s" % (match.group(1),match.group(2)))
random.seed(seed)
header()
for experiment in range(experiments):
# generate a schema
fields = create_fields()
# create a table with the schema
print create_table(fields, "t", "tokudb")
# insert some rows
for r in range(nrows):
print insert_row(fields) % ('t')
print create_table(fields, "ti", "myisam");
print "INSERT INTO ti SELECT * FROM t;"
# transform table schema and contents
for f in [ 0, 2, 3, 5, 6, 7 ]:
fields[f] = fields[f].next_field()
print "ALTER TABLE t CHANGE COLUMN %s %s %s;" % (fields[f].name, fields[f].name, fields[f].get_type())
print "ALTER TABLE ti CHANGE COLUMN %s %s %s;" % (fields[f].name, fields[f].name, fields[f].get_type())
new_row = insert_row(fields)
print new_row % ('t')
print new_row % ('ti')
# compare tables
print "let $diff_tables = test.t, test.ti;"
print "source include/diff_tables.inc;"
# cleanup
print "DROP TABLE t, ti;"
print
return 0
sys.exit(main())
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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