Commit 46148f2e authored by Ondrej Sury's avatar Ondrej Sury
Browse files

New upstream version 10.1.26

parent 94344f2b
commit: da7604a2943f633df3b193e26ee20110bae9fa7a commit: 535910ae5f20e36405631030e9c0eb22fe40a7c4
date: 2017-07-01 21:12:26 +0300 date: 2017-08-09 16:15:30 +0300
build-date: 2017-07-01 20:20:31 +0200 build-date: 2017-08-09 13:20:45 +0000
short: da7604a short: 535910a
branch: HEAD branch: HEAD
MariaDB source 10.1.25 MariaDB source 10.1.26
MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=1 MYSQL_VERSION_MINOR=1
MYSQL_VERSION_PATCH=25 MYSQL_VERSION_PATCH=26
...@@ -149,7 +149,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0, ...@@ -149,7 +149,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
default_pager_set= 0, opt_sigint_ignore= 0, default_pager_set= 0, opt_sigint_ignore= 0,
auto_vertical_output= 0, auto_vertical_output= 0,
show_warnings= 0, executing_query= 0, show_warnings= 0, executing_query= 0,
ignore_spaces= 0, opt_progress_reports; ignore_spaces= 0, opt_binhex= 0, opt_progress_reports;
static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error; static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error;
static my_bool column_types_flag; static my_bool column_types_flag;
static my_bool preserve_comments= 0; static my_bool preserve_comments= 0;
...@@ -1492,6 +1492,8 @@ static struct my_option my_long_options[] = ...@@ -1492,6 +1492,8 @@ static struct my_option my_long_options[] =
{"batch", 'B', {"batch", 'B',
"Don't use history file. Disable interactive behavior. (Enables --silent.)", "Don't use history file. Disable interactive behavior. (Enables --silent.)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"binary-as-hex", 'b', "Print binary data as hex", &opt_binhex, &opt_binhex,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR, {"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", &charsets_dir, "Directory for character set files.", &charsets_dir,
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
...@@ -3314,7 +3316,8 @@ com_go(String *buffer,char *line __attribute__((unused))) ...@@ -3314,7 +3316,8 @@ com_go(String *buffer,char *line __attribute__((unused)))
print_table_data_html(result); print_table_data_html(result);
else if (opt_xml) else if (opt_xml)
print_table_data_xml(result); print_table_data_xml(result);
else if (vertical || (auto_vertical_output && (terminal_width < get_result_width(result)))) else if (vertical || (auto_vertical_output &&
(terminal_width < get_result_width(result))))
print_table_data_vertically(result); print_table_data_vertically(result);
else if (opt_silent && verbose <= 2 && !output_tables) else if (opt_silent && verbose <= 2 && !output_tables)
print_tab_data(result); print_tab_data(result);
...@@ -3533,6 +3536,41 @@ print_field_types(MYSQL_RES *result) ...@@ -3533,6 +3536,41 @@ print_field_types(MYSQL_RES *result)
} }
/* Used to determine if we should invoke print_as_hex for this field */
static bool
is_binary_field(MYSQL_FIELD *field)
{
if ((field->charsetnr == 63) &&
(field->type == MYSQL_TYPE_BIT ||
field->type == MYSQL_TYPE_BLOB ||
field->type == MYSQL_TYPE_LONG_BLOB ||
field->type == MYSQL_TYPE_MEDIUM_BLOB ||
field->type == MYSQL_TYPE_TINY_BLOB ||
field->type == MYSQL_TYPE_VAR_STRING ||
field->type == MYSQL_TYPE_STRING ||
field->type == MYSQL_TYPE_VARCHAR ||
field->type == MYSQL_TYPE_GEOMETRY))
return 1;
return 0;
}
/* Print binary value as hex literal (0x ...) */
static void
print_as_hex(FILE *output_file, const char *str, ulong len, ulong total_bytes_to_send)
{
const char *ptr= str, *end= ptr+len;
ulong i;
fprintf(output_file, "0x");
for(; ptr < end; ptr++)
fprintf(output_file, "%02X", *((uchar*)ptr));
for (i= 2*len+2; i < total_bytes_to_send; i++)
tee_putc((int)' ', output_file);
}
static void static void
print_table_data(MYSQL_RES *result) print_table_data(MYSQL_RES *result)
{ {
...@@ -3559,6 +3597,8 @@ print_table_data(MYSQL_RES *result) ...@@ -3559,6 +3597,8 @@ print_table_data(MYSQL_RES *result)
length= MY_MAX(length,field->max_length); length= MY_MAX(length,field->max_length);
if (length < 4 && !IS_NOT_NULL(field->flags)) if (length < 4 && !IS_NOT_NULL(field->flags))
length=4; // Room for "NULL" length=4; // Room for "NULL"
if (opt_binhex && is_binary_field(field))
length= 2 + length * 2;
field->max_length=length; field->max_length=length;
num_flag[mysql_field_tell(result) - 1]= IS_NUM(field->type); num_flag[mysql_field_tell(result) - 1]= IS_NUM(field->type);
separator.fill(separator.length()+length+2,'-'); separator.fill(separator.length()+length+2,'-');
...@@ -3626,9 +3666,11 @@ print_table_data(MYSQL_RES *result) ...@@ -3626,9 +3666,11 @@ print_table_data(MYSQL_RES *result)
many extra padding-characters we should send with the printing function. many extra padding-characters we should send with the printing function.
*/ */
visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length); visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
extra_padding= data_length - visible_length; extra_padding= (uint) (data_length - visible_length);
if (field_max_length > MAX_COLUMN_LENGTH) if (opt_binhex && is_binary_field(field))
print_as_hex(PAGER, cur[off], lengths[off], field_max_length);
else if (field_max_length > MAX_COLUMN_LENGTH)
tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE); tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE);
else else
{ {
...@@ -3762,11 +3804,15 @@ print_table_data_html(MYSQL_RES *result) ...@@ -3762,11 +3804,15 @@ print_table_data_html(MYSQL_RES *result)
if (interrupted_query) if (interrupted_query)
break; break;
ulong *lengths=mysql_fetch_lengths(result); ulong *lengths=mysql_fetch_lengths(result);
field= mysql_fetch_fields(result);
(void) tee_fputs("<TR>", PAGER); (void) tee_fputs("<TR>", PAGER);
for (uint i=0; i < mysql_num_fields(result); i++) for (uint i=0; i < mysql_num_fields(result); i++)
{ {
(void) tee_fputs("<TD>", PAGER); (void) tee_fputs("<TD>", PAGER);
xmlencode_print(cur[i], lengths[i]); if (opt_binhex && is_binary_field(&field[i]))
print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
else
xmlencode_print(cur[i], lengths[i]);
(void) tee_fputs("</TD>", PAGER); (void) tee_fputs("</TD>", PAGER);
} }
(void) tee_fputs("</TR>", PAGER); (void) tee_fputs("</TR>", PAGER);
...@@ -3802,7 +3848,10 @@ print_table_data_xml(MYSQL_RES *result) ...@@ -3802,7 +3848,10 @@ print_table_data_xml(MYSQL_RES *result)
if (cur[i]) if (cur[i])
{ {
tee_fprintf(PAGER, "\">"); tee_fprintf(PAGER, "\">");
xmlencode_print(cur[i], lengths[i]); if (opt_binhex && is_binary_field(&fields[i]))
print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
else
xmlencode_print(cur[i], lengths[i]);
tee_fprintf(PAGER, "</field>\n"); tee_fprintf(PAGER, "</field>\n");
} }
else else
...@@ -3849,23 +3898,28 @@ print_table_data_vertically(MYSQL_RES *result) ...@@ -3849,23 +3898,28 @@ print_table_data_vertically(MYSQL_RES *result)
{ {
unsigned int i; unsigned int i;
const char *p; const char *p;
if (opt_binhex && is_binary_field(field))
fprintf(PAGER, "0x");
for (i= 0, p= cur[off]; i < lengths[off]; i+= 1, p+= 1) for (i= 0, p= cur[off]; i < lengths[off]; i+= 1, p+= 1)
{ {
if (*p == '\0') if (opt_binhex && is_binary_field(field))
tee_putc((int)' ', PAGER); fprintf(PAGER, "%02X", *((uchar*)p));
else else
tee_putc((int)*p, PAGER); {
if (*p == '\0')
tee_putc((int)' ', PAGER);
else
tee_putc((int)*p, PAGER);
}
} }
tee_putc('\n', PAGER); tee_putc('\n', PAGER);
} }
else else
tee_fprintf(PAGER, "NULL\n"); tee_fprintf(PAGER, "NULL\n");
} }
} }
} }
/* print_warnings should be called right after executing a statement */ /* print_warnings should be called right after executing a statement */
static void print_warnings() static void print_warnings()
...@@ -4002,11 +4056,19 @@ print_tab_data(MYSQL_RES *result) ...@@ -4002,11 +4056,19 @@ print_tab_data(MYSQL_RES *result)
while ((cur = mysql_fetch_row(result))) while ((cur = mysql_fetch_row(result)))
{ {
lengths=mysql_fetch_lengths(result); lengths=mysql_fetch_lengths(result);
safe_put_field(cur[0],lengths[0]); field= mysql_fetch_fields(result);
if (opt_binhex && is_binary_field(&field[0]))
print_as_hex(PAGER, cur[0], lengths[0], lengths[0]);
else
safe_put_field(cur[0],lengths[0]);
for (uint off=1 ; off < mysql_num_fields(result); off++) for (uint off=1 ; off < mysql_num_fields(result); off++)
{ {
(void) tee_fputs("\t", PAGER); (void) tee_fputs("\t", PAGER);
safe_put_field(cur[off], lengths[off]); if (opt_binhex && field && is_binary_field(&field[off]))
print_as_hex(PAGER, cur[off], lengths[off], lengths[off]);
else
safe_put_field(cur[off], lengths[off]);
} }
(void) tee_fputs("\n", PAGER); (void) tee_fputs("\n", PAGER);
} }
...@@ -4798,10 +4860,11 @@ com_status(String *buffer __attribute__((unused)), ...@@ -4798,10 +4860,11 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "Protocol:\t\tCompressed\n"); tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
#endif #endif
if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0]) const char *pos;
if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0] &&
(pos= strchr(status_str,' ')))
{ {
ulong sec; ulong sec;
const char *pos= strchr(status_str,' ');
/* print label */ /* print label */
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str); tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str);
if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec))) if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec)))
......
...@@ -1171,6 +1171,8 @@ int main(int argc, char **argv) ...@@ -1171,6 +1171,8 @@ int main(int argc, char **argv)
{ {
int fd= create_temp_file(cnf_file_path, opt_tmpdir[0] ? opt_tmpdir : NULL, int fd= create_temp_file(cnf_file_path, opt_tmpdir[0] ? opt_tmpdir : NULL,
"mysql_upgrade-", O_CREAT | O_WRONLY, MYF(MY_FAE)); "mysql_upgrade-", O_CREAT | O_WRONLY, MYF(MY_FAE));
if (fd < 0)
die(NULL);
my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE)); my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE));
my_write(fd, (uchar*)ds_args.str, ds_args.length, MYF(MY_FAE)); my_write(fd, (uchar*)ds_args.str, ds_args.length, MYF(MY_FAE));
my_close(fd, MYF(0)); my_close(fd, MYF(0));
......
...@@ -92,8 +92,7 @@ ...@@ -92,8 +92,7 @@
static void add_load_option(DYNAMIC_STRING *str, const char *option, static void add_load_option(DYNAMIC_STRING *str, const char *option,
const char *option_value); const char *option_value);
static ulong find_set(TYPELIB *lib, const char *x, size_t length, static ulong find_set(TYPELIB *, const char *, size_t, char **, uint *);
char **err_pos, uint *err_len);
static char *alloc_query_str(ulong size); static char *alloc_query_str(ulong size);
static void field_escape(DYNAMIC_STRING* in, const char *from); static void field_escape(DYNAMIC_STRING* in, const char *from);
...@@ -5471,7 +5470,7 @@ static ulong find_set(TYPELIB *lib, const char *x, size_t length, ...@@ -5471,7 +5470,7 @@ static ulong find_set(TYPELIB *lib, const char *x, size_t length,
var_len= (uint) (pos - start); var_len= (uint) (pos - start);
strmake(buff, start, MY_MIN(sizeof(buff) - 1, var_len)); strmake(buff, start, MY_MIN(sizeof(buff) - 1, var_len));
find= find_type(buff, lib, FIND_TYPE_BASIC); find= find_type(buff, lib, FIND_TYPE_BASIC);
if (!find) if (find <= 0)
{ {
*err_pos= (char*) start; *err_pos= (char*) start;
*err_len= var_len; *err_len= var_len;
......
...@@ -675,7 +675,7 @@ int main(int argc, char **argv) ...@@ -675,7 +675,7 @@ int main(int argc, char **argv)
MYF(0)))) MYF(0))))
return -2; return -2;
for (counter= 0; *argv != NULL; argv++) /* Loop through tables */ for (; *argv != NULL; argv++) /* Loop through tables */
{ {
pthread_mutex_lock(&counter_mutex); pthread_mutex_lock(&counter_mutex);
while (counter == opt_use_threads) while (counter == opt_use_threads)
......
...@@ -600,7 +600,7 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query, ...@@ -600,7 +600,7 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
void str_to_file(const char *fname, char *str, int size); void str_to_file(const char *fname, char *str, int size);
void str_to_file2(const char *fname, char *str, int size, my_bool append); void str_to_file2(const char *fname, char *str, int size, my_bool append);
void fix_win_paths(const char *val, int len); void fix_win_paths(const char *val, size_t len);
const char *get_errname_from_code (uint error_code); const char *get_errname_from_code (uint error_code);
int multi_reg_replace(struct st_replace_regex* r,char* val); int multi_reg_replace(struct st_replace_regex* r,char* val);
...@@ -814,8 +814,7 @@ class LogFile { ...@@ -814,8 +814,7 @@ class LogFile {
LogFile log_file; LogFile log_file;
LogFile progress_file; LogFile progress_file;
void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val, void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val, size_t len);
int len);
void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val); void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val);
void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val); void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val);
void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING* ds_input, void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING* ds_input,
...@@ -2653,6 +2652,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end) ...@@ -2653,6 +2652,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
if (!mysql) if (!mysql)
{ {
struct st_command command; struct st_command command;
DBUG_ASSERT(query_end);
memset(&command, 0, sizeof(command)); memset(&command, 0, sizeof(command));
command.query= (char*)query; command.query= (char*)query;
command.first_word_len= (*query_end - query); command.first_word_len= (*query_end - query);
...@@ -7488,7 +7488,7 @@ void free_win_path_patterns() ...@@ -7488,7 +7488,7 @@ void free_win_path_patterns()
=> all \ from c:\mysql\m... until next space is converted into / => all \ from c:\mysql\m... until next space is converted into /
*/ */
void fix_win_paths(const char *val, int len) void fix_win_paths(const char *val, size_t len)
{ {
uint i; uint i;
char *p; char *p;
...@@ -11013,7 +11013,7 @@ void free_pointer_array(POINTER_ARRAY *pa) ...@@ -11013,7 +11013,7 @@ void free_pointer_array(POINTER_ARRAY *pa)
/* Append the string to ds, with optional replace */ /* Append the string to ds, with optional replace */
void replace_dynstr_append_mem(DYNAMIC_STRING *ds, void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
const char *val, int len) const char *val, size_t len)
{ {
char lower[512]; char lower[512];
#ifdef __WIN__ #ifdef __WIN__
......
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2009, 2012, Oracle and/or its affiliates.
# Copyright (c) 2011, 2017, MariaDB Corporation
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -11,7 +12,7 @@ ...@@ -11,7 +12,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# We support different versions of SSL: # We support different versions of SSL:
# - "bundled" uses source code in <source dir>/extra/yassl # - "bundled" uses source code in <source dir>/extra/yassl
...@@ -207,7 +208,7 @@ MACRO (MYSQL_CHECK_SSL) ...@@ -207,7 +208,7 @@ MACRO (MYSQL_CHECK_SSL)
HAVE_EncryptAes128Gcm) HAVE_EncryptAes128Gcm)
ELSE() ELSE()
IF(WITH_SSL STREQUAL "system") IF(WITH_SSL STREQUAL "system")
MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support") MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support")
ENDIF() ENDIF()
MYSQL_USE_BUNDLED_SSL() MYSQL_USE_BUNDLED_SSL()
ENDIF() ENDIF()
......
...@@ -76,9 +76,11 @@ MACRO(CHECK_SYSTEMD) ...@@ -76,9 +76,11 @@ MACRO(CHECK_SYSTEMD)
UNSET(HAVE_SYSTEMD_SD_NOTIFYF) UNSET(HAVE_SYSTEMD_SD_NOTIFYF)
MESSAGE(STATUS "Systemd features not enabled") MESSAGE(STATUS "Systemd features not enabled")
IF(WITH_SYSTEMD STREQUAL "yes") IF(WITH_SYSTEMD STREQUAL "yes")
MESSAGE(FATAL_ERROR "Requested WITH_SYSTEMD=YES however no dependencies installed/found") MESSAGE(FATAL_ERROR "Requested WITH_SYSTEMD=yes however no dependencies installed/found")
ENDIF() ENDIF()
ENDIF() ENDIF()
ELSEIF(NOT WITH_SYSTEMD STREQUAL "no")
MESSAGE(FATAL_ERROR "Invalid value for WITH_SYSTEMD. Must be 'yes', 'no', or 'auto'.")
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()
all:
distclean:
-rm -f Makefile
.PHONY: all distclean clean install check
all:
distclean:
-rm -f Makefile
.PHONY: all distclean clean install check
#!/bin/bash
#
# This script is executed by "/etc/init.d/mysql" on every (re)start.
#
# Changes to this file will be preserved when updating the Debian package.
#
source /usr/share/mysql/debian-start.inc.sh
MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf"
MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
MYCHECK_PARAMS="--all-databases --fast --silent"
MYCHECK_RCPT="root"
# The following commands should be run when the server is up but in background
# where they do not block the server start and in one shell instance so that
# they run sequentially. They are supposed not to echo anything to stdout.
# If you want to disable the check for crashed tables comment
# "check_for_crashed_tables" out.
# (There may be no output to stdout inside the background process!)
echo "Checking for corrupt, not cleanly closed and upgrade needing tables."
# Need to ignore SIGHUP, as otherwise a SIGHUP can sometimes abort the upgrade
# process in the middle.
trap "" SIGHUP
(
upgrade_system_tables_if_necessary;
check_root_accounts;
check_for_crashed_tables;
) >&2 &
exit 0
#!/bin/bash
#
# This file is included by /etc/mysql/debian-start
#
## Check all unclosed tables.
# - Requires the server to be up.
# - Is supposed to run silently in background.
function check_for_crashed_tables() {
set -e
set -u
# But do it in the background to not stall the boot process.
logger -p daemon.info -i -t$0 "Triggering myisam-recover for all MyISAM tables"
# Checking for $? is unreliable so the size of the output is checked.
# Some table handlers like HEAP do not support CHECK TABLE.
tempfile=`tempfile`
# We have to use xargs in this case, because a for loop barfs on the
# spaces in the thing to be looped over.
LC_ALL=C $MYSQL --skip-column-names --batch -e '
select concat('\''select count(*) into @discard from `'\'',
TABLE_SCHEMA, '\''`.`'\'', TABLE_NAME, '\''`'\'')
from information_schema.TABLES where ENGINE='\''MyISAM'\' | \
xargs -i $MYSQL --skip-column-names --silent --batch \
--force -e "{}" >$tempfile
if [ -s $tempfile ]; then
(
/bin/echo -e "\n" \
"Improperly closed tables are also reported if clients are accessing\n" \
"the tables *now*. A list of current connections is below.\n";
$MYADMIN processlist status
) >> $tempfile
# Check for presence as a dependency on mailx would require an MTA.
if [ -x /usr/bin/mailx ]; then
mailx -e -s"$MYCHECK_SUBJECT" $MYCHECK_RCPT < $tempfile
fi
(echo "$MYCHECK_SUBJECT"; cat $tempfile) | logger -p daemon.warn -i -t$0
fi
rm $tempfile
}
## Check for tables needing an upgrade.
# - Requires the server to be up.
# - Is supposed to run silently in background.
function upgrade_system_tables_if_necessary() {
set -e
set -u
logger -p daemon.info -i -t$0 "Upgrading MySQL tables if necessary."
# Filter all "duplicate column", "duplicate key" and "unknown column"
# errors as the script is designed to be idempotent.
LC_ALL=C $MYUPGRADE \
2>&1 \
| egrep -v '^(1|@had|ERROR (1054|1060|1061))' \
| logger -p daemon.warn -i -t$0
}
## Check for the presence of both, root accounts with and without password.
# This might have been caused by a bug related to mysql_install_db (#418672).
function check_root_accounts() {
set -e
set -u
logger -p daemon.info -i -t$0 "Checking for insecure root accounts."
ret=$( echo "SELECT count(*) FROM mysql.user WHERE user='root' and password='';" | $MYSQL --skip-column-names )
if [ "$ret" -ne "0" ]; then
logger -p daemon.warn -i -t$0 "WARNING: mysql.user contains $ret root accounts without password!"
fi
}
#!/bin/bash
echo "$*" 1>&2
Changelog for innotop:
2017-01-20: version 1.11.4
* add SUM function for ONLY_FULL_GROUP_BY
2017-01-20: version 1.11.3
* Undisplay handlersocket's threads in hide_inactive
* fix runtime error regarding redundant sprintf argument #122
* added sort on connection-name in display M, after sql/io running, seconds behind master and channel_name
* fixed bug that removed value for cxn and channel_name columns in display M
* added sort on replication delay, so that the replication-display will sort on slave_sql_running, timelag (in minutes) and channel_name.
* support for MariaDB 10.0 in InnoDB row (issue 93)
2013-07-12: version 1.9.1
Bugs fixed:
* Support of MySQL 5.6 was broken on some pages (issue 82, 83)
* Deadlock clearing transactions is now not included in binary log
(issue 84)
* New spec file with requirements and build requirements for
CentOS/RHEL and Fedora
2012-09-07: version 1.9.0
Changes:
* A new Health Dashboard (A) mode is the default mode.
* Added a new InnoDB Locked (K) mode.
* Added a new 'spark' config variable for sparklines.
* Added a new fuzzy_time formatting function.
* Added "query distill" summarizing.
* Handled more types of errors connecting to the server.
* Displayed some data more compactly.
Bugs fixed:
* Double-quotes were used to terminate strings in SQL (issue 57).
* T mode didn't show InnoDB transaction times (issue 67).
* Killing a query didn't suggest the longest-running one automatically.
* Connections weren't closed on exit (issue 64).
* Q mode didn't have connections in its header (issue 63).
* Connections and server groups were poorly handled (issue 68).
* The RPM spec file was buggy (issue 59).
* Event filters were defined wrong (issue 54).
2012-02-25: version 1.8.1
Bugs fixed:
* Various parsing errors with MySQL 5.5 (issue 23, 45, 47, 51, 52, 53).
* RPM spec file prevented building on CentOS 5.5 using mock (issue 44).
* Tests worked only from the test subdirectory (issue 43).
2010-11-06: version 1.8.0
Changes:
* Don't re-fetch SHOW VARIABLES every iteration; it's too slow on many hosts.
* Add a filter to remove EVENT threads in SHOW PROCESSLIST (issue 32).
* Add a timestamp to output in -n mode, when -t is specified (issue 37).
* Add a new U mode, for Percona/MariaDB USER_STATISTICS (issue 39).
* Add support for millisecond query time in Percona Server (issue 39).
* Display a summary of queries executed in Query List mode (issue 26).
Bugs fixed:
* Made config-file reading more robust (issue 41).
* Hostname parsing wasn't standards compliant (issue 30).
* MKDEBUG didn't work on some Perl versions (issue 22).
* Don't try to get InnoDB status if have_innodb != YES (issue 33).
* Status text from the InnoDB plugin wasn't parsed correctly (issue 36).
* Transaction ID from InnoDB plugin wasn't subtracted correctly (issue 38).
* Switching modes and pressing ? for help caused a crash (issue 40).
2009-09-06: version 1.7.2
Changes:
* add support for --socket
Bugs fixed:
* remove cxn from $meta->{group_by} if there's only one connection displayed
* fix for issue 19 - cxn column won't become visible when viewing two
connections after having viewed one connection
* supress errors resulting from the addition of a 'BACKGROUND THREAD'
section in the output of 'show innodb status'
* possible fix for issue 22 - Useless use of a constant in void context
* small change to set_to_tbl() around hiding the cxn column if there
aren't two or more connections
2009-03-09: version 1.7.1
Changes:
* Don't display the CXN column if only one connection is active in
the current view
* the 'state' column is now visible by default in Query List mode
Bugs fixed:
* fixed bug where trying to aggregate the time column would result
in a crash if the time column had an undef value in it, which is
the case when a thread is in the 'Connect' state
* updated innotop.spec file to reflect current version
2009-02-23: version 1.7.0
Changes:
* supports a central config (/etc/innotop/innotop.conf)
* changed the default home directory config to ~/.innotop/innotop.conf
(away from .ini)
* embedded InnoDBParser.pm into innotop so it can be run with no
installation
* no longer writes a new config file by default
* added --skipcentral (skip reading central config) and --write (write
a config if none were loaded at start-up)
* if no config file is loaded, connect to a MySQL database on
localhost using mysql_read_default_group=client
* embedded maatkit's DSNParser.pm and added support for --user,
--password, --host, --port
* changed default mode from T (InnoDB Transactions) to Q (Query List)
* in addition to connected threads, now displays running and cached
threads in statusbar
* don't load connections from a config file if any DSN information or
a username or password is specified on the command-line
Bugs fixed:
* fixed bug preventing utilization of command-line options that
override default config settings if no config file was loaded
* fixed a bug where migrating from an old version of the config will
delete ~/innotop.ini, if it exists. Now uses File::Temp::tempfile().
2007-11-09: version 1.6.0
* S mode crashed on non-numeric values.
* New user-defined columns crashed upon restart.
* Added --color option to control terminal coloring.
2007-09-18: version 1.5.2
* Added the ability to monitor InnoDB status from a file.
* Changed W mode to L mode; it monitors all locks, not just lock waits.
2007-09-16: version 1.5.1
* Added C (Command Summary) mode.
* Fixed a bug in the 'avg' aggregate function.
2007-09-10: version 1.5.0
Changes:
* Added plugin functionality.
* Added group-by functionality.
* Moved the configuration file to a directory.
* Enhanced filtering and sorting on pivoted tables.
* Many small bug fixes.
2007-07-16: version 1.4.3
Changes:
* Added standard --version command-line option
* Changed colors to cyan instead of blue; more visible on dark terminals.
* Added information to the filter-choosing dialog.
* Added column auto-completion when entering a filter expression.
* Changed Term::ReadKey from optional to mandatory.
* Clarified username in password prompting.
* Ten thousand words of documentation!
Bugs fixed:
* innotop crashed in W mode when InnoDB status data was truncated.
* innotop didn't display errors in tables if debug was enabled.
* The colored() subroutine wasn't being created in non-interactive mode.
* Don't prompt to save password except the first time.
2007-05-03: version 1.4.2
This version contains all changes to the trunk until revision 239; some
changes in revisions 240:250 are included.
MAJOR CHANGES:
* Quick-filters to easily filter any column in any display
* Compatibility with MySQL 3.23 through 6.0
* Improved error handling when a server is down, permissions denied, etc
* Use additional SHOW INNODB STATUS information in 5.1.x
* Make all modes use tables consistently, so they can all be edited,
filtered, colored and sorted consistently
* Combine V, G and S modes into S mode, with v, g, and s hot-keys
* Let DBD driver read MySQL option files; permit connections without
user/pass/etc
* Compile SQL-like expressions into Perl subroutines; eliminate need to
know Perl
* Do not save all config data to config file, only save user's customizations
* Rewritten and improved command-line option handling
* Added --count, --delay, and other command-line options to support
run-and-exit operation
* Improve built-in variable sets
* Improve help screen with three-part balanced-column layout
* Simplify table-editor and improve hotkey support
* Require Perl to have high-resolution time support (Time::HiRes)
* Help the user choose a query to analyze or kill
* Enable EXPLAIN, show-full-query in T mode just like Q mode
* Let data-extraction access current, previous and incremental data sets
all at once
MINOR CHANGES:
* Column stabilizing for Q mode
* New color rules for T, Q, W modes
* Apply slave I/O filter to Q mode
* Improve detection of server version and other meta-data
* Make connection timeout a config variable
* Improve cross-version-compatible SQL syntax
* Get some information from the DBD driver instead of asking MySQL for it
* Improved error messages
* Improve server group creation/editing
* Improve connection/thread killing
* Fix broken key bindings and restore previously mapped hot-keys for
choosing columns
* Some documentation updates (but not nearly enough)
* Allow the user to specify graphing char in S mode (formerly G mode)
* Allow easy switching between variable sets in S mode
* Bind 'n' key globally to choose the 'next' server connection
* Bind '%' key globally to filter displayed tables
* Allow aligning columns on the decimal place for easy readability
* Add hide_hdr config variable to hide column headers in tables
* Add a feature to smartly run PURGE MASTER LOGS in Replication mode
* Enable debug mode as a globally configurable variable
* Improve error messages when an expression or filter doesn't compile or has
a run-time error; die on error when debug is enabled
* Allow user-configurable delays after executing SQL (to let the server
settle down before taking another measurement)
* Add an expression to show how long until a transaction is finished
* Add skip_innodb as a global config variable
* Add '%' after percentages to help disambiguate (user-configurable)
* Add column to M mode to help see how fast slave is catching up to master
BUG FIXES:
* T and W modes had wrong value for wait_status column
* Error tracking on connections didn't reset when the connection recovered
* wait_timeout on connections couldn't be set before MySQL 4.0.3
* There was a crash on 3.23 when wiping deadlocks
* Lettercase changes in some result sets (SHOW MASTER/SLAVE STATUS) between
MySQL versions crashed innotop
* Inactive connections crashed innotop upon access to DBD driver
* set_precision did not respect user defaults for number of digits
* --inc command-line option could not be negated
* InnoDB status parsing was not always parsing all needed information
* S mode (formerly G mode) could crash trying to divide non-numeric data
* M table didn't show Slave_open_temp_tables variable; incorrect lettercase
* DBD drivers with broken AutoCommit would crash innotop
* Some key bindings had incorrect labels
* Some config-file loading routines could load data for things that didn't
exist
* Headers printed too often in S mode
* High-resolution time was not used even when the user had it
* Non-interactive mode printed blank lines sometimes
* Q-mode header and statusbar showed different QPS numbers
* Formulas for key-cache and query-cache hit ratios were wrong
* Mac OS "Darwin" machines were mis-identified as Microsoft Windows
* Some multiplications crashed when given undefined input
* The commify transformation did not check its input and could crash
* Specifying an invalid mode on the command line or config file could crash
innotop
2007-03-29: version 1.4.1
* More tweaks to display of connection errors.
* Fixed a problem with skip-innodb in MySQL 5.1.
* Fix a bug with dead connections in single-connection mode.
* Fix a regex to allow parsing more data from truncated deadlocks.
* Don't load active cxns from the config file if the cxn isn't defined.
2007-03-03: version 1.4.0
* Further tweak error handling and display of connection errors
* More centralization of querying
* Fix forking so it doesn't kill all database connections
* Allow user to run innotop without permissions for GLOBAL variables and status
2007-02-11: version 1.3.6
* Handle some connection failures so innotop doesn't crash because of one server.
* Enable incremental display in more modes.
* Tweaks to colorizing, color editor, and default color rules.
* Tweaks to default sorting rules.
* Use prepared statements for efficiency.
* Bug fixes and code cleanups.
* Data storage is keyed on clock ticks now.
2007-02-03: version 1.3.5
* Bug fixes.
* More tools for editing configuration from within innotop.
* Filters and transformations are constrained to valid values.
* Support for colorizing rows.
* Sorting by multiple columns.
* Compress headers when display is very wide.
* Stabilize and limit column widths.
* Check config file formats when upgrading so upgrades go smoothly.
* Make D mode handle many connections at once.
* Extract simple expressions from data sets in column src property.
This makes innotop more awk-ish.
2007-01-16: version 1.3
* Readline support.
* Can be used unattended, or in a pipe-and-filter mode
where it outputs tab-separated data to standard output.
* You can specify a config file on the command line.
Config files can be marked read-only.
* Monitor multiple servers simultaneously.
* Server groups to help manage many servers conveniently.
* Monitor master/slave status, and control slaves.
* Columns can have user-defined expressions as their data sources.
* Better configuration tools.
* InnoDB status information is merged into SHOW VARIABLES and
SHOW STATUS information, so you can access it all together.
* High-precision time support in more places.
* Lots of tweaks to make things display more readably and compactly.
* Column transformations and filters.
2007-01-16: version 1.0.1
* NOTE: innotop is now hosted at Sourceforge, in Subversion not CVS.
The new project homepage is http://sourceforge.net/projects/innotop/
* Tweak default T/Q mode sort columns to match what people expect.
* Fix broken InnoDBParser.pm documentation (and hence man page).
2007-01-06: version 1.0
* NOTE: innotop is now hosted at Sourceforge, in Subversion not CVS.
The new project homepage is http://sourceforge.net/projects/innotop/
* Prevent control characters from freaking terminal out.
* Set timeout to keep busy servers from closing connection.
* There is only one InnoDB insert buffer.
* Make licenses clear and consistent.
2006-11-14: innotop 0.1.160, InnoDBParser version 1.69
* Support for ANSI color on Microsoft Windows (more readable, compact
display; thanks Gisbert W. Selke).
* Better handling of $ENV{HOME} on Windows.
* Added a LICENSE file to the package as per Gentoo bug:
http://bugs.gentoo.org/show_bug.cgi?id=147600
2006-11-11: innotop 0.1.157, InnoDBParser version 1.69
* Add Microsoft Windows support.
2006-10-19: innotop 0.1.154, InnoDBParser version 1.69
* Add O (Open Tables) mode
* Add some more checks to handle incomplete InnoDB status information
2006-09-30: innotop 0.1.152, InnoDBParser version 1.69
* Figured out what was wrong with package $VERSION variable: it wasn't
after the package declaration!
2006-09-28: innotop 0.1.152, InnoDBParser version 1.67
* Make more efforts towards crash-resistance and tolerance of completely
messed-up inputs. If innotop itself is broken, it is now much harder to
tell, because it just keeps on running without complaining.
* Fix a small bug parsing out some information and displaying it.
2006-09-05: innotop 0.1.149, InnoDBParser version 1.64
* Try to find and eliminate any parsing code that assumes pattern matches
will succeed.
2006-09-05: innotop 0.1.149, InnoDBParser version 1.62
* Make innotop crash-resistant, so I can declare it STABLE finally.
* Instead of using SQL conditional comments, detect MySQL version.
2006-08-22: innotop 0.1.147, InnoDBParser version 1.60
* Fix some innotop bugs with undefined values, bad formatting etc.
2006-08-19: innotop 0.1.146, InnoDBParser version 1.60
* Make innotop handle some unexpected NULL values in Q mode.
* Add OS wait information to W mode, so it is now "everything that waits."
* Center section captions better.
* Make R mode more readable and compact.
* Make InnoDBParser parse lock waits even when they've been waiting 0 secs.
2006-08-12: innotop 0.1.139, InnoDBParser version 1.59
* Add more documentation
* Tweak V mode to show more info in less space.
* Fix a bug in G mode.
2006-08-10: innotop 0.1.132, InnoDBParser version 1.58
* Handle yet more types of FK error... it will never end!
* Handle some special cases when DEADLOCK info truncated
* Add a bit more FK info to F mode in innotop
* More tests added to the test suite
2006-08-07: innotop 0.1.131, InnoDBParser version 1.55
* Fix another issue with configuration
* Handle another type of FK error
2006-08-03: innotop 0.1.130, InnoDBParser version 1.54
* Fix an issue loading config file
* Add heap_no to 'D' (InnoDB Deadlock) mode to ease deadlock debugging.
2006-08-02: innotop 0.1.128, InnoDBParser version 1.54
* Parse lock wait information from the TRANSACTION section.
* Even more OS-specific parsing... pain in the butt...
* Add 'W' (InnoDB Lock Wait) mode.
* Fix some minor display issues with statusbar.
2006-08-02: innotop 0.1.125, InnoDBParser version 1.50
* Don't try to get references to Perl built-in functions like time()
* Handle more OS-specific variations of InnoDB status text
* Add some more information to various places in innotop
2006-08-01: innotop 0.1.123, InnoDBParser version 1.47
* Enhance S and G modes: clear screen and re-print headers
* Don't crash when deadlock data is truncated
* Make Analyze mode say how to get back to whatever you came from
* Display 'nothing to display' when there is nothing
* Add ability to read InnoDB status text from a file (mostly helps test)
* Add table of Wait Array Information in Row Op/Semaphore mode
* Add table of lock information in InnoDB deadlock mode
* Ensure new features in upgrades don't get masked by existing config files
* Tweak default column choices for T mode
* Enhance foreign key parsing
* Enhance physical record and data tuple parsing
* Enhance lock parsing (handle old-style and new-style formats)
2006-07-24: innotop 0.1.112, InnoDBParser version 1.36
* InnoDBParser enhancements for FK error messages.
* A fix to innotop to prevent it from crashing while trying to display a FK
error message.
* Some minor cosmetic changes to number formatting in innotop.
2006-07-22: innotop 0.1.106, InnoDBParser version 1.35
* InnoDBParser is much more complete and accurate.
* Tons of bug fixes.
* Add partitions to EXPLAIN mode.
* Enhance Q mode header, add T mode header.
* Share some configuration variables across modes.
* Add formatted time columns to Q, T modes.
* Add command-line argument parsing.
* Turn off echo when asking for password.
* Add option to specify port when connecting.
* Let display-optimized-query display multiple notes.
* Lots of small improvements, such as showing more info in statusbar.
2006-07-02: innotop 0.1.74, InnoDBParser version 1.24
* Initial release for public consumption.
This diff is collapsed.
This diff is collapsed.
# MariaDB-specific config file.
# Read by /etc/mysql/my.cnf
[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
#default-character-set = utf8
[mysqld]
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
#character-set-server = utf8
#collation-server = utf8_general_ci
#character_set_server = utf8
#collation_server = utf8_general_ci
# MariaDB database server configuration file.
#
# You can copy this file to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
max_connections = 100
connect_timeout = 5
wait_timeout = 600
max_allowed_packet = 16M
thread_cache_size = 128
sort_buffer_size = 4M
bulk_insert_buffer_size = 16M
tmp_table_size = 32M
max_heap_table_size = 32M
#
# * MyISAM
#
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched. On error, make copy and try a repair.
myisam_recover_options = BACKUP
key_buffer_size = 128M
#open-files-limit = 2000
table_open_cache = 400
myisam_sort_buffer_size = 512M
concurrent_insert = 2
read_buffer_size = 2M
read_rnd_buffer_size = 1M
#
# * Query Cache Configuration
#
# Cache only tiny result sets, so we can fit more in the query cache.
query_cache_limit = 128K
query_cache_size = 64M
# for more write intensive setups, set to DEMAND or OFF
#query_cache_type = DEMAND
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# we do want to know about network errors and such
log_warnings = 2
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log[={0|1}]
slow_query_log_file = /var/log/mysql/mariadb-slow.log
long_query_time = 10
#log_slow_rate_limit = 1000
log_slow_verbosity = query_plan
#log-queries-not-using-indexes
#log_slow_admin_statements
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#report_host = master1
#auto_increment_increment = 2
#auto_increment_offset = 1
log_bin = /var/log/mysql/mariadb-bin
log_bin_index = /var/log/mysql/mariadb-bin.index
# not fab for performance, but safer
#sync_binlog = 1
expire_logs_days = 10
max_binlog_size = 100M
# slaves
#relay_log = /var/log/mysql/relay-bin
#relay_log_index = /var/log/mysql/relay-bin.index
#relay_log_info_file = /var/log/mysql/relay-bin.info
#log_slave_updates
#read_only
#
# If applications support it, this stricter sql_mode prevents some
# mistakes like inserting invalid dates etc.
#sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine = InnoDB
# you can't just change log file size, requires special procedure
#innodb_log_file_size = 50M
innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_file_per_table = 1
innodb_open_files = 400
innodb_io_capacity = 400
innodb_flush_method = O_DIRECT
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completion
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
[mysqld_safe]
skip_log_error
syslog
Supports Markdown
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