diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-01-18 19:46:52 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-01-18 22:21:19 +0200 |
commit | 96c49808bd64e2dd45c24e8746b32b96c37da98a (patch) | |
tree | 90b646ce116d94a6c0fa71382598e79f522c763c /sql/mysqld.cc | |
parent | a1315a650a69745bac7166cfe1423215dfaac6e1 (diff) | |
parent | f7d030489d2980c9deb733925515099ec256f6d2 (diff) | |
download | mariadb-git-10.2-merge.tar.gz |
WIP merge 10.1 to 10.210.2-merge
Bootstrap fails:
mysqld: sql/field.h:957: bool Field::has_explicit_value(): Assertion `table->has_value_set' failed.
assertion=0x1411e89 "table->has_value_set",
file=0x1411e9e "/home/marko/mariadb/server/sql/field.h", line=957,
function=0x1411ec5 "bool Field::has_explicit_value()") at assert.c:101
at /home/marko/mariadb/server/sql/field.h:957
table_list=0x7fff7407b4f0, fields=..., values_list=...,
update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false)
at /home/marko/mariadb/server/sql/sql_insert.cc:1017
at /home/marko/mariadb/server/sql/sql_parse.cc:4370
rawbuf=0x7fff740f43e0 " INSERT INTO global_suppressions VALUES (\".SELECT UNIX_TIMESTAMP... failed on master\"), (\"Aborted connection\"), (\"Client requested master to start replication from impossible position\"), (\"Could"..., length=6339, parser_state=0x7fffe8efcab8, is_com_multi=false,
is_next_command=false) at /home/marko/mariadb/server/sql/sql_parse.cc:7839
at /home/marko/mariadb/server/sql/sql_parse.cc:1033
There are unresolved conflicts in the following files:
mysql-test/suite/galera/r/galera_var_cluster_address.result
mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result
mysql-test/suite/innodb/r/innodb-wl5522-debug.result
mysql-test/suite/innodb/r/innodb_bug14147491.result
mysql-test/suite/innodb/r/xa_recovery.result
mysql-test/suite/innodb/t/doublewrite.test
mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test
mysql-test/suite/innodb/t/innodb-wl5522-debug.test
mysql-test/suite/innodb/t/innodb_bug14147491.test
mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
mysql-test/suite/sys_vars/r/sysvars_innodb.result
mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff
mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff
mysql-test/suite/vcol/inc/vcol_trigger_sp.inc
mysql-test/suite/vcol/r/vcol_trigger_sp_innodb.result
mysql-test/suite/vcol/r/vcol_trigger_sp_myisam.result
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r-- | sql/mysqld.cc | 128 |
1 files changed, 40 insertions, 88 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 4b79ea43c7c..d30fa3e25c7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2008, 2016, MariaDB + Copyright (c) 2008, 2017, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -130,10 +130,7 @@ extern "C" { // Because of SCO 3.2V4.2 #include <sysent.h> #endif #ifdef HAVE_PWD_H -#include <pwd.h> // For getpwent -#endif -#ifdef HAVE_GRP_H -#include <grp.h> +#include <pwd.h> // For struct passwd #endif #include <my_net.h> @@ -485,9 +482,7 @@ ulong opt_binlog_rows_event_max_size; my_bool opt_master_verify_checksum= 0; my_bool opt_slave_sql_verify_checksum= 1; const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS}; -#ifdef HAVE_INITGROUPS volatile sig_atomic_t calling_initgroups= 0; /**< Used in SIGSEGV handler. */ -#endif uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options; uint mysqld_extra_port; uint mysqld_port_timeout; @@ -2421,59 +2416,18 @@ static void set_ports() static struct passwd *check_user(const char *user) { -#if !defined(__WIN__) - struct passwd *tmp_user_info; - uid_t user_id= geteuid(); + myf flags= 0; + if (global_system_variables.log_warnings) + flags|= MY_WME; + if (!opt_bootstrap && !opt_help) + flags|= MY_FAE; - // Don't bother if we aren't superuser - if (user_id) - { - if (user) - { - /* Don't give a warning, if real user is same as given with --user */ - /* purecov: begin tested */ - tmp_user_info= getpwnam(user); - if ((!tmp_user_info || user_id != tmp_user_info->pw_uid) && - global_system_variables.log_warnings) - sql_print_warning( - "One can only use the --user switch if running as root\n"); - /* purecov: end */ - } - return NULL; - } - if (!user) - { - if (!opt_bootstrap && !opt_help) - { - sql_print_error("Fatal error: Please consult the Knowledge Base " - "to find out how to run mysqld as root!\n"); - unireg_abort(1); - } - return NULL; - } - /* purecov: begin tested */ - if (!strcmp(user,"root")) - return NULL; // Avoid problem with dynamic libraries + struct passwd *tmp_user_info= my_check_user(user, MYF(flags)); - if (!(tmp_user_info= getpwnam(user))) - { - // Allow a numeric uid to be used - const char *pos; - for (pos= user; my_isdigit(mysqld_charset,*pos); pos++) ; - if (*pos) // Not numeric id - goto err; - if (!(tmp_user_info= getpwuid(atoi(user)))) - goto err; - } + if (!tmp_user_info && my_errno==EINVAL && (flags & MY_FAE)) + unireg_abort(1); return tmp_user_info; - /* purecov: end */ - -err: - sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user); - unireg_abort(1); -#endif - return NULL; } static inline void allow_coredumps() @@ -2490,10 +2444,6 @@ static inline void allow_coredumps() static void set_user(const char *user, struct passwd *user_info_arg) { - /* purecov: begin tested */ -#if !defined(__WIN__) - DBUG_ASSERT(user_info_arg != 0); -#ifdef HAVE_INITGROUPS /* We can get a SIGSEGV when calling initgroups() on some systems when NSS is configured to use LDAP and the server is statically linked. We set @@ -2501,22 +2451,11 @@ static void set_user(const char *user, struct passwd *user_info_arg) output a specific message to help the user resolve this problem. */ calling_initgroups= 1; - initgroups((char*) user, user_info_arg->pw_gid); + int res= my_set_user(user, user_info_arg, MYF(MY_WME)); calling_initgroups= 0; -#endif - if (setgid(user_info_arg->pw_gid) == -1) - { - sql_perror("setgid"); + if (res) unireg_abort(1); - } - if (setuid(user_info_arg->pw_uid) == -1) - { - sql_perror("setuid"); - unireg_abort(1); - } allow_coredumps(); -#endif - /* purecov: end */ } @@ -4087,8 +4026,8 @@ extern "C" { static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific) { THD *thd= current_thd; - - if (likely(is_thread_specific)) /* If thread specific memory */ + + if (is_thread_specific) /* If thread specific memory */ { /* When thread specfic is set, both mysqld_server_initialized and thd @@ -4100,14 +4039,22 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific) (longlong) thd->status_var.local_memory_used, size)); thd->status_var.local_memory_used+= size; + if (thd->status_var.local_memory_used > (int64)thd->variables.max_mem_used && + !thd->killed) + { + char buf[1024]; + thd->killed= KILL_QUERY; + my_snprintf(buf, sizeof(buf), "--max-thread-mem-used=%llu", + thd->variables.max_mem_used); + my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), buf); + } DBUG_ASSERT((longlong) thd->status_var.local_memory_used >= 0 || !debug_assert_on_not_freed_memory); } else if (likely(thd)) { DBUG_PRINT("info", ("global thd memory_used: %lld size: %lld", - (longlong) thd->status_var.global_memory_used, - size)); + (longlong) thd->status_var.global_memory_used, size)); thd->status_var.global_memory_used+= size; } else @@ -4580,19 +4527,24 @@ static int init_common_variables() default_charset_info= default_collation; } /* Set collactions that depends on the default collation */ - global_system_variables.collation_server= default_charset_info; - global_system_variables.collation_database= default_charset_info; - global_system_variables.collation_connection= default_charset_info; - global_system_variables.character_set_results= default_charset_info; - if (default_charset_info->mbminlen > 1) - { - global_system_variables.character_set_client= &my_charset_latin1; - sql_print_warning("Cannot use %s as character_set_client, %s will be used instead", - default_charset_info->csname, - global_system_variables.character_set_client->csname); + global_system_variables.collation_server= default_charset_info; + global_system_variables.collation_database= default_charset_info; + if (is_supported_parser_charset(default_charset_info)) + { + global_system_variables.collation_connection= default_charset_info; + global_system_variables.character_set_results= default_charset_info; + global_system_variables.character_set_client= default_charset_info; } else - global_system_variables.character_set_client= default_charset_info; + { + sql_print_warning("'%s' can not be used as client character set. " + "'%s' will be used as default client character set.", + default_charset_info->csname, + my_charset_latin1.csname); + global_system_variables.collation_connection= &my_charset_latin1; + global_system_variables.character_set_results= &my_charset_latin1; + global_system_variables.character_set_client= &my_charset_latin1; + } if (!(character_set_filesystem= get_charset_by_csname(character_set_filesystem_name, |