Commit 207d4484 authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb

into mysql.com:/home/jonas/src/mysql-4.1-ndb
parents f94cc6e6 7fa8e047
...@@ -1515,6 +1515,11 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [ ...@@ -1515,6 +1515,11 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
--with-ndb-docs Include the NDB Cluster ndbapi and mgmapi documentation], --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi documentation],
[ndb_docs="$withval"], [ndb_docs="$withval"],
[ndb_docs=no]) [ndb_docs=no])
AC_ARG_WITH([ndb-port-base],
[
--with-ndb-port-base Base port for NDB Cluster],
[ndb_port_base="$withval"],
[ndb_port_base="default"])
AC_MSG_CHECKING([for NDB Cluster options]) AC_MSG_CHECKING([for NDB Cluster options])
AC_MSG_RESULT([]) AC_MSG_RESULT([])
......
...@@ -389,8 +389,6 @@ then ...@@ -389,8 +389,6 @@ then
# Disable exceptions as they seams to create problems with gcc and threads. # Disable exceptions as they seams to create problems with gcc and threads.
# mysqld doesn't use run-time-type-checking, so we disable it. # mysqld doesn't use run-time-type-checking, so we disable it.
CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti" CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
# ndb cannot be compiled with -fno-implicit-templaces
ndb_cxxflags_fix="$ndb_cxxflags_fix -fimplicit-templates"
# If you are using 'gcc' 3.0 (not g++) to compile C++ programs on Linux, # If you are using 'gcc' 3.0 (not g++) to compile C++ programs on Linux,
# we will gets some problems when linking static programs. # we will gets some problems when linking static programs.
...@@ -2985,6 +2983,13 @@ then ...@@ -2985,6 +2983,13 @@ then
AC_SUBST([NDB_DEFS]) AC_SUBST([NDB_DEFS])
AC_SUBST([ndb_cxxflags_fix]) AC_SUBST([ndb_cxxflags_fix])
if test X"$ndb_port_base" = Xdefault
then
ndb_port_base="2200"
fi
AC_SUBST([ndb_port_base])
ndb_transporter_opt_objs="" ndb_transporter_opt_objs=""
if test X"$have_ndb_shm" = Xyes if test X"$have_ndb_shm" = Xyes
then then
......
...@@ -1451,12 +1451,10 @@ then ...@@ -1451,12 +1451,10 @@ then
then then
echo "Starting ndbcluster" echo "Starting ndbcluster"
./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --small --diskless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1 ./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --small --diskless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT" USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"host=localhost:$NDBCLUSTER_PORT\""
export NDB_CONNECTSTRING
else else
NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER" USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"$USE_RUNNING_NDBCLUSTER\""
export NDB_CONNECTSTRING echo "Using ndbcluster at $USE_NDBCLUSTER"
echo "Using ndbcluster at $NDB_CONNECTSTRING"
fi fi
fi fi
......
...@@ -7,19 +7,11 @@ Diskless: CHOOSE_Diskless ...@@ -7,19 +7,11 @@ Diskless: CHOOSE_Diskless
TimeBetweenWatchDogCheck: 30000 TimeBetweenWatchDogCheck: 30000
FileSystemPath: CHOOSE_FILESYSTEM FileSystemPath: CHOOSE_FILESYSTEM
[COMPUTER]
Id: 1
HostName: CHOOSE_HOSTNAME_1
[COMPUTER]
Id: 2
HostName: CHOOSE_HOSTNAME_2
[DB] [DB]
ExecuteOnComputer: 1 HostName: CHOOSE_HOSTNAME_1
[DB] [DB]
ExecuteOnComputer: 2 HostName: CHOOSE_HOSTNAME_2
[MGM] [MGM]
PortNumber: CHOOSE_PORT_MGM PortNumber: CHOOSE_PORT_MGM
......
...@@ -116,3 +116,21 @@ select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1; ...@@ -116,3 +116,21 @@ select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
collation(a) collation(b) collation(binary 'ccc') collation(a) collation(b) collation(binary 'ccc')
latin1_bin binary latin1_bin latin1_bin binary latin1_bin
drop table t1; drop table t1;
create table t1( firstname char(20), lastname char(20));
insert into t1 values ("john","doe"),("John","Doe");
select * from t1 where firstname='john' and firstname like binary 'john';
firstname lastname
john doe
select * from t1 where firstname='john' and binary 'john' = firstname;
firstname lastname
john doe
select * from t1 where firstname='john' and firstname = binary 'john';
firstname lastname
john doe
select * from t1 where firstname='John' and firstname like binary 'john';
firstname lastname
john doe
select * from t1 where firstname='john' and firstname like binary 'John';
firstname lastname
John Doe
drop table t1;
...@@ -560,3 +560,13 @@ select * from t1 where str='str'; ...@@ -560,3 +560,13 @@ select * from t1 where str='str';
str str
str str
drop table t1; drop table t1;
create table t1 (
str varchar(255) character set utf8 not null,
key str using hash (str(2))
) engine=heap;
INSERT INTO t1 VALUES ('str');
INSERT INTO t1 VALUES ('str2');
select * from t1 where str='str';
str
str
drop table t1;
...@@ -634,7 +634,7 @@ insert into t2 values (10,1),(20,2),(30,3); ...@@ -634,7 +634,7 @@ insert into t2 values (10,1),(20,2),(30,3);
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index 1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 2 const 1 Using where; Using index 1 SIMPLE t1 const PRIMARY PRIMARY 2 const 1 Using where; Using index
select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
fooID barID fooID fooID barID fooID
10 1 NULL 10 1 NULL
...@@ -682,3 +682,72 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -682,3 +682,72 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 1 SIMPLE t3 ALL NULL NULL NULL NULL 2
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (
match_id tinyint(3) unsigned not null auto_increment,
home tinyint(3) unsigned default '0',
unique key match_id (match_id),
key match_id_2 (match_id)
);
insert into t1 values("1", "2");
create table t2 (
player_id tinyint(3) unsigned default '0',
match_1_h tinyint(3) unsigned default '0',
key player_id (player_id)
);
insert into t2 values("1", "5");
insert into t2 values("2", "9");
insert into t2 values("3", "3");
insert into t2 values("4", "7");
insert into t2 values("5", "6");
insert into t2 values("6", "8");
insert into t2 values("7", "4");
insert into t2 values("8", "12");
insert into t2 values("9", "11");
insert into t2 values("10", "10");
explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
(t2 s left join t1 m on m.match_id = 1)
order by m.match_id desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE s ALL NULL NULL NULL NULL 10
1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 Using where
explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
(t2 s left join t1 m on m.match_id = 1)
order by UUX desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE s ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 Using where
select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
(t2 s left join t1 m on m.match_id = 1)
order by UUX desc;
player_id match_1_h * match_id home UUX
8 12 * 1 2 10
9 11 * 1 2 9
10 10 * 1 2 8
2 9 * 1 2 7
6 8 * 1 2 6
4 7 * 1 2 5
5 6 * 1 2 4
1 5 * 1 2 3
7 4 * 1 2 2
3 3 * 1 2 1
explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
t2 s straight_join t1 m where m.match_id = 1
order by UUX desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE s ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 Using where
select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
t2 s straight_join t1 m where m.match_id = 1
order by UUX desc;
player_id match_1_h * match_id home UUX
8 12 * 1 2 10
9 11 * 1 2 9
10 10 * 1 2 8
2 9 * 1 2 7
6 8 * 1 2 6
4 7 * 1 2 5
5 6 * 1 2 4
1 5 * 1 2 3
7 4 * 1 2 2
3 3 * 1 2 1
drop table t1, t2;
...@@ -401,10 +401,3 @@ where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; ...@@ -401,10 +401,3 @@ where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
delete from mysql.db delete from mysql.db
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges; flush privileges;
set names latin1;
create database ``;
create table ``.`` (a int) engine=heap;
show table status from `` LIKE '';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
HEAP 9 Fixed 0 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
drop database ``;
...@@ -67,3 +67,16 @@ select * from t1 where lower(b)='bbb'; ...@@ -67,3 +67,16 @@ select * from t1 where lower(b)='bbb';
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1; select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1; select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
drop table t1; drop table t1;
#
# Bug5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results
#
create table t1( firstname char(20), lastname char(20));
insert into t1 values ("john","doe"),("John","Doe");
select * from t1 where firstname='john' and firstname like binary 'john';
select * from t1 where firstname='john' and binary 'john' = firstname;
select * from t1 where firstname='john' and firstname = binary 'john';
select * from t1 where firstname='John' and firstname like binary 'john';
select * from t1 where firstname='john' and firstname like binary 'John';
drop table t1;
...@@ -417,3 +417,15 @@ INSERT INTO t1 VALUES ('str'); ...@@ -417,3 +417,15 @@ INSERT INTO t1 VALUES ('str');
INSERT INTO t1 VALUES ('str2'); INSERT INTO t1 VALUES ('str2');
select * from t1 where str='str'; select * from t1 where str='str';
drop table t1; drop table t1;
# the same for HEAP+HASH
#
create table t1 (
str varchar(255) character set utf8 not null,
key str using hash (str(2))
) engine=heap;
INSERT INTO t1 VALUES ('str');
INSERT INTO t1 VALUES ('str2');
select * from t1 where str='str';
drop table t1;
...@@ -451,3 +451,53 @@ select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is ...@@ -451,3 +451,53 @@ select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is
explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null; explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
drop table t1, t2, t3; drop table t1, t2, t3;
# Test for BUG#5088
create table t1 (
match_id tinyint(3) unsigned not null auto_increment,
home tinyint(3) unsigned default '0',
unique key match_id (match_id),
key match_id_2 (match_id)
);
insert into t1 values("1", "2");
create table t2 (
player_id tinyint(3) unsigned default '0',
match_1_h tinyint(3) unsigned default '0',
key player_id (player_id)
);
insert into t2 values("1", "5");
insert into t2 values("2", "9");
insert into t2 values("3", "3");
insert into t2 values("4", "7");
insert into t2 values("5", "6");
insert into t2 values("6", "8");
insert into t2 values("7", "4");
insert into t2 values("8", "12");
insert into t2 values("9", "11");
insert into t2 values("10", "10");
explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
(t2 s left join t1 m on m.match_id = 1)
order by m.match_id desc;
explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
(t2 s left join t1 m on m.match_id = 1)
order by UUX desc;
select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
(t2 s left join t1 m on m.match_id = 1)
order by UUX desc;
explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
t2 s straight_join t1 m where m.match_id = 1
order by UUX desc;
select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
t2 s straight_join t1 m where m.match_id = 1
order by UUX desc;
drop table t1, t2;
...@@ -307,9 +307,11 @@ where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; ...@@ -307,9 +307,11 @@ where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges; flush privileges;
#Bug #4374 SHOW TABLE STATUS FROM ignores collation_connection #Bug #4374 SHOW TABLE STATUS FROM ignores collation_connection
set names latin1; # This test fails on MAC OSX, so it is temporary disabled.
create database ``; # This needs WL#1324 to be done.
create table ``.`` (a int) engine=heap; #set names latin1;
--replace_column 7 # 8 # 9 # #create database ``;
show table status from `` LIKE ''; #create table ``.`` (a int) engine=heap;
drop database ``; #--replace_column 7 # 8 # 9 #
#show table status from `` LIKE '';
#drop database ``;
LDADD += $(top_builddir)/ndb/test/src/libNDBT.a \ LDADD += $(top_builddir)/ndb/test/src/libNDBT.a \
$(top_builddir)/ndb/src/libndbclient.la $(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a
INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \ INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \
-I$(top_srcdir)/ndb/include \ -I$(top_srcdir)/ndb/include \
......
LDADD += $(top_builddir)/ndb/src/libndbclient.la LDADD += \
$(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a
INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \ INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \
-I$(top_srcdir)/ndb/include \ -I$(top_srcdir)/ndb/include \
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#define NDBGLOBAL_H #define NDBGLOBAL_H
#include <my_global.h> #include <my_global.h>
#define NDB_BASE_PORT 2200
/** signal & SIG_PIPE */ /** signal & SIG_PIPE */
#include <my_alarm.h> #include <my_alarm.h>
......
This diff is collapsed.
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
* A MANDATORY parameters must be specified in the config file * A MANDATORY parameters must be specified in the config file
* An UNDEFINED parameter may or may not be specified in the config file * An UNDEFINED parameter may or may not be specified in the config file
*/ */
static const Uint64 MANDATORY = ~0; // Default value for mandatory params. static const char* MANDATORY = (char*)~(UintPtr)0; // Default value for mandatory params.
static const Uint64 UNDEFINED = (~0)-1; // Default value for undefined params. static const char* UNDEFINED = 0; // Default value for undefined params.
/** /**
* @class ConfigInfo * @class ConfigInfo
...@@ -56,9 +56,9 @@ public: ...@@ -56,9 +56,9 @@ public:
Status _status; Status _status;
bool _updateable; bool _updateable;
Type _type; Type _type;
Uint64 _default; const char* _default;
Uint64 _min; const char* _min;
Uint64 _max; const char* _max;
}; };
/** /**
......
...@@ -31,7 +31,6 @@ static void require(bool v) { if(!v) abort();} ...@@ -31,7 +31,6 @@ static void require(bool v) { if(!v) abort();}
// Ctor / Dtor // Ctor / Dtor
//**************************************************************************** //****************************************************************************
InitConfigFileParser::InitConfigFileParser(){ InitConfigFileParser::InitConfigFileParser(){
m_info = new ConfigInfo(); m_info = new ConfigInfo();
} }
...@@ -111,7 +110,6 @@ InitConfigFileParser::parseConfig(FILE * file) { ...@@ -111,7 +110,6 @@ InitConfigFileParser::parseConfig(FILE * file) {
"of configuration file."); "of configuration file.");
return 0; return 0;
} }
snprintf(ctx.fname, sizeof(ctx.fname), section); free(section); snprintf(ctx.fname, sizeof(ctx.fname), section); free(section);
ctx.type = InitConfigFileParser::DefaultSection; ctx.type = InitConfigFileParser::DefaultSection;
ctx.m_sectionLineno = ctx.m_lineno; ctx.m_sectionLineno = ctx.m_lineno;
...@@ -132,7 +130,6 @@ InitConfigFileParser::parseConfig(FILE * file) { ...@@ -132,7 +130,6 @@ InitConfigFileParser::parseConfig(FILE * file) {
"of configuration file."); "of configuration file.");
return 0; return 0;
} }
snprintf(ctx.fname, sizeof(ctx.fname), section); snprintf(ctx.fname, sizeof(ctx.fname), section);
free(section); free(section);
ctx.type = InitConfigFileParser::Section; ctx.type = InitConfigFileParser::Section;
...@@ -162,7 +159,6 @@ InitConfigFileParser::parseConfig(FILE * file) { ...@@ -162,7 +159,6 @@ InitConfigFileParser::parseConfig(FILE * file) {
ctx.reportError("Could not store section of configuration file."); ctx.reportError("Could not store section of configuration file.");
return 0; return 0;
} }
for(size_t i = 0; ConfigInfo::m_ConfigRules[i].m_configRule != 0; i++){ for(size_t i = 0; ConfigInfo::m_ConfigRules[i].m_configRule != 0; i++){
ctx.type = InitConfigFileParser::Undefined; ctx.type = InitConfigFileParser::Undefined;
ctx.m_currentSection = 0; ctx.m_currentSection = 0;
...@@ -378,7 +374,7 @@ bool InitConfigFileParser::convertStringToUint64(const char* s, ...@@ -378,7 +374,7 @@ bool InitConfigFileParser::convertStringToUint64(const char* s,
errno = 0; errno = 0;
char* p; char* p;
long long v = strtoll(s, &p, 10); long long v = strtoll(s, &p, log10base);
if (errno != 0) if (errno != 0)
return false; return false;
...@@ -536,20 +532,18 @@ InitConfigFileParser::storeSection(Context& ctx){ ...@@ -536,20 +532,18 @@ InitConfigFileParser::storeSection(Context& ctx){
if(ctx.type == InitConfigFileParser::Section){ if(ctx.type == InitConfigFileParser::Section){
for(int i = 0; i<m_info->m_NoOfRules; i++){ for(int i = 0; i<m_info->m_NoOfRules; i++){
const ConfigInfo::SectionRule & rule = m_info->m_SectionRules[i]; const ConfigInfo::SectionRule & rule = m_info->m_SectionRules[i];
if(!strcmp(rule.m_section, "*") || !strcmp(rule.m_section, ctx.fname)) if(!strcmp(rule.m_section, "*") || !strcmp(rule.m_section, ctx.fname)){
if(!(* rule.m_sectionRule)(ctx, rule.m_ruleData)) if(!(* rule.m_sectionRule)(ctx, rule.m_ruleData)){
return false; return false;
} }
} }
}
}
if(ctx.type == InitConfigFileParser::DefaultSection) if(ctx.type == InitConfigFileParser::DefaultSection)
require(ctx.m_defaults->put(ctx.pname, ctx.m_currentSection)); require(ctx.m_defaults->put(ctx.pname, ctx.m_currentSection));
if(ctx.type == InitConfigFileParser::Section) if(ctx.type == InitConfigFileParser::Section)
require(ctx.m_config->put(ctx.pname, ctx.m_currentSection)); require(ctx.m_config->put(ctx.pname, ctx.m_currentSection));
delete ctx.m_currentSection; ctx.m_currentSection = NULL; delete ctx.m_currentSection; ctx.m_currentSection = NULL;
return true; return true;
} }
......
...@@ -86,6 +86,9 @@ public: ...@@ -86,6 +86,9 @@ public:
void reportWarning(const char * msg, ...); void reportWarning(const char * msg, ...);
}; };
static bool convertStringToUint64(const char* s, Uint64& val, Uint32 log10base = 0);
static bool convertStringToBool(const char* s, bool& val);
private: private:
/** /**
* Check if line only contains space/comments * Check if line only contains space/comments
...@@ -111,8 +114,6 @@ private: ...@@ -111,8 +114,6 @@ private:
bool parseNameValuePair(Context&, const char* line); bool parseNameValuePair(Context&, const char* line);
bool storeNameValuePair(Context&, const char* fname, const char* value); bool storeNameValuePair(Context&, const char* fname, const char* value);
bool convertStringToUint64(const char* s, Uint64& val, Uint32 log10base = 0);
bool convertStringToBool(const char* s, bool& val);
bool storeSection(Context&); bool storeSection(Context&);
const Properties* getSection(const char * name, const Properties* src); const Properties* getSection(const char * name, const Properties* src);
......
...@@ -89,7 +89,7 @@ LocalConfig::init(const char *connectString, ...@@ -89,7 +89,7 @@ LocalConfig::init(const char *connectString,
//7. Check //7. Check
{ {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), "host=localhost:%u", NDB_BASE_PORT); snprintf(buf, sizeof(buf), "host=localhost:%s", NDB_BASE_PORT);
if(readConnectString(buf)) if(readConnectString(buf))
return true; return true;
} }
......
MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
noinst_LTLIBRARIES = libmgmsrvcommon.la noinst_LTLIBRARIES = libmgmsrvcommon.la
libmgmsrvcommon_la_SOURCES = \ libmgmsrvcommon_la_SOURCES = \
...@@ -10,6 +14,11 @@ libmgmsrvcommon_la_SOURCES = \ ...@@ -10,6 +14,11 @@ libmgmsrvcommon_la_SOURCES = \
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi
DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DNDB_BASE_PORT="\"@ndb_port_base@\""
include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am
......
...@@ -3,7 +3,11 @@ ndbbin_PROGRAMS = ndb_cpcd ...@@ -3,7 +3,11 @@ ndbbin_PROGRAMS = ndb_cpcd
ndb_cpcd_SOURCES = main.cpp CPCD.cpp Process.cpp APIService.cpp Monitor.cpp common.cpp ndb_cpcd_SOURCES = main.cpp CPCD.cpp Process.cpp APIService.cpp Monitor.cpp common.cpp
LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la LDADD_LOC = \
$(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a
include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_util.mk.am include $(top_srcdir)/ndb/config/type_util.mk.am
......
...@@ -3,7 +3,11 @@ ndbtools_PROGRAMS = ndb_restore ...@@ -3,7 +3,11 @@ ndbtools_PROGRAMS = ndb_restore
ndb_restore_SOURCES = main.cpp consumer.cpp consumer_restore.cpp consumer_printer.cpp Restore.cpp ndb_restore_SOURCES = main.cpp consumer.cpp consumer_restore.cpp consumer_printer.cpp Restore.cpp
LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la LDADD_LOC = \
$(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a
include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/common.mk.am
......
...@@ -405,3 +405,7 @@ operator<<(NdbOut& out, const Dbtup::Th& th) ...@@ -405,3 +405,7 @@ operator<<(NdbOut& out, const Dbtup::Th& th)
return out; return out;
} }
#endif #endif
#ifdef VM_TRACE
template class Vector<Chunk>;
#endif
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
ParserRow_t::IgnoreMinMax, \ ParserRow_t::IgnoreMinMax, \
0, 0, \ 0, 0, \
0, \ 0, \
(desc) } (desc), 0 }
#define CPC_END() \ #define CPC_END() \
{ 0, \ { 0, \
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
ParserRow_t::IgnoreMinMax, \ ParserRow_t::IgnoreMinMax, \
0, 0, \ 0, 0, \
0, \ 0, \
0 } 0, 0 }
#ifdef DEBUG_PRINT_PROPERTIES #ifdef DEBUG_PRINT_PROPERTIES
static void printprop(const Properties &p) { static void printprop(const Properties &p) {
......
...@@ -19,6 +19,10 @@ INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \ ...@@ -19,6 +19,10 @@ INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \
LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la \ LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/ndb/src/common/editline/libeditline.a \ $(top_builddir)/ndb/src/common/editline/libeditline.a \
$(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a
@TERMCAP_LIB@ @TERMCAP_LIB@
include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/common.mk.am
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "Services.hpp" #include "Services.hpp"
extern bool g_StopServer;
static const unsigned int MAX_READ_TIMEOUT = 1000 ; static const unsigned int MAX_READ_TIMEOUT = 1000 ;
static const unsigned int MAX_WRITE_TIMEOUT = 100 ; static const unsigned int MAX_WRITE_TIMEOUT = 100 ;
...@@ -1012,11 +1014,28 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &, ...@@ -1012,11 +1014,28 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
nodes.push_back(atoi(p)); nodes.push_back(atoi(p));
} }
int stop_self= 0;
for(size_t i=0; i < nodes.size(); i++) {
if (nodes[i] == m_mgmsrv.getOwnNodeId()) {
stop_self= 1;
if (i != nodes.size()-1) {
m_output->println("stop reply");
m_output->println("result: server must be stopped last");
m_output->println("");
return;
}
}
}
int stopped = 0, result = 0; int stopped = 0, result = 0;
for(size_t i=0; i < nodes.size(); i++) for(size_t i=0; i < nodes.size(); i++)
if (nodes[i] != m_mgmsrv.getOwnNodeId()) {
if((result = m_mgmsrv.stopNode(nodes[i], abort != 0)) == 0) if((result = m_mgmsrv.stopNode(nodes[i], abort != 0)) == 0)
stopped++; stopped++;
} else
stopped++;
m_output->println("stop reply"); m_output->println("stop reply");
if(result != 0) if(result != 0)
...@@ -1025,6 +1044,9 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &, ...@@ -1025,6 +1044,9 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println("stopped: %d", stopped); m_output->println("stopped: %d", stopped);
m_output->println(""); m_output->println("");
if (stop_self)
g_StopServer= true;
} }
......
...@@ -265,9 +265,10 @@ NDB_MAIN(mgmsrv){ ...@@ -265,9 +265,10 @@ NDB_MAIN(mgmsrv){
NdbSleep_MilliSleep(500); NdbSleep_MilliSleep(500);
} }
g_EventLogger.info("Shutting down server...");
glob.socketServer->stopServer(); glob.socketServer->stopServer();
glob.socketServer->stopSessions(); glob.socketServer->stopSessions();
g_EventLogger.info("Shutdown complete");
return 0; return 0;
error_end: error_end:
return 1; return 1;
......
...@@ -296,6 +296,7 @@ Remark: Start transaction. Synchronous. ...@@ -296,6 +296,7 @@ Remark: Start transaction. Synchronous.
NdbConnection* NdbConnection*
Ndb::startTransaction(Uint32 aPriority, const char * keyData, Uint32 keyLen) Ndb::startTransaction(Uint32 aPriority, const char * keyData, Uint32 keyLen)
{ {
DBUG_ENTER("Ndb::startTransaction");
if (theInitState == Initialised) { if (theInitState == Initialised) {
theError.code = 0; theError.code = 0;
...@@ -312,9 +313,9 @@ Ndb::startTransaction(Uint32 aPriority, const char * keyData, Uint32 keyLen) ...@@ -312,9 +313,9 @@ Ndb::startTransaction(Uint32 aPriority, const char * keyData, Uint32 keyLen)
} else { } else {
nodeId = 0; nodeId = 0;
}//if }//if
return startTransactionLocal(aPriority, nodeId); DBUG_RETURN(startTransactionLocal(aPriority, nodeId));
} else { } else {
return NULL; DBUG_RETURN(NULL);
}//if }//if
}//Ndb::startTransaction() }//Ndb::startTransaction()
...@@ -329,9 +330,11 @@ Remark: Start transaction. Synchronous. ...@@ -329,9 +330,11 @@ Remark: Start transaction. Synchronous.
NdbConnection* NdbConnection*
Ndb::hupp(NdbConnection* pBuddyTrans) Ndb::hupp(NdbConnection* pBuddyTrans)
{ {
DBUG_ENTER("Ndb::hupp");
Uint32 aPriority = 0; Uint32 aPriority = 0;
if (pBuddyTrans == NULL){ if (pBuddyTrans == NULL){
return startTransaction(); DBUG_RETURN(startTransaction());
} }
if (theInitState == Initialised) { if (theInitState == Initialised) {
...@@ -341,19 +344,19 @@ Ndb::hupp(NdbConnection* pBuddyTrans) ...@@ -341,19 +344,19 @@ Ndb::hupp(NdbConnection* pBuddyTrans)
Uint32 nodeId = pBuddyTrans->getConnectedNodeId(); Uint32 nodeId = pBuddyTrans->getConnectedNodeId();
NdbConnection* pCon = startTransactionLocal(aPriority, nodeId); NdbConnection* pCon = startTransactionLocal(aPriority, nodeId);
if(pCon == NULL) if(pCon == NULL)
return NULL; DBUG_RETURN(NULL);
if (pCon->getConnectedNodeId() != nodeId){ if (pCon->getConnectedNodeId() != nodeId){
// We could not get a connection to the desired node // We could not get a connection to the desired node
// release the connection and return NULL // release the connection and return NULL
closeTransaction(pCon); closeTransaction(pCon);
return NULL; DBUG_RETURN(NULL);
} }
pCon->setTransactionId(pBuddyTrans->getTransactionId()); pCon->setTransactionId(pBuddyTrans->getTransactionId());
pCon->setBuddyConPtr((Uint32)pBuddyTrans->getTC_ConnectPtr()); pCon->setBuddyConPtr((Uint32)pBuddyTrans->getTC_ConnectPtr());
return pCon; DBUG_RETURN(pCon);
} else { } else {
return NULL; DBUG_RETURN(NULL);
}//if }//if
}//Ndb::hupp() }//Ndb::hupp()
...@@ -443,6 +446,8 @@ Remark: Close transaction by releasing the connection and all operations ...@@ -443,6 +446,8 @@ Remark: Close transaction by releasing the connection and all operations
void void
Ndb::closeTransaction(NdbConnection* aConnection) Ndb::closeTransaction(NdbConnection* aConnection)
{ {
DBUG_ENTER("Ndb::closeTransaction");
NdbConnection* tCon; NdbConnection* tCon;
NdbConnection* tPreviousCon; NdbConnection* tPreviousCon;
...@@ -454,7 +459,7 @@ Ndb::closeTransaction(NdbConnection* aConnection) ...@@ -454,7 +459,7 @@ Ndb::closeTransaction(NdbConnection* aConnection)
#ifdef VM_TRACE #ifdef VM_TRACE
printf("NULL into closeTransaction\n"); printf("NULL into closeTransaction\n");
#endif #endif
return; DBUG_VOID_RETURN;
}//if }//if
CHECK_STATUS_MACRO_VOID; CHECK_STATUS_MACRO_VOID;
...@@ -479,14 +484,14 @@ Ndb::closeTransaction(NdbConnection* aConnection) ...@@ -479,14 +484,14 @@ Ndb::closeTransaction(NdbConnection* aConnection)
printf("Scan timeout:ed NdbConnection-> " printf("Scan timeout:ed NdbConnection-> "
"not returning it-> memory leak\n"); "not returning it-> memory leak\n");
#endif #endif
return; DBUG_VOID_RETURN;
} }
#ifdef VM_TRACE #ifdef VM_TRACE
printf("Non-existing transaction into closeTransaction\n"); printf("Non-existing transaction into closeTransaction\n");
abort(); abort();
#endif #endif
return; DBUG_VOID_RETURN;
}//if }//if
tPreviousCon = tCon; tPreviousCon = tCon;
tCon = tCon->next(); tCon = tCon->next();
...@@ -505,7 +510,7 @@ Ndb::closeTransaction(NdbConnection* aConnection) ...@@ -505,7 +510,7 @@ Ndb::closeTransaction(NdbConnection* aConnection)
#ifdef VM_TRACE #ifdef VM_TRACE
printf("Con timeout:ed NdbConnection-> not returning it-> memory leak\n"); printf("Con timeout:ed NdbConnection-> not returning it-> memory leak\n");
#endif #endif
return; DBUG_VOID_RETURN;
} }
if (aConnection->theReleaseOnClose == false) { if (aConnection->theReleaseOnClose == false) {
...@@ -515,11 +520,12 @@ Ndb::closeTransaction(NdbConnection* aConnection) ...@@ -515,11 +520,12 @@ Ndb::closeTransaction(NdbConnection* aConnection)
Uint32 nodeId = aConnection->getConnectedNodeId(); Uint32 nodeId = aConnection->getConnectedNodeId();
aConnection->theNext = theConnectionArray[nodeId]; aConnection->theNext = theConnectionArray[nodeId];
theConnectionArray[nodeId] = aConnection; theConnectionArray[nodeId] = aConnection;
return; DBUG_VOID_RETURN;
} else { } else {
aConnection->theReleaseOnClose = false; aConnection->theReleaseOnClose = false;
releaseNdbCon(aConnection); releaseNdbCon(aConnection);
}//if }//if
DBUG_VOID_RETURN;
}//Ndb::closeTransaction() }//Ndb::closeTransaction()
/***************************************************************************** /*****************************************************************************
......
...@@ -12,7 +12,11 @@ test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \ ...@@ -12,7 +12,11 @@ test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
atrt_SOURCES = main.cpp atrt_SOURCES = main.cpp
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmclient INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmclient
LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CpcClient.o $(top_builddir)/ndb/src/libndbclient.la LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CpcClient.o \
$(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%
...@@ -46,6 +46,9 @@ static const int max_transactions= 256; ...@@ -46,6 +46,9 @@ static const int max_transactions= 256;
// Default value for prefetch of autoincrement values // Default value for prefetch of autoincrement values
static const ha_rows autoincrement_prefetch= 32; static const ha_rows autoincrement_prefetch= 32;
// connectstring to cluster if given by mysqld
const char *ndbcluster_connectstring= 0;
#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8 #define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
...@@ -3375,6 +3378,12 @@ int ndb_discover_tables() ...@@ -3375,6 +3378,12 @@ int ndb_discover_tables()
bool ndbcluster_init() bool ndbcluster_init()
{ {
DBUG_ENTER("ndbcluster_init"); DBUG_ENTER("ndbcluster_init");
// Set connectstring if specified
if (ndbcluster_connectstring != 0)
{
DBUG_PRINT("connectstring", ("%s", ndbcluster_connectstring));
Ndb::setConnectString(ndbcluster_connectstring);
}
// Create a Ndb object to open the connection to NDB // Create a Ndb object to open the connection to NDB
g_ndb= new Ndb("sys"); g_ndb= new Ndb("sys");
if (g_ndb->init() != 0) if (g_ndb->init() != 0)
......
...@@ -37,6 +37,8 @@ class NdbScanOperation; ...@@ -37,6 +37,8 @@ class NdbScanOperation;
class NdbIndexScanOperation; class NdbIndexScanOperation;
class NdbBlob; class NdbBlob;
// connectstring to cluster if given by mysqld
extern const char *ndbcluster_connectstring;
typedef enum ndb_index_type { typedef enum ndb_index_type {
UNDEFINED_INDEX = 0, UNDEFINED_INDEX = 0,
......
...@@ -159,10 +159,7 @@ Item *Item_sum::get_tmp_table_item(THD *thd) ...@@ -159,10 +159,7 @@ Item *Item_sum::get_tmp_table_item(THD *thd)
if (!arg->const_item()) if (!arg->const_item())
{ {
if (arg->type() == Item::FIELD_ITEM) if (arg->type() == Item::FIELD_ITEM)
{
arg->maybe_null= result_field_tmp->maybe_null();
((Item_field*) arg)->field= result_field_tmp++; ((Item_field*) arg)->field= result_field_tmp++;
}
else else
sum_item->args[i]= new Item_field(result_field_tmp++); sum_item->args[i]= new Item_field(result_field_tmp++);
} }
......
...@@ -211,10 +211,17 @@ bool key_cmp_if_same(TABLE *table,const byte *key,uint idx,uint key_length) ...@@ -211,10 +211,17 @@ bool key_cmp_if_same(TABLE *table,const byte *key,uint idx,uint key_length)
if (!(key_part->key_type & (FIELDFLAG_NUMBER+FIELDFLAG_BINARY+ if (!(key_part->key_type & (FIELDFLAG_NUMBER+FIELDFLAG_BINARY+
FIELDFLAG_PACK))) FIELDFLAG_PACK)))
{ {
if (my_strnncoll(key_part->field->charset(), CHARSET_INFO *cs= key_part->field->charset();
uint char_length= key_part->length / cs->mbmaxlen;
const byte *pos= table->record[0] + key_part->offset;
if (length > char_length)
{
char_length= my_charpos(cs, pos, pos + length, char_length);
set_if_smaller(char_length, length);
}
if (cs->coll->strnncollsp(cs,
(const uchar*) key, length, (const uchar*) key, length,
(const uchar*) table->record[0]+key_part->offset, (const uchar*) pos, char_length))
length))
return 1; return 1;
} }
else if (memcmp(key,table->record[0]+key_part->offset,length)) else if (memcmp(key,table->record[0]+key_part->offset,length))
......
...@@ -3893,7 +3893,7 @@ enum options_mysqld ...@@ -3893,7 +3893,7 @@ enum options_mysqld
OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB, OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB,
OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG, OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG, OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG,
OPT_INNODB, OPT_ISAM, OPT_NDBCLUSTER, OPT_SKIP_SAFEMALLOC, OPT_INNODB, OPT_ISAM, OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_SKIP_SAFEMALLOC,
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_TEMP_POOL, OPT_TX_ISOLATION,
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL, OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
...@@ -4318,6 +4318,11 @@ master-ssl", ...@@ -4318,6 +4318,11 @@ master-ssl",
Disable with --skip-ndbcluster (will save memory).", Disable with --skip-ndbcluster (will save memory).",
(gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 1, 0, 0, (gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 1, 0, 0,
0, 0, 0}, 0, 0, 0},
#ifdef HAVE_NDBCLUSTER_DB
{"ndb-connectstring", OPT_NDB_CONNECTSTRING, "Connect string for ndbcluster.",
(gptr*) &ndbcluster_connectstring, (gptr*) &ndbcluster_connectstring, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"new", 'n', "Use very new possible 'unsafe' functions.", {"new", 'n', "Use very new possible 'unsafe' functions.",
(gptr*) &global_system_variables.new_mode, (gptr*) &global_system_variables.new_mode,
(gptr*) &max_system_variables.new_mode, (gptr*) &max_system_variables.new_mode,
...@@ -5972,15 +5977,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -5972,15 +5977,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
} }
case OPT_BDB_SHARED: case OPT_BDB_SHARED:
berkeley_init_flags&= ~(DB_PRIVATE); berkeley_init_flags&= ~(DB_PRIVATE);
berkeley_shared_data=1; berkeley_shared_data= 1;
break; break;
#endif /* HAVE_BERKELEY_DB */ #endif /* HAVE_BERKELEY_DB */
case OPT_BDB: case OPT_BDB:
#ifdef HAVE_BERKELEY_DB #ifdef HAVE_BERKELEY_DB
if (opt_bdb) if (opt_bdb)
have_berkeley_db=SHOW_OPTION_YES; have_berkeley_db= SHOW_OPTION_YES;
else else
have_berkeley_db=SHOW_OPTION_DISABLED; have_berkeley_db= SHOW_OPTION_DISABLED;
#endif #endif
break; break;
case OPT_ISAM: case OPT_ISAM:
...@@ -5994,22 +5999,22 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -5994,22 +5999,22 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case OPT_NDBCLUSTER: case OPT_NDBCLUSTER:
#ifdef HAVE_NDBCLUSTER_DB #ifdef HAVE_NDBCLUSTER_DB
if (opt_ndbcluster) if (opt_ndbcluster)
have_ndbcluster=SHOW_OPTION_YES; have_ndbcluster= SHOW_OPTION_YES;
else else
have_ndbcluster=SHOW_OPTION_DISABLED; have_ndbcluster= SHOW_OPTION_DISABLED;
#endif #endif
break; break;
case OPT_INNODB: case OPT_INNODB:
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
if (opt_innodb) if (opt_innodb)
have_innodb=SHOW_OPTION_YES; have_innodb= SHOW_OPTION_YES;
else else
have_innodb=SHOW_OPTION_DISABLED; have_innodb= SHOW_OPTION_DISABLED;
#endif #endif
break; break;
case OPT_INNODB_DATA_FILE_PATH: case OPT_INNODB_DATA_FILE_PATH:
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
innobase_data_file_path=argument; innobase_data_file_path= argument;
#endif #endif
break; break;
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
......
...@@ -3215,6 +3215,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, ...@@ -3215,6 +3215,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
store_key **ref_key= j->ref.key_copy; store_key **ref_key= j->ref.key_copy;
byte *key_buff=j->ref.key_buff, *null_ref_key= 0; byte *key_buff=j->ref.key_buff, *null_ref_key= 0;
bool keyuse_uses_no_tables= true;
if (ftkey) if (ftkey)
{ {
j->ref.items[0]=((Item_func*)(keyuse->val))->key_item(); j->ref.items[0]=((Item_func*)(keyuse->val))->key_item();
...@@ -3234,6 +3235,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, ...@@ -3234,6 +3235,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
uint maybe_null= test(keyinfo->key_part[i].null_bit); uint maybe_null= test(keyinfo->key_part[i].null_bit);
j->ref.items[i]=keyuse->val; // Save for cond removal j->ref.items[i]=keyuse->val; // Save for cond removal
keyuse_uses_no_tables= keyuse_uses_no_tables & !keyuse->used_tables;
if (!keyuse->used_tables && if (!keyuse->used_tables &&
!(join->select_options & SELECT_DESCRIBE)) !(join->select_options & SELECT_DESCRIBE))
{ // Compare against constant { // Compare against constant
...@@ -3273,7 +3275,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, ...@@ -3273,7 +3275,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
j->type= null_ref_key ? JT_REF_OR_NULL : JT_REF; j->type= null_ref_key ? JT_REF_OR_NULL : JT_REF;
j->ref.null_ref_key= null_ref_key; j->ref.null_ref_key= null_ref_key;
} }
else if (ref_key == j->ref.key_copy) else if (keyuse_uses_no_tables)
{ {
/* /*
This happen if we are using a constant expression in the ON part This happen if we are using a constant expression in the ON part
...@@ -4062,7 +4064,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, bool *simple_order) ...@@ -4062,7 +4064,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, bool *simple_order)
} }
if ((ref=order_tables & (not_const_tables ^ first_table))) if ((ref=order_tables & (not_const_tables ^ first_table)))
{ {
if (only_eq_ref_tables(join,first_order,ref)) if (!(order_tables & first_table) && only_eq_ref_tables(join,first_order,ref))
{ {
DBUG_PRINT("info",("removing: %s", order->item[0]->full_name())); DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
continue; continue;
...@@ -4184,7 +4186,10 @@ change_cond_ref_to_const(I_List<COND_CMP> *save_list,Item *and_father, ...@@ -4184,7 +4186,10 @@ change_cond_ref_to_const(I_List<COND_CMP> *save_list,Item *and_father,
Item *right_item= func->arguments()[1]; Item *right_item= func->arguments()[1];
Item_func::Functype functype= func->functype(); Item_func::Functype functype= func->functype();
if (right_item->eq(field,0) && left_item != value) if (right_item->eq(field,0) && left_item != value &&
(left_item->result_type() != STRING_RESULT ||
value->result_type() != STRING_RESULT ||
left_item->collation.collation == value->collation.collation))
{ {
Item *tmp=value->new_item(); Item *tmp=value->new_item();
if (tmp) if (tmp)
...@@ -4202,7 +4207,10 @@ change_cond_ref_to_const(I_List<COND_CMP> *save_list,Item *and_father, ...@@ -4202,7 +4207,10 @@ change_cond_ref_to_const(I_List<COND_CMP> *save_list,Item *and_father,
func->set_cmp_func(); func->set_cmp_func();
} }
} }
else if (left_item->eq(field,0) && right_item != value) else if (left_item->eq(field,0) && right_item != value &&
(right_item->result_type() != STRING_RESULT ||
value->result_type() != STRING_RESULT ||
right_item->collation.collation == value->collation.collation))
{ {
Item *tmp=value->new_item(); Item *tmp=value->new_item();
if (tmp) if (tmp)
...@@ -5003,16 +5011,21 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ...@@ -5003,16 +5011,21 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
tmp_from_field++; tmp_from_field++;
*(reg_field++)= new_field; *(reg_field++)= new_field;
reclength+=new_field->pack_length(); reclength+=new_field->pack_length();
if (!(new_field->flags & NOT_NULL_FLAG))
null_count++;
if (new_field->flags & BLOB_FLAG) if (new_field->flags & BLOB_FLAG)
{ {
*blob_field++= new_field; *blob_field++= new_field;
blob_count++; blob_count++;
} }
((Item_sum*) item)->args[i]= new Item_field(new_field); ((Item_sum*) item)->args[i]= new Item_field(new_field);
if (((Item_sum*) item)->arg_count == 1) if (!(new_field->flags & NOT_NULL_FLAG))
((Item_sum*) item)->result_field= new_field; {
null_count++;
/*
new_field->maybe_null() is still false, it will be
changed below. But we have to setup Item_field correctly
*/
((Item_sum*) item)->args[i]->maybe_null=1;
}
} }
} }
} }
......
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