diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-09-21 10:14:42 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-09-21 10:14:42 +0200 |
commit | 9af177042ed0e297b8f26f2c2f8ae00b3a814a90 (patch) | |
tree | 0d8d2fab7ebeb02f3c25c00ac1543754b625bde8 /client | |
parent | a6add4ff43a905cee1bfd00b2ec2d276018866ce (diff) | |
parent | 2fe0836eed16ce5809c34064893681f12c77da9f (diff) | |
download | mariadb-git-9af177042ed0e297b8f26f2c2f8ae00b3a814a90.tar.gz |
10.0-base merge.
Partitioning/InnoDB changes are *not* merged (they'll come from 5.6)
TokuDB does not compile (not updated to 10.0 SE API)
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 2 | ||||
-rw-r--r-- | client/mysql_plugin.c | 14 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 1 | ||||
-rw-r--r-- | client/mysqldump.c | 78 |
4 files changed, 60 insertions, 35 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 90310f85e95..36567da5947 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3510,6 +3510,7 @@ print_table_data(MYSQL_RES *result) if (length < 4 && !IS_NOT_NULL(field->flags)) length=4; // Room for "NULL" field->max_length=length; + num_flag[mysql_field_tell(result) - 1]= IS_NUM(field->type); separator.fill(separator.length()+length+2,'-'); separator.append('+'); } @@ -3529,7 +3530,6 @@ print_table_data(MYSQL_RES *result) tee_fprintf(PAGER, " %-*s |",(int) MY_MIN(display_length, MAX_COLUMN_LENGTH), field->name); - num_flag[off]= IS_NUM(field->type); } (void) tee_fputs("\n", PAGER); tee_puts((char*) separator.ptr(), PAGER); diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index b6fa350b54a..c3fa1a49e81 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -101,7 +101,7 @@ int main(int argc,char *argv[]) MY_INIT(argv[0]); sf_leaking_memory=1; /* don't report memory leaks on early exits */ - plugin_data.name= 0; // initialize name + plugin_data.name= 0; /* initialize name */ /* The following operations comprise the method for enabling or disabling @@ -655,11 +655,11 @@ static int load_plugin_data(char *plugin_name, char *config_file) } break; } - if ((line[0] == '#') || (line[0] == '\n')) // skip comment and blank lines + if ((line[0] == '#') || (line[0] == '\n')) /* skip comment and blank lines */ { continue; } - if (i == -1) // if first pass, read this line as so_name + if (i == -1) /* if first pass, read this line as so_name */ { /* Add proper file extension for soname */ strcat(line, FN_SOEXT); @@ -707,10 +707,10 @@ error: static int check_options(int argc, char **argv, char *operation) { - int i= 0; // loop counter - int num_found= 0; // number of options found (shortcut loop) - char config_file[FN_REFLEN]; // configuration file name - char plugin_name[FN_REFLEN]; // plugin name + int i= 0; /* loop counter */ + int num_found= 0; /* number of options found (shortcut loop) */ + char config_file[FN_REFLEN]; /* configuration file name */ + char plugin_name[FN_REFLEN]; /* plugin name */ /* Form prefix strings for the options. */ const char *basedir_prefix = "--basedir="; diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 31a1d583c4f..4f6475ef95f 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2562,6 +2562,7 @@ void *sql_alloc(size_t size) the server */ +#include "rpl_tblmap.cc" #undef TABLE #include "my_decimal.h" #include "decimal.c" diff --git a/client/mysqldump.c b/client/mysqldump.c index ef3b0ce1ca0..f9fcbb65515 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -87,15 +87,6 @@ /* Chars needed to store LONGLONG, excluding trailing '\0'. */ #define LONGLONG_LEN 20 -/* general_log or slow_log tables under mysql database */ -static inline my_bool general_log_or_slow_log_tables(const char *db, - const char *table) -{ - return (strcmp(db, "mysql") == 0) && - ((strcmp(table, "general_log") == 0) || - (strcmp(table, "slow_log") == 0)); -} - static void add_load_option(DYNAMIC_STRING *str, const char *option, const char *option_value); static ulong find_set(TYPELIB *lib, const char *x, uint length, @@ -2470,6 +2461,15 @@ static uint dump_routines_for_db(char *db) DBUG_RETURN(0); } +/* general_log or slow_log tables under mysql database */ +static inline my_bool general_log_or_slow_log_tables(const char *db, + const char *table) +{ + return (!my_strcasecmp(charset_info, db, "mysql")) && + (!my_strcasecmp(charset_info, table, "general_log") || + !my_strcasecmp(charset_info, table, "slow_log")); +} + /* get_table_structure -- retrievs database structure, prints out corresponding CREATE statement and fills out insert_pat if the table is the type we will @@ -4344,7 +4344,8 @@ static int dump_all_tables_in_db(char *database) char table_buff[NAME_LEN*2+3]; char hash_key[2*NAME_LEN+2]; /* "db.tablename" */ char *afterdot; - int using_mysql_db= my_strcasecmp(&my_charset_latin1, database, "mysql"); + my_bool general_log_table_exists= 0, slow_log_table_exists=0; + int using_mysql_db= !my_strcasecmp(charset_info, database, "mysql"); DBUG_ENTER("dump_all_tables_in_db"); afterdot= strmov(hash_key, database); @@ -4355,22 +4356,6 @@ static int dump_all_tables_in_db(char *database) if (opt_xml) print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS); - if (strcmp(database, "mysql") == 0) - { - char table_type[NAME_LEN]; - char ignore_flag; - uint num_fields; - num_fields= get_table_structure((char *) "general_log", - database, table_type, &ignore_flag); - if (num_fields == 0) - verbose_msg("-- Warning: get_table_structure() failed with some internal " - "error for 'general_log' table\n"); - num_fields= get_table_structure((char *) "slow_log", - database, table_type, &ignore_flag); - if (num_fields == 0) - verbose_msg("-- Warning: get_table_structure() failed with some internal " - "error for 'slow_log' table\n"); - } if (lock_tables) { DYNAMIC_STRING query; @@ -4416,6 +4401,26 @@ static int dump_all_tables_in_db(char *database) } } } + else + { + /* + If general_log and slow_log exists in the 'mysql' database, + we should dump the table structure. But we cannot + call get_table_structure() here as 'LOCK TABLES' query got executed + above on the session and that 'LOCK TABLES' query does not contain + 'general_log' and 'slow_log' tables. (you cannot acquire lock + on log tables). Hence mark the existence of these log tables here and + after 'UNLOCK TABLES' query is executed on the session, get the table + structure from server and dump it in the file. + */ + if (using_mysql_db) + { + if (!my_strcasecmp(charset_info, table, "general_log")) + general_log_table_exists= 1; + else if (!my_strcasecmp(charset_info, table, "slow_log")) + slow_log_table_exists= 1; + } + } } if (opt_events && mysql_get_server_version(mysql) >= 50106) { @@ -4434,7 +4439,26 @@ static int dump_all_tables_in_db(char *database) } if (lock_tables) (void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"); - if (flush_privileges && using_mysql_db == 0) + if (using_mysql_db) + { + char table_type[NAME_LEN]; + char ignore_flag; + if (general_log_table_exists) + { + if (!get_table_structure((char *) "general_log", + database, table_type, &ignore_flag) ) + verbose_msg("-- Warning: get_table_structure() failed with some internal " + "error for 'general_log' table\n"); + } + if (slow_log_table_exists) + { + if (!get_table_structure((char *) "slow_log", + database, table_type, &ignore_flag) ) + verbose_msg("-- Warning: get_table_structure() failed with some internal " + "error for 'slow_log' table\n"); + } + } + if (flush_privileges && using_mysql_db) { fprintf(md_result_file,"\n--\n-- Flush Grant Tables \n--\n"); fprintf(md_result_file,"\n/*! FLUSH PRIVILEGES */;\n"); |