Browse Source

--getopt-prefix-matching command-line option

replace/d7d589dc01f6d70d1518b74d46fd3b75e76267f5
Sergei Golubchik 11 years ago
parent
commit
4280b25ed8
  1. 1
      include/my_getopt.h
  2. 2
      mysql-test/include/default_mysqld.cnf
  3. 13
      mysql-test/include/have_innodb.combinations
  4. 4
      mysql-test/include/have_xtradb.combinations
  5. 8
      mysql-test/r/information_schema_all_engines.result
  6. 5
      mysql-test/r/mysqld--help.result
  7. 2
      mysql-test/suite/engines/funcs/t/rpl_skip_error-slave.opt
  8. 2
      mysql-test/suite/maria/maria-recovery2-master.opt
  9. 2
      mysql-test/suite/parts/t/partition_debug_myisam-master.opt
  10. 2
      mysql-test/suite/parts/t/partition_recover_myisam-master.opt
  11. 2
      mysql-test/suite/parts/t/partition_repair_myisam-master.opt
  12. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow-master.opt
  13. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny-master.opt
  14. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow-master.opt
  15. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny-master.opt
  16. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow-master.opt
  17. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny-master.opt
  18. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow-master.opt
  19. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny-master.opt
  20. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin-master.opt
  21. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_blocked-master.opt
  22. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_max_con-master.opt
  23. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow-master.opt
  24. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny-master.opt
  25. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow-master.opt
  26. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny-master.opt
  27. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_passwd-master.opt
  28. 2
      mysql-test/suite/perfschema/t/hostcache_ipv6_ssl-master.opt
  29. 2
      mysql-test/suite/perfschema/t/short_option_1-master.opt
  30. 2
      mysql-test/suite/perfschema/t/start_server_nothing-master.opt
  31. 2
      mysql-test/suite/rpl/t/rpl_skip_error-slave.opt
  32. 2
      mysql-test/suite/rpl/t/rpl_skip_incident-slave.opt
  33. 4
      mysql-test/suite/sys_vars/r/sysvars_innodb.result
  34. 2
      mysql-test/suite/sys_vars/t/delay_key_write_func-master.opt
  35. 22
      mysql-test/suite/sys_vars/t/ignore_db_dirs_basic-master.opt
  36. 2
      mysql-test/t/merge_recover-master.opt
  37. 2
      mysql-test/t/show_check-master.opt
  38. 23
      mysys/my_getopt.c
  39. 6
      sql/mysqld.cc

1
include/my_getopt.h

@ -102,6 +102,7 @@ typedef void *(*my_getopt_value)(const char *, uint, const struct my_option *,
extern char *disabled_my_option;
extern my_bool my_getopt_print_errors;
extern my_bool my_getopt_skip_unknown;
extern my_bool my_getopt_prefix_matching;
extern my_error_reporter my_getopt_error_reporter;
extern int handle_options (int *argc, char ***argv,

2
mysql-test/include/default_mysqld.cnf

@ -16,6 +16,8 @@
# Default values that applies to all MySQL Servers
[mysqld]
disable-getopt-prefix-matching
open-files-limit= 1024
local-infile
character-set-server= latin1

13
mysql-test/include/have_innodb.combinations

@ -3,12 +3,14 @@ ignore-builtin-innodb
plugin-load-add=$HA_INNODB_SO
innodb
innodb-cmpmem
innodb-cmp-per-index
innodb-trx
innodb-locks
innodb-buffer-pool-stats
innodb-buffer-page
innodb-buffer-page-lru
innodb-sys-foreign
innodb-sys-foreign-col
innodb-sys-foreign-cols
innodb-sys-tables
innodb-metrics
@ -17,24 +19,27 @@ ignore-builtin-innodb
plugin-load-add=$HA_XTRADB_SO
innodb
innodb-cmpmem
innodb-cmp-per-index
innodb-trx
innodb-locks
innodb-buffer-pool-stats
innodb-buffer-page
innodb-buffer-page-lru
innodb-sys-foreign
innodb-sys-foreign-col
innodb-sys-foreign-cols
innodb-sys-tables
innodb-metrics
[xtradb]
innodb
innodb-cmpmem
innodb-cmp-per-index
innodb-trx
innodb-locks
innodb-metrics
innodb-buffer-pool-stats
innodb-buffer-page
innodb-buffer-page-lru
innodb-sys-foreign
innodb-sys-foreign-col
innodb-sys-foreign-cols
innodb-sys-tables
innodb-metrics

4
mysql-test/include/have_xtradb.combinations

@ -4,10 +4,10 @@ plugin-load-add=$HA_XTRADB_SO
innodb
innodb-cmpmem
innodb-trx
innodb-sys-index
innodb-sys-indexes
[xtradb]
innodb
innodb-cmpmem
innodb-trx
innodb-sys-index
innodb-sys-indexes

8
mysql-test/r/information_schema_all_engines.result

@ -23,7 +23,6 @@ INNODB_CMPMEM
INNODB_CMPMEM_RESET
INNODB_CMP_PER_INDEX
INNODB_CMP_RESET
INNODB_LOCKS
INNODB_LOCK_WAITS
INNODB_SYS_COLUMNS
INNODB_SYS_FIELDS
@ -95,7 +94,6 @@ INNODB_CMPMEM page_size
INNODB_CMPMEM_RESET page_size
INNODB_CMP_PER_INDEX database_name
INNODB_CMP_RESET page_size
INNODB_LOCKS lock_id
INNODB_LOCK_WAITS requesting_trx_id
INNODB_SYS_COLUMNS TABLE_ID
INNODB_SYS_FIELDS INDEX_ID
@ -167,7 +165,6 @@ INNODB_CMPMEM page_size
INNODB_CMPMEM_RESET page_size
INNODB_CMP_PER_INDEX database_name
INNODB_CMP_RESET page_size
INNODB_LOCKS lock_id
INNODB_LOCK_WAITS requesting_trx_id
INNODB_SYS_COLUMNS TABLE_ID
INNODB_SYS_FIELDS INDEX_ID
@ -244,7 +241,6 @@ INNODB_CMPMEM information_schema.INNODB_CMPMEM 1
INNODB_CMPMEM_RESET information_schema.INNODB_CMPMEM_RESET 1
INNODB_CMP_PER_INDEX information_schema.INNODB_CMP_PER_INDEX 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_SYS_COLUMNS information_schema.INNODB_SYS_COLUMNS 1
INNODB_SYS_FIELDS information_schema.INNODB_SYS_FIELDS 1
@ -306,7 +302,6 @@ Database: information_schema
| INNODB_CMPMEM_RESET |
| INNODB_CMP_PER_INDEX |
| INNODB_CMP_RESET |
| INNODB_LOCKS |
| INNODB_LOCK_WAITS |
| INNODB_SYS_COLUMNS |
| INNODB_SYS_FIELDS |
@ -368,7 +363,6 @@ Database: INFORMATION_SCHEMA
| INNODB_CMPMEM_RESET |
| INNODB_CMP_PER_INDEX |
| INNODB_CMP_RESET |
| INNODB_LOCKS |
| INNODB_LOCK_WAITS |
| INNODB_SYS_COLUMNS |
| INNODB_SYS_FIELDS |
@ -411,5 +405,5 @@ Wildcard: inf_rmation_schema
| information_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(*)
information_schema 57
information_schema 56
mysql 30

5
mysql-test/r/mysqld--help.result

@ -205,6 +205,10 @@ The following options may be given as the first argument:
mysql.general_logif --log-output=TABLE is used
--general-log-file=name
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=#
The maximum length of the result of function
GROUP_CONCAT()
@ -1152,6 +1156,7 @@ ft-query-expansion-limit 20
ft-stopword-file (No default value)
gdb FALSE
general-log FALSE
getopt-prefix-matching TRUE
group-concat-max-len 1024
gtid-domain-id 0
gtid-ignore-duplicates FALSE

2
mysql-test/suite/engines/funcs/t/rpl_skip_error-slave.opt

@ -1 +1 @@
--slave-skip-error=1053,1062,1582
--slave-skip-errors=1053,1062,1582

2
mysql-test/suite/maria/maria-recovery2-master.opt

@ -1 +1 @@
--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=

2
mysql-test/suite/parts/t/partition_debug_myisam-master.opt

@ -1 +1 @@
--skip-stack-trace --skip-core-file --myisam-recover-option=off
--skip-stack-trace --skip-core-file --myisam-recover-options=off

2
mysql-test/suite/parts/t/partition_recover_myisam-master.opt

@ -1 +1 @@
--myisam-recover
--myisam-recover-options

2
mysql-test/suite/parts/t/partition_repair_myisam-master.opt

@ -1 +1 @@
--myisam-recover=off
--myisam-recover-options=off

2
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_blocked-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_max_con-master.opt

@ -1,2 +1,2 @@
--bind-addr=::
--bind-address=::
--max-user-connections=1024

2
mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_passwd-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/hostcache_ipv6_ssl-master.opt

@ -1 +1 @@
--bind-addr=::
--bind-address=::

2
mysql-test/suite/perfschema/t/short_option_1-master.opt

@ -1 +1 @@
-a -Cutf8 --collation=utf8_bin -T12 -W3
-a -Cutf8 --collation-server=utf8_bin -T12 -W3

2
mysql-test/suite/perfschema/t/start_server_nothing-master.opt

@ -35,5 +35,5 @@
--loose-performance_schema_events_statements_history_long_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

2
mysql-test/suite/rpl/t/rpl_skip_error-slave.opt

@ -1 +1 @@
--slave-skip-error=1062
--slave-skip-errors=1062

2
mysql-test/suite/rpl/t/rpl_skip_incident-slave.opt

@ -1 +1 @@
--slave-skip-error=1590
--slave-skip-errors=1590

4
mysql-test/suite/sys_vars/r/sysvars_innodb.result

@ -386,7 +386,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_CMP_PER_INDEX_ENABLED
SESSION_VALUE NULL
GLOBAL_VALUE OFF
GLOBAL_VALUE_ORIGIN CONFIG
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
@ -1114,7 +1114,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
GLOBAL_VALUE_ORIGIN CONFIG
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN

2
mysql-test/suite/sys_vars/t/delay_key_write_func-master.opt

@ -1,2 +1,2 @@
--myisam-recover=BACKUP,FORCE
--myisam-recover-options=BACKUP,FORCE

22
mysql-test/suite/sys_vars/t/ignore_db_dirs_basic-master.opt

@ -1,11 +1,11 @@
--ignore-db-dir=a
--ignore-db-dir=b
--ignore-db-dir=c
--ignore-db-dir=
--ignore-db-dir=d
--ignore-db-dir x
--ignore-db-dir=
--ignore-db-dir=e
--ignore-db-dir=lost+found
--ignore-db-dir=.mysqlgui
--ignore-db-dir=ignored_db
--ignore-db-dirs=a
--ignore-db-dirs=b
--ignore-db-dirs=c
--ignore-db-dirs=
--ignore-db-dirs=d
--ignore-db-dirs x
--ignore-db-dirs=
--ignore-db-dirs=e
--ignore-db-dirs=lost+found
--ignore-db-dirs=.mysqlgui
--ignore-db-dirs=ignored_db

2
mysql-test/t/merge_recover-master.opt

@ -1 +1 @@
--myisam-recover=force
--myisam-recover-options=force

2
mysql-test/t/show_check-master.opt

@ -1 +1 @@
--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=""

23
mysys/my_getopt.c

@ -56,7 +56,7 @@ enum enum_special_opt
char *disabled_my_option= (char*) "0";
char *enabled_my_option= (char*) "1";
/*
/*
This is a flag that can be set in client programs. 0 means that
my_getopt will not print error messages, but the client should do
it by itself
@ -64,13 +64,21 @@ char *enabled_my_option= (char*) "1";
my_bool my_getopt_print_errors= 1;
/*
/*
This is a flag that can be set in client programs. 1 means that
my_getopt will skip over options it does not know how to handle.
*/
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,
const char *format, ...)
{
@ -851,6 +859,9 @@ static int findopt(char *optpat, uint length,
if (!opt->name[length]) /* Exact match */
DBUG_RETURN(1);
if (!my_getopt_prefix_matching)
continue;
if (!count)
{
/* We only need to know one prev */
@ -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);
}

6
sql/mysqld.cc

@ -839,8 +839,12 @@ static struct my_option pfs_early_options[]=
"Default startup value for the statements_digest consumer.",
&pfs_param.m_consumer_statement_digest_enabled,
&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 */
{"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

Loading…
Cancel
Save