From 8387d0000c9fda7fc8174999f406155c9f1bf926 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Sun, 14 Nov 2004 17:18:31 +0100 Subject: [PATCH 1/6] allowing --master-data without arg to be compatible with < 4.1.8 mysqldump. --- client/mysqldump.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 83967d62813..540f0d78c50 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -254,7 +254,7 @@ static struct my_option my_long_options[] = "any action on logs will happen at the exact moment of the dump." "Option automatically turns --lock-tables off.", (gptr*) &opt_master_data, (gptr*) &opt_master_data, 0, - GET_UINT, REQUIRED_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0}, + GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0}, {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "", (gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0, GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096, @@ -548,6 +548,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case '?': usage(); exit(0); + case (int) OPT_MASTER_DATA: + if (!argument) /* work like in old versions */ + opt_master_data= MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL; + break; case (int) OPT_OPTIMIZE: extended_insert= opt_drop= opt_lock= quick= create_options= opt_disable_keys= lock_tables= opt_set_charset= 1; From e8049f064971a910599396e4eb77e8ffe3bb8ecd Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Sun, 14 Nov 2004 17:45:37 +0100 Subject: [PATCH 2/6] Try to lower the probability of a stall of mysqldump AND most client connections, when mysqldump does a FLUSH TABLES WITH READ LOCK (doing FLUSH TABLES first). --- client/mysqldump.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 540f0d78c50..498a10041a9 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2050,8 +2050,18 @@ static int do_show_master_status(MYSQL *mysql_con) static int do_flush_tables_read_lock(MYSQL *mysql_con) { + /* + We do first a FLUSH TABLES. If a long update is running, the FLUSH TABLES + will wait but will not stall the whole mysqld, and when the long update is + done the FLUSH TABLES WITH READ LOCK will start and succeed quickly. So, + FLUSH TABLES is to lower the probability of a stage where both mysqldump + and most client connections are stalled. Of course, if a second long + update starts between the two FLUSHes, we have that bad stall. + */ return - mysql_query_with_error_report(mysql_con, 0, "FLUSH TABLES WITH READ LOCK"); + ( mysql_query_with_error_report(mysql_con, 0, "FLUSH TABLES") || + mysql_query_with_error_report(mysql_con, 0, + "FLUSH TABLES WITH READ LOCK") ); } From fb8b9ca6a478b7ebecf9df91ab61876d2faf62d7 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Tue, 16 Nov 2004 00:10:32 +0100 Subject: [PATCH 3/6] compilation failures fixes. mysqldump now compiles on AIX 4.3. --- client/mysqldump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 498a10041a9..cfe93a11024 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1684,7 +1684,7 @@ static void dumpTable(uint numFields, char *table) else if (opt_hex_blob && is_blob) { /* sakaik got the idea to to provide blob's in hex notation. */ - unsigned char *ptr= row[i], *end= ptr+ lengths[i]; + char *ptr= row[i], *end= ptr+ lengths[i]; fputs("0x", md_result_file); for (; ptr < end ; ptr++) fprintf(md_result_file, "%02X", *ptr); @@ -2246,7 +2246,7 @@ int main(int argc, char **argv) } if (opt_master_data && do_show_master_status(sock)) goto err; - if (opt_single_transaction && do_unlock_tables(sock)) // unlock but no commit! + if (opt_single_transaction && do_unlock_tables(sock)) /* unlock but no commit! */ goto err; if (opt_alldbs) From b8713e5e9cf764f75709e08617bb840ec5713f6c Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Tue, 16 Nov 2004 07:24:11 +0000 Subject: [PATCH 4/6] provided better error printout for mismatch of node types in configuratoin fetch fixed to that mgmt server actually uses the connectsring --- ndb/src/common/mgmcommon/ConfigRetriever.cpp | 13 ++++++++++--- ndb/src/mgmsrv/main.cpp | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp index d8417ac146a..a1b979f62d8 100644 --- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -238,7 +238,8 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32 char buf[255]; ndb_mgm_configuration_iterator * it; - it = ndb_mgm_create_configuration_iterator((struct ndb_mgm_configuration *)conf, CFG_SECTION_NODE); + it = ndb_mgm_create_configuration_iterator((struct ndb_mgm_configuration *)conf, + CFG_SECTION_NODE); if(it == 0){ BaseString::snprintf(buf, 255, "Unable to create config iterator"); @@ -284,8 +285,14 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32 } if(_type != m_node_type){ - BaseString::snprintf(buf, 255, "Supplied node type(%d) and config node type(%d) " - " don't match", m_node_type, _type); + const char *type_s, *alias_s, *type_s2, *alias_s2; + alias_s= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type)m_node_type, + &type_s); + alias_s2= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type)_type, + &type_s2); + BaseString::snprintf(buf, 255, "This node type %s(%s) and config " + "node type %s(%s) don't match for nodeid %d", + alias_s, type_s, alias_s2, type_s2, nodeid); setError(CR_ERROR, buf); return false; } diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp index 7a57fdeb77a..76f0679b069 100644 --- a/ndb/src/mgmsrv/main.cpp +++ b/ndb/src/mgmsrv/main.cpp @@ -216,7 +216,7 @@ int main(int argc, char** argv) * Read configuration files * ****************************/ LocalConfig local_config; - if(!local_config.init(0,glob.local_config_filename)){ + if(!local_config.init(opt_connect_str,glob.local_config_filename)){ local_config.printError(); goto error_end; } From 629f1bb6165ebac7fe1d8bacfa6c462567faac45 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Tue, 16 Nov 2004 12:05:13 +0400 Subject: [PATCH 5/6] Bug #6552 CHAR column w/o length is legal, BINARY w/o length is not --- mysql-test/r/binary.result | 7 +++++++ mysql-test/t/binary.test | 7 +++++++ sql/sql_yacc.yy | 3 +++ 3 files changed, 17 insertions(+) diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result index 405de1158d6..5b5f673b071 100644 --- a/mysql-test/r/binary.result +++ b/mysql-test/r/binary.result @@ -134,3 +134,10 @@ select * from t1 where firstname='john' and firstname like binary 'John'; firstname lastname John Doe drop table t1; +create table t1 (a binary); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` binary(1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test index 3e702fd5257..54ad8e92237 100644 --- a/mysql-test/t/binary.test +++ b/mysql-test/t/binary.test @@ -80,3 +80,10 @@ select * from t1 where firstname='john' and firstname = binary 'john'; select * from t1 where firstname='John' and firstname like binary 'john'; select * from t1 where firstname='john' and firstname like binary 'John'; drop table t1; + +# +# Bug #6552 CHAR column w/o length is legal, BINARY w/o length is not +# +create table t1 (a binary); +show create table t1; +drop table t1; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index d842b4b66bb..521196085bb 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1402,6 +1402,9 @@ type: | BINARY '(' NUM ')' { Lex->length=$3.str; Lex->charset=&my_charset_bin; $$=FIELD_TYPE_STRING; } + | BINARY { Lex->length= (char*) "1"; + Lex->charset=&my_charset_bin; + $$=FIELD_TYPE_STRING; } | varchar '(' NUM ')' opt_binary { Lex->length=$3.str; $$=FIELD_TYPE_VAR_STRING; } | nvarchar '(' NUM ')' { Lex->length=$3.str; From 4d89516226f7030da333c89db8d2e8926eeb8e54 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Tue, 16 Nov 2004 09:10:29 +0000 Subject: [PATCH 6/6] Makefile.am: changed link order to fix linking problems --- client/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/Makefile.am b/client/Makefile.am index 58398548b75..1c552036f9b 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -20,8 +20,8 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/regex \ $(openssl_includes) LIBS = @CLIENT_LIBS@ -DEPLIB= ../libmysql/libmysqlclient.la \ - @ndb_mgmclient_libs@ +DEPLIB= @ndb_mgmclient_libs@ \ + ../libmysql/libmysqlclient.la LDADD = @CLIENT_EXTRA_LDFLAGS@ $(DEPLIB) bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \ mysqldump mysqlimport mysqltest mysqlbinlog mysqlmanagerc mysqlmanager-pwgen