Commit 4280b25e authored by Sergei Golubchik's avatar Sergei Golubchik

--getopt-prefix-matching command-line option

parent 0ce8703e
...@@ -102,6 +102,7 @@ typedef void *(*my_getopt_value)(const char *, uint, const struct my_option *, ...@@ -102,6 +102,7 @@ typedef void *(*my_getopt_value)(const char *, uint, const struct my_option *,
extern char *disabled_my_option; extern char *disabled_my_option;
extern my_bool my_getopt_print_errors; extern my_bool my_getopt_print_errors;
extern my_bool my_getopt_skip_unknown; extern my_bool my_getopt_skip_unknown;
extern my_bool my_getopt_prefix_matching;
extern my_error_reporter my_getopt_error_reporter; extern my_error_reporter my_getopt_error_reporter;
extern int handle_options (int *argc, char ***argv, extern int handle_options (int *argc, char ***argv,
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
# Default values that applies to all MySQL Servers # Default values that applies to all MySQL Servers
[mysqld] [mysqld]
disable-getopt-prefix-matching
open-files-limit= 1024 open-files-limit= 1024
local-infile local-infile
character-set-server= latin1 character-set-server= latin1
......
...@@ -3,12 +3,14 @@ ignore-builtin-innodb ...@@ -3,12 +3,14 @@ ignore-builtin-innodb
plugin-load-add=$HA_INNODB_SO plugin-load-add=$HA_INNODB_SO
innodb innodb
innodb-cmpmem innodb-cmpmem
innodb-cmp-per-index
innodb-trx innodb-trx
innodb-locks
innodb-buffer-pool-stats innodb-buffer-pool-stats
innodb-buffer-page innodb-buffer-page
innodb-buffer-page-lru innodb-buffer-page-lru
innodb-sys-foreign innodb-sys-foreign
innodb-sys-foreign-col innodb-sys-foreign-cols
innodb-sys-tables innodb-sys-tables
innodb-metrics innodb-metrics
...@@ -17,24 +19,27 @@ ignore-builtin-innodb ...@@ -17,24 +19,27 @@ ignore-builtin-innodb
plugin-load-add=$HA_XTRADB_SO plugin-load-add=$HA_XTRADB_SO
innodb innodb
innodb-cmpmem innodb-cmpmem
innodb-cmp-per-index
innodb-trx innodb-trx
innodb-locks
innodb-buffer-pool-stats innodb-buffer-pool-stats
innodb-buffer-page innodb-buffer-page
innodb-buffer-page-lru innodb-buffer-page-lru
innodb-sys-foreign innodb-sys-foreign
innodb-sys-foreign-col innodb-sys-foreign-cols
innodb-sys-tables innodb-sys-tables
innodb-metrics innodb-metrics
[xtradb] [xtradb]
innodb innodb
innodb-cmpmem innodb-cmpmem
innodb-cmp-per-index
innodb-trx innodb-trx
innodb-locks
innodb-metrics innodb-metrics
innodb-buffer-pool-stats innodb-buffer-pool-stats
innodb-buffer-page innodb-buffer-page
innodb-buffer-page-lru innodb-buffer-page-lru
innodb-sys-foreign innodb-sys-foreign
innodb-sys-foreign-col innodb-sys-foreign-cols
innodb-sys-tables innodb-sys-tables
innodb-metrics
...@@ -4,10 +4,10 @@ plugin-load-add=$HA_XTRADB_SO ...@@ -4,10 +4,10 @@ plugin-load-add=$HA_XTRADB_SO
innodb innodb
innodb-cmpmem innodb-cmpmem
innodb-trx innodb-trx
innodb-sys-index innodb-sys-indexes
[xtradb] [xtradb]
innodb innodb
innodb-cmpmem innodb-cmpmem
innodb-trx innodb-trx
innodb-sys-index innodb-sys-indexes
...@@ -23,7 +23,6 @@ INNODB_CMPMEM ...@@ -23,7 +23,6 @@ INNODB_CMPMEM
INNODB_CMPMEM_RESET INNODB_CMPMEM_RESET
INNODB_CMP_PER_INDEX INNODB_CMP_PER_INDEX
INNODB_CMP_RESET INNODB_CMP_RESET
INNODB_LOCKS
INNODB_LOCK_WAITS INNODB_LOCK_WAITS
INNODB_SYS_COLUMNS INNODB_SYS_COLUMNS
INNODB_SYS_FIELDS INNODB_SYS_FIELDS
...@@ -95,7 +94,6 @@ INNODB_CMPMEM page_size ...@@ -95,7 +94,6 @@ INNODB_CMPMEM page_size
INNODB_CMPMEM_RESET page_size INNODB_CMPMEM_RESET page_size
INNODB_CMP_PER_INDEX database_name INNODB_CMP_PER_INDEX database_name
INNODB_CMP_RESET page_size INNODB_CMP_RESET page_size
INNODB_LOCKS lock_id
INNODB_LOCK_WAITS requesting_trx_id INNODB_LOCK_WAITS requesting_trx_id
INNODB_SYS_COLUMNS TABLE_ID INNODB_SYS_COLUMNS TABLE_ID
INNODB_SYS_FIELDS INDEX_ID INNODB_SYS_FIELDS INDEX_ID
...@@ -167,7 +165,6 @@ INNODB_CMPMEM page_size ...@@ -167,7 +165,6 @@ INNODB_CMPMEM page_size
INNODB_CMPMEM_RESET page_size INNODB_CMPMEM_RESET page_size
INNODB_CMP_PER_INDEX database_name INNODB_CMP_PER_INDEX database_name
INNODB_CMP_RESET page_size INNODB_CMP_RESET page_size
INNODB_LOCKS lock_id
INNODB_LOCK_WAITS requesting_trx_id INNODB_LOCK_WAITS requesting_trx_id
INNODB_SYS_COLUMNS TABLE_ID INNODB_SYS_COLUMNS TABLE_ID
INNODB_SYS_FIELDS INDEX_ID INNODB_SYS_FIELDS INDEX_ID
...@@ -244,7 +241,6 @@ INNODB_CMPMEM information_schema.INNODB_CMPMEM 1 ...@@ -244,7 +241,6 @@ INNODB_CMPMEM information_schema.INNODB_CMPMEM 1
INNODB_CMPMEM_RESET information_schema.INNODB_CMPMEM_RESET 1 INNODB_CMPMEM_RESET information_schema.INNODB_CMPMEM_RESET 1
INNODB_CMP_PER_INDEX information_schema.INNODB_CMP_PER_INDEX 1 INNODB_CMP_PER_INDEX information_schema.INNODB_CMP_PER_INDEX 1
INNODB_CMP_RESET information_schema.INNODB_CMP_RESET 1 INNODB_CMP_RESET information_schema.INNODB_CMP_RESET 1
INNODB_LOCKS information_schema.INNODB_LOCKS 1
INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1 INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
INNODB_SYS_COLUMNS information_schema.INNODB_SYS_COLUMNS 1 INNODB_SYS_COLUMNS information_schema.INNODB_SYS_COLUMNS 1
INNODB_SYS_FIELDS information_schema.INNODB_SYS_FIELDS 1 INNODB_SYS_FIELDS information_schema.INNODB_SYS_FIELDS 1
...@@ -306,7 +302,6 @@ Database: information_schema ...@@ -306,7 +302,6 @@ Database: information_schema
| INNODB_CMPMEM_RESET | | INNODB_CMPMEM_RESET |
| INNODB_CMP_PER_INDEX | | INNODB_CMP_PER_INDEX |
| INNODB_CMP_RESET | | INNODB_CMP_RESET |
| INNODB_LOCKS |
| INNODB_LOCK_WAITS | | INNODB_LOCK_WAITS |
| INNODB_SYS_COLUMNS | | INNODB_SYS_COLUMNS |
| INNODB_SYS_FIELDS | | INNODB_SYS_FIELDS |
...@@ -368,7 +363,6 @@ Database: INFORMATION_SCHEMA ...@@ -368,7 +363,6 @@ Database: INFORMATION_SCHEMA
| INNODB_CMPMEM_RESET | | INNODB_CMPMEM_RESET |
| INNODB_CMP_PER_INDEX | | INNODB_CMP_PER_INDEX |
| INNODB_CMP_RESET | | INNODB_CMP_RESET |
| INNODB_LOCKS |
| INNODB_LOCK_WAITS | | INNODB_LOCK_WAITS |
| INNODB_SYS_COLUMNS | | INNODB_SYS_COLUMNS |
| INNODB_SYS_FIELDS | | INNODB_SYS_FIELDS |
...@@ -411,5 +405,5 @@ Wildcard: inf_rmation_schema ...@@ -411,5 +405,5 @@ Wildcard: inf_rmation_schema
| information_schema | | information_schema |
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA; SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA;
table_schema count(*) table_schema count(*)
information_schema 57 information_schema 56
mysql 30 mysql 30
...@@ -205,6 +205,10 @@ The following options may be given as the first argument: ...@@ -205,6 +205,10 @@ The following options may be given as the first argument:
mysql.general_logif --log-output=TABLE is used mysql.general_logif --log-output=TABLE is used
--general-log-file=name --general-log-file=name
Log connections and queries to given file Log connections and queries to given file
--getopt-prefix-matching
Recognize command-line options by their unambiguos
prefixes.
(Defaults to on; use --skip-getopt-prefix-matching to disable.)
--group-concat-max-len=# --group-concat-max-len=#
The maximum length of the result of function The maximum length of the result of function
GROUP_CONCAT() GROUP_CONCAT()
...@@ -1152,6 +1156,7 @@ ft-query-expansion-limit 20 ...@@ -1152,6 +1156,7 @@ ft-query-expansion-limit 20
ft-stopword-file (No default value) ft-stopword-file (No default value)
gdb FALSE gdb FALSE
general-log FALSE general-log FALSE
getopt-prefix-matching TRUE
group-concat-max-len 1024 group-concat-max-len 1024
gtid-domain-id 0 gtid-domain-id 0
gtid-ignore-duplicates FALSE gtid-ignore-duplicates FALSE
......
--slave-skip-error=1053,1062,1582 --slave-skip-errors=1053,1062,1582
--skip-stack-trace --skip-core-file --loose-aria-log-dir-path=$MYSQLTEST_VARDIR/tmp --myisam-recover= --skip-stack-trace --skip-core-file --loose-aria-log-dir-path=$MYSQLTEST_VARDIR/tmp --myisam-recover-options=
--skip-stack-trace --skip-core-file --myisam-recover-option=off --skip-stack-trace --skip-core-file --myisam-recover-options=off
--bind-addr=:: --bind-address=::
--max-user-connections=1024 --max-user-connections=1024
-a -Cutf8 --collation=utf8_bin -T12 -W3 -a -Cutf8 --collation-server=utf8_bin -T12 -W3
...@@ -35,5 +35,5 @@ ...@@ -35,5 +35,5 @@
--loose-performance_schema_events_statements_history_long_size=0 --loose-performance_schema_events_statements_history_long_size=0
--loose-performance_schema_events_statements_history_size=0 --loose-performance_schema_events_statements_history_size=0
--loose-performance_schema_session_connect_attrs=0 --loose-performance_schema_session_connect_attrs_size=0
--slave-skip-error=1062 --slave-skip-errors=1062
--slave-skip-error=1590 --slave-skip-errors=1590
...@@ -386,7 +386,7 @@ COMMAND_LINE_ARGUMENT REQUIRED ...@@ -386,7 +386,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_CMP_PER_INDEX_ENABLED VARIABLE_NAME INNODB_CMP_PER_INDEX_ENABLED
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE OFF GLOBAL_VALUE OFF
GLOBAL_VALUE_ORIGIN CONFIG GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE OFF DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN VARIABLE_TYPE BOOLEAN
...@@ -1114,7 +1114,7 @@ COMMAND_LINE_ARGUMENT REQUIRED ...@@ -1114,7 +1114,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE OFF GLOBAL_VALUE OFF
GLOBAL_VALUE_ORIGIN CONFIG GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE OFF DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN VARIABLE_TYPE BOOLEAN
......
--myisam-recover=BACKUP,FORCE --myisam-recover-options=BACKUP,FORCE
--ignore-db-dir=a --ignore-db-dirs=a
--ignore-db-dir=b --ignore-db-dirs=b
--ignore-db-dir=c --ignore-db-dirs=c
--ignore-db-dir= --ignore-db-dirs=
--ignore-db-dir=d --ignore-db-dirs=d
--ignore-db-dir x --ignore-db-dirs x
--ignore-db-dir= --ignore-db-dirs=
--ignore-db-dir=e --ignore-db-dirs=e
--ignore-db-dir=lost+found --ignore-db-dirs=lost+found
--ignore-db-dir=.mysqlgui --ignore-db-dirs=.mysqlgui
--ignore-db-dir=ignored_db --ignore-db-dirs=ignored_db
--myisam-recover=force --myisam-recover-options=force
--log-output=table,file --slow-query-log --log-queries-not-using-indexes --myisam-recover="" --log-output=table,file --slow-query-log --log-queries-not-using-indexes --myisam-recover-options=""
...@@ -71,6 +71,14 @@ my_bool my_getopt_print_errors= 1; ...@@ -71,6 +71,14 @@ my_bool my_getopt_print_errors= 1;
my_bool my_getopt_skip_unknown= 0; my_bool my_getopt_skip_unknown= 0;
/*
This is a flag that can be set in client programs. 1 means that
my_getopt will reconize command line options by their unambiguous
prefixes. 0 means an option must be always specified in full.
*/
my_bool my_getopt_prefix_matching= 1;
static void default_reporter(enum loglevel level, static void default_reporter(enum loglevel level,
const char *format, ...) const char *format, ...)
{ {
...@@ -851,6 +859,9 @@ static int findopt(char *optpat, uint length, ...@@ -851,6 +859,9 @@ static int findopt(char *optpat, uint length,
if (!opt->name[length]) /* Exact match */ if (!opt->name[length]) /* Exact match */
DBUG_RETURN(1); DBUG_RETURN(1);
if (!my_getopt_prefix_matching)
continue;
if (!count) if (!count)
{ {
/* We only need to know one prev */ /* We only need to know one prev */
...@@ -867,6 +878,14 @@ static int findopt(char *optpat, uint length, ...@@ -867,6 +878,14 @@ static int findopt(char *optpat, uint length,
} }
} }
} }
if (count == 1)
my_getopt_error_reporter(INFORMATION_LEVEL,
"Using unique option prefix '%.*s' is error-prone "
"and can break in the future. "
"Please use the full name '%s' instead.",
length, optpat, *ffname);
DBUG_RETURN(count); DBUG_RETURN(count);
} }
......
...@@ -839,8 +839,12 @@ static struct my_option pfs_early_options[]= ...@@ -839,8 +839,12 @@ static struct my_option pfs_early_options[]=
"Default startup value for the statements_digest consumer.", "Default startup value for the statements_digest consumer.",
&pfs_param.m_consumer_statement_digest_enabled, &pfs_param.m_consumer_statement_digest_enabled,
&pfs_param.m_consumer_statement_digest_enabled, 0, &pfs_param.m_consumer_statement_digest_enabled, 0,
GET_BOOL, OPT_ARG, TRUE, 0, 0, 0, 0, 0} GET_BOOL, OPT_ARG, TRUE, 0, 0, 0, 0, 0},
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */ #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
{"getopt-prefix-matching", 0,
"Recognize command-line options by their unambiguos prefixes.",
&my_getopt_prefix_matching, &my_getopt_prefix_matching, 0, GET_BOOL,
NO_ARG, 1, 0, 1, 0, 0, 0}
}; };
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
......
Markdown is supported
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