Skip to content

Commit dc64ba2

Browse files
committed
MDEV-6137 better help for SET/ENUM sysvars
Auto-generate the allowed list of values for enum/set/flagset options in --help output. But don't do that when the help text already has them. Also, remove lists of values from help strings of various options, where they were simply listed without any additional information.
1 parent 0cb7c19 commit dc64ba2

22 files changed

+263
-260
lines changed

mysql-test/mysql-test-run.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,7 +1900,7 @@ sub collect_mysqld_features {
19001900
# they are listed in the --help output as
19011901
# --archive[=name] Enable or disable ARCHIVE plugin. Possible values are ON, OFF, FORCE (don't start if the plugin fails to load).
19021902
push @optional_plugins, $1
1903-
if /^ --([-a-z0-9]+)\[=name\] +Enable or disable \w+ plugin. Possible values are ON, OFF, FORCE/;
1903+
if /^ --([-a-z0-9]+)\[=name\] +Enable or disable \w+ plugin. One of: ON, OFF, FORCE/;
19041904
next;
19051905
}
19061906

mysql-test/r/myisam.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ test.t2 984116287
656656
drop table t1, t2;
657657
show variables like 'myisam_stats_method';
658658
Variable_name Value
659-
myisam_stats_method nulls_unequal
659+
myisam_stats_method NULLS_UNEQUAL
660660
create table t1 (a int, key(a));
661661
insert into t1 values (0),(1),(2),(3),(4);
662662
insert into t1 select NULL from t1;
@@ -677,7 +677,7 @@ t1 1 a 1 a A 10 NULL NULL YES BTREE
677677
set myisam_stats_method=nulls_equal;
678678
show variables like 'myisam_stats_method';
679679
Variable_name Value
680-
myisam_stats_method nulls_equal
680+
myisam_stats_method NULLS_EQUAL
681681
insert into t1 values (11);
682682
delete from t1 where a=11;
683683
analyze table t1;
@@ -697,7 +697,7 @@ t1 1 a 1 a A 5 NULL NULL YES BTREE
697697
set myisam_stats_method=DEFAULT;
698698
show variables like 'myisam_stats_method';
699699
Variable_name Value
700-
myisam_stats_method nulls_unequal
700+
myisam_stats_method NULLS_UNEQUAL
701701
insert into t1 values (11);
702702
delete from t1 where a=11;
703703
analyze table t1;
@@ -718,7 +718,7 @@ drop table t1;
718718
set myisam_stats_method=nulls_ignored;
719719
show variables like 'myisam_stats_method';
720720
Variable_name Value
721-
myisam_stats_method nulls_ignored
721+
myisam_stats_method NULLS_IGNORED
722722
create table t1 (
723723
a char(3), b char(4), c char(5), d char(6),
724724
key(a,b,c,d)

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

Lines changed: 64 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ The following options may be given as the first argument:
3939
increase this to get more performance
4040
--binlog-checksum=name
4141
Type of BINLOG_CHECKSUM_ALG. Include checksum for log
42-
events in the binary log. Possible values are NONE and
43-
CRC32; default is NONE.
42+
events in the binary log. One of: NONE, CRC32
4443
--binlog-commit-wait-count=#
4544
If non-zero, binlog write will wait at most
4645
binlog_commit_wait_usec microseconds for at least this
@@ -71,10 +70,7 @@ The following options may be given as the first argument:
7170
statements where only row-based is correct: those which
7271
involve user-defined functions (i.e. UDFs) or the UUID()
7372
function; for those, row-based binary logging is
74-
automatically used. If NDBCLUSTER is enabled and
75-
binlog-format is MIXED, the format switches to row-based
76-
and back implicitly per each query accessing an
77-
NDBCLUSTER table
73+
automatically used.
7874
--binlog-ignore-db=name
7975
Tells the master that updates to the given database
8076
should not be logged to the binary log.
@@ -114,11 +110,11 @@ The following options may be given as the first argument:
114110
--collation-server=name
115111
Set the default collation.
116112
--completion-type=name
117-
The transaction completion type, one of NO_CHAIN, CHAIN,
113+
The transaction completion type. One of: NO_CHAIN, CHAIN,
118114
RELEASE
119115
--concurrent-insert[=name]
120-
Use concurrent insert with MyISAM. Possible values are
121-
NEVER, AUTO, ALWAYS
116+
Use concurrent insert with MyISAM. One of: NEVER, AUTO,
117+
ALWAYS
122118
--console Write error output on screen; don't remove the console
123119
window on windows.
124120
--core-file Write core on errors.
@@ -137,9 +133,8 @@ The following options may be given as the first argument:
137133
Short timeout for the two-step deadlock detection (in
138134
microseconds)
139135
--default-regex-flags=name
140-
Default flags for the regex library. Syntax:
141-
default-regex-flags='[flag[,flag[,flag...]]]'. See the
142-
manual for the complete list of valid flags
136+
Default flags for the regex library. Any combination of:
137+
DOTALL, DUPNAMES, EXTENDED, EXTRA, MULTILINE, UNGREEDY
143138
--default-storage-engine=name
144139
The default storage engine for new tables
145140
--default-time-zone=name
@@ -150,7 +145,7 @@ The following options may be given as the first argument:
150145
--default-week-format=#
151146
The default week format used by WEEK() functions
152147
--delay-key-write[=name]
153-
Type of DELAY_KEY_WRITE
148+
Type of DELAY_KEY_WRITE. One of: OFF, ON, ALL
154149
--delayed-insert-limit=#
155150
After inserting delayed_insert_limit rows, the INSERT
156151
DELAYED handler will check if there are any SELECT
@@ -252,7 +247,7 @@ The following options may be given as the first argument:
252247
(unless the user has SUPER privilege)
253248
--init-file=name Read SQL commands from this file at startup
254249
--init-rpl-role=name
255-
Set the replication role.
250+
Set the replication role. One of: MASTER, SLAVE
256251
--init-slave=name Command(s) that are executed by a slave server each time
257252
the SQL thread starts
258253
--interactive-timeout=#
@@ -329,8 +324,8 @@ The following options may be given as the first argument:
329324
not specified then 'datadir'/'log-basename'.err or the
330325
'pid-file' path with extension .err is used
331326
--log-isam[=name] Log all MyISAM changes to file.
332-
--log-output=name Syntax: log-output=value[,value...], where "value" could
333-
be TABLE, FILE or NONE
327+
--log-output=name How logs should be written. Any combination of: NONE,
328+
FILE, TABLE
334329
--log-queries-not-using-indexes
335330
Log queries that are executed without benefit of any
336331
index to the slow log if it is open
@@ -343,10 +338,9 @@ The following options may be given as the first argument:
343338
Log slow OPTIMIZE, ANALYZE, ALTER and other
344339
administrative statements to the slow log if it is open.
345340
--log-slow-filter=name
346-
Log only certain types of queries. Multiple flags can be
347-
specified, separated by commas. Valid values are admin,
348-
slave, filesort, filesort_on_disk, full_join, full_scan,
349-
query_cache, query_cache_miss, tmp_table,
341+
Log only certain types of queries. Any combination of:
342+
admin, filesort, filesort_on_disk, full_join, full_scan,
343+
query_cache, query_cache_miss, tmp_table,
350344
tmp_table_on_disk
351345
--log-slow-rate-limit=#
352346
Write to slow log every #th slow query. Set to 1 to log
@@ -356,8 +350,8 @@ The following options may be given as the first argument:
356350
Log slow statements executed by slave thread to the slow
357351
log if it is open.
358352
--log-slow-verbosity=name
359-
log-slow-verbosity=[value[,value ...]] where value is one
360-
of 'innodb', 'query_plan', 'explain'
353+
Verbosity level for the slow log. Any combination of:
354+
innodb, query_plan, explain
361355
--log-tc=name Path to transaction coordinator log (used for
362356
transactions that affect more than one storage engine,
363357
when binary log is disabled).
@@ -458,9 +452,9 @@ The following options may be given as the first argument:
458452
Restricts the total memory used for memory mapping of
459453
MySQL tables
460454
--myisam-recover-options[=name]
461-
Syntax: myisam-recover-options[=option[,option...]],
462-
where option can be DEFAULT, BACKUP, BACKUP_ALL, FORCE,
463-
QUICK, or OFF
455+
Specifies how corrupted tables should be automatically
456+
repaired. Any combination of: DEFAULT, BACKUP, FORCE,
457+
QUICK, BACKUP_ALL, OFF
464458
--myisam-repair-threads=#
465459
If larger than 1, when repairing a MyISAM table all
466460
indexes will be created in parallel, with one thread per
@@ -489,8 +483,9 @@ The following options may be given as the first argument:
489483
See also --old-mode
490484
--old-alter-table Use old, non-optimized alter table
491485
--old-mode=name Used to emulate old behavior from earlier MariaDB or
492-
MySQL versions. Syntax: old_mode=mode[,mode[,mode...]].
493-
See the manual for the complete list of valid old modes
486+
MySQL versions. Any combination of:
487+
NO_DUP_KEY_WARNINGS_WITH_IGNORE, NO_PROGRESS_INFO,
488+
ZERO_DATE_TIME_CAST
494489
--old-passwords Use old password encryption method (needed for 4.0 and
495490
older clients)
496491
--old-style-user-limits
@@ -524,19 +519,20 @@ The following options may be given as the first argument:
524519
Controls number of record samples to check condition
525520
selectivity
526521
--optimizer-switch=name
527-
optimizer_switch=option=val[,option=val...], where option
528-
is one of {derived_merge, derived_with_keys, firstmatch,
529-
in_to_exists, engine_condition_pushdown,
530-
index_condition_pushdown, index_merge,
531-
index_merge_intersection, index_merge_sort_intersection,
532-
index_merge_sort_union, index_merge_union,
533-
join_cache_bka, join_cache_hashed,
534-
join_cache_incremental, loosescan, materialization, mrr,
535-
mrr_cost_based, mrr_sort_keys, optimize_join_buffer_size,
536-
outer_join_with_cache, partial_match_rowid_merge,
537-
partial_match_table_scan, semijoin, semijoin_with_cache,
538-
subquery_cache, table_elimination, extended_keys,
539-
exists_to_in } and val is one of {on, off, default}
522+
Fine-tune the optimizer behavior. Takes a comma-separated
523+
list of option=value pairs, where value is on, off, or
524+
default, and options are: index_merge, index_merge_union,
525+
index_merge_sort_union, index_merge_intersection,
526+
index_merge_sort_intersection, engine_condition_pushdown,
527+
index_condition_pushdown, derived_merge,
528+
derived_with_keys, firstmatch, loosescan, materialization,
529+
in_to_exists, semijoin, partial_match_rowid_merge,
530+
partial_match_table_scan, subquery_cache, mrr,
531+
mrr_cost_based, mrr_sort_keys, outer_join_with_cache,
532+
semijoin_with_cache, join_cache_incremental,
533+
join_cache_hashed, join_cache_bka,
534+
optimize_join_buffer_size, table_elimination,
535+
extended_keys, exists_to_in
540536
--optimizer-use-condition-selectivity=#
541537
Controls selectivity of which conditions the optimizer
542538
takes into account to calculate cardinality of a partial
@@ -689,9 +685,9 @@ The following options may be given as the first argument:
689685
in an incremental way. It can be specified many times,
690686
adding more plugins every time.
691687
--plugin-maturity=name
692-
The lowest desirable plugin maturity (unknown,
693-
experimental, alpha, beta, gamma, or stable). Plugins
694-
less mature than that will not be installed or loaded.
688+
The lowest desirable plugin maturity. Plugins less mature
689+
than that will not be installed or loaded. One of:
690+
unknown, experimental, alpha, beta, gamma, stable
695691
-P, --port=# Port number to use for connection or 0 to default to,
696692
my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default
697693
(3306), whatever comes first
@@ -934,11 +930,10 @@ The following options may be given as the first argument:
934930
transaction in case it failed with a deadlock or elapsed
935931
lock wait timeout, before giving up and stopping
936932
--slave-type-conversions=name
937-
Set of slave type conversions that are enabled. Legal
938-
values are: ALL_LOSSY to enable lossy conversions and
939-
ALL_NON_LOSSY to enable non-lossy conversions. If the
940-
variable is assigned the empty set, no conversions are
941-
allowed and it is expected that the types match exactly.
933+
Set of slave type conversions that are enabled. If the
934+
variable is empty, no conversions are allowed and it is
935+
expected that the types match exactly. Any combination
936+
of: ALL_LOSSY, ALL_NON_LOSSY
942937
--slow-launch-time=#
943938
If creating the thread takes longer than this value (in
944939
seconds), the Slow_launch_threads counter will be
@@ -955,8 +950,18 @@ The following options may be given as the first argument:
955950
--sort-buffer-size=#
956951
Each thread that needs to do a sort allocates a buffer of
957952
this size
958-
--sql-mode=name Syntax: sql-mode=mode[,mode[,mode...]]. See the manual
959-
for the complete list of valid sql modes
953+
--sql-mode=name Sets the sql mode. Any combination of: REAL_AS_FLOAT,
954+
PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE,
955+
IGNORE_BAD_TABLE_OPTIONS, ONLY_FULL_GROUP_BY,
956+
NO_UNSIGNED_SUBTRACTION, NO_DIR_IN_CREATE, POSTGRESQL,
957+
ORACLE, MSSQL, DB2, MAXDB, NO_KEY_OPTIONS,
958+
NO_TABLE_OPTIONS, NO_FIELD_OPTIONS, MYSQL323, MYSQL40,
959+
ANSI, NO_AUTO_VALUE_ON_ZERO, NO_BACKSLASH_ESCAPES,
960+
STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE,
961+
NO_ZERO_DATE, ALLOW_INVALID_DATES,
962+
ERROR_FOR_DIVISION_BY_ZERO, TRADITIONAL,
963+
NO_AUTO_CREATE_USER, HIGH_NOT_PRECEDENCE,
964+
NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH
960965
--stack-trace Print a symbolic stack trace on failure
961966
(Defaults to on; use --skip-stack-trace to disable.)
962967
--stored-program-cache=#
@@ -987,8 +992,8 @@ The following options may be given as the first argument:
987992
--table-open-cache=#
988993
The number of cached open tables
989994
--tc-heuristic-recover=name
990-
Decision to use in heuristic recover process. Possible
991-
values are COMMIT or ROLLBACK.
995+
Decision to use in heuristic recover process. One of:
996+
COMMIT, ROLLBACK
992997
--thread-cache-size=#
993998
How many threads we should keep in a cache for reuse
994999
--thread-pool-idle-timeout=#
@@ -1024,7 +1029,9 @@ The following options may be given as the first argument:
10241029
Allocation block size for transactions to be stored in
10251030
binary log
10261031
--transaction-isolation=name
1027-
Default transaction isolation level.
1032+
Default transaction isolation level. One of:
1033+
READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ,
1034+
SERIALIZABLE
10281035
--transaction-prealloc-size=#
10291036
Persistent buffer for transactions to be stored in binary
10301037
log
@@ -1039,8 +1046,8 @@ The following options may be given as the first argument:
10391046
of the underlying table and the query uses a LIMIT clause
10401047
(usually get from GUI tools)
10411048
--use-stat-tables=name
1042-
Specifies how to use system statistics tables. Possible
1043-
values are NEVER, COMPLEMENTARY, PREFERABLY
1049+
Specifies how to use system statistics tables. One of:
1050+
NEVER, COMPLEMENTARY, PREFERABLY
10441051
-u, --user=name Run mysqld daemon as user.
10451052
--userstat Enables statistics gathering for USER_STATISTICS,
10461053
CLIENT_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS
@@ -1196,7 +1203,7 @@ myisam-mmap-size 18446744073709551615
11961203
myisam-recover-options DEFAULT
11971204
myisam-repair-threads 1
11981205
myisam-sort-buffer-size 134216704
1199-
myisam-stats-method nulls_unequal
1206+
myisam-stats-method NULLS_UNEQUAL
12001207
myisam-use-mmap FALSE
12011208
net-buffer-length 16384
12021209
net-read-timeout 30
@@ -1282,7 +1289,7 @@ relay-log-purge TRUE
12821289
relay-log-recovery FALSE
12831290
relay-log-space-limit 0
12841291
replicate-annotate-row-events FALSE
1285-
replicate-events-marked-for-skip replicate
1292+
replicate-events-marked-for-skip REPLICATE
12861293
replicate-same-server-id FALSE
12871294
report-host (No default value)
12881295
report-password (No default value)

mysql-test/suite/rpl/r/rpl_skip_replication.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) fo
88
DROP USER'nonsuperuser'@'127.0.0.1';
99
SELECT @@global.replicate_events_marked_for_skip;
1010
@@global.replicate_events_marked_for_skip
11-
replicate
11+
REPLICATE
1212
SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE;
1313
ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
1414
SELECT @@global.replicate_events_marked_for_skip;
1515
@@global.replicate_events_marked_for_skip
16-
replicate
16+
REPLICATE
1717
STOP SLAVE;
1818
SET SESSION replicate_events_marked_for_skip=FILTER_ON_MASTER;
1919
ERROR HY000: Variable 'replicate_events_marked_for_skip' is a GLOBAL variable and should be set with SET GLOBAL
2020
SELECT @@global.replicate_events_marked_for_skip;
2121
@@global.replicate_events_marked_for_skip
22-
replicate
22+
REPLICATE
2323
SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER;
2424
SELECT @@global.replicate_events_marked_for_skip;
2525
@@global.replicate_events_marked_for_skip
26-
filter_on_master
26+
FILTER_ON_MASTER
2727
START SLAVE;
2828
SELECT @@skip_replication;
2929
@@skip_replication
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
SET @orig = @@global.innodb_checksum_algorithm;
22
SELECT @orig;
33
@orig
4-
innodb
4+
INNODB
55
SET GLOBAL innodb_checksum_algorithm = 'crc32';
66
SELECT @@global.innodb_checksum_algorithm;
77
@@global.innodb_checksum_algorithm
8-
crc32
8+
CRC32
99
SET GLOBAL innodb_checksum_algorithm = 'strict_crc32';
1010
SELECT @@global.innodb_checksum_algorithm;
1111
@@global.innodb_checksum_algorithm
12-
strict_crc32
12+
STRICT_CRC32
1313
SET GLOBAL innodb_checksum_algorithm = 'innodb';
1414
SELECT @@global.innodb_checksum_algorithm;
1515
@@global.innodb_checksum_algorithm
16-
innodb
16+
INNODB
1717
SET GLOBAL innodb_checksum_algorithm = 'strict_innodb';
1818
SELECT @@global.innodb_checksum_algorithm;
1919
@@global.innodb_checksum_algorithm
20-
strict_innodb
20+
STRICT_INNODB
2121
SET GLOBAL innodb_checksum_algorithm = 'none';
2222
SELECT @@global.innodb_checksum_algorithm;
2323
@@global.innodb_checksum_algorithm
24-
none
24+
NONE
2525
SET GLOBAL innodb_checksum_algorithm = 'strict_none';
2626
SELECT @@global.innodb_checksum_algorithm;
2727
@@global.innodb_checksum_algorithm
28-
strict_none
28+
STRICT_NONE
2929
SET GLOBAL innodb_checksum_algorithm = '';
3030
ERROR 42000: Variable 'innodb_checksum_algorithm' can't be set to the value of ''
3131
SELECT @@global.innodb_checksum_algorithm;
3232
@@global.innodb_checksum_algorithm
33-
strict_none
33+
STRICT_NONE
3434
SET GLOBAL innodb_checksum_algorithm = 'foobar';
3535
ERROR 42000: Variable 'innodb_checksum_algorithm' can't be set to the value of 'foobar'
3636
SELECT @@global.innodb_checksum_algorithm;
3737
@@global.innodb_checksum_algorithm
38-
strict_none
38+
STRICT_NONE
3939
SET GLOBAL innodb_checksum_algorithm = 123;
4040
ERROR 42000: Variable 'innodb_checksum_algorithm' can't be set to the value of '123'
4141
SELECT @@global.innodb_checksum_algorithm;
4242
@@global.innodb_checksum_algorithm
43-
strict_none
43+
STRICT_NONE
4444
SET GLOBAL innodb_checksum_algorithm = @orig;
4545
SELECT @@global.innodb_checksum_algorithm;
4646
@@global.innodb_checksum_algorithm
47-
innodb
47+
INNODB

0 commit comments

Comments
 (0)