Commit 8db7aebc authored by tomas@whalegate.ndb.mysql.com's avatar tomas@whalegate.ndb.mysql.com

Merge whalegate.ndb.mysql.com:/home/tomas/cge-5.1

into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb-merge
parents 87e96633 6e4fff3f
......@@ -831,6 +831,7 @@ our @tags=
["include/have_ndb.inc", "ndb_test", 1],
["include/have_multi_ndb.inc", "ndb_test", 1],
["include/have_ndb_extra.inc", "ndb_extra", 1],
["include/ndb_master-slave.inc", "ndb_test", 1],
["require_manager", "require_manager", 1],
);
......
......@@ -409,13 +409,20 @@ sub main () {
{
# use default and add any extra_suites as defined
$opt_suites= $opt_suites_default;
my $ddd= basename(dirname($glob_mysql_test_dir));
foreach my $extra_suite (@extra_suites)
my $ccc= dirname($glob_mysql_test_dir);
my $found= 0;
while (!$found and !($ccc eq "/") and !($ccc eq ""))
{
if ($extra_suite->[0] eq "$ddd")
my $ddd= basename($ccc);
foreach my $extra_suite (@extra_suites)
{
$opt_suites= "$extra_suite->[1],$opt_suites";
if ($extra_suite->[0] eq "$ddd")
{
$opt_suites= "$extra_suite->[1],$opt_suites";
$found= 1;
}
}
$ccc= dirname($ccc);
}
}
......
......@@ -38,6 +38,23 @@ a b c
1 10 3
1 11 3
1 12 3
select max(b) from t1 where a = 1;
max(b)
12
select b from t1 where a = 1 order by b desc;
b
12
11
10
9
8
7
6
5
4
3
2
1
DROP TABLE t1;
CREATE TABLE t1 (a INT, b CHAR(10) COLLATE latin1_bin, c INT, d INT,
PRIMARY KEY (a,b,c) USING HASH)
......
......@@ -46,6 +46,14 @@ a b c
1 1 1
6 1 1
10 1 1
INSERT into t1 values (1, 2, 2);
select max(b) from t1 where a = 1;
max(b)
2
select b from t1 where a = 1 order by b desc;
b
2
1
drop table t1;
CREATE TABLE t1 (
a int not null,
......
......@@ -38,6 +38,10 @@ insert into t1 values
select * from t1 order by b;
# BUG#33061: ORDER BY DESC becomes ASC in NDB partition pruning to one partition
select max(b) from t1 where a = 1;
select b from t1 where a = 1 order by b desc;
DROP TABLE t1;
#
......
......@@ -48,6 +48,11 @@ select * from t1 where a=21 order by a;
select * from t1 where a in (1,6,10,21) order by a;
select * from t1 where b=1 and a in (1,6,10,21) order by a;
# BUG#33061: ORDER BY DESC becomes ASC in NDB partition pruning to one partition
INSERT into t1 values (1, 2, 2);
select max(b) from t1 where a = 1;
select b from t1 where a = 1 order by b desc;
drop table t1;
#
......
......@@ -15,3 +15,6 @@ ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
#ndb_autodiscover3 : bug#21806
#ndb_autodiscover3 : Bug#20872 2007-07-15 ingo master*.err: miscellaneous error messages
#rpl_ndb_extraColMaster : BUG#30854 : Tables name show as binary in slave err msg on vm-win2003-64-b and Solaris
#rpl_ndb_mix_innodb : Bug #32720 Test rpl_ndb_mix_innodb fails on SPARC and PowerPC
#rpl_ndb_dd_advance : Bug #30222 rpl_ndb_dd_advance.test fails
This diff is collapsed.
......@@ -11,13 +11,6 @@
##############################################################################
rpl_ndb_2innodb : Bug #32648 Test failure between NDB Cluster and other engines
rpl_ndb_2myisam : Bug #32648 Test failure between NDB Cluster and other engines
rpl_ndb_2other : Bug #32648 Test failure between NDB Cluster and other engines
rpl_ndb_ctype_ucs2_def : BUG#27404 util thd mysql_parse sig11 when mysqld default multibyte charset
rpl_ndb_extraColMaster : BUG#30854 : Tables name show as binary in slave err msg on vm-win2003-64-b and Solaris
rpl_ndb_mix_innodb : Bug #32720 Test rpl_ndb_mix_innodb fails on SPARC and PowerPC
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
#rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly
--default-storage-engine=ndbcluster
--new --default-storage-engine=ndbcluster
--innodb --default-storage-engine=innodb
--innodb --default-storage-engine=innodb --ndbcluster=0
......@@ -8,9 +8,19 @@
# test and to have control over the tests.
##############################################################
-- source include/have_ndb.inc
-- source include/ndb_master-slave.inc
connection slave;
-- source include/master-slave.inc
-- connection slave
-- source include/have_innodb.inc
connection master;
SET storage_engine=ndb;
CREATE TABLE mysql.ndb_apply_status
( server_id INT UNSIGNED NOT NULL,
epoch BIGINT UNSIGNED NOT NULL,
log_name VARCHAR(255) BINARY NOT NULL,
start_pos BIGINT UNSIGNED NOT NULL,
end_pos BIGINT UNSIGNED NOT NULL,
PRIMARY KEY USING HASH (server_id)) ENGINE=INNODB;
--source extra/rpl_tests/rpl_ndb_2multi_eng.test
--connection slave
drop table mysql.ndb_apply_status;
--default-storage-engine=ndbcluster
--new --default-storage-engine=ndbcluster
--default-storage-engine=myisam
--default-storage-engine=myisam --ndbcluster=0
......@@ -8,6 +8,18 @@
# test and to have control over the tests.
##############################################################
-- source include/have_ndb.inc
-- source include/ndb_master-slave.inc
SET storage_engine=ndb;
-- source include/master-slave.inc
-- connection slave
CREATE TABLE mysql.ndb_apply_status
( server_id INT UNSIGNED NOT NULL,
epoch BIGINT UNSIGNED NOT NULL,
log_name VARCHAR(255) BINARY NOT NULL,
start_pos BIGINT UNSIGNED NOT NULL,
end_pos BIGINT UNSIGNED NOT NULL,
PRIMARY KEY USING HASH (server_id)) ENGINE=MYISAM;
--source extra/rpl_tests/rpl_ndb_2multi_eng.test
--connection slave
drop table mysql.ndb_apply_status;
#############################################################
# Author: Rafal Somla
# Date: 2006-08-20
# Purpose: Trying to test ability to replicate from cluster
# to other engines (innodb, myisam), see also rpl_ndb_2other.test
##############################################################
--source include/have_binlog_format_mixed_or_row.inc
--source include/ndb_master-slave.inc
# On master use NDB as storage engine.
connection master;
SET storage_engine=ndb;
--echo
--echo === NDB -> NDB ===
--echo
connection slave;
SET storage_engine=ndb;
--source extra/rpl_tests/rpl_ndb_2multi_basic.test
--innodb --log-slave-updates=0
--innodb --ndbcluster=0 --log-slave-updates=0
......@@ -7,7 +7,7 @@
--source include/have_ndb.inc
--source include/have_innodb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source include/ndb_master-slave.inc
--source include/master-slave.inc
# On master use NDB as storage engine.
connection master;
......@@ -17,6 +17,13 @@ SET storage_engine=ndb;
--echo === NDB -> MYISAM ===
--echo
connection slave;
CREATE TABLE mysql.ndb_apply_status
( server_id INT UNSIGNED NOT NULL,
epoch BIGINT UNSIGNED NOT NULL,
log_name VARCHAR(255) BINARY NOT NULL,
start_pos BIGINT UNSIGNED NOT NULL,
end_pos BIGINT UNSIGNED NOT NULL,
PRIMARY KEY USING HASH (server_id)) ENGINE=MYISAM;
SET storage_engine=myisam;
--source extra/rpl_tests/rpl_ndb_2multi_basic.test
......@@ -24,12 +31,9 @@ SET storage_engine=myisam;
--echo === NDB -> INNODB ===
--echo
connection slave;
alter table mysql.ndb_apply_status engine=innodb;
SET storage_engine=innodb;
--source extra/rpl_tests/rpl_ndb_2multi_basic.test
--echo
--echo === NDB -> NDB ===
--echo
connection slave;
SET storage_engine=ndb;
--source extra/rpl_tests/rpl_ndb_2multi_basic.test
drop table mysql.ndb_apply_status;
......@@ -3710,6 +3710,8 @@ int handler::ha_reset()
DBUG_ASSERT(inited == NONE);
/* Free cache used by filesort */
free_io_cache(table);
/* reset the bitmaps to point to defaults */
table->default_column_bitmaps();
DBUG_RETURN(reset());
}
......
......@@ -7837,7 +7837,7 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
{
DBUG_PRINT("info",("ha_index_init returns error %d",error));
table->file->print_error(error, MYF(0));
DBUG_RETURN(error);
goto err;
}
/* Fill key data for the row */
......@@ -7870,7 +7870,7 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
DBUG_PRINT("info",("no record matching the key found in the table"));
table->file->print_error(error, MYF(0));
table->file->ha_index_end();
DBUG_RETURN(error);
goto err;
}
/*
......@@ -7898,7 +7898,7 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
if (table->key_info->flags & HA_NOSAME)
{
table->file->ha_index_end();
DBUG_RETURN(0);
goto ok;
}
/*
......@@ -7930,7 +7930,7 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
DBUG_PRINT("info",("no record matching the given row found"));
table->file->print_error(error, MYF(0));
table->file->ha_index_end();
DBUG_RETURN(error);
goto err;
}
}
......@@ -7951,7 +7951,7 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
DBUG_PRINT("info",("error initializing table scan"
" (ha_rnd_init returns %d)",error));
table->file->print_error(error, MYF(0));
DBUG_RETURN(error);
goto err;
}
/* Continue until we find the right record or have made a full loop */
......@@ -7975,7 +7975,7 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
" (rnd_next returns %d)",error));
table->file->print_error(error, MYF(0));
table->file->ha_rnd_end();
DBUG_RETURN(error);
goto err;
}
}
while (restart_count < 2 && record_compare(table));
......@@ -7995,10 +7995,14 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
table->file->ha_rnd_end();
DBUG_ASSERT(error == HA_ERR_END_OF_FILE || error == HA_ERR_RECORD_DELETED || error == 0);
DBUG_RETURN(error);
goto err;
}
ok:
table->default_column_bitmaps();
DBUG_RETURN(0);
err:
table->default_column_bitmaps();
DBUG_RETURN(error);
}
#endif
......
......@@ -4086,9 +4086,7 @@ Dbdict::execALTER_TABLE_REQ(Signal* signal)
bool ok = false;
switch(tabState){
case TableRecord::NOT_DEFINED:
case TableRecord::REORG_TABLE_PREPARED:
case TableRecord::DEFINING:
case TableRecord::CHECKED:
jam();
alterTableRef(signal, req, AlterTableRef::NoSuchTable);
return;
......@@ -4339,9 +4337,7 @@ Dbdict::execALTER_TAB_REQ(Signal * signal)
bool ok = false;
switch(tabState){
case TableRecord::NOT_DEFINED:
case TableRecord::REORG_TABLE_PREPARED:
case TableRecord::DEFINING:
case TableRecord::CHECKED:
jam();
alterTabRef(signal, req, AlterTableRef::NoSuchTable);
return;
......@@ -6690,9 +6686,7 @@ Dbdict::execDROP_TABLE_REQ(Signal* signal){
bool ok = false;
switch(tabState){
case TableRecord::NOT_DEFINED:
case TableRecord::REORG_TABLE_PREPARED:
case TableRecord::DEFINING:
case TableRecord::CHECKED:
jam();
dropTableRef(signal, req, DropTableRef::NoSuchTable);
return;
......@@ -7718,7 +7712,6 @@ Dbdict::execLIST_TABLES_REQ(Signal* signal)
if(DictTabInfo::isTable(type)){
switch (tablePtr.p->tabState) {
case TableRecord::DEFINING:
case TableRecord::CHECKED:
conf->setTableState(pos, DictTabInfo::StateBuilding);
break;
case TableRecord::PREPARE_DROPPING:
......
......@@ -320,9 +320,7 @@ public:
enum TabState {
NOT_DEFINED = 0,
REORG_TABLE_PREPARED = 1,
DEFINING = 2,
CHECKED = 3,
DEFINED = 4,
PREPARE_DROPPING = 5,
DROPPING = 6,
......
......@@ -1340,29 +1340,41 @@ NdbIndexScanOperation::readTuples(LockMode lm,
if(insertATTRINFO(word) == -1)
res = -1;
}
if(!res && order_by){
m_ordered = true;
if (!res)
{
/**
* Note that it is valid to have order_desc true and order_by false.
*
* This means that there will be no merge sort among partitions, but
* each partition will still be returned in descending sort order.
*
* This is useful eg. if it is known that the scan spans only one
* partition.
*/
if (order_desc) {
m_descending = true;
ScanTabReq * req = CAST_PTR(ScanTabReq, theSCAN_TABREQ->getDataPtrSend());
ScanTabReq::setDescendingFlag(req->requestInfo, true);
}
Uint32 cnt = m_accessTable->getNoOfColumns() - 1;
m_sort_columns = cnt; // -1 for NDB$NODE
m_current_api_receiver = m_sent_receivers_count;
m_api_receivers_count = m_sent_receivers_count;
if (order_by) {
m_ordered = true;
Uint32 cnt = m_accessTable->getNoOfColumns() - 1;
m_sort_columns = cnt; // -1 for NDB$NODE
m_current_api_receiver = m_sent_receivers_count;
m_api_receivers_count = m_sent_receivers_count;
m_sort_columns = cnt;
for(Uint32 i = 0; i<cnt; i++){
const NdbColumnImpl* key = m_accessTable->m_index->m_columns[i];
const NdbColumnImpl* col = m_currentTable->getColumn(key->m_keyInfoPos);
NdbRecAttr* tmp = NdbScanOperation::getValue_impl(col, (char*)-1);
UintPtr newVal = UintPtr(tmp);
theTupleKeyDefined[i][0] = FAKE_PTR;
theTupleKeyDefined[i][1] = (newVal & 0xFFFFFFFF);
m_sort_columns = cnt;
for(Uint32 i = 0; i<cnt; i++){
const NdbColumnImpl* key = m_accessTable->m_index->m_columns[i];
const NdbColumnImpl* col = m_currentTable->getColumn(key->m_keyInfoPos);
NdbRecAttr* tmp = NdbScanOperation::getValue_impl(col, (char*)-1);
UintPtr newVal = UintPtr(tmp);
theTupleKeyDefined[i][0] = FAKE_PTR;
theTupleKeyDefined[i][1] = (newVal & 0xFFFFFFFF);
#if (SIZEOF_CHARP == 8)
theTupleKeyDefined[i][2] = (newVal >> 32);
theTupleKeyDefined[i][2] = (newVal >> 32);
#endif
}
}
}
m_this_bound_start = 0;
......
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