Commit 85301e4c authored by joreland@mysql.com's avatar joreland@mysql.com

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

into mysql.com:/home/jonas/src/mysql-5.0-ndb
parents 08ade1e7 1dcbc45b
...@@ -41,7 +41,7 @@ charset-collation code for them. */ ...@@ -41,7 +41,7 @@ charset-collation code for them. */
ulint data_mysql_default_charset_coll = 99999999; ulint data_mysql_default_charset_coll = 99999999;
ulint data_mysql_latin1_swedish_charset_coll = 99999999; ulint data_mysql_latin1_swedish_charset_coll = 99999999;
dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0}; dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0, 0, 0};
dtype_t* dtype_binary = &dtype_binary_val; dtype_t* dtype_binary = &dtype_binary_val;
/************************************************************************* /*************************************************************************
...@@ -216,6 +216,8 @@ dtype_validate( ...@@ -216,6 +216,8 @@ dtype_validate(
ut_a((type->prtype & DATA_MYSQL_TYPE_MASK) < DATA_N_SYS_COLS); ut_a((type->prtype & DATA_MYSQL_TYPE_MASK) < DATA_N_SYS_COLS);
} }
ut_a(type->mbminlen <= type->mbmaxlen);
return(TRUE); return(TRUE);
} }
......
...@@ -271,6 +271,24 @@ dtype_get_prec( ...@@ -271,6 +271,24 @@ dtype_get_prec(
/*===========*/ /*===========*/
dtype_t* type); dtype_t* type);
/************************************************************************* /*************************************************************************
Gets the minimum length of a character, in bytes. */
UNIV_INLINE
ulint
dtype_get_mbminlen(
/*===============*/
/* out: minimum length of a char, in bytes,
or 0 if this is not a character type */
const dtype_t* type); /* in: type */
/*************************************************************************
Gets the maximum length of a character, in bytes. */
UNIV_INLINE
ulint
dtype_get_mbmaxlen(
/*===============*/
/* out: maximum length of a char, in bytes,
or 0 if this is not a character type */
const dtype_t* type); /* in: type */
/*************************************************************************
Gets the padding character code for the type. */ Gets the padding character code for the type. */
UNIV_INLINE UNIV_INLINE
ulint ulint
...@@ -352,16 +370,25 @@ dtype_print( ...@@ -352,16 +370,25 @@ dtype_print(
/*========*/ /*========*/
dtype_t* type); /* in: type */ dtype_t* type); /* in: type */
/* Structure for an SQL data type */ /* Structure for an SQL data type.
If you add fields to this structure, be sure to initialize them everywhere.
This structure is initialized in the following functions:
dtype_set()
dtype_read_for_order_and_null_size()
dtype_new_read_for_order_and_null_size()
sym_tab_add_null_lit() */
struct dtype_struct{ struct dtype_struct{
ulint mtype; /* main data type */ ulint mtype; /* main data type */
ulint prtype; /* precise type; MySQL data type */ ulint prtype; /* precise type; MySQL data type */
/* the remaining two fields do not affect alphabetical ordering: */ /* the remaining fields do not affect alphabetical ordering: */
ulint len; /* length */ ulint len; /* length */
ulint prec; /* precision */ ulint prec; /* precision */
ulint mbminlen; /* minimum length of a character, in bytes */
ulint mbmaxlen; /* maximum length of a character, in bytes */
}; };
#ifndef UNIV_NONINL #ifndef UNIV_NONINL
......
...@@ -9,15 +9,46 @@ Created 1/16/1996 Heikki Tuuri ...@@ -9,15 +9,46 @@ Created 1/16/1996 Heikki Tuuri
#include "mach0data.h" #include "mach0data.h"
/********************************************************************** /**********************************************************************
Determines whether the given character set is of variable length. Get the variable length bounds of the given character set.
NOTE: the prototype of this function is copied from ha_innodb.cc! If you change NOTE: the prototype of this function is copied from ha_innodb.cc! If you change
this function, you MUST change also the prototype here! */ this function, you MUST change also the prototype here! */
extern extern
ibool void
innobase_is_mb_cset( innobase_get_cset_width(
/*================*/ /*====================*/
ulint cset); /* in: MySQL charset-collation code */ ulint cset, /* in: MySQL charset-collation code */
ulint* mbminlen, /* out: minimum length of a char (in bytes) */
ulint* mbmaxlen); /* out: maximum length of a char (in bytes) */
/*************************************************************************
Gets the MySQL charset-collation code for MySQL string types. */
UNIV_INLINE
ulint
dtype_get_charset_coll(
/*===================*/
ulint prtype) /* in: precise data type */
{
return((prtype >> 16) & 0xFFUL);
}
/*************************************************************************
Sets the mbminlen and mbmaxlen members of a data type structure. */
UNIV_INLINE
void
dtype_set_mblen(
/*============*/
dtype_t* type) /* in/out: type struct */
{
ut_ad(type);
if (dtype_is_string_type(type->mtype)) {
innobase_get_cset_width(dtype_get_charset_coll(type->prtype),
&type->mbminlen, &type->mbmaxlen);
ut_ad(type->mbminlen <= type->mbmaxlen);
} else {
type->mbminlen = type->mbmaxlen = 0;
}
}
/************************************************************************* /*************************************************************************
Sets a data type structure. */ Sets a data type structure. */
...@@ -39,6 +70,7 @@ dtype_set( ...@@ -39,6 +70,7 @@ dtype_set(
type->len = len; type->len = len;
type->prec = prec; type->prec = prec;
dtype_set_mblen(type);
ut_ad(dtype_validate(type)); ut_ad(dtype_validate(type));
} }
...@@ -82,17 +114,6 @@ dtype_get_prtype( ...@@ -82,17 +114,6 @@ dtype_get_prtype(
return(type->prtype); return(type->prtype);
} }
/*************************************************************************
Gets the MySQL charset-collation code for MySQL string types. */
UNIV_INLINE
ulint
dtype_get_charset_coll(
/*===================*/
ulint prtype) /* in: precise data type */
{
return((prtype >> 16) & 0xFFUL);
}
/************************************************************************* /*************************************************************************
Gets the type length. */ Gets the type length. */
UNIV_INLINE UNIV_INLINE
...@@ -119,6 +140,33 @@ dtype_get_prec( ...@@ -119,6 +140,33 @@ dtype_get_prec(
return(type->prec); return(type->prec);
} }
/*************************************************************************
Gets the minimum length of a character, in bytes. */
UNIV_INLINE
ulint
dtype_get_mbminlen(
/*===============*/
/* out: minimum length of a char, in bytes,
or 0 if this is not a character type */
const dtype_t* type) /* in: type */
{
ut_ad(type);
return(type->mbminlen);
}
/*************************************************************************
Gets the maximum length of a character, in bytes. */
UNIV_INLINE
ulint
dtype_get_mbmaxlen(
/*===============*/
/* out: maximum length of a char, in bytes,
or 0 if this is not a character type */
const dtype_t* type) /* in: type */
{
ut_ad(type);
return(type->mbmaxlen);
}
/************************************************************************* /*************************************************************************
Gets the padding character code for the type. */ Gets the padding character code for the type. */
UNIV_INLINE UNIV_INLINE
...@@ -211,6 +259,7 @@ dtype_read_for_order_and_null_size( ...@@ -211,6 +259,7 @@ dtype_read_for_order_and_null_size(
type->prtype = dtype_form_prtype(type->prtype, type->prtype = dtype_form_prtype(type->prtype,
data_mysql_default_charset_coll); data_mysql_default_charset_coll);
dtype_set_mblen(type);
} }
/************************************************************************** /**************************************************************************
...@@ -262,6 +311,7 @@ dtype_new_read_for_order_and_null_size( ...@@ -262,6 +311,7 @@ dtype_new_read_for_order_and_null_size(
type->prtype = dtype_form_prtype(type->prtype, charset_coll); type->prtype = dtype_form_prtype(type->prtype, charset_coll);
} }
dtype_set_mblen(type);
} }
/*************************************************************************** /***************************************************************************
...@@ -305,11 +355,40 @@ dtype_get_fixed_size( ...@@ -305,11 +355,40 @@ dtype_get_fixed_size(
case DATA_FLOAT: case DATA_FLOAT:
case DATA_DOUBLE: case DATA_DOUBLE:
case DATA_MYSQL: case DATA_MYSQL:
if ((type->prtype & DATA_BINARY_TYPE) if (type->prtype & DATA_BINARY_TYPE) {
|| !innobase_is_mb_cset(
dtype_get_charset_coll(
type->prtype))) {
return(dtype_get_len(type)); return(dtype_get_len(type));
} else {
/* We play it safe here and ask MySQL for
mbminlen and mbmaxlen. Although
type->mbminlen and type->mbmaxlen are
initialized if and only if type->prtype
is (in one of the 3 functions in this file),
it could be that none of these functions
has been called. */
ulint mbminlen, mbmaxlen;
innobase_get_cset_width(
dtype_get_charset_coll(type->prtype),
&mbminlen, &mbmaxlen);
if (type->mbminlen != mbminlen
|| type->mbmaxlen != mbmaxlen) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: "
"mbminlen=%lu, "
"mbmaxlen=%lu, "
"type->mbminlen=%lu, "
"type->mbmaxlen=%lu\n",
(ulong) mbminlen,
(ulong) mbmaxlen,
(ulong) type->mbminlen,
(ulong) type->mbmaxlen);
}
if (mbminlen == mbmaxlen) {
return(dtype_get_len(type));
}
} }
/* fall through for variable-length charsets */ /* fall through for variable-length charsets */
case DATA_VARCHAR: case DATA_VARCHAR:
......
...@@ -458,6 +458,10 @@ struct mysql_row_templ_struct { ...@@ -458,6 +458,10 @@ struct mysql_row_templ_struct {
numbers DATA_CHAR... */ numbers DATA_CHAR... */
ulint charset; /* MySQL charset-collation code ulint charset; /* MySQL charset-collation code
of the column, or zero */ of the column, or zero */
ulint mbminlen; /* minimum length of a char, in bytes,
or zero if not a char type */
ulint mbmaxlen; /* maximum length of a char, in bytes,
or zero if not a char type */
ulint is_unsigned; /* if a column type is an integer ulint is_unsigned; /* if a column type is an integer
type and this field is != 0, then type and this field is != 0, then
it is an unsigned integer type */ it is an unsigned integer type */
......
...@@ -93,17 +93,11 @@ row_mysql_store_col_in_innobase_format( ...@@ -93,17 +93,11 @@ row_mysql_store_col_in_innobase_format(
|| type == DATA_BINARY) { || type == DATA_BINARY) {
/* Remove trailing spaces. */ /* Remove trailing spaces. */
/* Handle UCS2 strings differently. As no new /* Handle UCS2 strings differently. */
collations will be introduced in 4.1, we hardcode the ulint mbminlen = dtype_get_mbminlen(
charset-collation codes here. In 5.0, the logic will dfield_get_type(dfield));
be based on mbminlen. */
ulint cset = dtype_get_charset_coll(
dtype_get_prtype(dfield_get_type(dfield)));
ptr = row_mysql_read_var_ref(&col_len, mysql_data); ptr = row_mysql_read_var_ref(&col_len, mysql_data);
if (cset == 35/*ucs2_general_ci*/ if (mbminlen == 2) {
|| cset == 90/*ucs2_bin*/
|| (cset >= 128/*ucs2_unicode_ci*/
&& cset <= 144/*ucs2_persian_ci*/)) {
/* space=0x0020 */ /* space=0x0020 */
/* Trim "half-chars", just in case. */ /* Trim "half-chars", just in case. */
col_len &= ~1; col_len &= ~1;
...@@ -113,6 +107,7 @@ row_mysql_store_col_in_innobase_format( ...@@ -113,6 +107,7 @@ row_mysql_store_col_in_innobase_format(
col_len -= 2; col_len -= 2;
} }
} else { } else {
ut_a(mbminlen == 1);
/* space=0x20 */ /* space=0x20 */
while (col_len > 0 && ptr[col_len - 1] == 0x20) { while (col_len > 0 && ptr[col_len - 1] == 0x20) {
col_len--; col_len--;
......
...@@ -424,10 +424,13 @@ row_create_prebuilt( ...@@ -424,10 +424,13 @@ row_create_prebuilt(
prebuilt->sel_graph = NULL; prebuilt->sel_graph = NULL;
prebuilt->search_tuple = dtuple_create(heap, prebuilt->search_tuple = dtuple_create(heap,
dict_table_get_n_cols(table)); 2 * dict_table_get_n_cols(table));
clust_index = dict_table_get_first_index(table); clust_index = dict_table_get_first_index(table);
/* Make sure that search_tuple is long enough for clustered index */
ut_a(2 * dict_table_get_n_cols(table) >= clust_index->n_fields);
ref_len = dict_index_get_n_unique(clust_index); ref_len = dict_index_get_n_unique(clust_index);
ref = dtuple_create(heap, ref_len); ref = dtuple_create(heap, ref_len);
......
...@@ -2410,14 +2410,9 @@ row_sel_store_mysql_rec( ...@@ -2410,14 +2410,9 @@ row_sel_store_mysql_rec(
/* Pad with trailing spaces */ /* Pad with trailing spaces */
data = mysql_rec + templ->mysql_col_offset; data = mysql_rec + templ->mysql_col_offset;
/* Handle UCS2 strings differently. As no new ut_ad(templ->mbminlen <= templ->mbmaxlen);
collations will be introduced in 4.1, we /* Handle UCS2 strings differently. */
hardcode the charset-collation codes here. if (templ->mbminlen == 2) {
5.0 will use a different approach. */
if (templ->charset == 35
|| templ->charset == 90
|| (templ->charset >= 128
&& templ->charset <= 144)) {
/* space=0x0020 */ /* space=0x0020 */
ulint col_len = templ->mysql_col_len; ulint col_len = templ->mysql_col_len;
...@@ -2436,6 +2431,7 @@ row_sel_store_mysql_rec( ...@@ -2436,6 +2431,7 @@ row_sel_store_mysql_rec(
data[len++] = 0x20; data[len++] = 0x20;
} }
} else { } else {
ut_ad(templ->mbminlen == 1);
/* space=0x20 */ /* space=0x20 */
memset(data + len, 0x20, memset(data + len, 0x20,
templ->mysql_col_len - len); templ->mysql_col_len - len);
...@@ -2477,14 +2473,8 @@ row_sel_store_mysql_rec( ...@@ -2477,14 +2473,8 @@ row_sel_store_mysql_rec(
pad_char = '\0'; pad_char = '\0';
} }
/* Handle UCS2 strings differently. As no new /* Handle UCS2 strings differently. */
collations will be introduced in 4.1, if (templ->mbminlen == 2) {
we hardcode the charset-collation codes here.
5.0 will use a different approach. */
if (templ->charset == 35
|| templ->charset == 90
|| (templ->charset >= 128
&& templ->charset <= 144)) {
/* There are two bytes per char, so the length /* There are two bytes per char, so the length
has to be an even number. */ has to be an even number. */
ut_a(!(templ->mysql_col_len & 1)); ut_a(!(templ->mysql_col_len & 1));
...@@ -2497,6 +2487,7 @@ row_sel_store_mysql_rec( ...@@ -2497,6 +2487,7 @@ row_sel_store_mysql_rec(
len -= 2; len -= 2;
} }
} else { } else {
ut_ad(templ->mbminlen == 1);
memset(mysql_rec + templ->mysql_col_offset, memset(mysql_rec + templ->mysql_col_offset,
pad_char, templ->mysql_col_len); pad_char, templ->mysql_col_len);
} }
......
...@@ -10,9 +10,11 @@ CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary D ...@@ -10,9 +10,11 @@ CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary D
CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Password char(41) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,File_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,ssl_cipher BLOB NOT NULL,x509_issuer BLOB NOT NULL,x509_subject BLOB NOT NULL,max_questions int(11) unsigned DEFAULT 0 NOT NULL,max_updates int(11) unsigned DEFAULT 0 NOT NULL,max_connections int(11) unsigned DEFAULT 0 NOT NULL,PRIMARY KEY Host (Host,User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Password char(41) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,File_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,ssl_cipher BLOB NOT NULL,x509_issuer BLOB NOT NULL,x509_subject BLOB NOT NULL,max_questions int(11) unsigned DEFAULT 0 NOT NULL,max_updates int(11) unsigned DEFAULT 0 NOT NULL,max_connections int(11) unsigned DEFAULT 0 NOT NULL,PRIMARY KEY Host (Host,User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); INSERT INTO user VALUES ('g4%' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0); REPLACE INTO user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user (host,user) VALUES ('localhost','');
INSERT INTO user (host,user) VALUES ('g4%','');
CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL,ret tinyint(1) DEFAULT '0' NOT NULL,dl char(128) DEFAULT '' NOT NULL,type enum ('function','aggregate') NOT NULL,PRIMARY KEY (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL,ret tinyint(1) DEFAULT '0' NOT NULL,dl char(128) DEFAULT '' NOT NULL,type enum ('function','aggregate') NOT NULL,PRIMARY KEY (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
...@@ -40,7 +42,7 @@ INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'), ...@@ -40,7 +42,7 @@ INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'),
CREATE TABLE time_zone_transition (Time_zone_id int unsigned NOT NULL,Transition_time bigint signed NOT NULL,Transition_type_id int unsigned NOT NULL,PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions'; CREATE TABLE time_zone_transition (Time_zone_id int unsigned NOT NULL,Transition_time bigint signed NOT NULL,Transition_type_id int unsigned NOT NULL,PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES (1, -1693706400, 0) ,(1, -1680483600, 1),(1, -1663455600, 2) ,(1, -1650150000, 3),(1, -1632006000, 2) ,(1, -1618700400, 3),(1, -938905200, 2) ,(1, -857257200, 3),(1, -844556400, 2) ,(1, -828226800, 3),(1, -812502000, 2) ,(1, -796777200, 3),(1, 228877200, 2) ,(1, 243997200, 3),(1, 260326800, 2) ,(1, 276051600, 3),(1, 291776400, 2) ,(1, 307501200, 3),(1, 323830800, 2) ,(1, 338950800, 3),(1, 354675600, 2) ,(1, 370400400, 3),(1, 386125200, 2) ,(1, 401850000, 3),(1, 417574800, 2) ,(1, 433299600, 3),(1, 449024400, 2) ,(1, 465354000, 3),(1, 481078800, 2) ,(1, 496803600, 3),(1, 512528400, 2) ,(1, 528253200, 3),(1, 543978000, 2) ,(1, 559702800, 3),(1, 575427600, 2) ,(1, 591152400, 3),(1, 606877200, 2) ,(1, 622602000, 3),(1, 638326800, 2) ,(1, 654656400, 3),(1, 670381200, 2) ,(1, 686106000, 3),(1, 701830800, 2) ,(1, 717555600, 3),(1, 733280400, 2) ,(1, 749005200, 3),(1, 764730000, 2) ,(1, 780454800, 3),(1, 796179600, 2) ,(1, 811904400, 3),(1, 828234000, 2) ,(1, 846378000, 3),(1, 859683600, 2) ,(1, 877827600, 3),(1, 891133200, 2) ,(1, 909277200, 3),(1, 922582800, 2) ,(1, 941331600, 3),(1, 954032400, 2) ,(1, 972781200, 3),(1, 985482000, 2) ,(1, 1004230800, 3),(1, 1017536400, 2) ,(1, 1035680400, 3),(1, 1048986000, 2) ,(1, 1067130000, 3),(1, 1080435600, 2) ,(1, 1099184400, 3),(1, 1111885200, 2) ,(1, 1130634000, 3),(1, 1143334800, 2) ,(1, 1162083600, 3),(1, 1174784400, 2) ,(1, 1193533200, 3),(1, 1206838800, 2) ,(1, 1224982800, 3),(1, 1238288400, 2) ,(1, 1256432400, 3),(1, 1269738000, 2) ,(1, 1288486800, 3),(1, 1301187600, 2) ,(1, 1319936400, 3),(1, 1332637200, 2) ,(1, 1351386000, 3),(1, 1364691600, 2) ,(1, 1382835600, 3),(1, 1396141200, 2) ,(1, 1414285200, 3),(1, 1427590800, 2) ,(1, 1445734800, 3),(1, 1459040400, 2) ,(1, 1477789200, 3),(1, 1490490000, 2) ,(1, 1509238800, 3),(1, 1521939600, 2) ,(1, 1540688400, 3),(1, 1553994000, 2) ,(1, 1572138000, 3),(1, 1585443600, 2) ,(1, 1603587600, 3),(1, 1616893200, 2) ,(1, 1635642000, 3),(1, 1648342800, 2) ,(1, 1667091600, 3),(1, 1679792400, 2) ,(1, 1698541200, 3),(1, 1711846800, 2) ,(1, 1729990800, 3),(1, 1743296400, 2) ,(1, 1761440400, 3),(1, 1774746000, 2) ,(1, 1792890000, 3),(1, 1806195600, 2) ,(1, 1824944400, 3),(1, 1837645200, 2) ,(1, 1856394000, 3),(1, 1869094800, 2) ,(1, 1887843600, 3),(1, 1901149200, 2) ,(1, 1919293200, 3),(1, 1932598800, 2) ,(1, 1950742800, 3),(1, 1964048400, 2) ,(1, 1982797200, 3),(1, 1995498000, 2) ,(1, 2014246800, 3),(1, 2026947600, 2) ,(1, 2045696400, 3),(1, 2058397200, 2) ,(1, 2077146000, 3),(1, 2090451600, 2) ,(1, 2108595600, 3),(1, 2121901200, 2) ,(1, 2140045200, 3),(3, -1688265000, 2) ,(3, -1656819048, 1),(3, -1641353448, 2) ,(3, -1627965048, 3),(3, -1618716648, 1) ,(3, -1596429048, 3),(3, -1593829848, 5) ,(3, -1589860800, 4),(3, -1542427200, 5) ,(3, -1539493200, 6),(3, -1525323600, 5) ,(3, -1522728000, 4),(3, -1491188400, 7) ,(3, -1247536800, 4),(3, 354920400, 5) ,(3, 370728000, 4),(3, 386456400, 5) ,(3, 402264000, 4),(3, 417992400, 5) ,(3, 433800000, 4),(3, 449614800, 5) ,(3, 465346800, 8),(3, 481071600, 9) ,(3, 496796400, 8),(3, 512521200, 9) ,(3, 528246000, 8),(3, 543970800, 9) ,(3, 559695600, 8),(3, 575420400, 9) ,(3, 591145200, 8),(3, 606870000, 9) ,(3, 622594800, 8),(3, 638319600, 9) ,(3, 654649200, 8),(3, 670374000, 10) ,(3, 686102400, 11),(3, 695779200, 8) ,(3, 701812800, 5),(3, 717534000, 4) ,(3, 733273200, 9),(3, 748998000, 8) ,(3, 764722800, 9),(3, 780447600, 8) ,(3, 796172400, 9),(3, 811897200, 8) ,(3, 828226800, 9),(3, 846370800, 8) ,(3, 859676400, 9),(3, 877820400, 8) ,(3, 891126000, 9),(3, 909270000, 8) ,(3, 922575600, 9),(3, 941324400, 8) ,(3, 954025200, 9),(3, 972774000, 8) ,(3, 985474800, 9),(3, 1004223600, 8) ,(3, 1017529200, 9),(3, 1035673200, 8) ,(3, 1048978800, 9),(3, 1067122800, 8) ,(3, 1080428400, 9),(3, 1099177200, 8) ,(3, 1111878000, 9),(3, 1130626800, 8) ,(3, 1143327600, 9),(3, 1162076400, 8) ,(3, 1174777200, 9),(3, 1193526000, 8) ,(3, 1206831600, 9),(3, 1224975600, 8) ,(3, 1238281200, 9),(3, 1256425200, 8) ,(3, 1269730800, 9),(3, 1288479600, 8) ,(3, 1301180400, 9),(3, 1319929200, 8) ,(3, 1332630000, 9),(3, 1351378800, 8) ,(3, 1364684400, 9),(3, 1382828400, 8) ,(3, 1396134000, 9),(3, 1414278000, 8) ,(3, 1427583600, 9),(3, 1445727600, 8) ,(3, 1459033200, 9),(3, 1477782000, 8) ,(3, 1490482800, 9),(3, 1509231600, 8) ,(3, 1521932400, 9),(3, 1540681200, 8) ,(3, 1553986800, 9),(3, 1572130800, 8) ,(3, 1585436400, 9),(3, 1603580400, 8) ,(3, 1616886000, 9),(3, 1635634800, 8) ,(3, 1648335600, 9),(3, 1667084400, 8) ,(3, 1679785200, 9),(3, 1698534000, 8) ,(3, 1711839600, 9),(3, 1729983600, 8) ,(3, 1743289200, 9),(3, 1761433200, 8) ,(3, 1774738800, 9),(3, 1792882800, 8) ,(3, 1806188400, 9),(3, 1824937200, 8) ,(3, 1837638000, 9),(3, 1856386800, 8) ,(3, 1869087600, 9),(3, 1887836400, 8) ,(3, 1901142000, 9),(3, 1919286000, 8) ,(3, 1932591600, 9),(3, 1950735600, 8) ,(3, 1964041200, 9),(3, 1982790000, 8) ,(3, 1995490800, 9),(3, 2014239600, 8) ,(3, 2026940400, 9),(3, 2045689200, 8) ,(3, 2058390000, 9),(3, 2077138800, 8) ,(3, 2090444400, 9),(3, 2108588400, 8) ,(3, 2121894000, 9),(3, 2140038000, 8),(4, -1688265000, 2) ,(4, -1656819048, 1),(4, -1641353448, 2) ,(4, -1627965048, 3),(4, -1618716648, 1) ,(4, -1596429048, 3),(4, -1593829848, 5) ,(4, -1589860800, 4),(4, -1542427200, 5) ,(4, -1539493200, 6),(4, -1525323600, 5) ,(4, -1522728000, 4),(4, -1491188400, 7) ,(4, -1247536800, 4),(4, 354920409, 5) ,(4, 370728010, 4),(4, 386456410, 5) ,(4, 402264011, 4),(4, 417992411, 5) ,(4, 433800012, 4),(4, 449614812, 5) ,(4, 465346812, 8),(4, 481071612, 9) ,(4, 496796413, 8),(4, 512521213, 9) ,(4, 528246013, 8),(4, 543970813, 9) ,(4, 559695613, 8),(4, 575420414, 9) ,(4, 591145214, 8),(4, 606870014, 9) ,(4, 622594814, 8),(4, 638319615, 9) ,(4, 654649215, 8),(4, 670374016, 10) ,(4, 686102416, 11),(4, 695779216, 8) ,(4, 701812816, 5),(4, 717534017, 4) ,(4, 733273217, 9),(4, 748998018, 8) ,(4, 764722818, 9),(4, 780447619, 8) ,(4, 796172419, 9),(4, 811897219, 8) ,(4, 828226820, 9),(4, 846370820, 8) ,(4, 859676420, 9),(4, 877820421, 8) ,(4, 891126021, 9),(4, 909270021, 8) ,(4, 922575622, 9),(4, 941324422, 8) ,(4, 954025222, 9),(4, 972774022, 8) ,(4, 985474822, 9),(4, 1004223622, 8) ,(4, 1017529222, 9),(4, 1035673222, 8) ,(4, 1048978822, 9),(4, 1067122822, 8) ,(4, 1080428422, 9),(4, 1099177222, 8) ,(4, 1111878022, 9),(4, 1130626822, 8) ,(4, 1143327622, 9),(4, 1162076422, 8) ,(4, 1174777222, 9),(4, 1193526022, 8) ,(4, 1206831622, 9),(4, 1224975622, 8) ,(4, 1238281222, 9),(4, 1256425222, 8) ,(4, 1269730822, 9),(4, 1288479622, 8) ,(4, 1301180422, 9),(4, 1319929222, 8) ,(4, 1332630022, 9),(4, 1351378822, 8) ,(4, 1364684422, 9),(4, 1382828422, 8) ,(4, 1396134022, 9),(4, 1414278022, 8) ,(4, 1427583622, 9),(4, 1445727622, 8) ,(4, 1459033222, 9),(4, 1477782022, 8) ,(4, 1490482822, 9),(4, 1509231622, 8) ,(4, 1521932422, 9),(4, 1540681222, 8) ,(4, 1553986822, 9),(4, 1572130822, 8) ,(4, 1585436422, 9),(4, 1603580422, 8) ,(4, 1616886022, 9),(4, 1635634822, 8) ,(4, 1648335622, 9),(4, 1667084422, 8) ,(4, 1679785222, 9),(4, 1698534022, 8) ,(4, 1711839622, 9),(4, 1729983622, 8) ,(4, 1743289222, 9),(4, 1761433222, 8) ,(4, 1774738822, 9),(4, 1792882822, 8) ,(4, 1806188422, 9),(4, 1824937222, 8) ,(4, 1837638022, 9),(4, 1856386822, 8) ,(4, 1869087622, 9),(4, 1887836422, 8) ,(4, 1901142022, 9),(4, 1919286022, 8) ,(4, 1932591622, 9),(4, 1950735622, 8) ,(4, 1964041222, 9),(4, 1982790022, 8) ,(4, 1995490822, 9),(4, 2014239622, 8) ,(4, 2026940422, 9),(4, 2045689222, 8) ,(4, 2058390022, 9),(4, 2077138822, 8) ,(4, 2090444422, 9),(4, 2108588422, 8) ,(4, 2121894022, 9),(4, 2140038022, 8); INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES (1, -1693706400, 0) ,(1, -1680483600, 1),(1, -1663455600, 2) ,(1, -1650150000, 3),(1, -1632006000, 2) ,(1, -1618700400, 3),(1, -938905200, 2) ,(1, -857257200, 3),(1, -844556400, 2) ,(1, -828226800, 3),(1, -812502000, 2) ,(1, -796777200, 3),(1, 228877200, 2) ,(1, 243997200, 3),(1, 260326800, 2) ,(1, 276051600, 3),(1, 291776400, 2) ,(1, 307501200, 3),(1, 323830800, 2) ,(1, 338950800, 3),(1, 354675600, 2) ,(1, 370400400, 3),(1, 386125200, 2) ,(1, 401850000, 3),(1, 417574800, 2) ,(1, 433299600, 3),(1, 449024400, 2) ,(1, 465354000, 3),(1, 481078800, 2) ,(1, 496803600, 3),(1, 512528400, 2) ,(1, 528253200, 3),(1, 543978000, 2) ,(1, 559702800, 3),(1, 575427600, 2) ,(1, 591152400, 3),(1, 606877200, 2) ,(1, 622602000, 3),(1, 638326800, 2) ,(1, 654656400, 3),(1, 670381200, 2) ,(1, 686106000, 3),(1, 701830800, 2) ,(1, 717555600, 3),(1, 733280400, 2) ,(1, 749005200, 3),(1, 764730000, 2) ,(1, 780454800, 3),(1, 796179600, 2) ,(1, 811904400, 3),(1, 828234000, 2) ,(1, 846378000, 3),(1, 859683600, 2) ,(1, 877827600, 3),(1, 891133200, 2) ,(1, 909277200, 3),(1, 922582800, 2) ,(1, 941331600, 3),(1, 954032400, 2) ,(1, 972781200, 3),(1, 985482000, 2) ,(1, 1004230800, 3),(1, 1017536400, 2) ,(1, 1035680400, 3),(1, 1048986000, 2) ,(1, 1067130000, 3),(1, 1080435600, 2) ,(1, 1099184400, 3),(1, 1111885200, 2) ,(1, 1130634000, 3),(1, 1143334800, 2) ,(1, 1162083600, 3),(1, 1174784400, 2) ,(1, 1193533200, 3),(1, 1206838800, 2) ,(1, 1224982800, 3),(1, 1238288400, 2) ,(1, 1256432400, 3),(1, 1269738000, 2) ,(1, 1288486800, 3),(1, 1301187600, 2) ,(1, 1319936400, 3),(1, 1332637200, 2) ,(1, 1351386000, 3),(1, 1364691600, 2) ,(1, 1382835600, 3),(1, 1396141200, 2) ,(1, 1414285200, 3),(1, 1427590800, 2) ,(1, 1445734800, 3),(1, 1459040400, 2) ,(1, 1477789200, 3),(1, 1490490000, 2) ,(1, 1509238800, 3),(1, 1521939600, 2) ,(1, 1540688400, 3),(1, 1553994000, 2) ,(1, 1572138000, 3),(1, 1585443600, 2) ,(1, 1603587600, 3),(1, 1616893200, 2) ,(1, 1635642000, 3),(1, 1648342800, 2) ,(1, 1667091600, 3),(1, 1679792400, 2) ,(1, 1698541200, 3),(1, 1711846800, 2) ,(1, 1729990800, 3),(1, 1743296400, 2) ,(1, 1761440400, 3),(1, 1774746000, 2) ,(1, 1792890000, 3),(1, 1806195600, 2) ,(1, 1824944400, 3),(1, 1837645200, 2) ,(1, 1856394000, 3),(1, 1869094800, 2) ,(1, 1887843600, 3),(1, 1901149200, 2) ,(1, 1919293200, 3),(1, 1932598800, 2) ,(1, 1950742800, 3),(1, 1964048400, 2) ,(1, 1982797200, 3),(1, 1995498000, 2) ,(1, 2014246800, 3),(1, 2026947600, 2) ,(1, 2045696400, 3),(1, 2058397200, 2) ,(1, 2077146000, 3),(1, 2090451600, 2) ,(1, 2108595600, 3),(1, 2121901200, 2) ,(1, 2140045200, 3),(3, -1688265000, 2) ,(3, -1656819048, 1),(3, -1641353448, 2) ,(3, -1627965048, 3),(3, -1618716648, 1) ,(3, -1596429048, 3),(3, -1593829848, 5) ,(3, -1589860800, 4),(3, -1542427200, 5) ,(3, -1539493200, 6),(3, -1525323600, 5) ,(3, -1522728000, 4),(3, -1491188400, 7) ,(3, -1247536800, 4),(3, 354920400, 5) ,(3, 370728000, 4),(3, 386456400, 5) ,(3, 402264000, 4),(3, 417992400, 5) ,(3, 433800000, 4),(3, 449614800, 5) ,(3, 465346800, 8),(3, 481071600, 9) ,(3, 496796400, 8),(3, 512521200, 9) ,(3, 528246000, 8),(3, 543970800, 9) ,(3, 559695600, 8),(3, 575420400, 9) ,(3, 591145200, 8),(3, 606870000, 9) ,(3, 622594800, 8),(3, 638319600, 9) ,(3, 654649200, 8),(3, 670374000, 10) ,(3, 686102400, 11),(3, 695779200, 8) ,(3, 701812800, 5),(3, 717534000, 4) ,(3, 733273200, 9),(3, 748998000, 8) ,(3, 764722800, 9),(3, 780447600, 8) ,(3, 796172400, 9),(3, 811897200, 8) ,(3, 828226800, 9),(3, 846370800, 8) ,(3, 859676400, 9),(3, 877820400, 8) ,(3, 891126000, 9),(3, 909270000, 8) ,(3, 922575600, 9),(3, 941324400, 8) ,(3, 954025200, 9),(3, 972774000, 8) ,(3, 985474800, 9),(3, 1004223600, 8) ,(3, 1017529200, 9),(3, 1035673200, 8) ,(3, 1048978800, 9),(3, 1067122800, 8) ,(3, 1080428400, 9),(3, 1099177200, 8) ,(3, 1111878000, 9),(3, 1130626800, 8) ,(3, 1143327600, 9),(3, 1162076400, 8) ,(3, 1174777200, 9),(3, 1193526000, 8) ,(3, 1206831600, 9),(3, 1224975600, 8) ,(3, 1238281200, 9),(3, 1256425200, 8) ,(3, 1269730800, 9),(3, 1288479600, 8) ,(3, 1301180400, 9),(3, 1319929200, 8) ,(3, 1332630000, 9),(3, 1351378800, 8) ,(3, 1364684400, 9),(3, 1382828400, 8) ,(3, 1396134000, 9),(3, 1414278000, 8) ,(3, 1427583600, 9),(3, 1445727600, 8) ,(3, 1459033200, 9),(3, 1477782000, 8) ,(3, 1490482800, 9),(3, 1509231600, 8) ,(3, 1521932400, 9),(3, 1540681200, 8) ,(3, 1553986800, 9),(3, 1572130800, 8) ,(3, 1585436400, 9),(3, 1603580400, 8) ,(3, 1616886000, 9),(3, 1635634800, 8) ,(3, 1648335600, 9),(3, 1667084400, 8) ,(3, 1679785200, 9),(3, 1698534000, 8) ,(3, 1711839600, 9),(3, 1729983600, 8) ,(3, 1743289200, 9),(3, 1761433200, 8) ,(3, 1774738800, 9),(3, 1792882800, 8) ,(3, 1806188400, 9),(3, 1824937200, 8) ,(3, 1837638000, 9),(3, 1856386800, 8) ,(3, 1869087600, 9),(3, 1887836400, 8) ,(3, 1901142000, 9),(3, 1919286000, 8) ,(3, 1932591600, 9),(3, 1950735600, 8) ,(3, 1964041200, 9),(3, 1982790000, 8) ,(3, 1995490800, 9),(3, 2014239600, 8) ,(3, 2026940400, 9),(3, 2045689200, 8) ,(3, 2058390000, 9),(3, 2077138800, 8) ,(3, 2090444400, 9),(3, 2108588400, 8) ,(3, 2121894000, 9),(3, 2140038000, 8),(4, -1688265000, 2) ,(4, -1656819048, 1),(4, -1641353448, 2) ,(4, -1627965048, 3),(4, -1618716648, 1) ,(4, -1596429048, 3),(4, -1593829848, 5) ,(4, -1589860800, 4),(4, -1542427200, 5) ,(4, -1539493200, 6),(4, -1525323600, 5) ,(4, -1522728000, 4),(4, -1491188400, 7) ,(4, -1247536800, 4),(4, 354920409, 5) ,(4, 370728010, 4),(4, 386456410, 5) ,(4, 402264011, 4),(4, 417992411, 5) ,(4, 433800012, 4),(4, 449614812, 5) ,(4, 465346812, 8),(4, 481071612, 9) ,(4, 496796413, 8),(4, 512521213, 9) ,(4, 528246013, 8),(4, 543970813, 9) ,(4, 559695613, 8),(4, 575420414, 9) ,(4, 591145214, 8),(4, 606870014, 9) ,(4, 622594814, 8),(4, 638319615, 9) ,(4, 654649215, 8),(4, 670374016, 10) ,(4, 686102416, 11),(4, 695779216, 8) ,(4, 701812816, 5),(4, 717534017, 4) ,(4, 733273217, 9),(4, 748998018, 8) ,(4, 764722818, 9),(4, 780447619, 8) ,(4, 796172419, 9),(4, 811897219, 8) ,(4, 828226820, 9),(4, 846370820, 8) ,(4, 859676420, 9),(4, 877820421, 8) ,(4, 891126021, 9),(4, 909270021, 8) ,(4, 922575622, 9),(4, 941324422, 8) ,(4, 954025222, 9),(4, 972774022, 8) ,(4, 985474822, 9),(4, 1004223622, 8) ,(4, 1017529222, 9),(4, 1035673222, 8) ,(4, 1048978822, 9),(4, 1067122822, 8) ,(4, 1080428422, 9),(4, 1099177222, 8) ,(4, 1111878022, 9),(4, 1130626822, 8) ,(4, 1143327622, 9),(4, 1162076422, 8) ,(4, 1174777222, 9),(4, 1193526022, 8) ,(4, 1206831622, 9),(4, 1224975622, 8) ,(4, 1238281222, 9),(4, 1256425222, 8) ,(4, 1269730822, 9),(4, 1288479622, 8) ,(4, 1301180422, 9),(4, 1319929222, 8) ,(4, 1332630022, 9),(4, 1351378822, 8) ,(4, 1364684422, 9),(4, 1382828422, 8) ,(4, 1396134022, 9),(4, 1414278022, 8) ,(4, 1427583622, 9),(4, 1445727622, 8) ,(4, 1459033222, 9),(4, 1477782022, 8) ,(4, 1490482822, 9),(4, 1509231622, 8) ,(4, 1521932422, 9),(4, 1540681222, 8) ,(4, 1553986822, 9),(4, 1572130822, 8) ,(4, 1585436422, 9),(4, 1603580422, 8) ,(4, 1616886022, 9),(4, 1635634822, 8) ,(4, 1648335622, 9),(4, 1667084422, 8) ,(4, 1679785222, 9),(4, 1698534022, 8) ,(4, 1711839622, 9),(4, 1729983622, 8) ,(4, 1743289222, 9),(4, 1761433222, 8) ,(4, 1774738822, 9),(4, 1792882822, 8) ,(4, 1806188422, 9),(4, 1824937222, 8) ,(4, 1837638022, 9),(4, 1856386822, 8) ,(4, 1869087622, 9),(4, 1887836422, 8) ,(4, 1901142022, 9),(4, 1919286022, 8) ,(4, 1932591622, 9),(4, 1950735622, 8) ,(4, 1964041222, 9),(4, 1982790022, 8) ,(4, 1995490822, 9),(4, 2014239622, 8) ,(4, 2026940422, 9),(4, 2045689222, 8) ,(4, 2058390022, 9),(4, 2077138822, 8) ,(4, 2090444422, 9),(4, 2108588422, 8) ,(4, 2121894022, 9),(4, 2140038022, 8),(5, -1009875600, 1);
CREATE TABLE time_zone_transition_type (Time_zone_id int unsigned NOT NULL,Transition_type_id int unsigned NOT NULL,Offset int signed DEFAULT 0 NOT NULL,Is_DST tinyint unsigned DEFAULT 0 NOT NULL,Abbreviation char(8) DEFAULT '' NOT NULL,PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types'; CREATE TABLE time_zone_transition_type (Time_zone_id int unsigned NOT NULL,Transition_type_id int unsigned NOT NULL,Offset int signed DEFAULT 0 NOT NULL,Is_DST tinyint unsigned DEFAULT 0 NOT NULL,Abbreviation char(8) DEFAULT '' NOT NULL,PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
......
...@@ -50,12 +50,14 @@ sub mtr_show_failed_diff ($) { ...@@ -50,12 +50,14 @@ sub mtr_show_failed_diff ($) {
$result_file= "$result_file$::opt_result_ext"; $result_file= "$result_file$::opt_result_ext";
} }
my $diffopts= $::opt_udiff ? "-u" : "-c";
if ( -f $reject_file ) if ( -f $reject_file )
{ {
print "Below are the diffs between actual and expected results:\n"; print "Below are the diffs between actual and expected results:\n";
print "-------------------------------------------------------\n"; print "-------------------------------------------------------\n";
# FIXME check result code?! # FIXME check result code?!
mtr_run("diff",["-c",$result_file,$reject_file], "", "", "", ""); mtr_run("diff",[$diffopts,$result_file,$reject_file], "", "", "", "");
print "-------------------------------------------------------\n"; print "-------------------------------------------------------\n";
print "Please follow the instructions outlined at\n"; print "Please follow the instructions outlined at\n";
print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n"; print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
......
...@@ -156,13 +156,13 @@ our @mysqld_src_dirs= ...@@ -156,13 +156,13 @@ our @mysqld_src_dirs=
our $glob_win32= 0; # OS and native Win32 executables our $glob_win32= 0; # OS and native Win32 executables
our $glob_win32_perl= 0; # ActiveState Win32 Perl our $glob_win32_perl= 0; # ActiveState Win32 Perl
our $glob_cygwin_perl= 0; # Cygwin Perl our $glob_cygwin_perl= 0; # Cygwin Perl
our $glob_cygwin_shell= undef;
our $glob_mysql_test_dir= undef; our $glob_mysql_test_dir= undef;
our $glob_mysql_bench_dir= undef; our $glob_mysql_bench_dir= undef;
our $glob_hostname= undef; our $glob_hostname= undef;
our $glob_scriptname= undef; our $glob_scriptname= undef;
our $glob_use_running_server= 0; our $glob_use_running_server= 0;
our $glob_use_running_ndbcluster= 0; our $glob_use_running_ndbcluster= 0;
our $glob_user= 'test';
our $glob_use_embedded_server= 0; our $glob_use_embedded_server= 0;
our $glob_basedir; our $glob_basedir;
...@@ -281,6 +281,8 @@ our $opt_wait_timeout= 10; ...@@ -281,6 +281,8 @@ our $opt_wait_timeout= 10;
our $opt_warnings; our $opt_warnings;
our $opt_udiff;
our $opt_with_ndbcluster; our $opt_with_ndbcluster;
our $opt_with_openssl; our $opt_with_openssl;
...@@ -422,7 +424,9 @@ sub initial_setup () { ...@@ -422,7 +424,9 @@ sub initial_setup () {
{ {
# Windows programs like 'mysqld' needs Windows paths # Windows programs like 'mysqld' needs Windows paths
$glob_mysql_test_dir= `cygpath -m $glob_mysql_test_dir`; $glob_mysql_test_dir= `cygpath -m $glob_mysql_test_dir`;
$glob_cygwin_shell= `cygpath -w $ENV{'SHELL'}`; # The Windows path c:\...
chomp($glob_mysql_test_dir); chomp($glob_mysql_test_dir);
chomp($glob_cygwin_shell);
} }
$glob_basedir= dirname($glob_mysql_test_dir); $glob_basedir= dirname($glob_mysql_test_dir);
$glob_mysql_bench_dir= "$glob_basedir/mysql-bench"; # FIXME make configurable $glob_mysql_bench_dir= "$glob_basedir/mysql-bench"; # FIXME make configurable
...@@ -524,6 +528,7 @@ sub command_line_setup () { ...@@ -524,6 +528,7 @@ sub command_line_setup () {
'start-from=s' => \$opt_start_from, 'start-from=s' => \$opt_start_from,
'timer' => \$opt_timer, 'timer' => \$opt_timer,
'tmpdir=s' => \$opt_tmpdir, 'tmpdir=s' => \$opt_tmpdir,
'unified-diff|udiff' => \$opt_udiff,
'user-test=s' => \$opt_user_test, 'user-test=s' => \$opt_user_test,
'user=s' => \$opt_user, 'user=s' => \$opt_user,
'verbose' => \$opt_verbose, 'verbose' => \$opt_verbose,
...@@ -712,17 +717,16 @@ sub command_line_setup () { ...@@ -712,17 +717,16 @@ sub command_line_setup () {
# } # }
#} #}
if ( $opt_user ) if ( ! $opt_user )
{
$glob_user= $opt_user;
}
elsif ( $glob_use_running_server )
{
$glob_user= "test";
}
else
{ {
$glob_user= "root"; # We want to do FLUSH xxx commands if ( $glob_use_running_server )
{
$opt_user= "test";
}
else
{
$opt_user= "root"; # We want to do FLUSH xxx commands
}
} }
} }
...@@ -837,7 +841,7 @@ sub executable_setup () { ...@@ -837,7 +841,7 @@ sub executable_setup () {
} }
else else
{ {
error("Cannot find embedded server 'mysqltest_embedded'"); mtr_error("Cannot find embedded server 'mysqltest_embedded'");
} }
if ( -d "$path_tests_bindir/mysql_client_test_embedded" ) if ( -d "$path_tests_bindir/mysql_client_test_embedded" )
{ {
...@@ -860,9 +864,6 @@ sub executable_setup () { ...@@ -860,9 +864,6 @@ sub executable_setup () {
$exe_ndb_mgm= "$glob_basedir/bin/ndb_mgm"; $exe_ndb_mgm= "$glob_basedir/bin/ndb_mgm";
} }
# FIXME special $exe_master_mysqld and $exe_slave_mysqld
# are not used that much....
if ( ! $exe_master_mysqld ) if ( ! $exe_master_mysqld )
{ {
$exe_master_mysqld= $exe_mysqld; $exe_master_mysqld= $exe_mysqld;
...@@ -1099,7 +1100,7 @@ sub run_benchmarks ($) { ...@@ -1099,7 +1100,7 @@ sub run_benchmarks ($) {
mtr_init_args(\$args); mtr_init_args(\$args);
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'}); mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
mtr_add_arg($args, "--user=root"); mtr_add_arg($args, "--user=%s", $opt_user);
if ( $opt_small_bench ) if ( $opt_small_bench )
{ {
...@@ -1223,11 +1224,36 @@ sub install_db ($$) { ...@@ -1223,11 +1224,36 @@ sub install_db ($$) {
my $type= shift; my $type= shift;
my $data_dir= shift; my $data_dir= shift;
my $init_db_sql= "lib/init_db.sql"; # FIXME this is too simple maybe my $init_db_sql= "lib/init_db.sql";
my $init_db_sql_tmp= "/tmp/init_db.sql$$";
my $args; my $args;
mtr_report("Installing \u$type Databases"); mtr_report("Installing \u$type Databases");
open(IN, $init_db_sql)
or error("Can't open $init_db_sql: $!");
open(OUT, ">", $init_db_sql_tmp)
or error("Can't write to $init_db_sql_tmp: $!");
while (<IN>)
{
chomp;
s/\@HOSTNAME\@/$glob_hostname/;
if ( /^\s*$/ )
{
print OUT "\n";
}
elsif (/;$/)
{
print OUT "$_\n";
}
else
{
print OUT $_;
}
}
close OUT;
close IN;
mtr_init_args(\$args); mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--no-defaults");
...@@ -1245,12 +1271,14 @@ sub install_db ($$) { ...@@ -1245,12 +1271,14 @@ sub install_db ($$) {
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
} }
if ( mtr_run($exe_mysqld, $args, $init_db_sql, if ( mtr_run($exe_mysqld, $args, $init_db_sql_tmp,
$path_manager_log, $path_manager_log, "") != 0 ) $path_manager_log, $path_manager_log, "") != 0 )
{ {
unlink($init_db_sql_tmp);
mtr_error("Error executing mysqld --bootstrap\n" . mtr_error("Error executing mysqld --bootstrap\n" .
"Could not install $type test DBs"); "Could not install $type test DBs");
} }
unlink($init_db_sql_tmp);
} }
...@@ -1499,8 +1527,8 @@ sub do_before_start_master ($$) { ...@@ -1499,8 +1527,8 @@ sub do_before_start_master ($$) {
$tname ne "rpl_crash_binlog_ib_3b") $tname ne "rpl_crash_binlog_ib_3b")
{ {
# FIXME we really want separate dir for binlogs # FIXME we really want separate dir for binlogs
`rm -fr $glob_mysql_test_dir/var/log/master-bin.*`; `rm -f $glob_mysql_test_dir/var/log/master-bin*`;
# unlink("$glob_mysql_test_dir/var/log/master-bin.*"); # unlink("$glob_mysql_test_dir/var/log/master-bin*");
} }
# Remove old master.info and relay-log.info files # Remove old master.info and relay-log.info files
...@@ -1509,8 +1537,7 @@ sub do_before_start_master ($$) { ...@@ -1509,8 +1537,7 @@ sub do_before_start_master ($$) {
unlink("$glob_mysql_test_dir/var/master1-data/master.info"); unlink("$glob_mysql_test_dir/var/master1-data/master.info");
unlink("$glob_mysql_test_dir/var/master1-data/relay-log.info"); unlink("$glob_mysql_test_dir/var/master1-data/relay-log.info");
#run master initialization shell script if one exists # Run master initialization shell script if one exists
if ( $master_init_script and if ( $master_init_script and
mtr_run($master_init_script, [], "", "", "", "") != 0 ) mtr_run($master_init_script, [], "", "", "", "") != 0 )
{ {
...@@ -1524,9 +1551,6 @@ sub do_before_start_slave ($$) { ...@@ -1524,9 +1551,6 @@ sub do_before_start_slave ($$) {
my $tname= shift; my $tname= shift;
my $slave_init_script= shift; my $slave_init_script= shift;
# When testing fail-safe replication, we will have more than one slave
# in this case, we start secondary slaves with an argument
# Remove stale binary logs and old master.info files # Remove stale binary logs and old master.info files
# except for too tests which need them # except for too tests which need them
if ( $tname ne "rpl_crash_binlog_ib_1b" and if ( $tname ne "rpl_crash_binlog_ib_1b" and
...@@ -1541,14 +1565,15 @@ sub do_before_start_slave ($$) { ...@@ -1541,14 +1565,15 @@ sub do_before_start_slave ($$) {
unlink("$glob_mysql_test_dir/var/slave-data/relay-log.info"); unlink("$glob_mysql_test_dir/var/slave-data/relay-log.info");
} }
#run slave initialization shell script if one exists # Run slave initialization shell script if one exists
if ( $slave_init_script and if ( $slave_init_script and
mtr_run($slave_init_script, [], "", "", "", "") != 0 ) mtr_run($slave_init_script, [], "", "", "", "") != 0 )
{ {
mtr_error("Can't run $slave_init_script"); mtr_error("Can't run $slave_init_script");
} }
unlink("$glob_mysql_test_dir/var/slave-data/log.*"); `rm -f $glob_mysql_test_dir/var/slave-data/log.*`;
# unlink("$glob_mysql_test_dir/var/slave-data/log.*");
} }
sub mysqld_arguments ($$$$$) { sub mysqld_arguments ($$$$$) {
...@@ -1666,12 +1691,12 @@ sub mysqld_arguments ($$$$$) { ...@@ -1666,12 +1691,12 @@ sub mysqld_arguments ($$$$$) {
{ {
if ( $type eq 'master' ) if ( $type eq 'master' )
{ {
mtr_add_arg($args, "--debug=d:t:i:A,%s/var/log/master%s.trace", mtr_add_arg($args, "%s--debug=d:t:i:A,%s/var/log/master%s.trace",
$prefix, $glob_mysql_test_dir, $sidx); $prefix, $glob_mysql_test_dir, $sidx);
} }
if ( $type eq 'slave' ) if ( $type eq 'slave' )
{ {
mtr_add_arg($args, "--debug=d:t:i:A,%s/var/log/slave%s.trace", mtr_add_arg($args, "%s--debug=d:t:i:A,%s/var/log/slave%s.trace",
$prefix, $glob_mysql_test_dir, $sidx); $prefix, $glob_mysql_test_dir, $sidx);
} }
} }
...@@ -1786,18 +1811,17 @@ sub mysqld_start ($$$$) { ...@@ -1786,18 +1811,17 @@ sub mysqld_start ($$$$) {
my $exe; my $exe;
my $pid; my $pid;
# FIXME code duplication, make up your mind.... if ( $type eq 'master' )
if ( $opt_source_dist )
{ {
$exe= "$glob_basedir/sql/mysqld"; $exe= $exe_master_mysqld;
}
elsif ( $type eq 'slave' )
{
$exe= $exe_slave_mysqld;
} }
else else
{ {
$exe ="$glob_basedir/libexec/mysqld"; $exe= $exe_mysqld;
if ( ! -x $exe )
{
$exe ="$glob_basedir/bin/mysqld";
}
} }
mtr_init_args(\$args); mtr_init_args(\$args);
...@@ -1980,7 +2004,7 @@ sub run_mysqltest ($$) { ...@@ -1980,7 +2004,7 @@ sub run_mysqltest ($$) {
mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'}); mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
mtr_add_arg($args, "--database=test"); mtr_add_arg($args, "--database=test");
mtr_add_arg($args, "--user=%s", $glob_user); mtr_add_arg($args, "--user=%s", $opt_user);
mtr_add_arg($args, "--password="); mtr_add_arg($args, "--password=");
mtr_add_arg($args, "--silent"); mtr_add_arg($args, "--silent");
mtr_add_arg($args, "-v"); mtr_add_arg($args, "-v");
...@@ -2051,7 +2075,7 @@ sub run_mysqltest ($$) { ...@@ -2051,7 +2075,7 @@ sub run_mysqltest ($$) {
mysqld_arguments($args,'master',0,$tinfo->{'master_opt'},[]); mysqld_arguments($args,'master',0,$tinfo->{'master_opt'},[]);
} }
return mtr_run($exe_mysqltest,$args,$tinfo->{'path'},"",$path_timefile,""); return mtr_run_test($exe_mysqltest,$args,$tinfo->{'path'},"",$path_timefile,"");
} }
############################################################################## ##############################################################################
...@@ -2133,6 +2157,7 @@ Misc options ...@@ -2133,6 +2157,7 @@ Misc options
start-and-exit Only initiate and start the "mysqld" servers start-and-exit Only initiate and start the "mysqld" servers
fast Don't try to cleanup from earlier runs fast Don't try to cleanup from earlier runs
help Get this help text help Get this help text
unified-diff | udiff When presenting differences, use unified diff
Options not yet described, or that I want to look into more Options not yet described, or that I want to look into more
......
...@@ -6,5 +6,5 @@ drop table t1; ...@@ -6,5 +6,5 @@ drop table t1;
flush tables; flush tables;
CREATE TABLE t1 (a int) ENGINE=INNODB; CREATE TABLE t1 (a int) ENGINE=INNODB;
SELECT * from T1; SELECT * from T1;
ERROR HY000: Can't open file: 'T1.ibd' (errno: 1) ERROR 42S02: Table 'test.T1' doesn't exist
drop table t1; drop table t1;
...@@ -32,6 +32,6 @@ flush tables; ...@@ -32,6 +32,6 @@ flush tables;
# #
CREATE TABLE t1 (a int) ENGINE=INNODB; CREATE TABLE t1 (a int) ENGINE=INNODB;
--error 1016 --error 1146
SELECT * from T1; SELECT * from T1;
drop table t1; drop table t1;
...@@ -1497,7 +1497,7 @@ NDB_SOCKET_TYPE TransporterRegistry::connect_ndb_mgmd(SocketClient *sc) ...@@ -1497,7 +1497,7 @@ NDB_SOCKET_TYPE TransporterRegistry::connect_ndb_mgmd(SocketClient *sc)
{ {
char c[100]; char c[100];
char *cs= &c[0]; char *cs= &c[0];
int len= strlen(sc->get_server_name())+20; unsigned len= strlen(sc->get_server_name())+20;
if( len > sizeof(c) ) if( len > sizeof(c) )
{ {
/* /*
......
...@@ -154,6 +154,7 @@ Configuration::Configuration() ...@@ -154,6 +154,7 @@ Configuration::Configuration()
_daemonMode = false; _daemonMode = false;
m_config_retriever= 0; m_config_retriever= 0;
m_clusterConfig= 0; m_clusterConfig= 0;
m_clusterConfigIter= 0;
} }
Configuration::~Configuration(){ Configuration::~Configuration(){
...@@ -363,6 +364,8 @@ Configuration::setupConfiguration(){ ...@@ -363,6 +364,8 @@ Configuration::setupConfiguration(){
ConfigValues* cf = ConfigValuesFactory::extractCurrentSection(iter.m_config); ConfigValues* cf = ConfigValuesFactory::extractCurrentSection(iter.m_config);
if(m_clusterConfigIter)
ndb_mgm_destroy_iterator(m_clusterConfigIter);
m_clusterConfigIter = ndb_mgm_create_configuration_iterator m_clusterConfigIter = ndb_mgm_create_configuration_iterator
(p, CFG_SECTION_NODE); (p, CFG_SECTION_NODE);
......
...@@ -151,7 +151,7 @@ ndb_mgm_create_handle() ...@@ -151,7 +151,7 @@ ndb_mgm_create_handle()
h->socket = NDB_INVALID_SOCKET; h->socket = NDB_INVALID_SOCKET;
h->read_timeout = 50000; h->read_timeout = 50000;
h->write_timeout = 100; h->write_timeout = 100;
h->cfg_i = 0; h->cfg_i = -1;
strncpy(h->last_error_desc, "No error", NDB_MGM_MAX_ERR_DESC_SIZE); strncpy(h->last_error_desc, "No error", NDB_MGM_MAX_ERR_DESC_SIZE);
...@@ -178,7 +178,7 @@ ndb_mgm_set_connectstring(NdbMgmHandle handle, const char * mgmsrv) ...@@ -178,7 +178,7 @@ ndb_mgm_set_connectstring(NdbMgmHandle handle, const char * mgmsrv)
SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, ""); SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, "");
return -1; return -1;
} }
handle->cfg_i= 0; handle->cfg_i= -1;
return 0; return 0;
} }
...@@ -191,6 +191,10 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle) ...@@ -191,6 +191,10 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle)
{ {
if(!handle) if(!handle)
return; return;
/**
* important! only disconnect if connected
* other code relies on this
*/
if((* handle)->connected){ if((* handle)->connected){
ndb_mgm_disconnect(* handle); ndb_mgm_disconnect(* handle);
} }
...@@ -1748,13 +1752,19 @@ ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle) ...@@ -1748,13 +1752,19 @@ ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle)
extern "C" extern "C"
int ndb_mgm_get_connected_port(NdbMgmHandle handle) int ndb_mgm_get_connected_port(NdbMgmHandle handle)
{ {
return handle->cfg.ids[handle->cfg_i].port; if (handle->cfg_i >= 0)
return handle->cfg.ids[handle->cfg_i].port;
else
return 0;
} }
extern "C" extern "C"
const char *ndb_mgm_get_connected_host(NdbMgmHandle handle) const char *ndb_mgm_get_connected_host(NdbMgmHandle handle)
{ {
return handle->cfg.ids[handle->cfg_i].name.c_str(); if (handle->cfg_i >= 0)
return handle->cfg.ids[handle->cfg_i].name.c_str();
else
return 0;
} }
extern "C" extern "C"
......
...@@ -189,16 +189,16 @@ MgmtSrvr::logLevelThreadRun() ...@@ -189,16 +189,16 @@ MgmtSrvr::logLevelThreadRun()
void void
MgmtSrvr::startEventLog() MgmtSrvr::startEventLog()
{ {
NdbMutex_Lock(m_configMutex);
g_eventLogger.setCategory("MgmSrvr"); g_eventLogger.setCategory("MgmSrvr");
ndb_mgm_configuration_iterator * iter = ndb_mgm_create_configuration_iterator ndb_mgm_configuration_iterator
((ndb_mgm_configuration*)_config->m_configValues, CFG_SECTION_NODE); iter(* _config->m_configValues, CFG_SECTION_NODE);
if(iter == 0)
return ; if(iter.find(CFG_NODE_ID, _ownNodeId) != 0){
NdbMutex_Unlock(m_configMutex);
if(ndb_mgm_find(iter, CFG_NODE_ID, _ownNodeId) != 0){ return;
ndb_mgm_destroy_iterator(iter);
return ;
} }
const char * tmp; const char * tmp;
...@@ -206,10 +206,10 @@ MgmtSrvr::startEventLog() ...@@ -206,10 +206,10 @@ MgmtSrvr::startEventLog()
char *clusterLog= NdbConfig_ClusterLogFileName(_ownNodeId); char *clusterLog= NdbConfig_ClusterLogFileName(_ownNodeId);
NdbAutoPtr<char> tmp_aptr(clusterLog); NdbAutoPtr<char> tmp_aptr(clusterLog);
if(ndb_mgm_get_string_parameter(iter, CFG_LOG_DESTINATION, &tmp) == 0){ if(iter.get(CFG_LOG_DESTINATION, &tmp) == 0){
logdest.assign(tmp); logdest.assign(tmp);
} }
ndb_mgm_destroy_iterator(iter); NdbMutex_Unlock(m_configMutex);
if(logdest.length() == 0 || logdest == "") { if(logdest.length() == 0 || logdest == "") {
logdest.assfmt("FILE:filename=%s,maxsize=1000000,maxfiles=6", logdest.assfmt("FILE:filename=%s,maxsize=1000000,maxfiles=6",
...@@ -343,42 +343,41 @@ MgmtSrvr::getNodeCount(enum ndb_mgm_node_type type) const ...@@ -343,42 +343,41 @@ MgmtSrvr::getNodeCount(enum ndb_mgm_node_type type) const
} }
int int
MgmtSrvr::getPort() const { MgmtSrvr::getPort() const
const Properties *mgmProps; {
if(NdbMutex_Lock(m_configMutex))
ndb_mgm_configuration_iterator * iter =
ndb_mgm_create_configuration_iterator(_config->m_configValues,
CFG_SECTION_NODE);
if(iter == 0)
return 0; return 0;
if(ndb_mgm_find(iter, CFG_NODE_ID, getOwnNodeId()) != 0){ ndb_mgm_configuration_iterator
iter(* _config->m_configValues, CFG_SECTION_NODE);
if(iter.find(CFG_NODE_ID, getOwnNodeId()) != 0){
ndbout << "Could not retrieve configuration for Node " ndbout << "Could not retrieve configuration for Node "
<< getOwnNodeId() << " in config file." << endl << getOwnNodeId() << " in config file." << endl
<< "Have you set correct NodeId for this node?" << endl; << "Have you set correct NodeId for this node?" << endl;
ndb_mgm_destroy_iterator(iter); NdbMutex_Unlock(m_configMutex);
return 0; return 0;
} }
unsigned type; unsigned type;
if(ndb_mgm_get_int_parameter(iter, CFG_TYPE_OF_SECTION, &type) != 0 || if(iter.get(CFG_TYPE_OF_SECTION, &type) != 0 ||
type != NODE_TYPE_MGM){ type != NODE_TYPE_MGM){
ndbout << "Local node id " << getOwnNodeId() ndbout << "Local node id " << getOwnNodeId()
<< " is not defined as management server" << endl << " is not defined as management server" << endl
<< "Have you set correct NodeId for this node?" << endl; << "Have you set correct NodeId for this node?" << endl;
ndb_mgm_destroy_iterator(iter); NdbMutex_Unlock(m_configMutex);
return 0; return 0;
} }
Uint32 port = 0; Uint32 port = 0;
if(ndb_mgm_get_int_parameter(iter, CFG_MGM_PORT, &port) != 0){ if(iter.get(CFG_MGM_PORT, &port) != 0){
ndbout << "Could not find PortNumber in the configuration file." << endl; ndbout << "Could not find PortNumber in the configuration file." << endl;
ndb_mgm_destroy_iterator(iter); NdbMutex_Unlock(m_configMutex);
return 0; return 0;
} }
ndb_mgm_destroy_iterator(iter); NdbMutex_Unlock(m_configMutex);
return port; return port;
} }
...@@ -472,14 +471,14 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server, ...@@ -472,14 +471,14 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
{ {
ndb_mgm_configuration_iterator ndb_mgm_configuration_iterator
*iter = ndb_mgm_create_configuration_iterator(_config->m_configValues, iter(* _config->m_configValues, CFG_SECTION_NODE);
CFG_SECTION_NODE);
for(ndb_mgm_first(iter); ndb_mgm_valid(iter); ndb_mgm_next(iter)){ for(iter.first(); iter.valid(); iter.next()){
unsigned type, id; unsigned type, id;
if(ndb_mgm_get_int_parameter(iter, CFG_TYPE_OF_SECTION, &type) != 0) if(iter.get(CFG_TYPE_OF_SECTION, &type) != 0)
continue; continue;
if(ndb_mgm_get_int_parameter(iter, CFG_NODE_ID, &id) != 0) if(iter.get(CFG_NODE_ID, &id) != 0)
continue; continue;
MGM_REQUIRE(id < MAX_NODES); MGM_REQUIRE(id < MAX_NODES);
...@@ -502,7 +501,6 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server, ...@@ -502,7 +501,6 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
break; break;
} }
} }
ndb_mgm_destroy_iterator(iter);
} }
_props = NULL; _props = NULL;
...@@ -1884,8 +1882,6 @@ void ...@@ -1884,8 +1882,6 @@ void
MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal) MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal)
{ {
// The way of handling a received signal is taken from the Ndb class. // The way of handling a received signal is taken from the Ndb class.
int returnCode;
int gsn = signal->readSignalNumber(); int gsn = signal->readSignalNumber();
switch (gsn) { switch (gsn) {
...@@ -2187,8 +2183,13 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId, ...@@ -2187,8 +2183,13 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
int r_config_addr= -1; int r_config_addr= -1;
unsigned type_c= 0; unsigned type_c= 0;
if(NdbMutex_Lock(m_configMutex))
{
error_string.appfmt("unable to lock configuration mutex");
return false;
}
ndb_mgm_configuration_iterator ndb_mgm_configuration_iterator
iter(*(ndb_mgm_configuration *)_config->m_configValues, CFG_SECTION_NODE); iter(* _config->m_configValues, CFG_SECTION_NODE);
for(iter.first(); iter.valid(); iter.next()) { for(iter.first(); iter.valid(); iter.next()) {
unsigned tmp= 0; unsigned tmp= 0;
if(iter.get(CFG_NODE_ID, &tmp)) abort(); if(iter.get(CFG_NODE_ID, &tmp)) abort();
...@@ -2258,6 +2259,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId, ...@@ -2258,6 +2259,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
"Suggest specifying node id in connectstring,\n" "Suggest specifying node id in connectstring,\n"
"or specifying unique host names in config file.", "or specifying unique host names in config file.",
id_found, tmp); id_found, tmp);
NdbMutex_Unlock(m_configMutex);
DBUG_RETURN(false); DBUG_RETURN(false);
} }
if (config_hostname == 0) { if (config_hostname == 0) {
...@@ -2270,6 +2272,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId, ...@@ -2270,6 +2272,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
} }
id_found= tmp; // mgmt server matched, check for more matches id_found= tmp; // mgmt server matched, check for more matches
} }
NdbMutex_Unlock(m_configMutex);
if (id_found) if (id_found)
{ {
...@@ -2682,13 +2685,18 @@ MgmtSrvr::Allocated_resources::get_nodeid() const ...@@ -2682,13 +2685,18 @@ MgmtSrvr::Allocated_resources::get_nodeid() const
int int
MgmtSrvr::setDbParameter(int node, int param, const char * value, MgmtSrvr::setDbParameter(int node, int param, const char * value,
BaseString& msg){ BaseString& msg){
if(NdbMutex_Lock(m_configMutex))
return -1;
/** /**
* Check parameter * Check parameter
*/ */
ndb_mgm_configuration_iterator iter(* _config->m_configValues, ndb_mgm_configuration_iterator
CFG_SECTION_NODE); iter(* _config->m_configValues, CFG_SECTION_NODE);
if(iter.first() != 0){ if(iter.first() != 0){
msg.assign("Unable to find node section (iter.first())"); msg.assign("Unable to find node section (iter.first())");
NdbMutex_Unlock(m_configMutex);
return -1; return -1;
} }
...@@ -2696,16 +2704,19 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value, ...@@ -2696,16 +2704,19 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value,
if(node != 0){ if(node != 0){
if(iter.find(CFG_NODE_ID, node) != 0){ if(iter.find(CFG_NODE_ID, node) != 0){
msg.assign("Unable to find node (iter.find())"); msg.assign("Unable to find node (iter.find())");
NdbMutex_Unlock(m_configMutex);
return -1; return -1;
} }
if(iter.get(CFG_TYPE_OF_SECTION, &type) != 0){ if(iter.get(CFG_TYPE_OF_SECTION, &type) != 0){
msg.assign("Unable to get node type(iter.get(CFG_TYPE_OF_SECTION))"); msg.assign("Unable to get node type(iter.get(CFG_TYPE_OF_SECTION))");
NdbMutex_Unlock(m_configMutex);
return -1; return -1;
} }
} else { } else {
do { do {
if(iter.get(CFG_TYPE_OF_SECTION, &type) != 0){ if(iter.get(CFG_TYPE_OF_SECTION, &type) != 0){
msg.assign("Unable to get node type(iter.get(CFG_TYPE_OF_SECTION))"); msg.assign("Unable to get node type(iter.get(CFG_TYPE_OF_SECTION))");
NdbMutex_Unlock(m_configMutex);
return -1; return -1;
} }
if(type == NODE_TYPE_DB) if(type == NODE_TYPE_DB)
...@@ -2716,6 +2727,7 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value, ...@@ -2716,6 +2727,7 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value,
if(type != NODE_TYPE_DB){ if(type != NODE_TYPE_DB){
msg.assfmt("Invalid node type or no such node (%d %d)", msg.assfmt("Invalid node type or no such node (%d %d)",
type, NODE_TYPE_DB); type, NODE_TYPE_DB);
NdbMutex_Unlock(m_configMutex);
return -1; return -1;
} }
...@@ -2741,6 +2753,7 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value, ...@@ -2741,6 +2753,7 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value,
break; break;
} }
msg.assign("Could not get parameter"); msg.assign("Could not get parameter");
NdbMutex_Unlock(m_configMutex);
return -1; return -1;
} while(0); } while(0);
...@@ -2778,6 +2791,7 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value, ...@@ -2778,6 +2791,7 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value,
} while(node == 0 && iter.next() == 0); } while(node == 0 && iter.next() == 0);
msg.assign("Success"); msg.assign("Success");
NdbMutex_Unlock(m_configMutex);
return 0; return 0;
} }
...@@ -2791,12 +2805,18 @@ MgmtSrvr::setConnectionDbParameter(int node1, ...@@ -2791,12 +2805,18 @@ MgmtSrvr::setConnectionDbParameter(int node1,
DBUG_ENTER("MgmtSrvr::setConnectionDbParameter"); DBUG_ENTER("MgmtSrvr::setConnectionDbParameter");
ndb_mgm_configuration_iterator iter(* _config->m_configValues, if(NdbMutex_Lock(m_configMutex))
CFG_SECTION_CONNECTION); {
DBUG_RETURN(-1);
}
ndb_mgm_configuration_iterator
iter(* _config->m_configValues, CFG_SECTION_CONNECTION);
if(iter.first() != 0){ if(iter.first() != 0){
msg.assign("Unable to find connection section (iter.first())"); msg.assign("Unable to find connection section (iter.first())");
return -1; NdbMutex_Unlock(m_configMutex);
DBUG_RETURN(-1);
} }
for(;iter.valid();iter.next()) { for(;iter.valid();iter.next()) {
...@@ -2809,11 +2829,13 @@ MgmtSrvr::setConnectionDbParameter(int node1, ...@@ -2809,11 +2829,13 @@ MgmtSrvr::setConnectionDbParameter(int node1,
} }
if(!iter.valid()) { if(!iter.valid()) {
msg.assign("Unable to find connection between nodes"); msg.assign("Unable to find connection between nodes");
NdbMutex_Unlock(m_configMutex);
DBUG_RETURN(-2); DBUG_RETURN(-2);
} }
if(iter.get(param, &current_value) < 0) { if(iter.get(param, &current_value) != 0) {
msg.assign("Unable to get current value of parameter"); msg.assign("Unable to get current value of parameter");
NdbMutex_Unlock(m_configMutex);
DBUG_RETURN(-3); DBUG_RETURN(-3);
} }
...@@ -2822,15 +2844,18 @@ MgmtSrvr::setConnectionDbParameter(int node1, ...@@ -2822,15 +2844,18 @@ MgmtSrvr::setConnectionDbParameter(int node1,
if(i2.set(param, (unsigned)value) == false) { if(i2.set(param, (unsigned)value) == false) {
msg.assign("Unable to set new value of parameter"); msg.assign("Unable to set new value of parameter");
NdbMutex_Unlock(m_configMutex);
DBUG_RETURN(-4); DBUG_RETURN(-4);
} }
if(iter.get(param, &new_value) < 0) { if(iter.get(param, &new_value) != 0) {
msg.assign("Unable to get parameter after setting it."); msg.assign("Unable to get parameter after setting it.");
NdbMutex_Unlock(m_configMutex);
DBUG_RETURN(-5); DBUG_RETURN(-5);
} }
msg.assfmt("%u -> %u",current_value,new_value); msg.assfmt("%u -> %u",current_value,new_value);
NdbMutex_Unlock(m_configMutex);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -2843,16 +2868,22 @@ MgmtSrvr::getConnectionDbParameter(int node1, ...@@ -2843,16 +2868,22 @@ MgmtSrvr::getConnectionDbParameter(int node1,
BaseString& msg){ BaseString& msg){
DBUG_ENTER("MgmtSrvr::getConnectionDbParameter"); DBUG_ENTER("MgmtSrvr::getConnectionDbParameter");
ndb_mgm_configuration_iterator iter(* _config->m_configValues, if(NdbMutex_Lock(m_configMutex))
CFG_SECTION_CONNECTION); {
DBUG_RETURN(-1);
}
ndb_mgm_configuration_iterator
iter(* _config->m_configValues, CFG_SECTION_CONNECTION);
if(iter.first() != 0){ if(iter.first() != 0){
msg.assign("Unable to find connection section (iter.first())"); msg.assign("Unable to find connection section (iter.first())");
return -1; NdbMutex_Unlock(m_configMutex);
DBUG_RETURN(-1);
} }
for(;iter.valid();iter.next()) { for(;iter.valid();iter.next()) {
Uint32 n1,n2; Uint32 n1=0,n2=0;
iter.get(CFG_CONNECTION_NODE_1, &n1); iter.get(CFG_CONNECTION_NODE_1, &n1);
iter.get(CFG_CONNECTION_NODE_2, &n2); iter.get(CFG_CONNECTION_NODE_2, &n2);
if((n1 == (unsigned)node1 && n2 == (unsigned)node2) if((n1 == (unsigned)node1 && n2 == (unsigned)node2)
...@@ -2861,21 +2892,35 @@ MgmtSrvr::getConnectionDbParameter(int node1, ...@@ -2861,21 +2892,35 @@ MgmtSrvr::getConnectionDbParameter(int node1,
} }
if(!iter.valid()) { if(!iter.valid()) {
msg.assign("Unable to find connection between nodes"); msg.assign("Unable to find connection between nodes");
return -1; NdbMutex_Unlock(m_configMutex);
DBUG_RETURN(-1);
} }
if(iter.get(param, (Uint32*)value) < 0) { if(iter.get(param, (Uint32*)value) != 0) {
msg.assign("Unable to get current value of parameter"); msg.assign("Unable to get current value of parameter");
return -1; NdbMutex_Unlock(m_configMutex);
DBUG_RETURN(-1);
} }
msg.assfmt("%d",*value); msg.assfmt("%d",*value);
NdbMutex_Unlock(m_configMutex);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
void MgmtSrvr::transporter_connect(NDB_SOCKET_TYPE sockfd) void MgmtSrvr::transporter_connect(NDB_SOCKET_TYPE sockfd)
{ {
theFacade->get_registry()->connect_server(sockfd); if (theFacade->get_registry()->connect_server(sockfd))
{
/**
* Force an update_connections() so that the
* ClusterMgr and TransporterFacade is up to date
* with the new connection.
* Important for correct node id reservation handling
*/
NdbMutex_Lock(theFacade->theMutexPtr);
theFacade->get_registry()->update_connections();
NdbMutex_Unlock(theFacade->theMutexPtr);
}
} }
int MgmtSrvr::set_connect_string(const char *str) int MgmtSrvr::set_connect_string(const char *str)
......
...@@ -318,7 +318,7 @@ MgmApiSession::runSession() { ...@@ -318,7 +318,7 @@ MgmApiSession::runSession() {
break; break;
} }
} }
if(m_socket >= 0) if(m_socket != NDB_INVALID_SOCKET)
NDB_CLOSE_SOCKET(m_socket); NDB_CLOSE_SOCKET(m_socket);
} }
...@@ -1547,7 +1547,7 @@ MgmApiSession::transporter_connect(Parser_t::Context &ctx, ...@@ -1547,7 +1547,7 @@ MgmApiSession::transporter_connect(Parser_t::Context &ctx,
m_stop= true; m_stop= true;
m_stopped= true; // force a stop (no closing socket) m_stopped= true; // force a stop (no closing socket)
m_socket= -1; // so nobody closes it m_socket= NDB_INVALID_SOCKET; // so nobody closes it
m_mgmsrv.transporter_connect(s); m_mgmsrv.transporter_connect(s);
} }
......
...@@ -410,7 +410,13 @@ ClusterMgr::reportConnected(NodeId nodeId){ ...@@ -410,7 +410,13 @@ ClusterMgr::reportConnected(NodeId nodeId){
theNode.connected = true; theNode.connected = true;
theNode.hbSent = 0; theNode.hbSent = 0;
theNode.hbCounter = 0; theNode.hbCounter = 0;
/**
* make sure the node itself is marked connected even
* if first API_REGCONF has not arrived
*/
theNode.m_state.m_connected_nodes.set(nodeId);
if (theNode.m_info.m_type != NodeInfo::REP) { if (theNode.m_info.m_type != NodeInfo::REP) {
theNode.hbFrequency = 0; theNode.hbFrequency = 0;
} }
......
...@@ -535,22 +535,31 @@ innobase_mysql_print_thd( ...@@ -535,22 +535,31 @@ innobase_mysql_print_thd(
} }
/********************************************************************** /**********************************************************************
Determines whether the given character set is of variable length. Get the variable length bounds of the given character set.
NOTE that the exact prototype of this function has to be in NOTE that the exact prototype of this function has to be in
/innobase/data/data0type.ic! */ /innobase/data/data0type.ic! */
extern "C" extern "C"
ibool void
innobase_is_mb_cset( innobase_get_cset_width(
/*================*/ /*====================*/
ulint cset) /* in: MySQL charset-collation code */ ulint cset, /* in: MySQL charset-collation code */
ulint* mbminlen, /* out: minimum length of a char (in bytes) */
ulint* mbmaxlen) /* out: maximum length of a char (in bytes) */
{ {
CHARSET_INFO* cs; CHARSET_INFO* cs;
ut_ad(cset < 256); ut_ad(cset < 256);
ut_ad(mbminlen);
ut_ad(mbmaxlen);
cs = all_charsets[cset]; cs = all_charsets[cset];
if (cs) {
return(cs && cs->mbminlen != cs->mbmaxlen); *mbminlen = cs->mbminlen;
*mbmaxlen = cs->mbmaxlen;
} else {
ut_a(cset == 0);
*mbminlen = *mbmaxlen = 0;
}
} }
/********************************************************************** /**********************************************************************
...@@ -1079,6 +1088,8 @@ innobase_init(void) ...@@ -1079,6 +1088,8 @@ innobase_init(void)
if (ret == FALSE) { if (ret == FALSE) {
sql_print_error( sql_print_error(
"InnoDB: syntax error in innodb_data_file_path"); "InnoDB: syntax error in innodb_data_file_path");
my_free(internal_innobase_data_file_path,
MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -1109,6 +1120,8 @@ innobase_init(void) ...@@ -1109,6 +1120,8 @@ innobase_init(void)
"InnoDB: syntax error in innodb_log_group_home_dir\n" "InnoDB: syntax error in innodb_log_group_home_dir\n"
"InnoDB: or a wrong number of mirrored log groups\n"); "InnoDB: or a wrong number of mirrored log groups\n");
my_free(internal_innobase_data_file_path,
MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -1155,11 +1168,11 @@ innobase_init(void) ...@@ -1155,11 +1168,11 @@ innobase_init(void)
srv_fast_shutdown = (ibool) innobase_fast_shutdown; srv_fast_shutdown = (ibool) innobase_fast_shutdown;
srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite; srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
srv_use_checksums = (ibool) innobase_use_checksums; srv_use_checksums = (ibool) innobase_use_checksums;
os_use_large_pages = (ibool) innobase_use_large_pages; os_use_large_pages = (ibool) innobase_use_large_pages;
os_large_page_size = (ulint) innobase_large_page_size; os_large_page_size = (ulint) innobase_large_page_size;
srv_file_per_table = (ibool) innobase_file_per_table; srv_file_per_table = (ibool) innobase_file_per_table;
srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog; srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
...@@ -1197,7 +1210,8 @@ innobase_init(void) ...@@ -1197,7 +1210,8 @@ innobase_init(void)
err = innobase_start_or_create_for_mysql(); err = innobase_start_or_create_for_mysql();
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
my_free(internal_innobase_data_file_path,
MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -1241,23 +1255,23 @@ innobase_end(void) ...@@ -1241,23 +1255,23 @@ innobase_end(void)
set_panic_flag_for_netware(); set_panic_flag_for_netware();
} }
#endif #endif
if (innodb_inited) if (innodb_inited) {
{ if (innobase_very_fast_shutdown) {
if (innobase_very_fast_shutdown) { srv_very_fast_shutdown = TRUE;
srv_very_fast_shutdown = TRUE; fprintf(stderr,
fprintf(stderr,
"InnoDB: MySQL has requested a very fast shutdown without flushing\n" "InnoDB: MySQL has requested a very fast shutdown without flushing\n"
"InnoDB: the InnoDB buffer pool to data files. At the next mysqld startup\n" "InnoDB: the InnoDB buffer pool to data files. At the next mysqld startup\n"
"InnoDB: InnoDB will do a crash recovery!\n"); "InnoDB: InnoDB will do a crash recovery!\n");
}
} innodb_inited = 0;
if (innobase_shutdown_for_mysql() != DB_SUCCESS) {
innodb_inited= 0; err = 1;
if (innobase_shutdown_for_mysql() != DB_SUCCESS) }
err= 1; hash_free(&innobase_open_tables);
hash_free(&innobase_open_tables); my_free(internal_innobase_data_file_path,
my_free(internal_innobase_data_file_path,MYF(MY_ALLOW_ZERO_PTR)); MYF(MY_ALLOW_ZERO_PTR));
pthread_mutex_destroy(&innobase_mutex); pthread_mutex_destroy(&innobase_mutex);
} }
DBUG_RETURN(err); DBUG_RETURN(err);
...@@ -1861,7 +1875,7 @@ ha_innobase::open( ...@@ -1861,7 +1875,7 @@ ha_innobase::open(
my_free((char*) upd_buff, MYF(0)); my_free((char*) upd_buff, MYF(0));
my_errno = ENOENT; my_errno = ENOENT;
DBUG_RETURN(1); DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
} }
if (ib_table->ibd_file_missing && !thd->tablespace_op) { if (ib_table->ibd_file_missing && !thd->tablespace_op) {
...@@ -1878,7 +1892,7 @@ ha_innobase::open( ...@@ -1878,7 +1892,7 @@ ha_innobase::open(
my_free((char*) upd_buff, MYF(0)); my_free((char*) upd_buff, MYF(0));
my_errno = ENOENT; my_errno = ENOENT;
DBUG_RETURN(1); DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
} }
innobase_prebuilt = row_create_prebuilt(ib_table); innobase_prebuilt = row_create_prebuilt(ib_table);
...@@ -2475,6 +2489,8 @@ build_template( ...@@ -2475,6 +2489,8 @@ build_template(
templ->type = get_innobase_type_from_mysql_type(field); templ->type = get_innobase_type_from_mysql_type(field);
templ->charset = dtype_get_charset_coll_noninline( templ->charset = dtype_get_charset_coll_noninline(
index->table->cols[i].type.prtype); index->table->cols[i].type.prtype);
templ->mbminlen = index->table->cols[i].type.mbminlen;
templ->mbmaxlen = index->table->cols[i].type.mbmaxlen;
templ->is_unsigned = (ulint) (field->flags & UNSIGNED_FLAG); templ->is_unsigned = (ulint) (field->flags & UNSIGNED_FLAG);
if (templ->type == DATA_BLOB) { if (templ->type == DATA_BLOB) {
......
...@@ -1189,7 +1189,7 @@ int bin2decimal(char *from, decimal *to, int precision, int scale) ...@@ -1189,7 +1189,7 @@ int bin2decimal(char *from, decimal *to, int precision, int scale)
intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1, intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1,
intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1, intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1,
intg1=intg0+(intg0x>0), frac1=frac0+(frac0x>0); intg1=intg0+(intg0x>0), frac1=frac0+(frac0x>0);
dec1 *buf=to->buf, mask=(*from <0) ? 0 : -1; dec1 *buf=to->buf, mask=(*from & 0x80) ? 0 : -1;
char *stop; char *stop;
char *d_copy; char *d_copy;
int bin_size= decimal_bin_size(precision, scale); int bin_size= decimal_bin_size(precision, scale);
......
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