/
sys_vars.cc
6787 lines (5941 loc) · 267 KB
/
sys_vars.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
Copyright (c) 2012, 2021, MariaDB Corporation.
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
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/**
@file
Definitions of all server's session or global variables.
How to add new variables:
1. copy one of the existing variables, and edit the declaration.
2. if you need special behavior on assignment or additional checks
use ON_CHECK and ON_UPDATE callbacks.
3. *Don't* add new Sys_var classes or uncle Occam will come
with his razor to haunt you at nights
Note - all storage engine variables (for example myisam_whatever)
should go into the corresponding storage engine sources
(for example in storage/myisam/ha_myisam.cc) !
*/
#include "sql_plugin.h"
#include "sql_priv.h"
#include "sql_class.h" // set_var.h: THD
#include "sys_vars.ic"
#include "my_sys.h"
#include "events.h"
#include <thr_alarm.h>
#include "slave.h"
#include "rpl_mi.h"
#include "transaction.h"
#include "mysqld.h"
#include "lock.h"
#include "sql_time.h" // known_date_time_formats
#include "sql_acl.h" // mysql_user_table_is_in_short_password_format
#include "derror.h" // read_texts
#include "sql_base.h" // close_cached_tables
#include "hostname.h" // host_cache_size
#include <myisam.h>
#include "debug_sync.h" // DEBUG_SYNC
#include "sql_show.h"
#include "opt_trace_context.h"
#include "log_event.h"
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#include "../storage/perfschema/pfs_server.h"
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
#include "threadpool.h"
#include "sql_repl.h"
#include "opt_range.h"
#include "rpl_parallel.h"
#include "semisync_master.h"
#include "semisync_slave.h"
#include <ssl_compat.h>
#define PCRE2_STATIC 1 /* Important on Windows */
#include "pcre2.h" /* pcre2 header file */
/*
The rule for this file: everything should be 'static'. When a sys_var
variable or a function from this file is - in very rare cases - needed
elsewhere it should be explicitly declared 'export' here to show that it's
not a mistakenly forgotten 'static' keyword.
*/
#define export /* not static */
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
static Sys_var_mybool Sys_pfs_enabled(
"performance_schema", "Enable the performance schema.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_long Sys_pfs_events_waits_history_long_size(
"performance_schema_events_waits_history_long_size",
"Number of rows in EVENTS_WAITS_HISTORY_LONG."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_waits_history_long_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_waits_history_size(
"performance_schema_events_waits_history_size",
"Number of rows per thread in EVENTS_WAITS_HISTORY."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_waits_history_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_cond_classes(
"performance_schema_max_cond_classes",
"Maximum number of condition instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_cond_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
DEFAULT(PFS_MAX_COND_CLASS), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_cond_instances(
"performance_schema_max_cond_instances",
"Maximum number of instrumented condition objects."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_cond_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_program_instances(
"performance_schema_max_program_instances",
"Maximum number of instrumented programs."
" Use 0 to disable, -1 for automated scaling.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_program_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_prepared_stmt_instances(
"performance_schema_max_prepared_statements_instances",
"Maximum number of instrumented prepared statements."
" Use 0 to disable, -1 for automated scaling.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_prepared_stmt_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_file_classes(
"performance_schema_max_file_classes",
"Maximum number of file instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_file_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
DEFAULT(PFS_MAX_FILE_CLASS), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_file_handles(
"performance_schema_max_file_handles",
"Maximum number of opened instrumented files.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_file_handle_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
DEFAULT(PFS_MAX_FILE_HANDLE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_file_instances(
"performance_schema_max_file_instances",
"Maximum number of instrumented files."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_file_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_sockets(
"performance_schema_max_socket_instances",
"Maximum number of opened instrumented sockets."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_socket_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_socket_classes(
"performance_schema_max_socket_classes",
"Maximum number of socket instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_socket_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
DEFAULT(PFS_MAX_SOCKET_CLASS), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_mutex_classes(
"performance_schema_max_mutex_classes",
"Maximum number of mutex instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_mutex_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
DEFAULT(PFS_MAX_MUTEX_CLASS), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_mutex_instances(
"performance_schema_max_mutex_instances",
"Maximum number of instrumented MUTEX objects."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_mutex_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 100*1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_rwlock_classes(
"performance_schema_max_rwlock_classes",
"Maximum number of rwlock instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_rwlock_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
DEFAULT(PFS_MAX_RWLOCK_CLASS), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_rwlock_instances(
"performance_schema_max_rwlock_instances",
"Maximum number of instrumented RWLOCK objects."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_rwlock_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 100*1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_table_handles(
"performance_schema_max_table_handles",
"Maximum number of opened instrumented tables."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_table_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_table_instances(
"performance_schema_max_table_instances",
"Maximum number of instrumented tables."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_table_share_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_table_lock_stat(
"performance_schema_max_table_lock_stat",
"Maximum number of lock statistics for instrumented tables."
" Use 0 to disable, -1 for automated scaling.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_table_lock_stat_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_index_stat(
"performance_schema_max_index_stat",
"Maximum number of index statistics for instrumented tables."
" Use 0 to disable, -1 for automated scaling.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_index_stat_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_thread_classes(
"performance_schema_max_thread_classes",
"Maximum number of thread instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_thread_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
DEFAULT(PFS_MAX_THREAD_CLASS), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_thread_instances(
"performance_schema_max_thread_instances",
"Maximum number of instrumented threads."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_thread_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_setup_actors_size(
"performance_schema_setup_actors_size",
"Maximum number of rows in SETUP_ACTORS.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_setup_actor_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_setup_objects_size(
"performance_schema_setup_objects_size",
"Maximum number of rows in SETUP_OBJECTS.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_setup_object_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_accounts_size(
"performance_schema_accounts_size",
"Maximum number of instrumented user@host accounts."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_account_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_hosts_size(
"performance_schema_hosts_size",
"Maximum number of instrumented hosts."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_host_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_users_size(
"performance_schema_users_size",
"Maximum number of instrumented users."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_user_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_stage_classes(
"performance_schema_max_stage_classes",
"Maximum number of stage instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_stage_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
DEFAULT(PFS_MAX_STAGE_CLASS), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_stages_history_long_size(
"performance_schema_events_stages_history_long_size",
"Number of rows in EVENTS_STAGES_HISTORY_LONG."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_stages_history_long_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_stages_history_size(
"performance_schema_events_stages_history_size",
"Number of rows per thread in EVENTS_STAGES_HISTORY."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_stages_history_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
/**
Variable performance_schema_max_statement_classes.
The default number of statement classes is the sum of:
- SQLCOM_END for all regular "statement/sql/...",
- SP_PSI_STATEMENT_INFO_COUNT for "statement/sp/...".
- (COM_END - mariadb gap) for all regular "statement/com/...",
- 1 for "statement/com/new_packet", for unknown enum_server_command
- 1 for "statement/com/Error", for invalid enum_server_command
- 1 for "statement/sql/error", for invalid enum_sql_command
- 1 for "statement/rpl/relay_log", for replicated statements.
- 1 for "statement/scheduler/event", for scheduled events.
*/
static Sys_var_ulong Sys_pfs_max_statement_classes(
"performance_schema_max_statement_classes",
"Maximum number of statement instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_statement_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
DEFAULT((ulong) SQLCOM_END + SP_PSI_STATEMENT_INFO_COUNT +
(ulong) (COM_END -(COM_MDB_GAP_END - COM_MDB_GAP_BEG + 1)) + 5),
BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_statements_history_long_size(
"performance_schema_events_statements_history_long_size",
"Number of rows in EVENTS_STATEMENTS_HISTORY_LONG."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_statements_history_long_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_statements_history_size(
"performance_schema_events_statements_history_size",
"Number of rows per thread in EVENTS_STATEMENTS_HISTORY."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_statements_history_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_statement_stack_size(
"performance_schema_max_statement_stack",
"Number of rows per thread in EVENTS_STATEMENTS_CURRENT.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_statement_stack_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(1, 256),
DEFAULT(PFS_STATEMENTS_STACK_SIZE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_memory_classes(
"performance_schema_max_memory_classes",
"Maximum number of memory pool instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_memory_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024),
DEFAULT(PFS_MAX_MEMORY_CLASS), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_digest_size(
"performance_schema_digests_size",
"Size of the statement digest."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_digest_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_transactions_history_long_size(
"performance_schema_events_transactions_history_long_size",
"Number of rows in EVENTS_TRANSACTIONS_HISTORY_LONG."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_transactions_history_long_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
DEFAULT(PFS_AUTOSIZE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_transactions_history_size(
"performance_schema_events_transactions_history_size",
"Number of rows per thread in EVENTS_TRANSACTIONS_HISTORY."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_transactions_history_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
DEFAULT(PFS_AUTOSIZE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_digest_length(
"performance_schema_max_digest_length",
"Maximum length considered for digest text, when stored in performance_schema tables.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_max_digest_length),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024 * 1024),
DEFAULT(1024), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_connect_attrs_size(
"performance_schema_session_connect_attrs_size",
"Size of session attribute string buffer per thread."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY
GLOBAL_VAR(pfs_param.m_session_connect_attrs_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024 * 1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_metadata_locks(
"performance_schema_max_metadata_locks",
"Maximum number of metadata locks."
" Use 0 to disable, -1 for automated scaling.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_metadata_lock_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 100*1024*1024),
DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_sql_text_length(
"performance_schema_max_sql_text_length",
"Maximum length of displayed sql text.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_max_sql_text_length),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024 * 1024),
DEFAULT(1024), BLOCK_SIZE(1));
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
#ifdef WITH_WSREP
/*
We need to keep the original values set by the user, as they will
be lost if wsrep_auto_increment_control set to 'ON':
*/
static bool update_auto_increment_increment (sys_var *self, THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.saved_auto_increment_increment=
global_system_variables.auto_increment_increment;
else
thd->variables.saved_auto_increment_increment=
thd->variables.auto_increment_increment;
return false;
}
#endif /* WITH_WSREP */
static Sys_var_double Sys_analyze_sample_percentage(
"analyze_sample_percentage",
"Percentage of rows from the table ANALYZE TABLE will sample "
"to collect table statistics. Set to 0 to let MariaDB decide "
"what percentage of rows to sample.",
SESSION_VAR(sample_percentage),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100),
DEFAULT(100));
static Sys_var_ulong Sys_auto_increment_increment(
"auto_increment_increment",
"Auto-increment columns are incremented by this",
SESSION_VAR(auto_increment_increment),
CMD_LINE(OPT_ARG),
VALID_RANGE(1, 65535), DEFAULT(1), BLOCK_SIZE(1),
#ifdef WITH_WSREP
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_auto_increment_increment));
#else
NO_MUTEX_GUARD, IN_BINLOG);
#endif /* WITH_WSREP */
#ifdef WITH_WSREP
/*
We need to keep the original values set by the user, as they will
be lost if wsrep_auto_increment_control set to 'ON':
*/
static bool update_auto_increment_offset (sys_var *self, THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.saved_auto_increment_offset=
global_system_variables.auto_increment_offset;
else
thd->variables.saved_auto_increment_offset=
thd->variables.auto_increment_offset;
return false;
}
#endif /* WITH_WSREP */
static Sys_var_ulong Sys_auto_increment_offset(
"auto_increment_offset",
"Offset added to Auto-increment columns. Used when "
"auto-increment-increment != 1",
SESSION_VAR(auto_increment_offset),
CMD_LINE(OPT_ARG),
VALID_RANGE(1, 65535), DEFAULT(1), BLOCK_SIZE(1),
#ifdef WITH_WSREP
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_auto_increment_offset));
#else
NO_MUTEX_GUARD, IN_BINLOG);
#endif /* WITH_WSREP */
static Sys_var_mybool Sys_automatic_sp_privileges(
"automatic_sp_privileges",
"Creating and dropping stored procedures alters ACLs",
GLOBAL_VAR(sp_automatic_privileges),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
static Sys_var_ulong Sys_back_log(
"back_log", "The number of outstanding connection requests "
"MariaDB can have. This comes into play when the main MariaDB thread "
"gets very many connection requests in a very short time",
AUTO_SET READ_ONLY GLOBAL_VAR(back_log), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 65535), DEFAULT(150), BLOCK_SIZE(1));
static Sys_var_charptr_fscs Sys_basedir(
"basedir", "Path to installation directory. All paths are "
"usually resolved relative to this",
READ_ONLY GLOBAL_VAR(mysql_home_ptr), CMD_LINE(REQUIRED_ARG, 'b'),
DEFAULT(0));
static Sys_var_charptr_fscs Sys_my_bind_addr(
"bind_address", "IP address to bind to.",
READ_ONLY GLOBAL_VAR(my_bind_addr_str), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_vers_asof Sys_vers_asof_timestamp(
"system_versioning_asof", "Default value for the FOR SYSTEM_TIME AS OF clause",
SESSION_VAR(vers_asof_timestamp.type), NO_CMD_LINE,
DEFAULT(SYSTEM_TIME_UNSPECIFIED));
static const char *vers_alter_history_keywords[]= {"ERROR", "KEEP", NullS};
static Sys_var_enum Sys_vers_alter_history(
"system_versioning_alter_history", "Versioning ALTER TABLE mode. "
"ERROR: Fail ALTER with error; " /* TODO: fail only when history non-empty */
"KEEP: Keep historical system rows and subject them to ALTER",
SESSION_VAR(vers_alter_history), CMD_LINE(REQUIRED_ARG),
vers_alter_history_keywords, DEFAULT(VERS_ALTER_HISTORY_ERROR));
static Sys_var_on_access_global<Sys_var_ulonglong,
PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_CACHE_SIZE>
Sys_binlog_cache_size(
"binlog_cache_size", "The size of the transactional cache for "
"updates to transactional engines for the binary log. "
"If you often use transactions containing many statements, "
"you can increase this to get more performance",
GLOBAL_VAR(binlog_cache_size),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, SIZE_T_MAX), DEFAULT(32768), BLOCK_SIZE(IO_SIZE));
static Sys_var_on_access_global<Sys_var_ulonglong,
PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_FILE_CACHE_SIZE>
Sys_binlog_file_cache_size(
"binlog_file_cache_size",
"The size of file cache for the binary log",
GLOBAL_VAR(binlog_file_cache_size),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE*2, SIZE_T_MAX), DEFAULT(IO_SIZE*4), BLOCK_SIZE(IO_SIZE));
static Sys_var_on_access_global<Sys_var_ulonglong,
PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_STMT_CACHE_SIZE>
Sys_binlog_stmt_cache_size(
"binlog_stmt_cache_size", "The size of the statement cache for "
"updates to non-transactional engines for the binary log. "
"If you often use statements updating a great number of rows, "
"you can increase this to get more performance.",
GLOBAL_VAR(binlog_stmt_cache_size),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, SIZE_T_MAX), DEFAULT(32768), BLOCK_SIZE(IO_SIZE));
/*
Some variables like @sql_log_bin and @binlog_format change how/if binlogging
is done. We must not change them inside a running transaction or statement,
otherwise the event group eventually written to the binlog may become
incomplete or otherwise garbled.
This function does the appropriate check.
It returns true if an error is caused by incorrect usage, false if ok.
*/
static bool
error_if_in_trans_or_substatement(THD *thd, int in_substatement_error,
int in_transaction_error)
{
if (unlikely(thd->in_sub_stmt))
{
my_error(in_substatement_error, MYF(0));
return true;
}
if (unlikely(thd->in_active_multi_stmt_transaction()))
{
my_error(in_transaction_error, MYF(0));
return true;
}
return false;
}
bool check_has_super(sys_var *self, THD *thd, set_var *var)
{
DBUG_ASSERT(self->scope() != sys_var::GLOBAL);// don't abuse check_has_super()
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!(thd->security_ctx->master_access &
PRIV_SET_RESTRICTED_SESSION_SYSTEM_VARIABLE))
{
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
return true;
}
#endif
return false;
}
static Sys_var_bit Sys_core_file("core_file", "write a core-file on crashes",
READ_ONLY GLOBAL_VAR(test_flags), NO_CMD_LINE,
TEST_CORE_ON_SIGNAL, DEFAULT(IF_WIN(TRUE,FALSE)), NO_MUTEX_GUARD, NOT_IN_BINLOG,
0,0,0);
static bool binlog_format_check(sys_var *self, THD *thd, set_var *var)
{
/*
MariaDB Galera does not support STATEMENT or MIXED binlog format currently.
*/
if ((WSREP(thd) || opt_support_flashback) &&
var->save_result.ulonglong_value != BINLOG_FORMAT_ROW)
{
// Push a warning to the error log.
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"MariaDB Galera and flashback do not support binlog format: %s",
binlog_format_names[var->save_result.ulonglong_value]);
/*
We allow setting up binlog_format other then ROW for session scope when
wsrep/flasback is enabled.This is done because of 2 reasons
1. User might want to run pt-table-checksum.
2. SuperUser knows what is doing :-)
For refrence:- MDEV-7322
*/
if (var->type == OPT_GLOBAL)
{
if (WSREP(thd))
WSREP_ERROR("MariaDB Galera does not support binlog format: %s",
binlog_format_names[var->save_result.ulonglong_value]);
else
my_error(ER_FLASHBACK_NOT_SUPPORTED,MYF(0),"binlog_format",
binlog_format_names[var->save_result.ulonglong_value]);
return true;
}
}
if (var->type == OPT_GLOBAL)
return false;
/*
If RBR and open temporary tables, their CREATE TABLE may not be in the
binlog, so we can't toggle to SBR in this connection.
If binlog_format=MIXED, there are open temporary tables, and an unsafe
statement is executed, then subsequent statements are logged in row
format and hence changes to temporary tables may be lost. So we forbid
switching @@SESSION.binlog_format from MIXED to STATEMENT when there are
open temp tables and we are logging in row format.
*/
if (thd->has_thd_temporary_tables() &&
var->type == OPT_SESSION &&
var->save_result.ulonglong_value == BINLOG_FORMAT_STMT &&
((thd->variables.binlog_format == BINLOG_FORMAT_MIXED &&
thd->is_current_stmt_binlog_format_row()) ||
thd->variables.binlog_format == BINLOG_FORMAT_ROW))
{
my_error(ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR, MYF(0));
return true;
}
if (unlikely(error_if_in_trans_or_substatement(thd,
ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT,
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT)))
return true;
return false;
}
static bool fix_binlog_format_after_update(sys_var *self, THD *thd,
enum_var_type type)
{
if (type == OPT_SESSION)
thd->reset_current_stmt_binlog_format_row();
return false;
}
static Sys_var_on_access<Sys_var_enum,
PRIV_SET_SYSTEM_VAR_BINLOG_FORMAT,
PRIV_SET_SYSTEM_VAR_BINLOG_FORMAT>
Sys_binlog_format(
"binlog_format", "What form of binary logging the master will "
"use: either ROW for row-based binary logging, STATEMENT "
"for statement-based binary logging, or MIXED. MIXED is statement-"
"based binary logging except for those statements where only row-"
"based is correct: those which involve user-defined functions (i.e. "
"UDFs) or the UUID() function; for those, row-based binary logging is "
"automatically used.",
SESSION_VAR(binlog_format), CMD_LINE(REQUIRED_ARG, OPT_BINLOG_FORMAT),
binlog_format_names, DEFAULT(BINLOG_FORMAT_MIXED),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_format_check),
ON_UPDATE(fix_binlog_format_after_update));
static bool binlog_direct_check(sys_var *self, THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
return false;
if (unlikely(error_if_in_trans_or_substatement(thd,
ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT,
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT)))
return true;
return false;
}
static Sys_var_on_access<Sys_var_mybool,
PRIV_SET_SYSTEM_VAR_BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES,
PRIV_SET_SYSTEM_VAR_BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES>
Sys_binlog_direct(
"binlog_direct_non_transactional_updates",
"Causes updates to non-transactional engines using statement format to "
"be written directly to binary log. Before using this option make sure "
"that there are no dependencies between transactional and "
"non-transactional tables such as in the statement INSERT INTO t_myisam "
"SELECT * FROM t_innodb; otherwise, slaves may diverge from the master.",
SESSION_VAR(binlog_direct_non_trans_update),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_direct_check));
static Sys_var_mybool Sys_explicit_defaults_for_timestamp(
"explicit_defaults_for_timestamp",
"This option causes CREATE TABLE to create all TIMESTAMP columns "
"as NULL with DEFAULT NULL attribute, Without this option, "
"TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses.",
READ_ONLY GLOBAL_VAR(opt_explicit_defaults_for_timestamp),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_ulonglong Sys_bulk_insert_buff_size(
"bulk_insert_buffer_size", "Size of tree cache used in bulk "
"insert optimisation. Note that this is a limit per thread!",
SESSION_VAR(bulk_insert_buff_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, SIZE_T_MAX), DEFAULT(8192*1024), BLOCK_SIZE(1));
static Sys_var_charptr_fscs Sys_character_sets_dir(
"character_sets_dir", "Directory where character sets are",
READ_ONLY GLOBAL_VAR(charsets_dir), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static bool check_not_null(sys_var *self, THD *thd, set_var *var)
{
return var->value && var->value->is_null();
}
static bool check_charset(sys_var *self, THD *thd, set_var *var)
{
if (!var->value)
return false;
char buff[STRING_BUFFER_USUAL_SIZE];
if (var->value->result_type() == STRING_RESULT)
{
String str(buff, sizeof(buff), system_charset_info), *res;
if (!(res= var->value->val_str(&str)))
var->save_result.ptr= NULL;
else
{
ErrConvString err(res); /* Get utf8 '\0' terminated string */
myf utf8_flag= thd->get_utf8_flag();
if (!(var->save_result.ptr= get_charset_by_csname(err.ptr(),
MY_CS_PRIMARY,
MYF(utf8_flag))) &&
!(var->save_result.ptr= get_old_charset_by_name(err.ptr())))
{
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), err.ptr());
return true;
}
}
}
else // INT_RESULT
{
int csno= (int)var->value->val_int();
if (!(var->save_result.ptr= get_charset(csno, MYF(0))))
{
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), llstr(csno, buff));
return true;
}
}
return false;
}
static bool check_charset_not_null(sys_var *self, THD *thd, set_var *var)
{
return check_charset(self, thd, var) || check_not_null(self, thd, var);
}
static Sys_var_struct Sys_character_set_system(
"character_set_system", "The character set used by the server "
"for storing identifiers",
READ_ONLY GLOBAL_VAR(system_charset_info), NO_CMD_LINE,
offsetof(CHARSET_INFO, cs_name.str), DEFAULT(0));
static Sys_var_struct Sys_character_set_server(
"character_set_server", "The default character set",
SESSION_VAR(collation_server), NO_CMD_LINE,
offsetof(CHARSET_INFO, cs_name.str), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_charset_not_null));
static bool check_charset_db(sys_var *self, THD *thd, set_var *var)
{
if (check_charset_not_null(self, thd, var))
return true;
if (!var->value) // = DEFAULT
var->save_result.ptr= thd->db_charset;
return false;
}
static Sys_var_struct Sys_character_set_database(
"character_set_database",
"The character set used by the default database",
SESSION_VAR(collation_database), NO_CMD_LINE,
offsetof(CHARSET_INFO, cs_name.str), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_charset_db));
static bool check_cs_client(sys_var *self, THD *thd, set_var *var)
{
if (check_charset_not_null(self, thd, var))
return true;
// Currently, UCS-2 cannot be used as a client character set
if (!is_supported_parser_charset((CHARSET_INFO *)(var->save_result.ptr)))
return true;
return false;
}
static bool fix_thd_charset(sys_var *self, THD *thd, enum_var_type type)
{
if (type == OPT_SESSION)
thd->update_charset();
return false;
}
static Sys_var_struct Sys_character_set_client(
"character_set_client", "The character set for statements "
"that arrive from the client",
NO_SET_STMT SESSION_VAR(character_set_client), NO_CMD_LINE,
offsetof(CHARSET_INFO, cs_name.str), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_cs_client),
ON_UPDATE(fix_thd_charset));
// for check changing
export sys_var *Sys_character_set_client_ptr= &Sys_character_set_client;
static Sys_var_struct Sys_character_set_connection(
"character_set_connection", "The character set used for "
"literals that do not have a character set introducer and for "
"number-to-string conversion",
NO_SET_STMT SESSION_VAR(collation_connection), NO_CMD_LINE,
offsetof(CHARSET_INFO, cs_name.str), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_charset_not_null),
ON_UPDATE(fix_thd_charset));
// for check changing
export sys_var *Sys_character_set_connection_ptr= &Sys_character_set_connection;
static Sys_var_struct Sys_character_set_results(
"character_set_results", "The character set used for returning "
"query results to the client",
SESSION_VAR(character_set_results), NO_CMD_LINE,
offsetof(CHARSET_INFO, cs_name.str), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_charset));
// for check changing
export sys_var *Sys_character_set_results_ptr= &Sys_character_set_results;
static Sys_var_struct Sys_character_set_filesystem(
"character_set_filesystem", "The filesystem character set",
NO_SET_STMT SESSION_VAR(character_set_filesystem), NO_CMD_LINE,
offsetof(CHARSET_INFO, cs_name.str), DEFAULT(&character_set_filesystem),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_charset_not_null),
ON_UPDATE(fix_thd_charset));
static const char *completion_type_names[]= {"NO_CHAIN", "CHAIN", "RELEASE", 0};
static Sys_var_enum Sys_completion_type(
"completion_type", "The transaction completion type",
SESSION_VAR(completion_type), CMD_LINE(REQUIRED_ARG),
completion_type_names, DEFAULT(0));
static bool check_collation_not_null(sys_var *self, THD *thd, set_var *var)
{
if (!var->value)
return false;
myf utf8_flag= thd->get_utf8_flag();
char buff[STRING_BUFFER_USUAL_SIZE];
if (var->value->result_type() == STRING_RESULT)
{
String str(buff, sizeof(buff), system_charset_info), *res;
if (!(res= var->value->val_str(&str)))
var->save_result.ptr= NULL;
else
{
ErrConvString err(res); /* Get utf8 '\0'-terminated string */
if (!(var->save_result.ptr= get_charset_by_name(err.ptr(), MYF(utf8_flag))))
{
my_error(ER_UNKNOWN_COLLATION, MYF(0), err.ptr());
return true;
}
}
}
else // INT_RESULT
{
int csno= (int)var->value->val_int();
if (!(var->save_result.ptr= get_charset(csno, MYF(0))))
{
my_error(ER_UNKNOWN_COLLATION, MYF(0), llstr(csno, buff));
return true;
}
}
return check_not_null(self, thd, var);
}
static Sys_var_struct Sys_collation_connection(
"collation_connection", "The collation of the connection "
"character set",
NO_SET_STMT SESSION_VAR(collation_connection), NO_CMD_LINE,
offsetof(CHARSET_INFO, coll_name.str), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_collation_not_null),
ON_UPDATE(fix_thd_charset));
static bool check_collation_db(sys_var *self, THD *thd, set_var *var)
{
if (check_collation_not_null(self, thd, var))
return true;
if (!var->value) // = DEFAULT
var->save_result.ptr= thd->db_charset;
return false;
}
static Sys_var_struct Sys_collation_database(
"collation_database", "The collation of the database "
"character set",
SESSION_VAR(collation_database), NO_CMD_LINE,
offsetof(CHARSET_INFO, coll_name.str), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_collation_db));
static Sys_var_struct Sys_collation_server(
"collation_server", "The server default collation",
SESSION_VAR(collation_server), NO_CMD_LINE,
offsetof(CHARSET_INFO, coll_name.str), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_collation_not_null));
static Sys_var_uint Sys_column_compression_threshold(
"column_compression_threshold",
"Minimum column data length eligible for compression",
SESSION_VAR(column_compression_threshold), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(100), BLOCK_SIZE(1));
static Sys_var_uint Sys_column_compression_zlib_level(
"column_compression_zlib_level",
"zlib compression level (1 gives best speed, 9 gives best compression)",
SESSION_VAR(column_compression_zlib_level), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 9), DEFAULT(6), BLOCK_SIZE(1));
/*
Note that names must correspond to zlib strategy definition. So that we can
pass column_compression_zlib_strategy directly to deflateInit2().
*/
static const char *column_compression_zlib_strategy_names[]=
{ "DEFAULT_STRATEGY", "FILTERED", "HUFFMAN_ONLY", "RLE", "FIXED", 0 };
static Sys_var_enum Sys_column_compression_zlib_strategy(
"column_compression_zlib_strategy",
"The strategy parameter is used to tune the compression algorithm. Use "
"the value DEFAULT_STRATEGY for normal data, FILTERED for data produced "
"by a filter (or predictor), HUFFMAN_ONLY to force Huffman encoding "
"only (no string match), or RLE to limit match distances to one "
"(run-length encoding). Filtered data consists mostly of small values "
"with a somewhat random distribution. In this case, the compression "
"algorithm is tuned to compress them better. The effect of FILTERED is "
"to force more Huffman coding and less string matching; it is somewhat "
"intermediate between DEFAULT_STRATEGY and HUFFMAN_ONLY. RLE is "
"designed to be almost as fast as HUFFMAN_ONLY, but give better "
"compression for PNG image data. The strategy parameter only affects "
"the compression ratio but not the correctness of the compressed output "
"even if it is not set appropriately. FIXED prevents the use of dynamic "
"Huffman codes, allowing for a simpler decoder for special "
"applications.",
SESSION_VAR(column_compression_zlib_strategy), CMD_LINE(REQUIRED_ARG),
column_compression_zlib_strategy_names, DEFAULT(0));
static Sys_var_mybool Sys_column_compression_zlib_wrap(
"column_compression_zlib_wrap",
"Generate zlib header and trailer and compute adler32 check value. "
"It can be used with storage engines that don't provide data integrity "
"verification to detect data corruption.",
SESSION_VAR(column_compression_zlib_wrap), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static const char *concurrent_insert_names[]= {"NEVER", "AUTO", "ALWAYS", 0};
static Sys_var_enum Sys_concurrent_insert(
"concurrent_insert", "Use concurrent insert with MyISAM",
GLOBAL_VAR(myisam_concurrent_insert), CMD_LINE(OPT_ARG),
concurrent_insert_names, DEFAULT(1));
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_CONNECT_TIMEOUT>
Sys_connect_timeout(
"connect_timeout",
"The number of seconds the mysqld server is waiting for a connect "
"packet before responding with 'Bad handshake'",
GLOBAL_VAR(connect_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(2, LONG_TIMEOUT), DEFAULT(CONNECT_TIMEOUT), BLOCK_SIZE(1));
static Sys_var_charptr_fscs Sys_datadir(
"datadir", "Path to the database root directory",
READ_ONLY GLOBAL_VAR(mysql_real_data_home_ptr),
CMD_LINE(REQUIRED_ARG, 'h'), DEFAULT(mysql_real_data_home));