Commit f0f8b0a9 authored by ndbdev@dl145c.mysql.com's avatar ndbdev@dl145c.mysql.com

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

into dl145c.mysql.com:/home/ndbdev/tomas/mysql-5.1
parents 4b478284 ed674271
...@@ -273,8 +273,8 @@ int CertManager::SetPrivateKey(const x509& key) ...@@ -273,8 +273,8 @@ int CertManager::SetPrivateKey(const x509& key)
privateKey_.assign(key.get_buffer(), key.get_length()); privateKey_.assign(key.get_buffer(), key.get_length());
// set key type // set key type
if (x509* cert = list_.front()) { if (x509* cert509 = list_.front()) {
TaoCrypt::Source source(cert->get_buffer(), cert->get_length()); TaoCrypt::Source source(cert509->get_buffer(), cert509->get_length());
TaoCrypt::CertDecoder cert(source, false); TaoCrypt::CertDecoder cert(source, false);
cert.DecodeToKey(); cert.DecodeToKey();
if (int err = cert.GetError().What()) if (int err = cert.GetError().What())
......
...@@ -65,7 +65,7 @@ UNKOWN_HASH_E = 1034, // "unknown hash OID" ...@@ -65,7 +65,7 @@ UNKOWN_HASH_E = 1034, // "unknown hash OID"
DSA_SZ_E = 1035, // "bad DSA r or s size" DSA_SZ_E = 1035, // "bad DSA r or s size"
BEFORE_DATE_E = 1036, // "before date in the future" BEFORE_DATE_E = 1036, // "before date in the future"
AFTER_DATE_E = 1037, // "after date in the past" AFTER_DATE_E = 1037, // "after date in the past"
SIG_CONFIRM_E = 1038, // "bad signature confirmation" SIG_CONFIRM_E = 1038 // "bad signature confirmation"
}; };
......
...@@ -97,7 +97,7 @@ typedef unsigned int word32; ...@@ -97,7 +97,7 @@ typedef unsigned int word32;
typedef word32 word; typedef word32 word;
typedef word64 dword; typedef word64 dword;
#else #else
typedef word8 hword; typedef byte hword;
typedef word16 word; typedef word16 word;
typedef word32 dword; typedef word32 dword;
#endif #endif
......
...@@ -120,6 +120,9 @@ ASIN(0.8+0.2) ...@@ -120,6 +120,9 @@ ASIN(0.8+0.2)
SELECT ASIN(1.2-0.2); SELECT ASIN(1.2-0.2);
ASIN(1.2-0.2) ASIN(1.2-0.2)
1.5707963267949 1.5707963267949
select format(4.55, 1), format(4.551, 1);
format(4.55, 1) format(4.551, 1)
4.6 4.6
explain extended select degrees(pi()),radians(360); explain extended select degrees(pi()),radians(360);
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 NULL NULL NULL NULL NULL NULL NULL No tables used 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
......
...@@ -667,3 +667,9 @@ counter datavalue ...@@ -667,3 +667,9 @@ counter datavalue
57 newval 57 newval
58 newval 58 newval
drop table t1; drop table t1;
create table atablewithareallylongandirritatingname (a int);
insert into atablewithareallylongandirritatingname values (2);
select * from atablewithareallylongandirritatingname;
a
2
drop table atablewithareallylongandirritatingname;
...@@ -2355,6 +2355,74 @@ EXPLAIN SELECT i FROM t1 WHERE i=1; ...@@ -2355,6 +2355,74 @@ EXPLAIN SELECT i FROM t1 WHERE i=1;
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 t1 const PRIMARY PRIMARY 4 const 1 Using index 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
1 SIMPLE t2 ref a a 23 test.t1.a 2
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
1 SIMPLE t2 ref a a 23 test.t1.a 2
DROP TABLE t1, t2;
CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London');
INSERT INTO t1 VALUES ('Paris');
SELECT * FROM t1 WHERE city='London';
city
London
SELECT * FROM t1 WHERE city='london';
city
London
EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1 WHERE city='London' AND city='london';
city
London
EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
city
London
DROP TABLE t1;
create table t1 (a int(11) unsigned, b int(11) unsigned);
insert into t1 values (1,0), (1,1), (1,2);
select a-b from t1 order by 1;
a-b
0
1
18446744073709551615
select a-b , (a-b < 0) from t1 order by 1;
a-b (a-b < 0)
0 0
1 0
18446744073709551615 0
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
d (a-b >= 0) b
1 1 0
0 1 1
18446744073709551615 1 2
select cast((a - b) as unsigned) from t1 order by 1;
cast((a - b) as unsigned)
0
1
18446744073709551615
drop table t1;
create table t1 (a int(11));
select all all * from t1;
a
select distinct distinct * from t1;
a
select all distinct * from t1;
ERROR HY000: Incorrect usage of ALL and DISTINCT
select distinct all * from t1;
ERROR HY000: Incorrect usage of ALL and DISTINCT
drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '',
K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000',
...@@ -2486,3 +2554,125 @@ ERROR HY000: Incorrect usage of ALL and DISTINCT ...@@ -2486,3 +2554,125 @@ ERROR HY000: Incorrect usage of ALL and DISTINCT
select distinct all * from t1; select distinct all * from t1;
ERROR HY000: Incorrect usage of ALL and DISTINCT ERROR HY000: Incorrect usage of ALL and DISTINCT
drop table t1; drop table t1;
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
1 SIMPLE t2 ref a a 23 test.t1.a 2
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
1 SIMPLE t2 ref a a 23 test.t1.a 2
DROP TABLE t1, t2;
CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London');
INSERT INTO t1 VALUES ('Paris');
SELECT * FROM t1 WHERE city='London';
city
London
SELECT * FROM t1 WHERE city='london';
city
London
EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1 WHERE city='London' AND city='london';
city
London
EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
city
London
DROP TABLE t1;
create table t1 (a int(11) unsigned, b int(11) unsigned);
insert into t1 values (1,0), (1,1), (1,2);
select a-b from t1 order by 1;
a-b
0
1
18446744073709551615
select a-b , (a-b < 0) from t1 order by 1;
a-b (a-b < 0)
0 0
1 0
18446744073709551615 0
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
d (a-b >= 0) b
1 1 0
0 1 1
18446744073709551615 1 2
select cast((a - b) as unsigned) from t1 order by 1;
cast((a - b) as unsigned)
0
1
18446744073709551615
drop table t1;
create table t1 (a int(11));
select all all * from t1;
a
select distinct distinct * from t1;
a
select all distinct * from t1;
ERROR HY000: Incorrect usage of ALL and DISTINCT
select distinct all * from t1;
ERROR HY000: Incorrect usage of ALL and DISTINCT
drop table t1;
CREATE TABLE t1 (
kunde_intern_id int(10) unsigned NOT NULL default '0',
kunde_id int(10) unsigned NOT NULL default '0',
FK_firma_id int(10) unsigned NOT NULL default '0',
aktuell enum('Ja','Nein') NOT NULL default 'Ja',
vorname varchar(128) NOT NULL default '',
nachname varchar(128) NOT NULL default '',
geloescht enum('Ja','Nein') NOT NULL default 'Nein',
firma varchar(128) NOT NULL default ''
);
INSERT INTO t1 VALUES
(3964,3051,1,'Ja','Vorname1','1Nachname','Nein','Print Schau XXXX'),
(3965,3051111,1,'Ja','Vorname1111','1111Nachname','Nein','Print Schau XXXX');
SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname, geloescht FROM t1
WHERE
(
(
( '' != '' AND firma LIKE CONCAT('%', '', '%'))
OR
(vorname LIKE CONCAT('%', 'Vorname1', '%') AND
nachname LIKE CONCAT('%', '1Nachname', '%') AND
'Vorname1' != '' AND 'xxxx' != '')
)
AND
(
aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
)
)
;
kunde_id FK_firma_id aktuell vorname nachname geloescht
SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname,
geloescht FROM t1
WHERE
(
(
aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
)
AND
(
( '' != '' AND firma LIKE CONCAT('%', '', '%') )
OR
( vorname LIKE CONCAT('%', 'Vorname1', '%') AND
nachname LIKE CONCAT('%', '1Nachname', '%') AND 'Vorname1' != '' AND
'xxxx' != '')
)
)
;
kunde_id FK_firma_id aktuell vorname nachname geloescht
SELECT COUNT(*) FROM t1 WHERE
( 0 OR (vorname LIKE '%Vorname1%' AND nachname LIKE '%1Nachname%' AND 1))
AND FK_firma_id = 2;
COUNT(*)
0
drop table t1;
...@@ -54,6 +54,11 @@ SELECT ASIN(1.2-0.2); ...@@ -54,6 +54,11 @@ SELECT ASIN(1.2-0.2);
#select floor(log(8)/log(2)); #select floor(log(8)/log(2));
#select floor(log(16)/log(2)); #select floor(log(16)/log(2));
#
# Bug #9060 (format returns incorrect result)
#
select format(4.55, 1), format(4.551, 1);
explain extended select degrees(pi()),radians(360); explain extended select degrees(pi()),radians(360);
# #
......
...@@ -605,3 +605,12 @@ insert into t1 (datavalue) select datavalue from t1 where counter < 100; ...@@ -605,3 +605,12 @@ insert into t1 (datavalue) select datavalue from t1 where counter < 100;
select * from t1 order by counter; select * from t1 order by counter;
drop table t1; drop table t1;
#
# Test long table name
#
create table atablewithareallylongandirritatingname (a int);
insert into atablewithareallylongandirritatingname values (2);
select * from atablewithareallylongandirritatingname;
drop table atablewithareallylongandirritatingname;
...@@ -1939,6 +1939,64 @@ EXPLAIN SELECT i FROM t1 WHERE i=1; ...@@ -1939,6 +1939,64 @@ EXPLAIN SELECT i FROM t1 WHERE i=1;
DROP TABLE t1; DROP TABLE t1;
#
# Test case for bug 7520: a wrong cost of the index for a BLOB field
#
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
DROP TABLE t1, t2;
#
# Test case for bug 7098: substitution of a constant for a string field
#
CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London');
INSERT INTO t1 VALUES ('Paris');
SELECT * FROM t1 WHERE city='London';
SELECT * FROM t1 WHERE city='london';
EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
SELECT * FROM t1 WHERE city='London' AND city='london';
EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
DROP TABLE t1;
#
# Bug#7425 inconsistent sort order on unsigned columns result of substraction
#
create table t1 (a int(11) unsigned, b int(11) unsigned);
insert into t1 values (1,0), (1,1), (1,2);
select a-b from t1 order by 1;
select a-b , (a-b < 0) from t1 order by 1;
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
select cast((a - b) as unsigned) from t1 order by 1;
drop table t1;
#
# Bug#8733 server accepts malformed query (multiply mentioned distinct)
#
create table t1 (a int(11));
select all all * from t1;
select distinct distinct * from t1;
--error 1221
select all distinct * from t1;
--error 1221
select distinct all * from t1;
drop table t1;
# #
# Test for bug #6474 # Test for bug #6474
# #
...@@ -2072,3 +2130,119 @@ drop table t1; ...@@ -2072,3 +2130,119 @@ drop table t1;
# #
# Test case for bug 7520: a wrong cost of the index for a BLOB field
#
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
DROP TABLE t1, t2;
#
# Test case for bug 7098: substitution of a constant for a string field
#
CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London');
INSERT INTO t1 VALUES ('Paris');
SELECT * FROM t1 WHERE city='London';
SELECT * FROM t1 WHERE city='london';
EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
SELECT * FROM t1 WHERE city='London' AND city='london';
EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
DROP TABLE t1;
#
# Bug#7425 inconsistent sort order on unsigned columns result of substraction
#
create table t1 (a int(11) unsigned, b int(11) unsigned);
insert into t1 values (1,0), (1,1), (1,2);
select a-b from t1 order by 1;
select a-b , (a-b < 0) from t1 order by 1;
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
select cast((a - b) as unsigned) from t1 order by 1;
drop table t1;
#
# Bug#8733 server accepts malformed query (multiply mentioned distinct)
#
create table t1 (a int(11));
select all all * from t1;
select distinct distinct * from t1;
--error 1221
select all distinct * from t1;
--error 1221
select distinct all * from t1;
drop table t1;
#
# Test for BUG#10095
#
CREATE TABLE t1 (
kunde_intern_id int(10) unsigned NOT NULL default '0',
kunde_id int(10) unsigned NOT NULL default '0',
FK_firma_id int(10) unsigned NOT NULL default '0',
aktuell enum('Ja','Nein') NOT NULL default 'Ja',
vorname varchar(128) NOT NULL default '',
nachname varchar(128) NOT NULL default '',
geloescht enum('Ja','Nein') NOT NULL default 'Nein',
firma varchar(128) NOT NULL default ''
);
INSERT INTO t1 VALUES
(3964,3051,1,'Ja','Vorname1','1Nachname','Nein','Print Schau XXXX'),
(3965,3051111,1,'Ja','Vorname1111','1111Nachname','Nein','Print Schau XXXX');
SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname, geloescht FROM t1
WHERE
(
(
( '' != '' AND firma LIKE CONCAT('%', '', '%'))
OR
(vorname LIKE CONCAT('%', 'Vorname1', '%') AND
nachname LIKE CONCAT('%', '1Nachname', '%') AND
'Vorname1' != '' AND 'xxxx' != '')
)
AND
(
aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
)
)
;
SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname,
geloescht FROM t1
WHERE
(
(
aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
)
AND
(
( '' != '' AND firma LIKE CONCAT('%', '', '%') )
OR
( vorname LIKE CONCAT('%', 'Vorname1', '%') AND
nachname LIKE CONCAT('%', '1Nachname', '%') AND 'Vorname1' != '' AND
'xxxx' != '')
)
)
;
SELECT COUNT(*) FROM t1 WHERE
( 0 OR (vorname LIKE '%Vorname1%' AND nachname LIKE '%1Nachname%' AND 1))
AND FK_firma_id = 2;
drop table t1;
...@@ -171,7 +171,7 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize, ...@@ -171,7 +171,7 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
info->arg = 0; info->arg = 0;
info->alloced_buffer = 0; info->alloced_buffer = 0;
info->buffer=0; info->buffer=0;
info->seek_not_done= test(file >= 0); info->seek_not_done= test(file >= 0 && seek_offset != my_tell(file, MYF(0)));
info->disk_writes= 0; info->disk_writes= 0;
#ifdef THREAD #ifdef THREAD
info->share=0; info->share=0;
...@@ -184,8 +184,10 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize, ...@@ -184,8 +184,10 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
{ /* Assume file isn't growing */ { /* Assume file isn't growing */
if (!(cache_myflags & MY_DONT_CHECK_FILESIZE)) if (!(cache_myflags & MY_DONT_CHECK_FILESIZE))
{ {
/* Calculate end of file to not allocate to big buffers */ /* Calculate end of file to avoid allocating oversized buffers */
end_of_file=my_seek(file,0L,MY_SEEK_END,MYF(0)); end_of_file=my_seek(file,0L,MY_SEEK_END,MYF(0));
/* Need to reset seek_not_done now that we just did a seek. */
info->seek_not_done= end_of_file == seek_offset ? 0 : 1;
if (end_of_file < seek_offset) if (end_of_file < seek_offset)
end_of_file=seek_offset; end_of_file=seek_offset;
/* Trim cache size if the file is very small */ /* Trim cache size if the file is very small */
......
...@@ -85,6 +85,7 @@ void init_thr_alarm(uint max_alarms) ...@@ -85,6 +85,7 @@ void init_thr_alarm(uint max_alarms)
#else #else
{ {
struct sigaction sact; struct sigaction sact;
sact.sa_flags = 0;
bzero((char*) &sact, sizeof(sact)); bzero((char*) &sact, sizeof(sact));
sact.sa_handler = thread_alarm; sact.sa_handler = thread_alarm;
sigaction(THR_CLIENT_ALARM, &sact, (struct sigaction*) 0); sigaction(THR_CLIENT_ALARM, &sact, (struct sigaction*) 0);
......
...@@ -459,8 +459,8 @@ int main(int argc,char **argv) ...@@ -459,8 +459,8 @@ int main(int argc,char **argv)
generate_find_structs(); generate_find_structs();
print_find_structs(); print_find_structs();
printf("\static unsigned int sql_functions_max_len=%d;\n",max_len); printf("\nstatic unsigned int sql_functions_max_len=%d;\n", max_len);
printf("\static unsigned int symbols_max_len=%d;\n\n",max_len2); printf("\nstatic unsigned int symbols_max_len=%d;\n\n", max_len2);
printf("\ printf("\
static inline SYMBOL *get_hash_symbol(const char *s,\n\ static inline SYMBOL *get_hash_symbol(const char *s,\n\
......
...@@ -984,16 +984,13 @@ static int fix_unique_index_attr_order(NDB_INDEX_DATA &data, ...@@ -984,16 +984,13 @@ static int fix_unique_index_attr_order(NDB_INDEX_DATA &data,
for (unsigned i= 0; key_part != end; key_part++, i++) for (unsigned i= 0; key_part != end; key_part++, i++)
{ {
const char *field_name= key_part->field->field_name; const char *field_name= key_part->field->field_name;
unsigned name_sz= strlen(field_name);
if (name_sz >= NDB_MAX_ATTR_NAME_SIZE)
name_sz= NDB_MAX_ATTR_NAME_SIZE-1;
#ifndef DBUG_OFF #ifndef DBUG_OFF
data.unique_index_attrid_map[i]= 255; data.unique_index_attrid_map[i]= 255;
#endif #endif
for (unsigned j= 0; j < sz; j++) for (unsigned j= 0; j < sz; j++)
{ {
const NDBCOL *c= index->getColumn(j); const NDBCOL *c= index->getColumn(j);
if (strncmp(field_name, c->getName(), name_sz) == 0) if (strcmp(field_name, c->getName()) == 0)
{ {
data.unique_index_attrid_map[i]= j; data.unique_index_attrid_map[i]= j;
break; break;
...@@ -3449,12 +3446,7 @@ static int create_ndb_column(NDBCOL &col, ...@@ -3449,12 +3446,7 @@ static int create_ndb_column(NDBCOL &col,
HA_CREATE_INFO *info) HA_CREATE_INFO *info)
{ {
// Set name // Set name
{ col.setName(field->field_name);
char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE];
strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name));
truncated_field_name[sizeof(truncated_field_name)-1]= '\0';
col.setName(truncated_field_name);
}
// Get char set // Get char set
CHARSET_INFO *cs= field->charset(); CHARSET_INFO *cs= field->charset();
// Set type and sizes // Set type and sizes
...@@ -3944,12 +3936,7 @@ int ha_ndbcluster::create_index(const char *name, ...@@ -3944,12 +3936,7 @@ int ha_ndbcluster::create_index(const char *name,
{ {
Field *field= key_part->field; Field *field= key_part->field;
DBUG_PRINT("info", ("attr: %s", field->field_name)); DBUG_PRINT("info", ("attr: %s", field->field_name));
{ ndb_index.addColumnName(field->field_name);
char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE];
strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name));
truncated_field_name[sizeof(truncated_field_name)-1]= '\0';
ndb_index.addColumnName(truncated_field_name);
}
} }
if (dict->createIndex(ndb_index)) if (dict->createIndex(ndb_index))
...@@ -5409,6 +5396,7 @@ ndb_get_table_statistics(Ndb* ndb, const char * table, ...@@ -5409,6 +5396,7 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
DBUG_RETURN(0); DBUG_RETURN(0);
} while(0); } while(0);
if (pTrans)
ndb->closeTransaction(pTrans); ndb->closeTransaction(pTrans);
DBUG_PRINT("exit", ("failed")); DBUG_PRINT("exit", ("failed"));
DBUG_RETURN(-1); DBUG_RETURN(-1);
......
...@@ -1880,22 +1880,16 @@ void Item_func_round::fix_length_and_dec() ...@@ -1880,22 +1880,16 @@ void Item_func_round::fix_length_and_dec()
} }
} }
double Item_func_round::real_op() double my_double_round(double value, int dec, bool truncate)
{ {
double value= args[0]->val_real();
int dec=(int) args[1]->val_int();
if (dec > 0)
decimals= dec; // to get correct output
uint abs_dec=abs(dec);
double tmp; double tmp;
uint abs_dec= abs(dec);
/* /*
tmp2 is here to avoid return the value with 80 bit precision tmp2 is here to avoid return the value with 80 bit precision
This will fix that the test round(0.1,1) = round(0.1,1) is true This will fix that the test round(0.1,1) = round(0.1,1) is true
*/ */
volatile double tmp2; volatile double tmp2;
if ((null_value=args[0]->null_value || args[1]->null_value))
return 0.0;
tmp=(abs_dec < array_elements(log_10) ? tmp=(abs_dec < array_elements(log_10) ?
log_10[abs_dec] : pow(10.0,(double) abs_dec)); log_10[abs_dec] : pow(10.0,(double) abs_dec));
...@@ -1912,6 +1906,18 @@ double Item_func_round::real_op() ...@@ -1912,6 +1906,18 @@ double Item_func_round::real_op()
} }
double Item_func_round::real_op()
{
double value= args[0]->val_real();
int dec= (int) args[1]->val_int();
if (!(null_value= args[0]->null_value || args[1]->null_value))
return my_double_round(value, dec, truncate);
return 0.0;
}
longlong Item_func_round::int_op() longlong Item_func_round::int_op()
{ {
longlong value= args[0]->val_int(); longlong value= args[0]->val_int();
......
...@@ -1673,6 +1673,7 @@ String *Item_func_format::val_str(String *str) ...@@ -1673,6 +1673,7 @@ String *Item_func_format::val_str(String *str)
int diff; int diff;
if ((null_value=args[0]->null_value)) if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
nr= my_double_round(nr, decimals, FALSE);
dec= decimals ? decimals+1 : 0; dec= decimals ? decimals+1 : 0;
/* Here default_charset() is right as this is not an automatic conversion */ /* Here default_charset() is right as this is not an automatic conversion */
str->set(nr,decimals, default_charset()); str->set(nr,decimals, default_charset());
......
...@@ -1254,6 +1254,7 @@ ha_rows filesort(THD *thd, TABLE *form,struct st_sort_field *sortorder, ...@@ -1254,6 +1254,7 @@ ha_rows filesort(THD *thd, TABLE *form,struct st_sort_field *sortorder,
ha_rows max_rows, ha_rows *examined_rows); ha_rows max_rows, ha_rows *examined_rows);
void filesort_free_buffers(TABLE *table); void filesort_free_buffers(TABLE *table);
void change_double_for_sort(double nr,byte *to); void change_double_for_sort(double nr,byte *to);
double my_double_round(double value, int dec, bool truncate);
int get_quick_record(SQL_SELECT *select); int get_quick_record(SQL_SELECT *select);
int calc_weekday(long daynr,bool sunday_first_day_of_week); int calc_weekday(long daynr,bool sunday_first_day_of_week);
uint calc_week(TIME *l_time, uint week_behaviour, uint *year); uint calc_week(TIME *l_time, uint week_behaviour, uint *year);
......
...@@ -98,6 +98,12 @@ static Geometry::Class_info ...@@ -98,6 +98,12 @@ static Geometry::Class_info
geometrycollection_class("GEOMETRYCOLLECTION",Geometry::wkb_geometrycollection, geometrycollection_class("GEOMETRYCOLLECTION",Geometry::wkb_geometrycollection,
create_geometrycollection); create_geometrycollection);
static void get_point(double *x, double *y, const char *data)
{
float8get(*x, data);
float8get(*y, data + SIZEOF_STORED_DOUBLE);
}
/***************************** Geometry *******************************/ /***************************** Geometry *******************************/
Geometry::Class_info *Geometry::find_class(const char *name, uint32 len) Geometry::Class_info *Geometry::find_class(const char *name, uint32 len)
...@@ -268,14 +274,13 @@ const char *Geometry::append_points(String *txt, uint32 n_points, ...@@ -268,14 +274,13 @@ const char *Geometry::append_points(String *txt, uint32 n_points,
{ {
while (n_points--) while (n_points--)
{ {
double d; double x,y;
data+= offset; data+= offset;
float8get(d, data); get_point(&x, &y, data);
txt->qs_append(d);
txt->qs_append(' ');
float8get(d, data + SIZEOF_STORED_DOUBLE);
data+= SIZEOF_STORED_DOUBLE * 2; data+= SIZEOF_STORED_DOUBLE * 2;
txt->qs_append(d); txt->qs_append(x);
txt->qs_append(' ');
txt->qs_append(y);
txt->qs_append(','); txt->qs_append(',');
} }
return data; return data;
...@@ -428,8 +433,7 @@ bool Gis_line_string::get_data_as_wkt(String *txt, const char **end) const ...@@ -428,8 +433,7 @@ bool Gis_line_string::get_data_as_wkt(String *txt, const char **end) const
while (n_points--) while (n_points--)
{ {
double x, y; double x, y;
float8get(x, data); get_point(&x, &y, data);
float8get(y, data + SIZEOF_STORED_DOUBLE);
data+= SIZEOF_STORED_DOUBLE * 2; data+= SIZEOF_STORED_DOUBLE * 2;
txt->qs_append(x); txt->qs_append(x);
txt->qs_append(' '); txt->qs_append(' ');
...@@ -462,15 +466,13 @@ int Gis_line_string::length(double *len) const ...@@ -462,15 +466,13 @@ int Gis_line_string::length(double *len) const
if (n_points < 1 || no_data(data, SIZEOF_STORED_DOUBLE * 2 * n_points)) if (n_points < 1 || no_data(data, SIZEOF_STORED_DOUBLE * 2 * n_points))
return 1; return 1;
float8get(prev_x, data); get_point(&prev_x, &prev_y, data);
float8get(prev_y, data + SIZEOF_STORED_DOUBLE);
data+= SIZEOF_STORED_DOUBLE*2; data+= SIZEOF_STORED_DOUBLE*2;
while (--n_points) while (--n_points)
{ {
double x, y; double x, y;
float8get(x, data); get_point(&x, &y, data);
float8get(y, data + SIZEOF_STORED_DOUBLE);
data+= SIZEOF_STORED_DOUBLE * 2; data+= SIZEOF_STORED_DOUBLE * 2;
*len+= sqrt(pow(prev_x-x,2)+pow(prev_y-y,2)); *len+= sqrt(pow(prev_x-x,2)+pow(prev_y-y,2));
prev_x= x; prev_x= x;
...@@ -499,13 +501,11 @@ int Gis_line_string::is_closed(int *closed) const ...@@ -499,13 +501,11 @@ int Gis_line_string::is_closed(int *closed) const
return 1; return 1;
/* Get first point */ /* Get first point */
float8get(x1, data); get_point(&x1, &y1, data);
float8get(y1, data + SIZEOF_STORED_DOUBLE);
/* get last point */ /* get last point */
data+= SIZEOF_STORED_DOUBLE*2 + (n_points-2)*POINT_DATA_SIZE; data+= SIZEOF_STORED_DOUBLE*2 + (n_points-2)*POINT_DATA_SIZE;
float8get(x2, data); get_point(&x2, &y2, data);
float8get(y2, data + SIZEOF_STORED_DOUBLE);
*closed= (x1==x2) && (y1==y2); *closed= (x1==x2) && (y1==y2);
return 0; return 0;
...@@ -683,15 +683,13 @@ int Gis_polygon::area(double *ar, const char **end_of_data) const ...@@ -683,15 +683,13 @@ int Gis_polygon::area(double *ar, const char **end_of_data) const
n_points= uint4korr(data); n_points= uint4korr(data);
if (no_data(data, (SIZEOF_STORED_DOUBLE*2) * n_points)) if (no_data(data, (SIZEOF_STORED_DOUBLE*2) * n_points))
return 1; return 1;
float8get(prev_x, data+4); get_point(&prev_x, &prev_y, data+4);
float8get(prev_y, data+(4+SIZEOF_STORED_DOUBLE));
data+= (4+SIZEOF_STORED_DOUBLE*2); data+= (4+SIZEOF_STORED_DOUBLE*2);
while (--n_points) // One point is already read while (--n_points) // One point is already read
{ {
double x, y; double x, y;
float8get(x, data); get_point(&x, &y, data);
float8get(y, data + SIZEOF_STORED_DOUBLE);
data+= (SIZEOF_STORED_DOUBLE*2); data+= (SIZEOF_STORED_DOUBLE*2);
/* QQ: Is the following prev_x+x right ? */ /* QQ: Is the following prev_x+x right ? */
lr_area+= (prev_x + x)* (prev_y - y); lr_area+= (prev_x + x)* (prev_y - y);
...@@ -781,7 +779,8 @@ int Gis_polygon::interior_ring_n(uint32 num, String *result) const ...@@ -781,7 +779,8 @@ int Gis_polygon::interior_ring_n(uint32 num, String *result) const
int Gis_polygon::centroid_xy(double *x, double *y) const int Gis_polygon::centroid_xy(double *x, double *y) const
{ {
uint32 n_linear_rings; uint32 n_linear_rings;
double res_area, res_cx, res_cy; double res_area;
double res_cx, res_cy;
const char *data= m_data; const char *data= m_data;
bool first_loop= 1; bool first_loop= 1;
LINT_INIT(res_area); LINT_INIT(res_area);
...@@ -807,15 +806,13 @@ int Gis_polygon::centroid_xy(double *x, double *y) const ...@@ -807,15 +806,13 @@ int Gis_polygon::centroid_xy(double *x, double *y) const
data+= 4; data+= 4;
if (no_data(data, (SIZEOF_STORED_DOUBLE*2) * n_points)) if (no_data(data, (SIZEOF_STORED_DOUBLE*2) * n_points))
return 1; return 1;
float8get(prev_x, data); get_point(&prev_x, &prev_y, data);
float8get(prev_y, data+SIZEOF_STORED_DOUBLE);
data+= (SIZEOF_STORED_DOUBLE*2); data+= (SIZEOF_STORED_DOUBLE*2);
while (--n_points) // One point is already read while (--n_points) // One point is already read
{ {
double x, y; double x, y;
float8get(x, data); get_point(&x, &y, data);
float8get(y, data + SIZEOF_STORED_DOUBLE);
data+= (SIZEOF_STORED_DOUBLE*2); data+= (SIZEOF_STORED_DOUBLE*2);
/* QQ: Is the following prev_x+x right ? */ /* QQ: Is the following prev_x+x right ? */
cur_area+= (prev_x + x) * (prev_y - y); cur_area+= (prev_x + x) * (prev_y - y);
......
...@@ -192,6 +192,54 @@ class base_list :public Sql_alloc ...@@ -192,6 +192,54 @@ class base_list :public Sql_alloc
friend class error_list; friend class error_list;
friend class error_list_iterator; friend class error_list_iterator;
#ifdef LIST_EXTRA_DEBUG
/*
Check list invariants and print results into trace. Invariants are:
- (*last) points to end_of_list
- There are no NULLs in the list.
- base_list::elements is the number of elements in the list.
SYNOPSIS
check_list()
name Name to print to trace file
RETURN
1 The list is Ok.
0 List invariants are not met.
*/
bool check_list(const char *name)
{
base_list *list= this;
list_node *node= first;
uint cnt= 0;
while (node->next != &end_of_list)
{
if (!node->info)
{
DBUG_PRINT("list_invariants",("%s: error: NULL element in the list",
name));
return FALSE;
}
node= node->next;
cnt++;
}
if (last != &(node->next))
{
DBUG_PRINT("list_invariants", ("%s: error: wrong last pointer", name));
return FALSE;
}
if (cnt+1 != elements)
{
DBUG_PRINT("list_invariants", ("%s: error: wrong element count", name));
return FALSE;
}
DBUG_PRINT("list_invariants", ("%s: list is ok", name));
return TRUE;
}
#endif // LIST_EXTRA_DEBUG
protected: protected:
void after(void *info,list_node *node) void after(void *info,list_node *node)
{ {
......
...@@ -194,7 +194,9 @@ void udf_init() ...@@ -194,7 +194,9 @@ void udf_init()
This is done to ensure that only approved dll from the system This is done to ensure that only approved dll from the system
directories are used (to make this even remotely secure). directories are used (to make this even remotely secure).
*/ */
if (strchr(dl_name, '/') || name.length > NAME_LEN) if (strchr(dl_name, '/') ||
IF_WIN(strchr(dl_name, '\\'),0) ||
strlen(name.str) > NAME_LEN)
{ {
sql_print_error("Invalid row in mysql.func table for function '%.64s'", sql_print_error("Invalid row in mysql.func table for function '%.64s'",
name.str); name.str);
...@@ -223,7 +225,7 @@ void udf_init() ...@@ -223,7 +225,7 @@ void udf_init()
} }
tmp->dlhandle = dl; tmp->dlhandle = dl;
{ {
char buf[MAX_FIELD_NAME+16], *missing; char buf[NAME_LEN+16], *missing;
if ((missing= init_syms(tmp, buf))) if ((missing= init_syms(tmp, buf)))
{ {
sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), missing); sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), missing);
...@@ -410,7 +412,7 @@ int mysql_create_function(THD *thd,udf_func *udf) ...@@ -410,7 +412,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
This is done to ensure that only approved dll from the system This is done to ensure that only approved dll from the system
directories are used (to make this even remotely secure). directories are used (to make this even remotely secure).
*/ */
if (strchr(udf->dl, '/')) if (strchr(udf->dl, '/') || IF_WIN(strchr(dl_name, '\\'),0))
{ {
my_message(ER_UDF_NO_PATHS, ER(ER_UDF_NO_PATHS), MYF(0)); my_message(ER_UDF_NO_PATHS, ER(ER_UDF_NO_PATHS), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -441,7 +443,7 @@ int mysql_create_function(THD *thd,udf_func *udf) ...@@ -441,7 +443,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
} }
udf->dlhandle=dl; udf->dlhandle=dl;
{ {
char buf[MAX_FIELD_NAME+16], *missing; char buf[NAME_LEN+16], *missing;
if ((missing= init_syms(udf, buf))) if ((missing= init_syms(udf, buf)))
{ {
my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), missing); my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), missing);
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#define USES_TYPES #define USES_TYPES
#include "mysql_priv.h" #include "mysql_priv.h"
#include <m_ctype.h> #include <m_ctype.h>
#include <assert.h>
#define FCOMP 17 /* Bytes for a packed field */ #define FCOMP 17 /* Bytes for a packed field */
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#ifndef NDB_LIMITS_H #ifndef NDB_LIMITS_H
#define NDB_LIMITS_H #define NDB_LIMITS_H
#include <mysql.h>
#define RNIL 0xffffff00 #define RNIL 0xffffff00
/** /**
...@@ -52,7 +54,7 @@ ...@@ -52,7 +54,7 @@
#define MAX_TUPLES_BITS 13 /* 13 bits = 8191 tuples per page */ #define MAX_TUPLES_BITS 13 /* 13 bits = 8191 tuples per page */
#define MAX_TABLES 20320 /* SchemaFile.hpp */ #define MAX_TABLES 20320 /* SchemaFile.hpp */
#define MAX_TAB_NAME_SIZE 128 #define MAX_TAB_NAME_SIZE 128
#define MAX_ATTR_NAME_SIZE 32 #define MAX_ATTR_NAME_SIZE NAME_LEN /* From mysql_com.h */
#define MAX_ATTR_DEFAULT_VALUE_SIZE 128 #define MAX_ATTR_DEFAULT_VALUE_SIZE 128
#define MAX_ATTRIBUTES_IN_TABLE 128 #define MAX_ATTRIBUTES_IN_TABLE 128
#define MAX_ATTRIBUTES_IN_INDEX 32 #define MAX_ATTRIBUTES_IN_INDEX 32
......
...@@ -39,22 +39,15 @@ class GetTabInfoReq { ...@@ -39,22 +39,15 @@ class GetTabInfoReq {
friend bool printGET_TABINFO_REQ(FILE *, const Uint32 *, Uint32, Uint16); friend bool printGET_TABINFO_REQ(FILE *, const Uint32 *, Uint32, Uint16);
public: public:
STATIC_CONST( SignalLength = 5 ); STATIC_CONST( SignalLength = 5 );
// STATIC_CONST( MaxTableNameLengthInWords = 20 );
public: public:
Uint32 senderData; Uint32 senderData;
Uint32 senderRef; Uint32 senderRef;
Uint32 requestType; // Bitmask of GetTabInfoReq::RequestType
/**
* 0 = request by id, 1 = request by name
*/
Uint32 requestType;
union { union {
Uint32 tableId; Uint32 tableId;
Uint32 tableNameLen; Uint32 tableNameLen;
}; };
Uint32 unused; // This is located here so that Req & Ref have the same format Uint32 unused; // This is located here so that Req & Ref have the same format
// Uint32 tableName[MaxTableNameLengthInWords];
enum RequestType { enum RequestType {
RequestById = 0, RequestById = 0,
...@@ -79,11 +72,10 @@ class GetTabInfoRef { ...@@ -79,11 +72,10 @@ class GetTabInfoRef {
friend bool printGET_TABINFO_REF(FILE *, const Uint32 *, Uint32, Uint16); friend bool printGET_TABINFO_REF(FILE *, const Uint32 *, Uint32, Uint16);
public: public:
STATIC_CONST( SignalLength = 5 ); STATIC_CONST( SignalLength = 5 );
public: public:
Uint32 senderData; Uint32 senderData;
Uint32 senderRef; Uint32 senderRef;
Uint32 requestType; // 0 = request by id, 1 = request by name Uint32 requestType; // Bitmask of GetTabInfoReq::RequestType
union { union {
Uint32 tableId; Uint32 tableId;
Uint32 tableNameLen; Uint32 tableNameLen;
......
...@@ -999,10 +999,6 @@ typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*); ...@@ -999,10 +999,6 @@ typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*);
#define WAITFOR_RESPONSE_TIMEOUT 120000 // Milliseconds #define WAITFOR_RESPONSE_TIMEOUT 120000 // Milliseconds
#endif #endif
#define NDB_MAX_INTERNAL_TABLE_LENGTH NDB_MAX_DATABASE_NAME_SIZE + \
NDB_MAX_SCHEMA_NAME_SIZE + \
NDB_MAX_TAB_NAME_SIZE*2
/** /**
* @class Ndb * @class Ndb
* @brief Represents the NDB kernel and is the main class of the NDB API. * @brief Represents the NDB kernel and is the main class of the NDB API.
...@@ -1626,12 +1622,7 @@ private: ...@@ -1626,12 +1622,7 @@ private:
bool fullyQualifiedNames; bool fullyQualifiedNames;
// Ndb database name.
char theDataBase[NDB_MAX_DATABASE_NAME_SIZE];
// Ndb database schema name.
char theDataBaseSchema[NDB_MAX_SCHEMA_NAME_SIZE];
char prefixName[NDB_MAX_INTERNAL_TABLE_LENGTH];
char * prefixEnd;
class NdbImpl * theImpl; class NdbImpl * theImpl;
class NdbDictionaryImpl* theDictionary; class NdbDictionaryImpl* theDictionary;
......
...@@ -19,10 +19,6 @@ ...@@ -19,10 +19,6 @@
#define NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY 32 #define NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY 32
#define NDB_MAX_ATTRIBUTES_IN_INDEX NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY #define NDB_MAX_ATTRIBUTES_IN_INDEX NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY
#define NDB_MAX_DATABASE_NAME_SIZE 128
#define NDB_MAX_SCHEMA_NAME_SIZE 128
#define NDB_MAX_TAB_NAME_SIZE 128
#define NDB_MAX_ATTR_NAME_SIZE 32
#define NDB_MAX_ATTRIBUTES_IN_TABLE 128 #define NDB_MAX_ATTRIBUTES_IN_TABLE 128
#define NDB_MAX_TUPLE_SIZE_IN_WORDS 2013 #define NDB_MAX_TUPLE_SIZE_IN_WORDS 2013
......
...@@ -45,8 +45,9 @@ enum SendStatus { ...@@ -45,8 +45,9 @@ enum SendStatus {
* Protocol6 Header + * Protocol6 Header +
* (optional signal id) + (optional checksum) + (signal data) * (optional signal id) + (optional checksum) + (signal data)
*/ */
const Uint32 MAX_SECTION_SIZE= 4096;
//const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25)); //const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25));
const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25)+(3*4)+4*4096); const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25)+(3*4)+4*MAX_SECTION_SIZE);
/** /**
* TransporterConfiguration * TransporterConfiguration
......
...@@ -93,6 +93,7 @@ TransporterRegistry::unpack(Uint32 * readPtr, ...@@ -93,6 +93,7 @@ TransporterRegistry::unpack(Uint32 * readPtr,
signalHeader.theSendersSignalId = * signalData; signalHeader.theSendersSignalId = * signalData;
signalData ++; signalData ++;
}//if }//if
signalHeader.theSignalId= ~0;
Uint32 * sectionPtr = signalData + signalHeader.theLength; Uint32 * sectionPtr = signalData + signalHeader.theLength;
Uint32 * sectionData = sectionPtr + signalHeader.m_noOfSections; Uint32 * sectionData = sectionPtr + signalHeader.m_noOfSections;
......
...@@ -799,11 +799,7 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){ ...@@ -799,11 +799,7 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){
request->error = errno; request->error = errno;
return; return;
} }
#if defined(__INTEL_COMPILER)
struct dirent64 * dp;
#else
struct dirent * dp; struct dirent * dp;
#endif
while ((dp = readdir(dirp)) != NULL){ while ((dp = readdir(dirp)) != NULL){
if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0)) { if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0)) {
BaseString::snprintf(path_add, (size_t)path_max_copy, "%s%s", BaseString::snprintf(path_add, (size_t)path_max_copy, "%s%s",
......
...@@ -1041,39 +1041,31 @@ convertEndian(Uint32 Data) ...@@ -1041,39 +1041,31 @@ convertEndian(Uint32 Data)
} }
const char * Ndb::getCatalogName() const const char * Ndb::getCatalogName() const
{ {
return theDataBase; return theImpl->m_dbname.c_str();
} }
void Ndb::setCatalogName(const char * a_catalog_name) void Ndb::setCatalogName(const char * a_catalog_name)
{ {
if (a_catalog_name) { if (a_catalog_name)
BaseString::snprintf(theDataBase, sizeof(theDataBase), "%s", {
a_catalog_name ? a_catalog_name : ""); theImpl->m_dbname.assign(a_catalog_name);
theImpl->update_prefix();
int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
theDataBase, table_name_separator,
theDataBaseSchema, table_name_separator);
prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len :
sizeof(prefixName) - 1);
} }
} }
const char * Ndb::getSchemaName() const const char * Ndb::getSchemaName() const
{ {
return theDataBaseSchema; return theImpl->m_schemaname.c_str();
} }
void Ndb::setSchemaName(const char * a_schema_name) void Ndb::setSchemaName(const char * a_schema_name)
{ {
if (a_schema_name) { if (a_schema_name) {
BaseString::snprintf(theDataBaseSchema, sizeof(theDataBase), "%s", theImpl->m_schemaname.assign(a_schema_name);
a_schema_name ? a_schema_name : ""); theImpl->update_prefix();
int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
theDataBase, table_name_separator,
theDataBaseSchema, table_name_separator);
prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len :
sizeof(prefixName) - 1);
} }
} }
...@@ -1153,10 +1145,8 @@ Ndb::externalizeIndexName(const char * internalIndexName) ...@@ -1153,10 +1145,8 @@ Ndb::externalizeIndexName(const char * internalIndexName)
const char * const char *
Ndb::internalizeTableName(const char * externalTableName) Ndb::internalizeTableName(const char * externalTableName)
{ {
if (fullyQualifiedNames) { if (fullyQualifiedNames)
strncpy(prefixEnd, externalTableName, NDB_MAX_TAB_NAME_SIZE); return theImpl->internalize_table_name(externalTableName);
return prefixName;
}
else else
return externalTableName; return externalTableName;
} }
...@@ -1165,16 +1155,8 @@ const char * ...@@ -1165,16 +1155,8 @@ const char *
Ndb::internalizeIndexName(const NdbTableImpl * table, Ndb::internalizeIndexName(const NdbTableImpl * table,
const char * externalIndexName) const char * externalIndexName)
{ {
if (fullyQualifiedNames) { if (fullyQualifiedNames)
char tableId[10]; return theImpl->internalize_index_name(table, externalIndexName);
sprintf(tableId, "%d", table->m_tableId);
Uint32 tabIdLen = strlen(tableId);
strncpy(prefixEnd, tableId, tabIdLen);
prefixEnd[tabIdLen] = table_name_separator;
strncpy(prefixEnd + tabIdLen + 1,
externalIndexName, NDB_MAX_TAB_NAME_SIZE);
return prefixName;
}
else else
return externalIndexName; return externalIndexName;
} }
......
...@@ -172,6 +172,7 @@ NdbColumnImpl::init(Type t) ...@@ -172,6 +172,7 @@ NdbColumnImpl::init(Type t)
m_length = 1; // legal m_length = 1; // legal
m_cs = NULL; m_cs = NULL;
break; break;
default:
case Undefined: case Undefined:
assert(false); assert(false);
break; break;
...@@ -299,22 +300,25 @@ NdbTableImpl::~NdbTableImpl() ...@@ -299,22 +300,25 @@ NdbTableImpl::~NdbTableImpl()
void void
NdbTableImpl::init(){ NdbTableImpl::init(){
clearNewProperties(); m_changeMask= 0;
m_tableId= RNIL;
m_frm.clear(); m_frm.clear();
m_fragmentType = NdbDictionary::Object::FragAllSmall; m_fragmentType= NdbDictionary::Object::FragAllSmall;
m_logging = true; m_hashValueMask= 0;
m_kvalue = 6; m_hashpointerValue= 0;
m_minLoadFactor = 78; m_logging= true;
m_maxLoadFactor = 80; m_kvalue= 6;
m_minLoadFactor= 78;
m_index = 0; m_maxLoadFactor= 80;
m_indexType = NdbDictionary::Index::Undefined; m_keyLenInWords= 0;
m_fragmentCount= 0;
m_noOfKeys = 0; m_dictionary= NULL;
m_noOfDistributionKeys = 0; m_index= NULL;
m_fragmentCount = 0; m_indexType= NdbDictionary::Index::Undefined;
m_keyLenInWords = 0; m_noOfKeys= 0;
m_noOfBlobs = 0; m_noOfDistributionKeys= 0;
m_noOfBlobs= 0;
m_replicaCount= 0;
} }
bool bool
...@@ -428,19 +432,6 @@ NdbTableImpl::getName() const ...@@ -428,19 +432,6 @@ NdbTableImpl::getName() const
return m_newExternalName.c_str(); return m_newExternalName.c_str();
} }
void NdbTableImpl::clearNewProperties()
{
m_newExternalName.assign("");
m_changeMask = 0;
}
void NdbTableImpl::copyNewProperties()
{
if (!m_newExternalName.empty()) {
m_externalName.assign(m_newExternalName);
AlterTableReq::setNameFlag(m_changeMask, true);
}
}
void void
NdbTableImpl::buildColumnHash(){ NdbTableImpl::buildColumnHash(){
...@@ -537,14 +528,22 @@ NdbIndexImpl::NdbIndexImpl() : ...@@ -537,14 +528,22 @@ NdbIndexImpl::NdbIndexImpl() :
NdbDictionary::Index(* this), NdbDictionary::Index(* this),
m_facade(this) m_facade(this)
{ {
m_logging = true; init();
} }
NdbIndexImpl::NdbIndexImpl(NdbDictionary::Index & f) : NdbIndexImpl::NdbIndexImpl(NdbDictionary::Index & f) :
NdbDictionary::Index(* this), NdbDictionary::Index(* this),
m_facade(&f) m_facade(&f)
{ {
m_logging = true; init();
}
void NdbIndexImpl::init()
{
m_indexId= RNIL;
m_type= NdbDictionary::Index::Undefined;
m_logging= true;
m_table= NULL;
} }
NdbIndexImpl::~NdbIndexImpl(){ NdbIndexImpl::~NdbIndexImpl(){
...@@ -589,20 +588,26 @@ NdbEventImpl::NdbEventImpl() : ...@@ -589,20 +588,26 @@ NdbEventImpl::NdbEventImpl() :
NdbDictionary::Event(* this), NdbDictionary::Event(* this),
m_facade(this) m_facade(this)
{ {
mi_type = 0; init();
m_dur = NdbDictionary::Event::ED_UNDEFINED;
eventOp = NULL;
m_tableImpl = NULL;
} }
NdbEventImpl::NdbEventImpl(NdbDictionary::Event & f) : NdbEventImpl::NdbEventImpl(NdbDictionary::Event & f) :
NdbDictionary::Event(* this), NdbDictionary::Event(* this),
m_facade(&f) m_facade(&f)
{ {
mi_type = 0; init();
m_dur = NdbDictionary::Event::ED_UNDEFINED; }
eventOp = NULL;
m_tableImpl = NULL; void NdbEventImpl::init()
{
m_eventId= RNIL;
m_eventKey= RNIL;
m_tableId= RNIL;
mi_type= 0;
m_dur= NdbDictionary::Event::ED_UNDEFINED;
m_tableImpl= NULL;
m_bufferId= RNIL;
eventOp= NULL;
} }
NdbEventImpl::~NdbEventImpl() NdbEventImpl::~NdbEventImpl()
...@@ -715,11 +720,13 @@ NdbDictionaryImpl::~NdbDictionaryImpl() ...@@ -715,11 +720,13 @@ NdbDictionaryImpl::~NdbDictionaryImpl()
delete NdbDictionary::Column::ROW_COUNT; delete NdbDictionary::Column::ROW_COUNT;
delete NdbDictionary::Column::COMMIT_COUNT; delete NdbDictionary::Column::COMMIT_COUNT;
delete NdbDictionary::Column::ROW_SIZE; delete NdbDictionary::Column::ROW_SIZE;
delete NdbDictionary::Column::RANGE_NO;
NdbDictionary::Column::FRAGMENT= 0; NdbDictionary::Column::FRAGMENT= 0;
NdbDictionary::Column::FRAGMENT_MEMORY= 0; NdbDictionary::Column::FRAGMENT_MEMORY= 0;
NdbDictionary::Column::ROW_COUNT= 0; NdbDictionary::Column::ROW_COUNT= 0;
NdbDictionary::Column::COMMIT_COUNT= 0; NdbDictionary::Column::COMMIT_COUNT= 0;
NdbDictionary::Column::ROW_SIZE= 0; NdbDictionary::Column::ROW_SIZE= 0;
NdbDictionary::Column::RANGE_NO= 0;
} }
m_globalHash->unlock(); m_globalHash->unlock();
} else { } else {
...@@ -1049,14 +1056,17 @@ NdbDictInterface::dictSignal(NdbApiSignal* signal, ...@@ -1049,14 +1056,17 @@ NdbDictInterface::dictSignal(NdbApiSignal* signal,
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
/***************************************************************** /*
* get tab info Get dictionary information for a table using table id as reference
DESCRIPTION
Sends a GET_TABINFOREQ signal containing the table id
*/ */
NdbTableImpl * NdbTableImpl *
NdbDictInterface::getTable(int tableId, bool fullyQualifiedNames) NdbDictInterface::getTable(int tableId, bool fullyQualifiedNames)
{ {
NdbApiSignal tSignal(m_reference); NdbApiSignal tSignal(m_reference);
GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend()); GetTabInfoReq* const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
req->senderRef = m_reference; req->senderRef = m_reference;
req->senderData = 0; req->senderData = 0;
...@@ -1070,40 +1080,56 @@ NdbDictInterface::getTable(int tableId, bool fullyQualifiedNames) ...@@ -1070,40 +1080,56 @@ NdbDictInterface::getTable(int tableId, bool fullyQualifiedNames)
return getTable(&tSignal, 0, 0, fullyQualifiedNames); return getTable(&tSignal, 0, 0, fullyQualifiedNames);
} }
/*
Get dictionary information for a table using table name as the reference
DESCRIPTION
Send GET_TABINFOREQ signal with the table name in the first
long section part
*/
NdbTableImpl * NdbTableImpl *
NdbDictInterface::getTable(const char * name, bool fullyQualifiedNames) NdbDictInterface::getTable(const char * name, bool fullyQualifiedNames)
{ {
NdbApiSignal tSignal(m_reference); NdbApiSignal tSignal(m_reference);
GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend()); GetTabInfoReq* const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
const Uint32 strLen = strlen(name) + 1; // NULL Terminated const Uint32 str_len= strlen(name) + 1; // NULL terminated
if(strLen > MAX_TAB_NAME_SIZE) {//sizeof(req->tableName)){ const Uint32 str_len_words= (str_len + 3) / 4; // Size in words
if (str_len > MAX_SECTION_SIZE)
{
m_error.code= 4307; m_error.code= 4307;
return 0; return 0;
} }
req->senderRef = m_reference; m_namebuf.clear();
req->senderData = 0; m_namebuf.grow(str_len_words*4); // Word size aligned number of bytes
req->requestType = m_namebuf.append(name, str_len);
req->senderRef= m_reference;
req->senderData= 0;
req->requestType=
GetTabInfoReq::RequestByName | GetTabInfoReq::LongSignalConf; GetTabInfoReq::RequestByName | GetTabInfoReq::LongSignalConf;
req->tableNameLen = strLen; req->tableNameLen= str_len;
tSignal.theReceiversBlockNumber = DBDICT; tSignal.theReceiversBlockNumber= DBDICT;
tSignal.theVerId_signalNumber = GSN_GET_TABINFOREQ; tSignal.theVerId_signalNumber= GSN_GET_TABINFOREQ;
// tSignal.theLength = GetTabInfoReq::HeaderLength + ((strLen + 3) / 4); tSignal.theLength= GetTabInfoReq::SignalLength;
tSignal.theLength = GetTabInfoReq::SignalLength;
LinearSectionPtr ptr[1]; LinearSectionPtr ptr[1];
ptr[0].p = (Uint32*)name; ptr[0].p= (Uint32*)m_namebuf.get_data();
ptr[0].sz = strLen; ptr[0].sz= str_len_words;
return getTable(&tSignal, ptr, 1, fullyQualifiedNames); return getTable(&tSignal, ptr, 1, fullyQualifiedNames);
} }
NdbTableImpl * NdbTableImpl *
NdbDictInterface::getTable(class NdbApiSignal * signal, NdbDictInterface::getTable(class NdbApiSignal * signal,
LinearSectionPtr ptr[3], LinearSectionPtr ptr[3],
Uint32 noOfSections, bool fullyQualifiedNames) Uint32 noOfSections, bool fullyQualifiedNames)
{ {
//GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, signal->getDataPtrSend());
int errCodes[] = {GetTabInfoRef::Busy }; int errCodes[] = {GetTabInfoRef::Busy };
int r = dictSignal(signal,ptr,noOfSections, int r = dictSignal(signal,ptr,noOfSections,
...@@ -1464,7 +1490,7 @@ NdbDictionaryImpl::createBlobTables(NdbTableImpl &t) ...@@ -1464,7 +1490,7 @@ NdbDictionaryImpl::createBlobTables(NdbTableImpl &t)
return -1; return -1;
// Save BLOB table handle // Save BLOB table handle
Ndb_local_table_info *info= Ndb_local_table_info *info=
get_local_table_info(bt.m_internalName.c_str(),false); get_local_table_info(bt.m_internalName.c_str(), false);
if (info == 0) { if (info == 0) {
return -1; return -1;
} }
...@@ -1560,7 +1586,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -1560,7 +1586,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
impl.copyNewProperties(); if (!impl.m_newExternalName.empty()) {
impl.m_externalName.assign(impl.m_newExternalName);
AlterTableReq::setNameFlag(impl.m_changeMask, true);
}
//validate(); //validate();
//aggregate(); //aggregate();
...@@ -1677,7 +1707,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -1677,7 +1707,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
NdbApiSignal tSignal(m_reference); NdbApiSignal tSignal(m_reference);
tSignal.theReceiversBlockNumber = DBDICT; tSignal.theReceiversBlockNumber = DBDICT;
LinearSectionPtr ptr[3]; LinearSectionPtr ptr[1];
ptr[0].p = (Uint32*)m_buffer.get_data(); ptr[0].p = (Uint32*)m_buffer.get_data();
ptr[0].sz = m_buffer.length() / 4; ptr[0].sz = m_buffer.length() / 4;
int ret; int ret;
...@@ -2182,7 +2212,7 @@ NdbDictInterface::createIndex(Ndb & ndb, ...@@ -2182,7 +2212,7 @@ NdbDictInterface::createIndex(Ndb & ndb,
} }
attributeList.id[i] = col->m_attrId; attributeList.id[i] = col->m_attrId;
} }
LinearSectionPtr ptr[3]; LinearSectionPtr ptr[2];
ptr[0].p = (Uint32*)&attributeList; ptr[0].p = (Uint32*)&attributeList;
ptr[0].sz = 1 + attributeList.sz; ptr[0].sz = 1 + attributeList.sz;
ptr[1].p = (Uint32*)m_buffer.get_data(); ptr[1].p = (Uint32*)m_buffer.get_data();
...@@ -2489,7 +2519,7 @@ NdbDictInterface::createEvent(class Ndb & ndb, ...@@ -2489,7 +2519,7 @@ NdbDictInterface::createEvent(class Ndb & ndb,
w.add(SimpleProperties::StringValue, w.add(SimpleProperties::StringValue,
ndb.internalizeTableName(evnt.m_tableName.c_str())); ndb.internalizeTableName(evnt.m_tableName.c_str()));
LinearSectionPtr ptr[3]; LinearSectionPtr ptr[1];
ptr[0].p = (Uint32*)m_buffer.get_data(); ptr[0].p = (Uint32*)m_buffer.get_data();
ptr[0].sz = (m_buffer.length()+3) >> 2; ptr[0].sz = (m_buffer.length()+3) >> 2;
......
...@@ -161,8 +161,6 @@ public: ...@@ -161,8 +161,6 @@ public:
*/ */
bool equal(const NdbTableImpl&) const; bool equal(const NdbTableImpl&) const;
void assign(const NdbTableImpl&); void assign(const NdbTableImpl&);
void clearNewProperties();
void copyNewProperties();
static NdbTableImpl & getImpl(NdbDictionary::Table & t); static NdbTableImpl & getImpl(NdbDictionary::Table & t);
static NdbTableImpl & getImpl(const NdbDictionary::Table & t); static NdbTableImpl & getImpl(const NdbDictionary::Table & t);
...@@ -180,6 +178,7 @@ public: ...@@ -180,6 +178,7 @@ public:
NdbIndexImpl(NdbDictionary::Index &); NdbIndexImpl(NdbDictionary::Index &);
~NdbIndexImpl(); ~NdbIndexImpl();
void init();
void setName(const char * name); void setName(const char * name);
const char * getName() const; const char * getName() const;
void setTable(const char * table); void setTable(const char * table);
...@@ -209,6 +208,7 @@ public: ...@@ -209,6 +208,7 @@ public:
NdbEventImpl(NdbDictionary::Event &); NdbEventImpl(NdbDictionary::Event &);
~NdbEventImpl(); ~NdbEventImpl();
void init();
void setName(const char * name); void setName(const char * name);
const char * getName() const; const char * getName() const;
void setTable(const NdbDictionary::Table& table); void setTable(const NdbDictionary::Table& table);
...@@ -368,6 +368,8 @@ private: ...@@ -368,6 +368,8 @@ private:
Uint32 m_fragmentId; Uint32 m_fragmentId;
UtilBuffer m_buffer; UtilBuffer m_buffer;
// Buffer used when requesting a table by name
UtilBuffer m_namebuf;
}; };
class NdbDictionaryImpl : public NdbDictionary::Dictionary { class NdbDictionaryImpl : public NdbDictionary::Dictionary {
...@@ -560,7 +562,7 @@ NdbTableImpl::getColumn(const char * name){ ...@@ -560,7 +562,7 @@ NdbTableImpl::getColumn(const char * name){
do { do {
if(hashValue == (tmp & 0xFFFE)){ if(hashValue == (tmp & 0xFFFE)){
NdbColumnImpl* col = cols[tmp >> 16]; NdbColumnImpl* col = cols[tmp >> 16];
if(strncmp(name, col->m_name.c_str(), NDB_MAX_ATTR_NAME_SIZE-1) == 0){ if(strncmp(name, col->m_name.c_str(), col->m_name.length()) == 0){
return col; return col;
} }
} }
...@@ -578,7 +580,7 @@ NdbTableImpl::getColumn(const char * name){ ...@@ -578,7 +580,7 @@ NdbTableImpl::getColumn(const char * name){
} else { } else {
for(Uint32 i = 0; i<sz; i++){ for(Uint32 i = 0; i<sz; i++){
NdbColumnImpl* col = * cols++; NdbColumnImpl* col = * cols++;
if(col != 0 && strncmp(name, col->m_name.c_str(), NDB_MAX_ATTR_NAME_SIZE-1) == 0) if(col != 0 && strcmp(name, col->m_name.c_str()) == 0)
return col; return col;
} }
} }
......
...@@ -59,6 +59,37 @@ public: ...@@ -59,6 +59,37 @@ public:
NdbWaiter theWaiter; NdbWaiter theWaiter;
int m_optimized_node_selection; int m_optimized_node_selection;
BaseString m_dbname; // Database name
BaseString m_schemaname; // Schema name
BaseString m_prefix; // Buffer for preformatted internal name <db>/<schema>/
BaseString m_internalname;
void update_prefix()
{
m_prefix.assfmt("%s%c%s%c", m_dbname.c_str(), table_name_separator,
m_schemaname.c_str(), table_name_separator);
}
const char* internalize_table_name(const char* ext_name)
{
// Internal table name format <db>/<schema>/<table>
return m_internalname.assign(m_prefix).append(ext_name).c_str();
}
const char* internalize_index_name(const NdbTableImpl *table,
const char* ext_name)
{
// Internal index name format <db>/<schema>/<tabid>/<table>
return m_internalname.assign(m_prefix).appfmt("%d%c%s",
table->m_tableId,
table_name_separator,
ext_name).c_str();
}
}; };
#ifdef VM_TRACE #ifdef VM_TRACE
......
...@@ -62,7 +62,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection, ...@@ -62,7 +62,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
theNoOfAllocatedTransactions= 0; theNoOfAllocatedTransactions= 0;
theMaxNoOfTransactions= 0; theMaxNoOfTransactions= 0;
theMinNoOfEventsToWakeUp= 0; theMinNoOfEventsToWakeUp= 0;
prefixEnd= NULL;
theConIdleList= NULL; theConIdleList= NULL;
theOpIdleList= NULL; theOpIdleList= NULL;
theScanOpIdleList= NULL; theScanOpIdleList= NULL;
...@@ -110,16 +109,9 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection, ...@@ -110,16 +109,9 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
theLastTupleId[i] = 0; theLastTupleId[i] = 0;
}//for }//for
BaseString::snprintf(theDataBase, sizeof(theDataBase), "%s", theImpl->m_dbname.assign(aDataBase);
aDataBase ? aDataBase : ""); theImpl->m_schemaname.assign(aSchema);
BaseString::snprintf(theDataBaseSchema, sizeof(theDataBaseSchema), "%s", theImpl->update_prefix();
aSchema ? aSchema : "");
int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
theDataBase, table_name_separator,
theDataBaseSchema, table_name_separator);
prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len :
sizeof(prefixName) - 1);
theImpl->theWaiter.m_mutex = TransporterFacade::instance()->theMutexPtr; theImpl->theWaiter.m_mutex = TransporterFacade::instance()->theMutexPtr;
......
...@@ -265,14 +265,11 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char * ...@@ -265,14 +265,11 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
m_connect_callback= 0; m_connect_callback= 0;
if (ndb_global_event_buffer_mutex == NULL) if (ndb_global_event_buffer_mutex == NULL)
{
ndb_global_event_buffer_mutex= NdbMutex_Create(); ndb_global_event_buffer_mutex= NdbMutex_Create();
}
#ifdef VM_TRACE #ifdef VM_TRACE
if (ndb_print_state_mutex == NULL) if (ndb_print_state_mutex == NULL)
{
ndb_print_state_mutex= NdbMutex_Create(); ndb_print_state_mutex= NdbMutex_Create();
}
#endif #endif
m_config_retriever= m_config_retriever=
new ConfigRetriever(connect_string, NDB_VERSION, NODE_TYPE_API); new ConfigRetriever(connect_string, NDB_VERSION, NODE_TYPE_API);
...@@ -294,7 +291,6 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char * ...@@ -294,7 +291,6 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl() Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl()
{ {
DBUG_ENTER("~Ndb_cluster_connection"); DBUG_ENTER("~Ndb_cluster_connection");
DBUG_PRINT("enter",("~Ndb_cluster_connection this=0x%x", this));
TransporterFacade::stop_instance(); TransporterFacade::stop_instance();
if (m_connect_thread) if (m_connect_thread)
{ {
...@@ -312,10 +308,22 @@ Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl() ...@@ -312,10 +308,22 @@ Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl()
TransporterFacade::theFacadeInstance= 0; TransporterFacade::theFacadeInstance= 0;
} }
if (m_config_retriever) if (m_config_retriever)
{
delete m_config_retriever; delete m_config_retriever;
m_config_retriever= NULL;
// fragmentToNodeMap.release(); }
if (ndb_global_event_buffer_mutex != NULL)
{
NdbMutex_Destroy(ndb_global_event_buffer_mutex);
ndb_global_event_buffer_mutex= NULL;
}
#ifdef VM_TRACE
if (ndb_print_state_mutex != NULL)
{
NdbMutex_Destroy(ndb_print_state_mutex);
ndb_print_state_mutex= NULL;
}
#endif
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -17,8 +17,9 @@ ...@@ -17,8 +17,9 @@
INCLUDES=-I$(top_srcdir)/include $(openssl_includes) \ INCLUDES=-I$(top_srcdir)/include $(openssl_includes) \
-I$(top_builddir)/include -I$(top_builddir)/include
LDADD= @CLIENT_EXTRA_LDFLAGS@ @openssl_libs@ \ LDADD= @CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la @ZLIB_LIBS@ $(top_builddir)/libmysql_r/libmysqlclient_r.la \
@openssl_libs@ @ZLIB_LIBS@
bin_PROGRAMS= mysqltestmanager bin_PROGRAMS= mysqltestmanager
mysqltestmanager_SOURCES= mysqlmanager.c mysqltestmanager_SOURCES= mysqlmanager.c
mysqltestmanager_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) mysqltestmanager_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
......
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