Commit 37142368 authored by tomas@mc05.(none)'s avatar tomas@mc05.(none)

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

into mc05.(none):/space2/tomas/mysql-4.1-ndb-test
parents cbc550e5 25b8f29f
...@@ -378,7 +378,7 @@ then ...@@ -378,7 +378,7 @@ then
# 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 cannot be compiled with -fno-implicit-templaces
ndb_cxxflags_fix=-fimplicit-templates 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.
...@@ -1032,6 +1032,7 @@ case $SYSTEM_TYPE in ...@@ -1032,6 +1032,7 @@ case $SYSTEM_TYPE in
CXXFLAGS="$CXXFLAGS +O2" CXXFLAGS="$CXXFLAGS +O2"
MAX_C_OPTIMIZE="" MAX_C_OPTIMIZE=""
MAX_CXX_OPTIMIZE="" MAX_CXX_OPTIMIZE=""
ndb_cxxflags_fix="$ndb_cxxflags_fix -Aa"
fi fi
;; ;;
*rhapsody*) *rhapsody*)
......
...@@ -73,63 +73,5 @@ ExecuteOnComputer: 6 ...@@ -73,63 +73,5 @@ ExecuteOnComputer: 6
Id: 14 Id: 14
ExecuteOnComputer: 7 ExecuteOnComputer: 7
# Mgmtsrvr connections [TCP DEFAULT]
[TCP]
NodeId1: 1
NodeId2: 2
PortNumber: CHOOSE_PORT_BASE02 PortNumber: CHOOSE_PORT_BASE02
[TCP]
NodeId1: 1
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE03
# Ndb nodes connections
[TCP]
NodeId1: 2
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE04
# Api connections
[TCP]
NodeId1: 11
NodeId2: 2
PortNumber: CHOOSE_PORT_BASE05
[TCP]
NodeId1: 11
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE06
[TCP]
NodeId1: 12
NodeId2: 2
PortNumber: CHOOSE_PORT_BASE07
[TCP]
NodeId1: 12
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE08
[TCP]
NodeId1: 13
NodeId2: 2
PortNumber: CHOOSE_PORT_BASE09
[TCP]
NodeId1: 13
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE10
[TCP]
NodeId1: 14
NodeId2: 2
PortNumber: CHOOSE_PORT_BASE11
[TCP]
NodeId1: 14
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE12
...@@ -1075,24 +1075,24 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a; ...@@ -1075,24 +1075,24 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bigint(1) NOT NULL default '0', `a` bigint(20) NOT NULL default '0',
`(SELECT 1)` bigint(1) NOT NULL default '0' `(SELECT 1)` bigint(20) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bigint(1) NOT NULL default '0', `a` bigint(20) NOT NULL default '0',
`(SELECT a)` bigint(1) NOT NULL default '0' `(SELECT a)` bigint(20) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bigint(1) NOT NULL default '0', `a` bigint(20) NOT NULL default '0',
`(SELECT a+0)` bigint(17) NOT NULL default '0' `(SELECT a+0)` bigint(20) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
...@@ -1102,7 +1102,7 @@ a ...@@ -1102,7 +1102,7 @@ a
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bigint(17) NOT NULL default '0' `a` bigint(20) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 (a int); create table t1 (a int);
......
...@@ -546,7 +546,7 @@ aa ...@@ -546,7 +546,7 @@ aa
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` char(2) NOT NULL default '' `a` char(20) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 SELECT 12 as a UNION select 12.2 as a; create table t1 SELECT 12 as a UNION select 12.2 as a;
...@@ -557,7 +557,7 @@ a ...@@ -557,7 +557,7 @@ a
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` double(4,1) NOT NULL default '0.0' `a` double(53,1) NOT NULL default '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text); create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
...@@ -647,7 +647,7 @@ f ...@@ -647,7 +647,7 @@ f
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f` binary(12) default NULL `f` binary(24) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 SELECT y from t2 UNION select da from t2; create table t1 SELECT y from t2 UNION select da from t2;
...@@ -795,7 +795,7 @@ select * from t1; ...@@ -795,7 +795,7 @@ select * from t1;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`1` bigint(1) NOT NULL default '0' `1` bigint(20) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 select _latin1"test" union select _latin2"testt" ; create table t1 select _latin1"test" union select _latin2"testt" ;
...@@ -953,3 +953,10 @@ CREATE TABLE t2 (i int(11) default NULL,c char(1) default NULL,KEY i (i)); ...@@ -953,3 +953,10 @@ CREATE TABLE t2 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
explain (select * from t1) union (select * from t2) order by not_existing_column; explain (select * from t1) union (select * from t2) order by not_existing_column;
ERROR 42S22: Unknown column 'not_existing_column' in 'order clause' ERROR 42S22: Unknown column 'not_existing_column' in 'order clause'
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (uid int(1));
INSERT INTO t1 SELECT 150;
SELECT 'a' UNION SELECT uid FROM t1;
a
a
150
drop table t1;
...@@ -527,3 +527,11 @@ CREATE TABLE t2 (i int(11) default NULL,c char(1) default NULL,KEY i (i)); ...@@ -527,3 +527,11 @@ CREATE TABLE t2 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
--error 1054 --error 1054
explain (select * from t1) union (select * from t2) order by not_existing_column; explain (select * from t1) union (select * from t2) order by not_existing_column;
drop table t1, t2; drop table t1, t2;
#
# length detecting
#
CREATE TABLE t1 (uid int(1));
INSERT INTO t1 SELECT 150;
SELECT 'a' UNION SELECT uid FROM t1;
drop table t1;
...@@ -25,7 +25,13 @@ ...@@ -25,7 +25,13 @@
#endif #endif
#include <sys/param.h> #include <sys/param.h>
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
#include <sys/stat.h> #if defined(__cplusplus) && defined(_APP32_64BIT_OFF_T) && defined(_INCLUDE_AES_SOURCE)
#undef _INCLUDE_AES_SOURCE
#include <sys/stat.h>
#define _INCLUDE_AES_SOURCE
#else
#include <sys/stat.h>
#endif
#endif #endif
#include <sys/resource.h> #include <sys/resource.h>
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
......
...@@ -33,7 +33,7 @@ typedef unsigned int UintR; ...@@ -33,7 +33,7 @@ typedef unsigned int UintR;
#ifdef __SIZE_TYPE__ #ifdef __SIZE_TYPE__
typedef __SIZE_TYPE__ UintPtr; typedef __SIZE_TYPE__ UintPtr;
#else #else
#include <my_config.h> #include <my_global.h>
#ifdef HAVE_STDINT_H #ifdef HAVE_STDINT_H
#include <stdint.h> #include <stdint.h>
#endif #endif
......
...@@ -203,13 +203,13 @@ BaseString::empty() const ...@@ -203,13 +203,13 @@ BaseString::empty() const
inline void inline void
BaseString::ndb_toupper() { BaseString::ndb_toupper() {
for(unsigned i = 0; i < length(); i++) for(unsigned i = 0; i < length(); i++)
m_chr[i] = ::toupper(m_chr[i]); m_chr[i] = toupper(m_chr[i]);
} }
inline void inline void
BaseString::ndb_tolower() { BaseString::ndb_tolower() {
for(unsigned i = 0; i < length(); i++) for(unsigned i = 0; i < length(); i++)
m_chr[i] = ::tolower(m_chr[i]); m_chr[i] = tolower(m_chr[i]);
} }
inline bool inline bool
......
...@@ -150,7 +150,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -150,7 +150,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Tinyunsigned: case Type::Tinyunsigned:
{ {
if (size >= 1) { if (size >= 1) {
...@@ -165,7 +164,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -165,7 +164,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Smallint: case Type::Smallint:
{ {
if (size >= 1) { if (size >= 1) {
...@@ -180,7 +178,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -180,7 +178,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Smallunsigned: case Type::Smallunsigned:
{ {
if (size >= 1) { if (size >= 1) {
...@@ -195,7 +192,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -195,7 +192,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Mediumint: // XXX fix these case Type::Mediumint: // XXX fix these
break; break;
case Type::Mediumunsigned: case Type::Mediumunsigned:
...@@ -214,7 +210,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -214,7 +210,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Unsigned: case Type::Unsigned:
{ {
if (size >= 1) { if (size >= 1) {
...@@ -229,7 +224,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -229,7 +224,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Bigint: case Type::Bigint:
{ {
if (size >= 2) { if (size >= 2) {
...@@ -246,7 +240,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -246,7 +240,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Bigunsigned: case Type::Bigunsigned:
{ {
if (size >= 2) { if (size >= 2) {
...@@ -263,7 +256,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -263,7 +256,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Float: case Type::Float:
{ {
if (size >= 1) { if (size >= 1) {
...@@ -278,7 +270,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -278,7 +270,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Double: case Type::Double:
{ {
if (size >= 2) { if (size >= 2) {
...@@ -295,7 +286,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -295,7 +286,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Decimal: case Type::Decimal:
break; break;
case Type::Char: case Type::Char:
...@@ -310,7 +300,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -310,7 +300,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
int k = memcmp(u1.v, u2.v, size << 2); int k = memcmp(u1.v, u2.v, size << 2);
return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown; return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown;
} }
break;
case Type::Varchar: case Type::Varchar:
{ {
/* /*
...@@ -328,7 +317,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -328,7 +317,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Binary: // XXX fix these case Type::Binary: // XXX fix these
break; break;
case Type::Varbinary: case Type::Varbinary:
...@@ -352,7 +340,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -352,7 +340,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
case Type::Timespec: // XXX fix this case Type::Timespec: // XXX fix this
break; break;
case Type::Blob: // XXX fix case Type::Blob: // XXX fix
...@@ -371,7 +358,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full, ...@@ -371,7 +358,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
} }
return CmpUnknown; return CmpUnknown;
} }
break;
} }
return CmpError; return CmpError;
} }
......
...@@ -59,10 +59,10 @@ printFSREADWRITEREQ(FILE * output, const Uint32 * theData, ...@@ -59,10 +59,10 @@ printFSREADWRITEREQ(FILE * output, const Uint32 * theData,
sig->numberOfPages); sig->numberOfPages);
fprintf(output, " pageData: "); fprintf(output, " pageData: ");
unsigned int i;
switch(sig->getFormatFlag(sig->operationFlag)){ switch(sig->getFormatFlag(sig->operationFlag)){
case FsReadWriteReq::fsFormatListOfPairs: case FsReadWriteReq::fsFormatListOfPairs:
for (unsigned int i = 0; i < sig->numberOfPages*2; i += 2){ for (i= 0; i < sig->numberOfPages*2; i += 2){
fprintf(output, " H\'%.8x, H\'%.8x\n", sig->data.pageData[i], fprintf(output, " H\'%.8x, H\'%.8x\n", sig->data.pageData[i],
sig->data.pageData[i + 1]); sig->data.pageData[i + 1]);
} }
...@@ -72,7 +72,7 @@ printFSREADWRITEREQ(FILE * output, const Uint32 * theData, ...@@ -72,7 +72,7 @@ printFSREADWRITEREQ(FILE * output, const Uint32 * theData,
sig->data.pageData[1]); sig->data.pageData[1]);
break; break;
case FsReadWriteReq::fsFormatListOfMemPages: case FsReadWriteReq::fsFormatListOfMemPages:
for (unsigned int i = 0; i < (sig->numberOfPages + 1); i++){ for (i= 0; i < (sig->numberOfPages + 1); i++){
fprintf(output, " H\'%.8x, ", sig->data.pageData[i]); fprintf(output, " H\'%.8x, ", sig->data.pageData[i]);
} }
break; break;
......
...@@ -143,6 +143,19 @@ ConfigInfo::m_SectionRules[] = { ...@@ -143,6 +143,19 @@ ConfigInfo::m_SectionRules[] = {
}; };
const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule); const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule);
/****************************************************************************
* Config Rules declarations
****************************************************************************/
bool addNodeConnections(Vector<ConfigInfo::ConfigRuleSection>&sections,
struct InitConfigFileParser::Context &ctx,
const char * ruleData);
const ConfigInfo::ConfigRule
ConfigInfo::m_ConfigRules[] = {
{ addNodeConnections, 0 },
{ 0, 0 }
};
struct DepricationTransform { struct DepricationTransform {
const char * m_section; const char * m_section;
const char * m_oldName; const char * m_oldName;
...@@ -1525,7 +1538,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1525,7 +1538,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::USED, ConfigInfo::USED,
false, false,
ConfigInfo::INT, ConfigInfo::INT,
MANDATORY, 2202,
0, 0,
0x7FFFFFFF }, 0x7FFFFFFF },
...@@ -2712,13 +2725,13 @@ checkMandatory(InitConfigFileParser::Context & ctx, const char * data){ ...@@ -2712,13 +2725,13 @@ checkMandatory(InitConfigFileParser::Context & ctx, const char * data){
* Transform a string "NodeidX" (e.g. "uppsala.32") * Transform a string "NodeidX" (e.g. "uppsala.32")
* into a Uint32 "NodeIdX" (e.g. 32) and a string "SystemX" (e.g. "uppsala"). * into a Uint32 "NodeIdX" (e.g. 32) and a string "SystemX" (e.g. "uppsala").
*/ */
bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data){ bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data)
{
char buf[] = "NodeIdX"; buf[6] = data[sizeof("NodeI")]; char buf[] = "NodeIdX"; buf[6] = data[sizeof("NodeI")];
char sysbuf[] = "SystemX"; sysbuf[6] = data[sizeof("NodeI")]; char sysbuf[] = "SystemX"; sysbuf[6] = data[sizeof("NodeI")];
const char* nodeId; const char* nodeId;
require(ctx.m_currentSection->get(buf, &nodeId)); require(ctx.m_currentSection->get(buf, &nodeId));
char tmpLine[MAX_LINE_LENGTH]; char tmpLine[MAX_LINE_LENGTH];
strncpy(tmpLine, nodeId, MAX_LINE_LENGTH); strncpy(tmpLine, nodeId, MAX_LINE_LENGTH);
char* token1 = strtok(tmpLine, "."); char* token1 = strtok(tmpLine, ".");
...@@ -2739,7 +2752,6 @@ bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data){ ...@@ -2739,7 +2752,6 @@ bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data){
require(ctx.m_currentSection->put(buf, id, true)); require(ctx.m_currentSection->put(buf, id, true));
require(ctx.m_currentSection->put(sysbuf, token1)); require(ctx.m_currentSection->put(sysbuf, token1));
} }
return true; return true;
} }
...@@ -2862,9 +2874,9 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){ ...@@ -2862,9 +2874,9 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
Uint32 adder = 0; Uint32 adder = 0;
ctx.m_userProperties.get("PortNumberAdder", &adder); ctx.m_userProperties.get("PortNumberAdder", &adder);
Uint32 base = 0; Uint32 base = 0;
if(!ctx.m_userDefaults->get("PortNumber", &base) && if(!(ctx.m_userDefaults && ctx.m_userDefaults->get("PortNumber", &base)) &&
!ctx.m_systemDefaults->get("PortNumber", &base)){ !ctx.m_systemDefaults->get("PortNumber", &base)){
return true; return false;
} }
ctx.m_currentSection->put("PortNumber", base + adder); ctx.m_currentSection->put("PortNumber", base + adder);
adder++; adder++;
...@@ -3144,3 +3156,88 @@ saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){ ...@@ -3144,3 +3156,88 @@ saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){
} while(0); } while(0);
return true; return true;
} }
bool
addNodeConnections(Vector<ConfigInfo::ConfigRuleSection>&sections,
struct InitConfigFileParser::Context &ctx,
const char * ruleData)
{
Properties * props= ctx.m_config;
Properties p_connections;
Properties p_connections2;
for (Uint32 i = 0;; i++){
const Properties * tmp;
Uint32 nodeId1, nodeId2;
if(!props->get("Connection", i, &tmp)) break;
if(!tmp->get("NodeId1", &nodeId1)) continue;
p_connections.put("", nodeId1, nodeId1);
if(!tmp->get("NodeId2", &nodeId2)) continue;
p_connections.put("", nodeId2, nodeId2);
p_connections2.put("", nodeId1 + nodeId2<<16, nodeId1);
p_connections2.put("", nodeId2 + nodeId1<<16, nodeId2);
}
Uint32 nNodes;
ctx.m_userProperties.get("NoOfNodes", &nNodes);
Properties p_db_nodes;
Properties p_api_mgm_nodes;
Uint32 i_db= 0, i_api_mgm= 0;
for (Uint32 i= 0, n= 0; n < nNodes; i++){
const Properties * tmp;
if(!props->get("Node", i, &tmp)) continue;
n++;
const char * type;
if(!tmp->get("Type", &type)) continue;
if (strcmp(type,"DB") == 0)
p_db_nodes.put("", i_db++, i);
else if (strcmp(type,"API") == 0 ||
strcmp(type,"MGM") == 0)
p_api_mgm_nodes.put("", i_api_mgm++, i);
}
Uint32 nodeId1, nodeId2, dummy;
for (Uint32 i= 0; p_db_nodes.get("", i, &nodeId1); i++){
for (Uint32 j= i+1;; j++){
if(!p_db_nodes.get("", j, &nodeId2)) break;
if(!p_connections2.get("", nodeId1+nodeId2<<16, &dummy)) {
ConfigInfo::ConfigRuleSection s;
s.m_sectionType= BaseString("TCP");
s.m_sectionData= new Properties;
char buf[16];
snprintf(buf, sizeof(buf), "%u", nodeId1);
s.m_sectionData->put("NodeId1", buf);
snprintf(buf, sizeof(buf), "%u", nodeId2);
s.m_sectionData->put("NodeId2", buf);
sections.push_back(s);
}
}
}
for (Uint32 i= 0; p_api_mgm_nodes.get("", i, &nodeId1); i++){
if(!p_connections.get("", nodeId1, &dummy)) {
for (Uint32 j= 0;; j++){
if(!p_db_nodes.get("", j, &nodeId2)) break;
ConfigInfo::ConfigRuleSection s;
s.m_sectionType= BaseString("TCP");
s.m_sectionData= new Properties;
char buf[16];
snprintf(buf, sizeof(buf), "%u", nodeId1);
s.m_sectionData->put("NodeId1", buf);
snprintf(buf, sizeof(buf), "%u", nodeId2);
s.m_sectionData->put("NodeId2", buf);
sections.push_back(s);
}
}
}
return true;
}
...@@ -71,6 +71,21 @@ public: ...@@ -71,6 +71,21 @@ public:
const char * m_ruleData; const char * m_ruleData;
}; };
/**
* Entry for config rule
*/
struct ConfigRuleSection {
BaseString m_sectionType;
Properties * m_sectionData;
};
struct ConfigRule {
bool (* m_configRule)(Vector<ConfigRuleSection>&,
struct InitConfigFileParser::Context &,
const char * m_ruleData);
const char * m_ruleData;
};
ConfigInfo(); ConfigInfo();
/** /**
...@@ -113,6 +128,7 @@ private: ...@@ -113,6 +128,7 @@ private:
public: public:
static const SectionRule m_SectionRules[]; static const SectionRule m_SectionRules[];
static const ConfigRule m_ConfigRules[];
static const int m_NoOfRules; static const int m_NoOfRules;
}; };
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <NdbOut.hpp> #include <NdbOut.hpp>
#include "ConfigInfo.hpp" #include "ConfigInfo.hpp"
const int MAX_LINE_LENGTH = 120; // Max length of line of text in config file const int MAX_LINE_LENGTH = 1024; // Max length of line of text in config file
static void trim(char *); static void trim(char *);
static void require(bool v) { if(!v) abort();} static void require(bool v) { if(!v) abort();}
...@@ -163,6 +163,30 @@ InitConfigFileParser::parseConfig(FILE * file) { ...@@ -163,6 +163,30 @@ InitConfigFileParser::parseConfig(FILE * file) {
return 0; return 0;
} }
for(size_t i = 0; ConfigInfo::m_ConfigRules[i].m_configRule != 0; i++){
ctx.type = InitConfigFileParser::Undefined;
ctx.m_currentSection = 0;
ctx.m_userDefaults = 0;
ctx.m_currentInfo = 0;
ctx.m_systemDefaults = 0;
Vector<ConfigInfo::ConfigRuleSection> tmp;
if(!(* ConfigInfo::m_ConfigRules[i].m_configRule)(tmp, ctx,
ConfigInfo::m_ConfigRules[i].m_ruleData))
return 0;
for(size_t j = 0; j<tmp.size(); j++){
snprintf(ctx.fname, sizeof(ctx.fname), tmp[j].m_sectionType.c_str());
ctx.type = InitConfigFileParser::Section;
ctx.m_currentSection = tmp[j].m_sectionData;
ctx.m_userDefaults = getSection(ctx.fname, ctx.m_defaults);
ctx.m_currentInfo = m_info->getInfo(ctx.fname);
ctx.m_systemDefaults = m_info->getDefaults(ctx.fname);
if(!storeSection(ctx))
return 0;
}
}
Uint32 nConnections = 0; Uint32 nConnections = 0;
Uint32 nComputers = 0; Uint32 nComputers = 0;
Uint32 nNodes = 0; Uint32 nNodes = 0;
...@@ -499,28 +523,22 @@ bool ...@@ -499,28 +523,22 @@ bool
InitConfigFileParser::storeSection(Context& ctx){ InitConfigFileParser::storeSection(Context& ctx){
if(ctx.m_currentSection == NULL) if(ctx.m_currentSection == NULL)
return true; return true;
for(int i = strlen(ctx.fname) - 1; i>=0; i--){ for(int i = strlen(ctx.fname) - 1; i>=0; i--){
ctx.fname[i] = toupper(ctx.fname[i]); ctx.fname[i] = toupper(ctx.fname[i]);
} }
snprintf(ctx.pname, sizeof(ctx.pname), ctx.fname); snprintf(ctx.pname, sizeof(ctx.pname), ctx.fname);
char buf[255]; char buf[255];
if(ctx.type == InitConfigFileParser::Section) if(ctx.type == InitConfigFileParser::Section)
snprintf(buf, sizeof(buf), "%s", ctx.fname); snprintf(buf, sizeof(buf), "%s", ctx.fname);
if(ctx.type == InitConfigFileParser::DefaultSection) if(ctx.type == InitConfigFileParser::DefaultSection)
snprintf(buf, sizeof(buf), "%s DEFAULT", ctx.fname); snprintf(buf, sizeof(buf), "%s DEFAULT", ctx.fname);
snprintf(ctx.fname, sizeof(ctx.fname), buf); snprintf(ctx.fname, sizeof(ctx.fname), buf);
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;
}
}
} }
} }
......
...@@ -430,7 +430,7 @@ const int no_of_type_values = (sizeof(type_values) / ...@@ -430,7 +430,7 @@ const int no_of_type_values = (sizeof(type_values) /
sizeof(ndb_mgm_type_atoi)); sizeof(ndb_mgm_type_atoi));
extern "C" extern "C"
enum ndb_mgm_node_type ndb_mgm_node_type
ndb_mgm_match_node_type(const char * type) ndb_mgm_match_node_type(const char * type)
{ {
if(type == 0) if(type == 0)
...@@ -474,7 +474,7 @@ const int no_of_status_values = (sizeof(status_values) / ...@@ -474,7 +474,7 @@ const int no_of_status_values = (sizeof(status_values) /
sizeof(ndb_mgm_status_atoi)); sizeof(ndb_mgm_status_atoi));
extern "C" extern "C"
enum ndb_mgm_node_status ndb_mgm_node_status
ndb_mgm_match_node_status(const char * status) ndb_mgm_match_node_status(const char * status)
{ {
if(status == 0) if(status == 0)
......
...@@ -5812,3 +5812,30 @@ void Field::set_warning(const uint level, const uint code) ...@@ -5812,3 +5812,30 @@ void Field::set_warning(const uint level, const uint code)
code, ER(code), field_name, thd->row_count); code, ER(code), field_name, thd->row_count);
} }
} }
/*
maximum possible display length for blob
SYNOPSIS
Field_blob::max_length()
RETURN
length
*/
uint32 Field_blob::max_length()
{
switch (packlength)
{
case 1:
return 255;
case 2:
return 65535;
case 3:
return 16777215;
case 4:
return (uint32)4294967295;
default:
DBUG_ASSERT(0); // we should never go here
return 0;
}
}
...@@ -267,6 +267,8 @@ public: ...@@ -267,6 +267,8 @@ public:
void set_warning(const unsigned int level, const unsigned int code); void set_warning(const unsigned int level, const unsigned int code);
virtual field_cast_enum field_cast_type()= 0; virtual field_cast_enum field_cast_type()= 0;
bool field_cast_compatible(field_cast_enum type); bool field_cast_compatible(field_cast_enum type);
/* maximum possible display length */
virtual uint32 max_length()= 0;
friend bool reopen_table(THD *,struct st_table *,bool); friend bool reopen_table(THD *,struct st_table *,bool);
friend int cre_myisam(my_string name, register TABLE *form, uint options, friend int cre_myisam(my_string name, register TABLE *form, uint options,
ulonglong auto_increment_value); ulonglong auto_increment_value);
...@@ -336,6 +338,7 @@ public: ...@@ -336,6 +338,7 @@ public:
CHARSET_INFO *charset(void) const { return field_charset; } CHARSET_INFO *charset(void) const { return field_charset; }
void set_charset(CHARSET_INFO *charset) { field_charset=charset; } void set_charset(CHARSET_INFO *charset) { field_charset=charset; }
bool binary() const { return field_charset->state & MY_CS_BINSORT ? 1 : 0; } bool binary() const { return field_charset->state & MY_CS_BINSORT ? 1 : 0; }
uint32 max_length() { return field_length; }
friend class create_field; friend class create_field;
}; };
...@@ -366,6 +369,7 @@ public: ...@@ -366,6 +369,7 @@ public:
void overflow(bool negative); void overflow(bool negative);
bool zero_pack() const { return 0; } bool zero_pack() const { return 0; }
void sql_type(String &str) const; void sql_type(String &str) const;
uint32 max_length() { return field_length; }
field_cast_enum field_cast_type() { return FIELD_CAST_DECIMAL; } field_cast_enum field_cast_type() { return FIELD_CAST_DECIMAL; }
}; };
...@@ -397,6 +401,7 @@ public: ...@@ -397,6 +401,7 @@ public:
void sort_string(char *buff,uint length); void sort_string(char *buff,uint length);
uint32 pack_length() const { return 1; } uint32 pack_length() const { return 1; }
void sql_type(String &str) const; void sql_type(String &str) const;
uint32 max_length() { return 4; }
field_cast_enum field_cast_type() { return FIELD_CAST_TINY; } field_cast_enum field_cast_type() { return FIELD_CAST_TINY; }
}; };
...@@ -433,6 +438,7 @@ public: ...@@ -433,6 +438,7 @@ public:
void sort_string(char *buff,uint length); void sort_string(char *buff,uint length);
uint32 pack_length() const { return 2; } uint32 pack_length() const { return 2; }
void sql_type(String &str) const; void sql_type(String &str) const;
uint32 max_length() { return 6; }
field_cast_enum field_cast_type() { return FIELD_CAST_SHORT; } field_cast_enum field_cast_type() { return FIELD_CAST_SHORT; }
}; };
...@@ -464,6 +470,7 @@ public: ...@@ -464,6 +470,7 @@ public:
void sort_string(char *buff,uint length); void sort_string(char *buff,uint length);
uint32 pack_length() const { return 3; } uint32 pack_length() const { return 3; }
void sql_type(String &str) const; void sql_type(String &str) const;
uint32 max_length() { return 8; }
field_cast_enum field_cast_type() { return FIELD_CAST_MEDIUM; } field_cast_enum field_cast_type() { return FIELD_CAST_MEDIUM; }
}; };
...@@ -500,6 +507,7 @@ public: ...@@ -500,6 +507,7 @@ public:
void sort_string(char *buff,uint length); void sort_string(char *buff,uint length);
uint32 pack_length() const { return 4; } uint32 pack_length() const { return 4; }
void sql_type(String &str) const; void sql_type(String &str) const;
uint32 max_length() { return 11; }
field_cast_enum field_cast_type() { return FIELD_CAST_LONG; } field_cast_enum field_cast_type() { return FIELD_CAST_LONG; }
}; };
...@@ -539,6 +547,7 @@ public: ...@@ -539,6 +547,7 @@ public:
uint32 pack_length() const { return 8; } uint32 pack_length() const { return 8; }
void sql_type(String &str) const; void sql_type(String &str) const;
bool store_for_compare() { return 1; } bool store_for_compare() { return 1; }
uint32 max_length() { return 20; }
field_cast_enum field_cast_type() { return FIELD_CAST_LONGLONG; } field_cast_enum field_cast_type() { return FIELD_CAST_LONGLONG; }
}; };
#endif #endif
...@@ -573,6 +582,7 @@ public: ...@@ -573,6 +582,7 @@ public:
void sort_string(char *buff,uint length); void sort_string(char *buff,uint length);
uint32 pack_length() const { return sizeof(float); } uint32 pack_length() const { return sizeof(float); }
void sql_type(String &str) const; void sql_type(String &str) const;
uint32 max_length() { return 24; }
field_cast_enum field_cast_type() { return FIELD_CAST_FLOAT; } field_cast_enum field_cast_type() { return FIELD_CAST_FLOAT; }
}; };
...@@ -607,6 +617,7 @@ public: ...@@ -607,6 +617,7 @@ public:
void sort_string(char *buff,uint length); void sort_string(char *buff,uint length);
uint32 pack_length() const { return sizeof(double); } uint32 pack_length() const { return sizeof(double); }
void sql_type(String &str) const; void sql_type(String &str) const;
uint32 max_length() { return 53; }
field_cast_enum field_cast_type() { return FIELD_CAST_DOUBLE; } field_cast_enum field_cast_type() { return FIELD_CAST_DOUBLE; }
}; };
...@@ -637,6 +648,7 @@ public: ...@@ -637,6 +648,7 @@ public:
uint32 pack_length() const { return 0; } uint32 pack_length() const { return 0; }
void sql_type(String &str) const; void sql_type(String &str) const;
uint size_of() const { return sizeof(*this); } uint size_of() const { return sizeof(*this); }
uint32 max_length() { return 4; }
field_cast_enum field_cast_type() { return FIELD_CAST_NULL; } field_cast_enum field_cast_type() { return FIELD_CAST_NULL; }
}; };
...@@ -1034,6 +1046,7 @@ public: ...@@ -1034,6 +1046,7 @@ public:
bool has_charset(void) const bool has_charset(void) const
{ return charset() == &my_charset_bin ? FALSE : TRUE; } { return charset() == &my_charset_bin ? FALSE : TRUE; }
field_cast_enum field_cast_type() { return FIELD_CAST_BLOB; } field_cast_enum field_cast_type() { return FIELD_CAST_BLOB; }
uint32 max_length();
}; };
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
...@@ -1062,6 +1075,7 @@ public: ...@@ -1062,6 +1075,7 @@ public:
void get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetype type); void get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetype type);
void set_key_image(char *buff,uint length, CHARSET_INFO *cs); void set_key_image(char *buff,uint length, CHARSET_INFO *cs);
uint32 max_length() { return field_length; }
field_cast_enum field_cast_type() { return FIELD_CAST_GEOM; } field_cast_enum field_cast_type() { return FIELD_CAST_GEOM; }
}; };
#endif /*HAVE_SPATIAL*/ #endif /*HAVE_SPATIAL*/
......
...@@ -2419,6 +2419,7 @@ Item_type_holder::Item_type_holder(THD *thd, Item *item) ...@@ -2419,6 +2419,7 @@ Item_type_holder::Item_type_holder(THD *thd, Item *item)
field_example= ((Item_field*) item)->field; field_example= ((Item_field*) item)->field;
else else
field_example= 0; field_example= 0;
max_length= real_length(item);
collation.set(item->collation); collation.set(item->collation);
} }
...@@ -2438,6 +2439,7 @@ static Item_result type_convertor[4][4]= ...@@ -2438,6 +2439,7 @@ static Item_result type_convertor[4][4]=
bool Item_type_holder::join_types(THD *thd, Item *item) bool Item_type_holder::join_types(THD *thd, Item *item)
{ {
uint32 new_length= real_length(item);
bool change_field= 0, skip_store_field= 0; bool change_field= 0, skip_store_field= 0;
Item_result new_type= type_convertor[item_type][item->result_type()]; Item_result new_type= type_convertor[item_type][item->result_type()];
...@@ -2463,7 +2465,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item) ...@@ -2463,7 +2465,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
// size/type should be changed // size/type should be changed
if (change_field || if (change_field ||
(new_type != item_type) || (new_type != item_type) ||
(max_length < item->max_length) || (max_length < new_length) ||
((new_type == INT_RESULT) && ((new_type == INT_RESULT) &&
(decimals < item->decimals)) || (decimals < item->decimals)) ||
(!maybe_null && item->maybe_null) || (!maybe_null && item->maybe_null) ||
...@@ -2472,7 +2474,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item) ...@@ -2472,7 +2474,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
{ {
// new field has some parameters worse then current // new field has some parameters worse then current
skip_store_field|= (change_field && skip_store_field|= (change_field &&
(max_length > item->max_length) || (max_length > new_length) ||
((new_type == INT_RESULT) && ((new_type == INT_RESULT) &&
(decimals > item->decimals)) || (decimals > item->decimals)) ||
(maybe_null && !item->maybe_null) || (maybe_null && !item->maybe_null) ||
...@@ -2501,7 +2503,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item) ...@@ -2501,7 +2503,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
return 1; return 1;
} }
max_length= max(max_length, item->max_length); max_length= max(max_length, new_length);
decimals= max(decimals, item->decimals); decimals= max(decimals, item->decimals);
maybe_null|= item->maybe_null; maybe_null|= item->maybe_null;
item_type= new_type; item_type= new_type;
...@@ -2510,6 +2512,26 @@ bool Item_type_holder::join_types(THD *thd, Item *item) ...@@ -2510,6 +2512,26 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
return 0; return 0;
} }
uint32 Item_type_holder::real_length(Item *item)
{
if (item->type() == Item::FIELD_ITEM)
{
return ((Item_field *)item)->max_disp_length();
}
switch (item->result_type())
{
case STRING_RESULT:
return item->max_length;
case REAL_RESULT:
return 53;
case INT_RESULT:
return 20;
case ROW_RESULT:
default:
DBUG_ASSERT(0); // we should never go there
return 0;
}
}
double Item_type_holder::val() double Item_type_holder::val()
{ {
......
...@@ -382,6 +382,7 @@ public: ...@@ -382,6 +382,7 @@ public:
bool is_null() { return field->is_null(); } bool is_null() { return field->is_null(); }
Item *get_tmp_table_item(THD *thd); Item *get_tmp_table_item(THD *thd);
void cleanup(); void cleanup();
inline uint32 max_disp_length() { return field->max_length(); }
friend class Item_default_value; friend class Item_default_value;
friend class Item_insert_value; friend class Item_insert_value;
friend class st_select_lex_unit; friend class st_select_lex_unit;
...@@ -1199,6 +1200,7 @@ public: ...@@ -1199,6 +1200,7 @@ public:
String *val_str(String*); String *val_str(String*);
bool join_types(THD *thd, Item *); bool join_types(THD *thd, Item *);
Field *example() { return field_example; } Field *example() { return field_example; }
static uint32 real_length(Item *item);
void cleanup() void cleanup()
{ {
DBUG_ENTER("Item_type_holder::cleanup"); DBUG_ENTER("Item_type_holder::cleanup");
......
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