mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Remove mysqldump prompt, add --all-databases, and make --databases or --all-databases required to do mysqldump (Schema section).
This commit is contained in:
@@ -963,7 +963,7 @@ get_mysqldump_for () {
|
||||
$CMD_MYSQLDUMP $EXT_ARGV --no-data --skip-comments \
|
||||
--skip-add-locks --skip-add-drop-table --compact \
|
||||
--skip-lock-all-tables --skip-lock-tables --skip-set-charset \
|
||||
${args} --databases $( local IFS=,; echo ${dbtodump})
|
||||
${args} --databases $(local IFS=,; echo ${dbtodump})
|
||||
}
|
||||
|
||||
get_mysqldump_args () {
|
||||
@@ -2243,24 +2243,14 @@ report_mysql_summary () {
|
||||
fi
|
||||
|
||||
section "Schema"
|
||||
local reply="n"
|
||||
if [ "${OPT_DATABASES}" ] || [ "${OPT_READ_SAMPLES}" ] \
|
||||
|| [ -e "$dir/mysqldump" -a -s "$dir/mysqldump" ]; then
|
||||
reply="y"
|
||||
elif [ -t 0 -a -t 1 ]; then
|
||||
echo -n "Would you like to mysqldump -d the schema and analyze it? y/n "
|
||||
read reply
|
||||
reply=${reply:-n}
|
||||
fi
|
||||
if echo "${reply:-n}" | grep -i '^y' > /dev/null ; then
|
||||
if [ -z "${OPT_DATABASES}" ] && [ -z "$OPT_READ_SAMPLES" ] \
|
||||
&& [ ! -e "$dir/mysqldump" ]; then
|
||||
echo "There are ${num_dbs} databases. Would you like to dump all, or just one?"
|
||||
echo -n "Type the name of the database, or press Enter to dump all of them. "
|
||||
local dbtodump=""
|
||||
read dbtodump
|
||||
local trg_arg="$( get_mysqldump_args "$dir/mysql-variables" )"
|
||||
get_mysqldump_for "${trg_arg}" "${dbtodump}" > "$dir/mysqldump"
|
||||
if [ "${OPT_DATABASES}" ] \
|
||||
|| [ "${OPT_ALL_DATABASES}" ] \
|
||||
|| [ "${OPT_READ_SAMPLES}" ]; then
|
||||
|
||||
if [ -z "$OPT_READ_SAMPLES" ]; then
|
||||
local trg_arg="$(get_mysqldump_args "$dir/mysql-variables")"
|
||||
local dbstodump="${OPT_DATABASES:-""}"
|
||||
get_mysqldump_for "${trg_arg}" "${OPT_DATABASES}" > "$dir/mysqldump"
|
||||
fi
|
||||
|
||||
if [ -e "$dir/mysqldump" -a -s "$dir/mysqldump" ] \
|
||||
@@ -2273,7 +2263,7 @@ report_mysql_summary () {
|
||||
echo "Skipping schema analysis due to apparent error in dump file"
|
||||
fi
|
||||
else
|
||||
echo "Skipping schema analysis"
|
||||
echo "Specify --databases or --all-databases to dump and summarize schemas"
|
||||
fi
|
||||
|
||||
section "Noteworthy Technologies"
|
||||
@@ -2731,10 +2721,6 @@ the percentage of the cache in use and the hit-to-insert ratio. The latter two
|
||||
are fuzzy-rounded.
|
||||
|
||||
# Schema #####################################################
|
||||
Would you like to mysqldump -d the schema and analyze it? y/n y
|
||||
There are 4 databases. Would you like to dump all, or just one?
|
||||
Type the name of the database, or press Enter to dump all of them.
|
||||
|
||||
Database Tables Views SPs Trigs Funcs FKs Partn
|
||||
mysql 24
|
||||
performance_schema 17
|
||||
@@ -2765,16 +2751,10 @@ are fuzzy-rounded.
|
||||
performance_schema 5 16 33
|
||||
sakila 1 15 1 3 4 3 19 42 26
|
||||
|
||||
If you select to dump the schema and analyze it, the tool will print the above
|
||||
section. This summarizes the number and type of objects in the database. It is
|
||||
generated by running C<mysqldump --no-data>, not by querying the
|
||||
INFORMATION_SCHEMA, which can freeze a busy server. You can use the
|
||||
L<"--databases"> option to specify which databases to examine. If you do not,
|
||||
and you run the tool interactively, it will prompt you as shown.
|
||||
|
||||
You can choose not to dump the schema, to dump all of the databases, or to dump
|
||||
only a single named one, by specifying the appropriate options. In the example
|
||||
above, we are dumping all databases.
|
||||
If you specify L<"--databases"> or L<"--all-databases">, the tool will print
|
||||
the above section. This summarizes the number and type of objects in the
|
||||
databases. It is generated by running C<mysqldump --no-data>, not by querying
|
||||
the INFORMATION_SCHEMA, which can freeze a busy server.
|
||||
|
||||
The first sub-report in the section is the count of objects by type in each
|
||||
database: tables, views, and so on. The second one shows how many tables use
|
||||
@@ -2949,6 +2929,10 @@ All options after -- are passed to C<mysql>.
|
||||
|
||||
=over
|
||||
|
||||
=item --all-databases
|
||||
|
||||
C<mysqldump> and summarize all L<"--databases">.
|
||||
|
||||
=item --config
|
||||
|
||||
type: string
|
||||
@@ -2960,9 +2944,8 @@ first option on the command line.
|
||||
|
||||
type: string
|
||||
|
||||
Names of databases to summarize. If you want all of them, you can use the value
|
||||
C<--all-databases>; you can also pass in a comma-separated list of database
|
||||
names. If not provided, the program will ask you for manual input.
|
||||
C<mysqldump> and summarize this comma-separated list of databases. Specify
|
||||
L<"--all-databases"> instead if you want to dump and summary all databases.
|
||||
|
||||
=item --defaults-file
|
||||
|
||||
|
Reference in New Issue
Block a user