Commit 0f57c004 authored by unknown's avatar unknown

Manual merge


mysql-test/t/rpl_ddl.test:
  Auto merged
ndb/test/ndbapi/testBlobs.cpp:
  Auto merged
sql/sql_select.cc:
  Auto merged
parents af27fd8a 25136336
...@@ -4,6 +4,12 @@ ...@@ -4,6 +4,12 @@
# the $variables is extreme sensitive. # the $variables is extreme sensitive.
# #
###############################################################
# Debug options : To debug this test script
###############################################################
let $showbinlog= 0;
let $manipulate= 1;
######## The typical test sequence ######## The typical test sequence
# 1. INSERT without commit # 1. INSERT without commit
# check table content of master and slave # check table content of master and slave
...@@ -52,9 +58,12 @@ let $MAX= `SELECT MAX(f1) FROM t1` ; ...@@ -52,9 +58,12 @@ let $MAX= `SELECT MAX(f1) FROM t1` ;
eval INSERT INTO t1 SET f1= $MAX + 1; eval INSERT INTO t1 SET f1= $MAX + 1;
# results before DDL(to be tested) # results before DDL(to be tested)
SELECT MAX(f1) FROM t1; SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION --replace_result $VERSION VERSION
--replace_column 2 # 5 # --replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master; sync_slave_with_master;
connection slave; connection slave;
...@@ -63,9 +72,12 @@ SELECT '-------- switch to slave --------' as ""; ...@@ -63,9 +72,12 @@ SELECT '-------- switch to slave --------' as "";
--enable_query_log --enable_query_log
# results before DDL(to be tested) # results before DDL(to be tested)
SELECT MAX(f1) FROM t1; SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION --replace_result $VERSION VERSION
--replace_column 2 # 5 # --replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
}
############################################################### ###############################################################
# command to be tested # command to be tested
...@@ -79,9 +91,12 @@ eval $my_stmt; ...@@ -79,9 +91,12 @@ eval $my_stmt;
let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT; let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT;
# results after DDL(to be tested) # results after DDL(to be tested)
SELECT MAX(f1) FROM t1; SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION --replace_result $VERSION VERSION
--replace_column 2 # 5 # --replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master; sync_slave_with_master;
connection slave; connection slave;
...@@ -90,9 +105,12 @@ SELECT '-------- switch to slave --------' as ""; ...@@ -90,9 +105,12 @@ SELECT '-------- switch to slave --------' as "";
--enable_query_log --enable_query_log
# results after DDL(to be tested) # results after DDL(to be tested)
SELECT MAX(f1) FROM t1; SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION --replace_result $VERSION VERSION
--replace_column 2 # 5 # --replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
}
############################################################### ###############################################################
# ROLLBACK # ROLLBACK
...@@ -114,9 +132,12 @@ eval SELECT CONCAT(CONCAT('TEST-INFO: MASTER: The INSERT is ', ...@@ -114,9 +132,12 @@ eval SELECT CONCAT(CONCAT('TEST-INFO: MASTER: The INSERT is ',
' (Failed)')) AS "" ' (Failed)')) AS ""
FROM mysqltest1.t1; FROM mysqltest1.t1;
--enable_query_log --enable_query_log
if ($show_binlog)
{
--replace_result $VERSION VERSION --replace_result $VERSION VERSION
--replace_column 2 # 5 # --replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master; sync_slave_with_master;
connection slave; connection slave;
...@@ -133,16 +154,17 @@ eval SELECT CONCAT(CONCAT('TEST-INFO: SLAVE: The INSERT is ', ...@@ -133,16 +154,17 @@ eval SELECT CONCAT(CONCAT('TEST-INFO: SLAVE: The INSERT is ',
' (Failed)')) AS "" ' (Failed)')) AS ""
FROM mysqltest1.t1; FROM mysqltest1.t1;
--enable_query_log --enable_query_log
if ($show_binlog)
{
--replace_result $VERSION VERSION --replace_result $VERSION VERSION
--replace_column 2 # 5 # --replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
}
############################################################### ###############################################################
# Manipulate binlog # Manipulate binlog
############################################################### ###############################################################
#let $manipulate= 0; if ($manipulate)
let $manipulate= 1;
while ($manipulate)
{ {
#### Manipulate the binary logs, #### Manipulate the binary logs,
# so that the output of SHOW BINLOG EVENTS IN <current log> # so that the output of SHOW BINLOG EVENTS IN <current log>
...@@ -171,7 +193,6 @@ flush logs; ...@@ -171,7 +193,6 @@ flush logs;
# sleep 1; # sleep 1;
# eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; # eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
inc $_log_num_n; inc $_log_num_n;
let $manipulate= 0;
} }
connection master; connection master;
......
...@@ -12,10 +12,9 @@ show status like "Qcache_queries_in_cache"; ...@@ -12,10 +12,9 @@ show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 0
drop table t1; drop table t1;
commit;
set autocommit=1; set autocommit=1;
begin;
create table t1 (a int not null) engine=bdb; create table t1 (a int not null) engine=bdb;
begin;
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
select * from t1; select * from t1;
a a
...@@ -26,7 +25,6 @@ show status like "Qcache_queries_in_cache"; ...@@ -26,7 +25,6 @@ show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 0
drop table t1; drop table t1;
commit;
create table t1 (a int not null) engine=bdb; create table t1 (a int not null) engine=bdb;
create table t2 (a int not null) engine=bdb; create table t2 (a int not null) engine=bdb;
create table t3 (a int not null) engine=bdb; create table t3 (a int not null) engine=bdb;
......
...@@ -721,7 +721,8 @@ SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1 ...@@ -721,7 +721,8 @@ SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1
WHERE hostname LIKE '%aol%' WHERE hostname LIKE '%aol%'
GROUP BY hostname; GROUP BY hostname;
hostname no hostname no
cache-dtc-af05.proxy.aol.com 1 cache-dtc-af05.proxy.aol.com
DROP TABLE t1; 1
drop table if exists t1, t2; drop table if exists t1, t2;
Warnings: Warnings:
Note 1051 Unknown table 't2' Note 1051 Unknown table 't2'
...@@ -746,3 +747,13 @@ aaa ...@@ -746,3 +747,13 @@ aaa
show warnings; show warnings;
Level Code Message Level Code Message
drop table t1, t2; drop table t1, t2;
DROP TABLE t1;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,2), (1,3);
SELECT a, b FROM t1 GROUP BY 'const';
a b
1 2
SELECT DISTINCT a, b FROM t1 GROUP BY 'const';
a b
1 2
DROP TABLE t1;
...@@ -14,15 +14,13 @@ insert into t1 values (1),(2),(3); ...@@ -14,15 +14,13 @@ insert into t1 values (1),(2),(3);
select * from t1; select * from t1;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
drop table t1; drop table t1;
commit;
set autocommit=1; set autocommit=1;
begin;
create table t1 (a int not null) engine=bdb; create table t1 (a int not null) engine=bdb;
begin;
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
select * from t1; select * from t1;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
drop table t1; drop table t1;
commit;
create table t1 (a int not null) engine=bdb; create table t1 (a int not null) engine=bdb;
create table t2 (a int not null) engine=bdb; create table t2 (a int not null) engine=bdb;
create table t3 (a int not null) engine=bdb; create table t3 (a int not null) engine=bdb;
......
# Initialise # Initialise
--disable_warnings --disable_warnings
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
...@@ -524,7 +525,7 @@ select min(b) from t1; ...@@ -524,7 +525,7 @@ select min(b) from t1;
drop table t1; drop table t1;
# #
# Test for bug #11088: GROUP BY a BLOB colimn with COUNT(DISTINCT column1) # Test for bug #11088: GROUP BY a BLOB column with COUNT(DISTINCT column1)
# #
CREATE TABLE t1 (id int PRIMARY KEY, user_id int, hostname longtext); CREATE TABLE t1 (id int PRIMARY KEY, user_id int, hostname longtext);
...@@ -539,6 +540,8 @@ SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1 ...@@ -539,6 +540,8 @@ SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1
WHERE hostname LIKE '%aol%' WHERE hostname LIKE '%aol%'
GROUP BY hostname; GROUP BY hostname;
DROP TABLE t1;
# #
# Bug#11211: Ambiguous column reference in GROUP BY. # Bug#11211: Ambiguous column reference in GROUP BY.
# #
...@@ -563,3 +566,14 @@ group by t1.c1; ...@@ -563,3 +566,14 @@ group by t1.c1;
show warnings; show warnings;
drop table t1, t2; drop table t1, t2;
#
# Test for bug #8614: GROUP BY 'const with DISTINCT
#
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,2), (1,3);
SELECT a, b FROM t1 GROUP BY 'const';
SELECT DISTINCT a, b FROM t1 GROUP BY 'const';
DROP TABLE t1;
...@@ -365,7 +365,7 @@ calcBval(const Bcol& b, Bval& v, bool keepsize) ...@@ -365,7 +365,7 @@ calcBval(const Bcol& b, Bval& v, bool keepsize)
{ {
if (b.m_nullable && urandom(10) == 0) { if (b.m_nullable && urandom(10) == 0) {
v.m_len = 0; v.m_len = 0;
delete v.m_val; delete [] v.m_val;
v.m_val = 0; v.m_val = 0;
v.m_buf = new char [1]; v.m_buf = new char [1];
} else { } else {
...@@ -375,7 +375,7 @@ calcBval(const Bcol& b, Bval& v, bool keepsize) ...@@ -375,7 +375,7 @@ calcBval(const Bcol& b, Bval& v, bool keepsize)
v.m_len = urandom(b.m_inline); v.m_len = urandom(b.m_inline);
else else
v.m_len = urandom(b.m_inline + g_opt.m_parts * b.m_partsize + 1); v.m_len = urandom(b.m_inline + g_opt.m_parts * b.m_partsize + 1);
delete v.m_val; delete [] v.m_val;
v.m_val = new char [v.m_len + 1]; v.m_val = new char [v.m_len + 1];
for (unsigned i = 0; i < v.m_len; i++) for (unsigned i = 0; i < v.m_len; i++)
v.m_val[i] = 'a' + urandom(25); v.m_val[i] = 'a' + urandom(25);
...@@ -1445,6 +1445,7 @@ testperf() ...@@ -1445,6 +1445,7 @@ testperf()
if (! testcase('p')) if (! testcase('p'))
return 0; return 0;
DBG("=== perf test ==="); DBG("=== perf test ===");
g_bh1 = g_bh2 = 0;
g_ndb = new Ndb(g_ncc, "TEST_DB"); g_ndb = new Ndb(g_ncc, "TEST_DB");
CHK(g_ndb->init() == 0); CHK(g_ndb->init() == 0);
CHK(g_ndb->waitUntilReady() == 0); CHK(g_ndb->waitUntilReady() == 0);
......
...@@ -812,9 +812,14 @@ JOIN::optimize() ...@@ -812,9 +812,14 @@ JOIN::optimize()
DBUG_RETURN(1); DBUG_RETURN(1);
} }
simple_group= 0; simple_group= 0;
group_list= remove_const(this, group_list, conds, {
rollup.state == ROLLUP::STATE_NONE, ORDER *old_group_list;
&simple_group); group_list= remove_const(this, (old_group_list= group_list), conds,
rollup.state == ROLLUP::STATE_NONE,
&simple_group);
if (old_group_list && !group_list)
select_distinct= 0;
}
if (!group_list && group) if (!group_list && group)
{ {
order=0; // The output has only one row order=0; // The output has only one row
...@@ -11644,9 +11649,9 @@ store_record_in_cache(JOIN_CACHE *cache) ...@@ -11644,9 +11649,9 @@ store_record_in_cache(JOIN_CACHE *cache)
end > str && end[-1] == ' ' ; end > str && end[-1] == ' ' ;
end--) ; end--) ;
length=(uint) (end-str); length=(uint) (end-str);
memcpy(pos+sizeof(uint), str, length); memcpy(pos+sizeof(length), str, length);
*((uint *) pos)= length; memcpy_fixed(pos, &length, sizeof(length));
pos+= length+sizeof(uint); pos+= length+sizeof(length);
} }
else else
{ {
...@@ -11709,9 +11714,10 @@ read_cached_record(JOIN_TAB *tab) ...@@ -11709,9 +11714,10 @@ read_cached_record(JOIN_TAB *tab)
{ {
if (copy->strip) if (copy->strip)
{ {
memcpy(copy->str, pos+sizeof(uint), length= *((uint *) pos)); memcpy_fixed(&length, pos, sizeof(length));
memcpy(copy->str, pos+sizeof(length), length);
memset(copy->str+length, ' ', copy->length-length); memset(copy->str+length, ' ', copy->length-length);
pos+= sizeof(uint)+length; pos+= sizeof(length)+length;
} }
else else
{ {
......
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