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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
|
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
Copyright (c) 2012, 2022, 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.inl"
#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>
#ifdef WITH_WSREP
#include "wsrep_mysqld.h"
#endif
#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. Several addresses may be "
"specified, separated by a comma (,).",
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 core on crashes",
READ_ONLY GLOBAL_VAR(test_flags), CMD_LINE(OPT_ARG),
TEST_CORE_ON_SIGNAL, DEFAULT(IF_WIN(TRUE,FALSE)));
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_bit 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.",
SESSION_VAR(option_bits), CMD_LINE(OPT_ARG),
OPTION_EXPLICIT_DEF_TIMESTAMP, DEFAULT(TRUE), NO_MUTEX_GUARD, IN_BINLOG);
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_engine_supports_temporary(sys_var *self, THD *thd, set_var *var)
{
plugin_ref plugin= var->save_result.plugin;
if (!plugin)
return false;
DBUG_ASSERT(plugin);
handlerton *hton= plugin_hton(plugin);
DBUG_ASSERT(hton);
if (ha_check_storage_engine_flag(hton, HTON_TEMPORARY_NOT_SUPPORTED))
{
my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), hton_name(hton)->str,
"TEMPORARY");
return true;
}
return false;
}
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();
CHARSET_INFO *cs;
if ((var->save_result.ptr= cs= get_charset(csno, MYF(0))))
{
/*
Backward compatibility: pre MDEV-30824 servers
can write non-default collation IDs to binary log:
SET character_set_client=83; -- utf8mb3_bin
Convert a non-default collation to the compiled default collation,
e.g. utf8mb3_bin to utf8mb3_general_ci, but only if
- THD is a slave thread or
- is processing a mysqlbinlog output.
*/
if ((cs->state & MY_CS_PRIMARY) ||
((thd->variables.pseudo_slave_mode || thd->slave_thread) &&
(var->save_result.ptr=
Lex_exact_charset_opt_extended_collate(cs, true).
find_default_collation())))
return false;
}
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));
#ifndef DBUG_OFF
static Sys_var_dbug Sys_dbug(
"debug", "Built-in DBUG debugger", sys_var::SESSION,
CMD_LINE(OPT_ARG, '#'), DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_has_super), ON_UPDATE(0),
DEPRECATED("'@@debug_dbug'")); // since 5.5.37
static Sys_var_dbug Sys_debug_dbug(
"debug_dbug", "Built-in DBUG debugger", sys_var::SESSION,
CMD_LINE(OPT_ARG, '#'), DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_has_super));
#endif
/**
@todo
When updating myisam_delay_key_write, we should do a 'flush tables'
of all MyISAM tables to ensure that they are reopen with the
new attribute.
*/
export bool fix_delay_key_write(sys_var *self, THD *thd, enum_var_type type)
{
switch (delay_key_write_options) {
case DELAY_KEY_WRITE_NONE:
myisam_delay_key_write=0;
ha_open_options&= ~HA_OPEN_DELAY_KEY_WRITE;
break;
case DELAY_KEY_WRITE_ON:
myisam_delay_key_write=1;
ha_open_options&= ~HA_OPEN_DELAY_KEY_WRITE;
break;
case DELAY_KEY_WRITE_ALL:
myisam_delay_key_write=1;
ha_open_options|= HA_OPEN_DELAY_KEY_WRITE;
break;
}
#ifdef WITH_ARIA_STORAGE_ENGINE
maria_delay_key_write= myisam_delay_key_write;
#endif
return false;
}
static const char *delay_key_write_names[]= { "OFF", "ON", "ALL", NullS };
static Sys_var_enum Sys_delay_key_write(
"delay_key_write", "Specifies how MyISAM tables handles CREATE "
"TABLE DELAY_KEY_WRITE. If set to ON, the default, any DELAY KEY "
"WRITEs are honored. The key buffer is then flushed only when the "
"table closes, speeding up writes. MyISAM tables should be "
"automatically checked upon startup in this case, and "
"--external locking should not be used, as it can lead to index "
"corruption. If set to OFF, DELAY KEY WRITEs are ignored, while if "
"set to ALL, all new opened tables are treated as if created with "
"DELAY KEY WRITEs enabled.",
GLOBAL_VAR(delay_key_write_options), CMD_LINE(OPT_ARG),
delay_key_write_names, DEFAULT(DELAY_KEY_WRITE_ON),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_delay_key_write));
static Sys_var_ulong Sys_delayed_insert_limit(
"delayed_insert_limit",
"After inserting delayed_insert_limit rows, the INSERT DELAYED "
"handler will check if there are any SELECT statements pending. "
"If so, it allows these to execute before continuing.",
GLOBAL_VAR(delayed_insert_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, UINT_MAX), DEFAULT(DELAYED_LIMIT), BLOCK_SIZE(1));
static Sys_var_ulong Sys_delayed_insert_timeout(
"delayed_insert_timeout",
"How long a INSERT DELAYED thread should wait for INSERT statements "
"before terminating",
GLOBAL_VAR(delayed_insert_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(DELAYED_WAIT_TIMEOUT),
BLOCK_SIZE(1));
static Sys_var_ulong Sys_delayed_queue_size(
"delayed_queue_size",
"What size queue (in rows) should be allocated for handling INSERT "
"DELAYED. If the queue becomes full, any client that does INSERT "
"DELAYED will wait until there is room in the queue again",
GLOBAL_VAR(delayed_queue_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, UINT_MAX), DEFAULT(DELAYED_QUEUE_SIZE), BLOCK_SIZE(1));
#ifdef HAVE_EVENT_SCHEDULER
static const char *event_scheduler_names[]= { "OFF", "ON", "DISABLED",
"ORIGINAL", NullS };
static bool event_scheduler_check(sys_var *self, THD *thd, set_var *var)
{
if (Events::opt_event_scheduler == Events::EVENTS_DISABLED)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
"--event-scheduler=DISABLED or --skip-grant-tables");
return true;
}
/* DISABLED is only accepted on the command line */
if (var->save_result.ulonglong_value == Events::EVENTS_DISABLED)
return true;
return false;
}
static bool event_scheduler_update(sys_var *self, THD *thd, enum_var_type type)
{
int err_no= 0;
bool ret;
uint opt_event_scheduler_value= Events::opt_event_scheduler;
mysql_mutex_unlock(&LOCK_global_system_variables);
/*
Events::start() is heavyweight. In particular it creates a new THD,
which takes LOCK_global_system_variables internally.
Thus we have to release it here.
We need to re-take it before returning, though.
Note that since we release LOCK_global_system_variables before calling
start/stop, there is a possibility that the server variable
can become out of sync with the real event scheduler state.
This can happen with two concurrent statments if the first gets
interrupted after start/stop but before retaking
LOCK_global_system_variables. However, this problem should be quite
rare and it's difficult to avoid it without opening up possibilities
for deadlocks. See bug#51160.
*/
/* EVENTS_ORIGINAL means we should revert back to the startup state */
if (opt_event_scheduler_value == Events::EVENTS_ORIGINAL)
{
opt_event_scheduler_value= Events::opt_event_scheduler=
Events::startup_state;
}
/*
If the scheduler was not properly inited (because of wrong system tables),
try to init it again. This is needed for mysql_upgrade to work properly if
the event tables where upgraded.
*/
if (!Events::inited && (Events::init(thd, 0) || !Events::inited))
ret= 1;
else
ret= opt_event_scheduler_value == Events::EVENTS_ON ?
Events::start(&err_no) :
Events::stop();
mysql_mutex_lock(&LOCK_global_system_variables);
if (ret)
{
Events::opt_event_scheduler= Events::EVENTS_OFF;
my_error(ER_EVENT_SET_VAR_ERROR, MYF(0), err_no);
}
return ret;
}
static Sys_var_enum Sys_event_scheduler(
"event_scheduler", "Enable the event scheduler. Possible values are "
"ON, OFF, and DISABLED (keep the event scheduler completely "
"deactivated, it cannot be activated run-time)",
GLOBAL_VAR(Events::opt_event_scheduler), CMD_LINE(OPT_ARG),
event_scheduler_names, DEFAULT(Events::EVENTS_OFF),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(event_scheduler_check), ON_UPDATE(event_scheduler_update));
#endif
static bool copy_to_expire_logs_days(sys_var *, THD *,
enum_var_type type)
{
expire_logs_days= binlog_expire_logs_seconds / (double)(24 * 60 * 60);
return false;
}
static bool copy_to_binlog_expire_logs_seconds(sys_var *, THD *,
enum_var_type type)
{
binlog_expire_logs_seconds= (ulong)(expire_logs_days * 24 * 60 * 60);
return false;
}
static Sys_var_on_access_global<Sys_var_double,
PRIV_SET_SYSTEM_GLOBAL_VAR_EXPIRE_LOGS_DAYS>
Sys_expire_logs_days(
"expire_logs_days",
"If non-zero, binary logs will be purged after expire_logs_days "
"days; It and binlog_expire_logs_seconds are linked, such that "
"changes in one are converted into the other, presentable as a "
"decimal value with 1/1000000 of the day precision; possible "
"purges happen at startup and at binary log rotation",
GLOBAL_VAR(expire_logs_days),
CMD_LINE(REQUIRED_ARG, OPT_EXPIRE_LOGS_DAYS), VALID_RANGE(0, 99),
DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(copy_to_binlog_expire_logs_seconds));
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_EXPIRE_LOGS_DAYS>
Sys_binlog_expire_logs_seconds(
"binlog_expire_logs_seconds",
"If non-zero, binary logs will be purged after "
"binlog_expire_logs_seconds seconds; It and expire_logs_days are "
"linked, such that changes in one are converted into the other. "
"Possible purges happen at startup and at binary log rotation.",
GLOBAL_VAR(binlog_expire_logs_seconds),
CMD_LINE(REQUIRED_ARG, OPT_BINLOG_EXPIRE_LOGS_SECONDS),
VALID_RANGE(0, 8553600), DEFAULT(0), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(copy_to_expire_logs_days));
static Sys_var_mybool Sys_flush(
"flush", "Flush MyISAM tables to disk between SQL commands",
GLOBAL_VAR(myisam_flush),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_ulong Sys_flush_time(
"flush_time",
"A dedicated thread is created to flush all tables at the "
"given interval",
GLOBAL_VAR(flush_time),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, LONG_TIMEOUT),
DEFAULT(0), BLOCK_SIZE(1));
static bool check_ftb_syntax(sys_var *self, THD *thd, set_var *var)
{
return ft_boolean_check_syntax_string((uchar*)
(var->save_result.string_value.str),
var->save_result.string_value.length,
self->charset(thd));
}
static bool query_cache_flush(sys_var *self, THD *thd, enum_var_type type)
{
#ifdef HAVE_QUERY_CACHE
query_cache.flush();
#endif /* HAVE_QUERY_CACHE */
return false;
}
/// @todo make SESSION_VAR (usability enhancement and a fix for a race condition)
static Sys_var_charptr Sys_ft_boolean_syntax(
"ft_boolean_syntax", "List of operators for "
"MATCH ... AGAINST ( ... IN BOOLEAN MODE)",
GLOBAL_VAR(ft_boolean_syntax),
CMD_LINE(REQUIRED_ARG),
DEFAULT(DEFAULT_FTB_SYNTAX), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(check_ftb_syntax), ON_UPDATE(query_cache_flush));
static Sys_var_ulong Sys_ft_max_word_len(
"ft_max_word_len",
"The maximum length of the word to be included in a FULLTEXT index. "
"Note: FULLTEXT indexes must be rebuilt after changing this variable",
READ_ONLY GLOBAL_VAR(ft_max_word_len), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(10, HA_FT_MAXCHARLEN), DEFAULT(HA_FT_MAXCHARLEN),
BLOCK_SIZE(1));
static Sys_var_ulong Sys_ft_min_word_len(
"ft_min_word_len",
"The minimum length of the word to be included in a FULLTEXT index. "
"Note: FULLTEXT indexes must be rebuilt after changing this variable",
READ_ONLY GLOBAL_VAR(ft_min_word_len), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, HA_FT_MAXCHARLEN), DEFAULT(4), BLOCK_SIZE(1));
/// @todo make it an updatable SESSION_VAR
static Sys_var_ulong Sys_ft_query_expansion_limit(
"ft_query_expansion_limit",
"Number of best matches to use for query expansion",
READ_ONLY GLOBAL_VAR(ft_query_expansion_limit),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 1000), DEFAULT(20), BLOCK_SIZE(1));
static Sys_var_charptr_fscs Sys_ft_stopword_file(
"ft_stopword_file",
"Use stopwords from this file instead of built-in list",
READ_ONLY GLOBAL_VAR(ft_stopword_file), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_mybool Sys_ignore_builtin_innodb(
"ignore_builtin_innodb",
"Disable initialization of builtin InnoDB plugin",
READ_ONLY GLOBAL_VAR(opt_ignore_builtin_innodb),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static bool check_init_string(sys_var *self, THD *thd, set_var *var)
{
if (var->save_result.string_value.str == 0)
{
var->save_result.string_value.str= const_cast<char*>("");
var->save_result.string_value.length= 0;
}
return false;
}
static PolyLock_rwlock PLock_sys_init_connect(&LOCK_sys_init_connect);
static Sys_var_on_access_global<Sys_var_lexstring,
PRIV_SET_SYSTEM_GLOBAL_VAR_INIT_CONNECT>
Sys_init_connect(
"init_connect", "Command(s) that are executed for each "
"new connection (unless the user has SUPER privilege)",
GLOBAL_VAR(opt_init_connect), CMD_LINE(REQUIRED_ARG),
DEFAULT(""), &PLock_sys_init_connect, NOT_IN_BINLOG,
ON_CHECK(check_init_string));
#ifdef HAVE_REPLICATION
static bool check_master_connection(sys_var *self, THD *thd, set_var *var)
{
LEX_CSTRING tmp;
tmp.str= var->save_result.string_value.str;
tmp.length= var->save_result.string_value.length;
if (!tmp.str || check_master_connection_name(&tmp))
return true;
return false;
}
static Sys_var_session_lexstring Sys_default_master_connection(
"default_master_connection",
"Master connection to use for all slave variables and slave commands",
SESSION_ONLY(default_master_connection),
NO_CMD_LINE,
DEFAULT(""), MAX_CONNECTION_NAME, ON_CHECK(check_master_connection));
#endif
static Sys_var_charptr_fscs Sys_init_file(
"init_file", "Read SQL commands from this file at startup",
READ_ONLY GLOBAL_VAR(opt_init_file),
#ifdef DISABLE_GRANT_OPTIONS
NO_CMD_LINE,
#else
CMD_LINE(REQUIRED_ARG),
#endif
DEFAULT(0));
static PolyLock_rwlock PLock_sys_init_slave(&LOCK_sys_init_slave);
static Sys_var_on_access_global<Sys_var_lexstring,
PRIV_SET_SYSTEM_GLOBAL_VAR_INIT_SLAVE>
Sys_init_slave(
"init_slave", "Command(s) that are executed by a slave server "
"each time the SQL thread starts", GLOBAL_VAR(opt_init_slave),
CMD_LINE(REQUIRED_ARG),
DEFAULT(""), &PLock_sys_init_slave,
NOT_IN_BINLOG, ON_CHECK(check_init_string));
static Sys_var_ulong Sys_interactive_timeout(
"interactive_timeout",
"The number of seconds the server waits for activity on an interactive "
"connection before closing it",
NO_SET_STMT SESSION_VAR(net_interactive_timeout),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
static Sys_var_ulonglong Sys_join_buffer_size(
"join_buffer_size",
"The size of the buffer that is used for joins",
SESSION_VAR(join_buff_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(128, SIZE_T_MAX), DEFAULT(256*1024), BLOCK_SIZE(128));
static Sys_var_keycache Sys_key_buffer_size(
"key_buffer_size", "The size of the buffer used for "
"index blocks for MyISAM tables. Increase this to get better index "
"handling (for all reads and multiple writes) to as much as you can "
"afford",
KEYCACHE_VAR(param_buff_size),
CMD_LINE(REQUIRED_ARG, OPT_KEY_BUFFER_SIZE),
VALID_RANGE(0, SIZE_T_MAX), DEFAULT(KEY_CACHE_SIZE),
BLOCK_SIZE(IO_SIZE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_buffer_size));
static Sys_var_keycache Sys_key_cache_block_size(
"key_cache_block_size", "The default size of key cache blocks",
KEYCACHE_VAR(param_block_size),
CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_BLOCK_SIZE),
VALID_RANGE(512, 1024*16), DEFAULT(KEY_CACHE_BLOCK_SIZE),
BLOCK_SIZE(512), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(resize_keycache));
static Sys_var_keycache Sys_key_cache_division_limit(
"key_cache_division_limit",
"The minimum percentage of warm blocks in key cache",
KEYCACHE_VAR(param_division_limit),
CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_DIVISION_LIMIT),
VALID_RANGE(1, 100), DEFAULT(100),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(change_keycache_param));
static Sys_var_keycache Sys_key_cache_age_threshold(
"key_cache_age_threshold", "This characterizes the number of "
"hits a hot block has to be untouched until it is considered aged "
"enough to be downgraded to a warm block. This specifies the "
"percentage ratio of that number of hits to the total number of "
"blocks in key cache",
KEYCACHE_VAR(param_age_threshold),
CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_AGE_THRESHOLD),
VALID_RANGE(100, UINT_MAX), DEFAULT(300),
BLOCK_SIZE(100), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(change_keycache_param));
static Sys_var_keycache Sys_key_cache_file_hash_size(
"key_cache_file_hash_size",
"Number of hash buckets for open and changed files. If you have a lot of MyISAM "
"files open you should increase this for faster flush of changes. A good "
"value is probably 1/10 of number of possible open MyISAM files.",
KEYCACHE_VAR(changed_blocks_hash_size),
CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_CHANGED_BLOCKS_HASH_SIZE),
VALID_RANGE(128, 16384), DEFAULT(512),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(resize_keycache));
static Sys_var_mybool Sys_large_files_support(
"large_files_support",
"Whether mysqld was compiled with options for large file support",
READ_ONLY GLOBAL_VAR(opt_large_files),
CMD_LINE_HELP_ONLY, DEFAULT(sizeof(my_off_t) > 4));
static Sys_var_uint Sys_large_page_size(
"large_page_size",
"Previously showed the size of large memory pages, unused since "
"multiple page size support was added",
READ_ONLY GLOBAL_VAR(opt_large_page_size), NO_CMD_LINE,
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
DEPRECATED(""));
static Sys_var_mybool Sys_large_pages(
"large_pages", "Enable support for large pages",
READ_ONLY GLOBAL_VAR(opt_large_pages),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_charptr_fscs Sys_language(
"lc_messages_dir", "Directory where error messages are",
READ_ONLY GLOBAL_VAR(lc_messages_dir_ptr), CMD_LINE(REQUIRED_ARG, 'L'),
DEFAULT(0));
static Sys_var_mybool Sys_local_infile(
"local_infile", "Enable LOAD DATA LOCAL INFILE",
GLOBAL_VAR(opt_local_infile), CMD_LINE(OPT_ARG), DEFAULT(TRUE));
static Sys_var_ulong Sys_lock_wait_timeout(
"lock_wait_timeout",
"Timeout in seconds to wait for a lock before returning an error.",
SESSION_VAR(lock_wait_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, LONG_TIMEOUT), DEFAULT(24 * 60 * 60), BLOCK_SIZE(1));
#ifdef HAVE_MLOCKALL
static Sys_var_mybool Sys_locked_in_memory(
"locked_in_memory",
"Whether mysqld was locked in memory with --memlock",
READ_ONLY GLOBAL_VAR(locked_in_memory), NO_CMD_LINE, DEFAULT(FALSE));
#endif
/* this says NO_CMD_LINE, as command-line option takes a string, not a bool */
static Sys_var_mybool Sys_log_bin(
"log_bin", "Whether the binary log is enabled",
READ_ONLY GLOBAL_VAR(opt_bin_log), NO_CMD_LINE, DEFAULT(FALSE));
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_LOG_BIN_COMPRESS>
Sys_log_bin_compress(
"log_bin_compress", "Whether the binary log can be compressed",
GLOBAL_VAR(opt_bin_log_compress), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
/* the min length is 10, means that Begin/Commit/Rollback would never be compressed! */
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_LOG_BIN_COMPRESS_MIN_LEN>
Sys_log_bin_compress_min_len(
"log_bin_compress_min_len",
"Minimum length of sql statement(in statement mode) or record(in row mode)"
"that can be compressed.",
GLOBAL_VAR(opt_bin_log_compress_min_len),
CMD_LINE(OPT_ARG), VALID_RANGE(10, 1024), DEFAULT(256), BLOCK_SIZE(1));
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_LOG_BIN_TRUST_FUNCTION_CREATORS>
Sys_trust_function_creators(
"log_bin_trust_function_creators",
"If set to FALSE (the default), then when --log-bin is used, creation "
"of a stored function (or trigger) is allowed only to users having the "
"SUPER privilege and only if this stored function (trigger) may not "
"break binary logging. Note that if ALL connections to this server "
"ALWAYS use row-based binary logging, the security issues do not "
"exist and the binary logging cannot break, so you can safely set "
"this to TRUE",
GLOBAL_VAR(trust_function_creators),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_charptr_fscs Sys_log_error(
"log_error",
"Log errors to file (instead of stdout). If file name is not specified "
"then 'datadir'/'log-basename'.err or the 'pid-file' path with extension "
".err is used",
READ_ONLY GLOBAL_VAR(log_error_file_ptr),
CMD_LINE(OPT_ARG, OPT_LOG_ERROR),
DEFAULT(disabled_my_option));
static Sys_var_bit Sys_log_queries_not_using_indexes(
"log_queries_not_using_indexes",
"Log queries that are executed without benefit of any index to the "
"slow log if it is open. Same as log_slow_filter='not_using_index'",
SESSION_VAR(log_slow_filter), CMD_LINE(OPT_ARG), QPLAN_NOT_USING_INDEX,
DEFAULT(FALSE));
static Sys_var_bit Sys_log_slow_admin_statements(
"log_slow_admin_statements",
"Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements "
"to the slow log if it is open. Resets or sets the option 'admin' in "
"log_slow_disabled_statements",
SESSION_VAR(log_slow_disabled_statements),
CMD_LINE(OPT_ARG), REVERSE(LOG_SLOW_DISABLE_ADMIN), DEFAULT(TRUE));
static Sys_var_bit Sys_log_slow_slave_statements(
"log_slow_slave_statements",
"Log slow statements executed by slave thread to the slow log if it is "
"open. Resets or sets the option 'slave' in "
"log_slow_disabled_statements",
SESSION_VAR(log_slow_disabled_statements),
CMD_LINE(OPT_ARG), REVERSE(LOG_SLOW_DISABLE_SLAVE), DEFAULT(TRUE));
static Sys_var_ulong Sys_log_warnings(
"log_warnings",
"Log some not critical warnings to the general log file."
"Value can be between 0 and 11. Higher values mean more verbosity",
SESSION_VAR(log_warnings),
CMD_LINE(OPT_ARG, 'W'),
VALID_RANGE(0, UINT_MAX), DEFAULT(2), BLOCK_SIZE(1));
static bool update_cached_long_query_time(sys_var *self, THD *thd,
enum_var_type type)
{
if (type == OPT_SESSION)
thd->variables.long_query_time=
double2ulonglong(thd->variables.long_query_time_double * 1e6);
else
global_system_variables.long_query_time=
double2ulonglong(global_system_variables.long_query_time_double * 1e6);
return false;
}
static Sys_var_double Sys_long_query_time(
"long_query_time",
"Alias for log_slow_query_time. "
"Log all queries that have taken more than long_query_time seconds "
"to execute to the slow query log file. The argument will be treated "
"as a decimal value with microsecond precision",
SESSION_VAR(long_query_time_double),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, LONG_TIMEOUT), DEFAULT(10),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_cached_long_query_time));
static Sys_var_double Sys_log_slow_query_time(
"log_slow_query_time",
"Log all queries that have taken more than log_slow_query_time seconds "
"to execute to the slow query log file. The argument will be treated "
"as a decimal value with microsecond precision",
SESSION_VAR(long_query_time_double),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, LONG_TIMEOUT), DEFAULT(10),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_cached_long_query_time));
static bool update_cached_max_statement_time(sys_var *self, THD *thd,
enum_var_type type)
{
if (type == OPT_SESSION)
thd->variables.max_statement_time=
double2ulonglong(thd->variables.max_statement_time_double * 1e6);
else
global_system_variables.max_statement_time=
double2ulonglong(global_system_variables.max_statement_time_double * 1e6);
return false;
}
static Sys_var_double Sys_max_statement_time(
"max_statement_time",
"A query that has taken more than max_statement_time seconds "
"will be aborted. The argument will be treated as a decimal value "
"with microsecond precision. A value of 0 (default) means no timeout",
SESSION_VAR(max_statement_time_double),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, LONG_TIMEOUT), DEFAULT(0),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_cached_max_statement_time));
static bool fix_low_prio_updates(sys_var *self, THD *thd, enum_var_type type)
{
if (type == OPT_SESSION)
thd->update_lock_default= (thd->variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY : TL_WRITE);
else
thr_upgraded_concurrent_insert_lock=
(global_system_variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY : TL_WRITE);
return false;
}
static Sys_var_mybool Sys_low_priority_updates(
"low_priority_updates",
"INSERT/DELETE/UPDATE has lower priority than selects",
SESSION_VAR(low_priority_updates),
CMD_LINE(OPT_ARG),
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_low_prio_updates));
static Sys_var_mybool Sys_lower_case_file_system(
"lower_case_file_system",
"Case sensitivity of file names on the file system where the "
"data directory is located",
READ_ONLY GLOBAL_VAR(lower_case_file_system),
CMD_LINE_HELP_ONLY,
DEFAULT(FALSE));
static Sys_var_uint Sys_lower_case_table_names(
"lower_case_table_names",
"If set to 1 table names are stored in lowercase on disk and table "
"names will be case-insensitive. Should be set to 2 if you are using "
"a case insensitive file system",
READ_ONLY GLOBAL_VAR(lower_case_table_names),
CMD_LINE(OPT_ARG, OPT_LOWER_CASE_TABLE_NAMES),
VALID_RANGE(0, 2),
#ifdef FN_NO_CASE_SENSE
DEFAULT(1),
#else
DEFAULT(0),
#endif
BLOCK_SIZE(1));
static bool session_readonly(sys_var *self, THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
return false;
my_error(ER_VARIABLE_IS_READONLY, MYF(0), "SESSION",
self->name.str, "GLOBAL");
return true;
}
static bool check_max_allowed_packet(sys_var *self, THD *thd, set_var *var)
{
longlong val;
if (session_readonly(self, thd, var))
return true;
val= var->save_result.ulonglong_value;
if (val < (longlong) global_system_variables.net_buffer_length)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
WARN_OPTION_BELOW_LIMIT,
ER_THD(thd, WARN_OPTION_BELOW_LIMIT),
"max_allowed_packet", "net_buffer_length");
}
return false;
}
static Sys_var_ulong Sys_max_allowed_packet(
"max_allowed_packet",
"Max packet length to send to or receive from the server",
SESSION_VAR(max_allowed_packet), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, 1024*1024*1024), DEFAULT(16*1024*1024),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_max_allowed_packet));
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_MAX_ALLOWED_PACKET>
Sys_slave_max_allowed_packet(
"slave_max_allowed_packet",
"The maximum packet length to sent successfully from the master to slave.",
GLOBAL_VAR(slave_max_allowed_packet), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, MAX_MAX_ALLOWED_PACKET),
DEFAULT(MAX_MAX_ALLOWED_PACKET), BLOCK_SIZE(1024));
static Sys_var_on_access_global<Sys_var_ulonglong,
PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_BINLOG_CACHE_SIZE>
Sys_max_binlog_cache_size(
"max_binlog_cache_size",
"Sets the total size of the transactional cache",
GLOBAL_VAR(max_binlog_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, SIZE_T_MAX),
DEFAULT((SIZE_T_MAX/IO_SIZE)*IO_SIZE), BLOCK_SIZE(IO_SIZE));
static Sys_var_on_access_global<Sys_var_ulonglong,
PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_BINLOG_STMT_CACHE_SIZE>
Sys_max_binlog_stmt_cache_size(
"max_binlog_stmt_cache_size",
"Sets the total size of the statement cache",
GLOBAL_VAR(max_binlog_stmt_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, SIZE_T_MAX),
DEFAULT((SIZE_T_MAX/IO_SIZE)*IO_SIZE), BLOCK_SIZE(IO_SIZE));
static bool fix_max_binlog_size(sys_var *self, THD *thd, enum_var_type type)
{
mysql_bin_log.set_max_size(max_binlog_size);
return false;
}
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_BINLOG_SIZE>
Sys_max_binlog_size(
"max_binlog_size",
"Binary log will be rotated automatically when the size exceeds this "
"value.",
GLOBAL_VAR(max_binlog_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, 1024*1024L*1024L), DEFAULT(1024*1024L*1024L),
BLOCK_SIZE(IO_SIZE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_max_binlog_size));
static bool fix_max_connections(sys_var *self, THD *thd, enum_var_type type)
{
#ifndef EMBEDDED_LIBRARY
resize_thr_alarm(max_connections + extra_max_connections +
global_system_variables.max_insert_delayed_threads + 10);
#endif
return false;
}
// Default max_connections of 151 is larger than Apache's default max
// children, to avoid "too many connections" error in a common setup
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_CONNECTIONS>
Sys_max_connections(
"max_connections", "The number of simultaneous clients allowed",
PARSED_EARLY GLOBAL_VAR(max_connections), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(10, 100000),
DEFAULT(MAX_CONNECTIONS_DEFAULT), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_max_connections));
static Sys_var_uint Sys_default_password_lifetime(
"default_password_lifetime",
"This defines the global password expiration policy. 0 means "
"automatic password expiration is disabled. If the value is a "
"positive integer N, the passwords must be changed every N days. This "
"behavior can be overridden using the password expiration options in "
"ALTER USER.",
GLOBAL_VAR(default_password_lifetime), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_DISCONNECT_ON_EXPIRED_PASSWORD>
Sys_disconnect_on_expired_password(
"disconnect_on_expired_password",
"This variable controls how the server handles clients that are not "
"aware of the sandbox mode. If enabled, the server disconnects the "
"client, otherwise the server puts the client in a sandbox mode.",
GLOBAL_VAR(disconnect_on_expired_password), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_CONNECT_ERRORS>
Sys_max_connect_errors(
"max_connect_errors",
"If there is more than this number of interrupted connections from "
"a host this host will be blocked from further connections",
GLOBAL_VAR(max_connect_errors), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, UINT_MAX), DEFAULT(MAX_CONNECT_ERRORS),
BLOCK_SIZE(1));
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_MAX_PASSWORD_ERRORS>
Sys_max_password_errors(
"max_password_errors",
"If there is more than this number of failed connect attempts "
"due to invalid password, user will be blocked from further connections until FLUSH_PRIVILEGES.",
GLOBAL_VAR(max_password_errors), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, UINT_MAX), DEFAULT(UINT_MAX),
BLOCK_SIZE(1));
static Sys_var_uint Sys_max_digest_length(
"max_digest_length", "Maximum length considered for digest text.",
READ_ONLY GLOBAL_VAR(max_digest_length),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 1024 * 1024), DEFAULT(1024), BLOCK_SIZE(1));
static bool check_max_delayed_threads(sys_var *self, THD *thd, set_var *var)
{
return var->type != OPT_GLOBAL &&
var->save_result.ulonglong_value != 0 &&
var->save_result.ulonglong_value !=
global_system_variables.max_insert_delayed_threads;
}
static Sys_var_ulong Sys_max_insert_delayed_threads(
"max_insert_delayed_threads",
"Alias for max_delayed_threads. "
"Don't start more than this number of threads to handle INSERT "
"DELAYED statements. If set to zero INSERT DELAYED will be not used",
SESSION_VAR(max_insert_delayed_threads),
NO_CMD_LINE, VALID_RANGE(0, 16384), DEFAULT(20),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_max_delayed_threads), ON_UPDATE(fix_max_connections));
static Sys_var_ulong Sys_max_delayed_threads(
"max_delayed_threads",
"Don't start more than this number of threads to handle INSERT "
"DELAYED statements. If set to zero INSERT DELAYED will be not used",
SESSION_VAR(max_insert_delayed_threads),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 16384), DEFAULT(20),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_max_delayed_threads), ON_UPDATE(fix_max_connections));
static Sys_var_ulong Sys_max_error_count(
"max_error_count",
"Max number of errors/warnings to store for a statement",
SESSION_VAR(max_error_count), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 65535), DEFAULT(DEFAULT_ERROR_COUNT), BLOCK_SIZE(1));
static Sys_var_ulonglong Sys_max_heap_table_size(
"max_heap_table_size",
"Don't allow creation of heap tables bigger than this",
SESSION_VAR(max_heap_table_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(16384, SIZE_T_MAX), DEFAULT(16*1024*1024),
BLOCK_SIZE(1024));
static ulong mdl_locks_cache_size;
static Sys_var_ulong Sys_metadata_locks_cache_size(
"metadata_locks_cache_size", "Unused",
READ_ONLY GLOBAL_VAR(mdl_locks_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, 1024*1024), DEFAULT(1024),
BLOCK_SIZE(1));
static ulong mdl_locks_hash_partitions;
static Sys_var_ulong Sys_metadata_locks_hash_instances(
"metadata_locks_hash_instances", "Unused",
READ_ONLY GLOBAL_VAR(mdl_locks_hash_partitions), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, 1024), DEFAULT(8),
BLOCK_SIZE(1));
static Sys_var_on_access_session<Sys_var_ulonglong,
PRIV_SET_SYSTEM_SESSION_VAR_PSEUDO_THREAD_ID>
Sys_pseudo_thread_id(
"pseudo_thread_id",
"This variable is for internal server use",
SESSION_ONLY(pseudo_thread_id),
NO_CMD_LINE, VALID_RANGE(0, ULONGLONG_MAX), DEFAULT(0),
BLOCK_SIZE(1), NO_MUTEX_GUARD, IN_BINLOG);
static bool
check_gtid_domain_id(sys_var *self, THD *thd, set_var *var)
{
if (var->type != OPT_GLOBAL &&
error_if_in_trans_or_substatement(thd,
ER_STORED_FUNCTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO,
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO))
return true;
return false;
}
static Sys_var_on_access<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_DOMAIN_ID,
PRIV_SET_SYSTEM_SESSION_VAR_GTID_DOMAIN_ID>
Sys_gtid_domain_id(
"gtid_domain_id",
"Used with global transaction ID to identify logically independent "
"replication streams. When events can propagate through multiple "
"parallel paths (for example multiple masters), each independent "
"source server must use a distinct domain_id. For simple tree-shaped "
"replication topologies, it can be left at its default, 0.",
SESSION_VAR(gtid_domain_id),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, UINT_MAX32), DEFAULT(0),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_gtid_domain_id));
/*
Check that setting gtid_seq_no isn't done inside a transaction, and (in
gtid_strict_mode) doesn't create an out-of-order GTID sequence.
Setting gtid_seq_no to DEFAULT or 0 means we 'reset' it so that the value
doesn't affect the GTID of the next event group written to the binlog.
*/
static bool check_gtid_seq_no(sys_var *self, THD *thd, set_var *var)
{
uint32 domain_id, server_id;
uint64 seq_no;
if (unlikely(error_if_in_trans_or_substatement(thd,
ER_STORED_FUNCTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO,
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO)))
return true;
DBUG_EXECUTE_IF("ignore_set_gtid_seq_no_check", return false;);
if (var->value && opt_gtid_strict_mode && opt_bin_log)
{
domain_id= thd->variables.gtid_domain_id;
server_id= thd->variables.server_id;
seq_no= (uint64)var->value->val_uint();
if (seq_no != 0 &&
mysql_bin_log.check_strict_gtid_sequence(domain_id, server_id, seq_no))
return true;
}
return false;
}
static Sys_var_on_access_session<Sys_var_ulonglong,
PRIV_SET_SYSTEM_SESSION_VAR_GTID_SEQ_NO>
Sys_gtid_seq_no(
"gtid_seq_no",
"Internal server usage, for replication with global transaction id. "
"When set, next event group logged to the binary log will use this "
"sequence number, not generate a new one, thus allowing to preserve "
"master's GTID in slave's binlog.",
SESSION_ONLY(gtid_seq_no),
NO_CMD_LINE, VALID_RANGE(0, ULONGLONG_MAX), DEFAULT(0),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_gtid_seq_no));
#ifdef HAVE_REPLICATION
static unsigned char opt_gtid_binlog_pos_dummy;
static Sys_var_gtid_binlog_pos Sys_gtid_binlog_pos(
"gtid_binlog_pos", "Last GTID logged to the binary log, per replication"
"domain",
READ_ONLY GLOBAL_VAR(opt_gtid_binlog_pos_dummy), NO_CMD_LINE);
const uchar *
Sys_var_gtid_binlog_pos::global_value_ptr(THD *thd,
const LEX_CSTRING *base) const
{
char buf[128];
String str(buf, sizeof(buf), system_charset_info);
char *p;
str.length(0);
if ((opt_bin_log && mysql_bin_log.append_state_pos(&str)) ||
!(p= thd->strmake(str.ptr(), str.length())))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
return NULL;
}
return (uchar *)p;
}
static unsigned char opt_gtid_current_pos_dummy;
static Sys_var_gtid_current_pos Sys_gtid_current_pos(
"gtid_current_pos", "Current GTID position of the server. Per "
"replication domain, this is either the last GTID replicated by a "
"slave thread, or the GTID logged to the binary log, whichever is "
"most recent.",
READ_ONLY GLOBAL_VAR(opt_gtid_current_pos_dummy), NO_CMD_LINE);
const uchar *
Sys_var_gtid_current_pos::global_value_ptr(THD *thd,
const LEX_CSTRING *base) const
{
String str;
char *p;
str.length(0);
if (rpl_append_gtid_state(&str, true) ||
!(p= thd->strmake(str.ptr(), str.length())))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
return NULL;
}
return (uchar *)p;
}
bool
Sys_var_gtid_slave_pos::do_check(THD *thd, set_var *var)
{
String str, *res;
DBUG_ASSERT(var->type == OPT_GLOBAL);
if (rpl_load_gtid_slave_state(thd))
{
my_error(ER_CANNOT_LOAD_SLAVE_GTID_STATE, MYF(0), "mysql",
rpl_gtid_slave_state_table_name.str);
return true;
}
if (give_error_if_slave_running(0))
return true;
if (!(res= var->value->val_str(&str)))
return true;
if (thd->in_active_multi_stmt_transaction())
{
my_error(ER_CANT_DO_THIS_DURING_AN_TRANSACTION, MYF(0));
return true;
}
if (rpl_gtid_pos_check(thd, &((*res)[0]), res->length()))
return true;
if (!(var->save_result.string_value.str=
thd->strmake(res->ptr(), res->length())))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
return true;
}
var->save_result.string_value.length= res->length();
return false;
}
bool
Sys_var_gtid_slave_pos::global_update(THD *thd, set_var *var)
{
bool err;
DBUG_ASSERT(var->type == OPT_GLOBAL);
if (!var->value)
{
my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
return true;
}
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
if (give_error_if_slave_running(1))
err= true;
else
err= rpl_gtid_pos_update(thd, var->save_result.string_value.str,
var->save_result.string_value.length);
mysql_mutex_unlock(&LOCK_active_mi);
mysql_mutex_lock(&LOCK_global_system_variables);
return err;
}
const uchar *
Sys_var_gtid_slave_pos::global_value_ptr(THD *thd,
const LEX_CSTRING *base) const
{
String str;
char *p;
str.length(0);
/*
If the mysql.rpl_slave_pos table could not be loaded, then we cannot
easily automatically try to reload it here - we may be inside a statement
that already has tables locked and so opening more tables is problematic.
But if the table is not loaded (eg. missing mysql_upgrade_db or some such),
then the slave state must be empty anyway.
*/
if ((rpl_global_gtid_slave_state->loaded &&
rpl_append_gtid_state(&str, false)) ||
!(p= thd->strmake(str.ptr(), str.length())))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
return NULL;
}
return (uchar *)p;
}
static unsigned char opt_gtid_slave_pos_dummy;
static Sys_var_gtid_slave_pos Sys_gtid_slave_pos(
"gtid_slave_pos",
"The list of global transaction IDs that were last replicated on the "
"server, one for each replication domain.",
GLOBAL_VAR(opt_gtid_slave_pos_dummy), NO_CMD_LINE);
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_STRICT_MODE>
Sys_gtid_strict_mode(
"gtid_strict_mode",
"Enforce strict seq_no ordering of events in the binary log. Slave "
"stops with an error if it encounters an event that would cause it to "
"generate an out-of-order binlog if executed. "
"When ON the same server-id semisync-replicated transactions that "
"duplicate existing ones in binlog are ignored without error "
"and slave interruption.",
GLOBAL_VAR(opt_gtid_strict_mode),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
struct gtid_binlog_state_data { rpl_gtid *list; uint32 list_len; };
bool
Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var)
{
String str, *res;
struct gtid_binlog_state_data *data;
rpl_gtid *list;
uint32 list_len;
DBUG_ASSERT(var->type == OPT_GLOBAL);
if (!(res= var->value->val_str(&str)))
return true;
if (thd->in_active_multi_stmt_transaction())
{
my_error(ER_CANT_DO_THIS_DURING_AN_TRANSACTION, MYF(0));
return true;
}
if (!mysql_bin_log.is_open())
{
my_error(ER_FLUSH_MASTER_BINLOG_CLOSED, MYF(0));
return true;
}
if (!mysql_bin_log.is_empty_state())
{
my_error(ER_BINLOG_MUST_BE_EMPTY, MYF(0));
return true;
}
if (res->length() == 0)
{
list= NULL;
list_len= 0;
}
else if (!(list= gtid_parse_string_to_list(res->ptr(), res->length(),
&list_len)))
{
my_error(ER_INCORRECT_GTID_STATE, MYF(0));
return true;
}
if (!(data= (gtid_binlog_state_data *)my_malloc(PSI_INSTRUMENT_ME,
sizeof(*data), MYF(0))))
{
my_free(list);
my_error(ER_OUT_OF_RESOURCES, MYF(0));
return true;
}
data->list= list;
data->list_len= list_len;
var->save_result.ptr= data;
return false;
}
bool
Sys_var_gtid_binlog_state::global_update(THD *thd, set_var *var)
{
bool res;
DBUG_ASSERT(var->type == OPT_GLOBAL);
if (!var->value)
{
my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
return true;
}
struct gtid_binlog_state_data *data=
(struct gtid_binlog_state_data *)var->save_result.ptr;
mysql_mutex_unlock(&LOCK_global_system_variables);
res= (reset_master(thd, data->list, data->list_len, 0) != 0);
mysql_mutex_lock(&LOCK_global_system_variables);
my_free(data->list);
my_free(data);
return res;
}
const uchar *
Sys_var_gtid_binlog_state::global_value_ptr(THD *thd,
const LEX_CSTRING *base) const
{
char buf[512];
String str(buf, sizeof(buf), system_charset_info);
char *p;
str.length(0);
if ((opt_bin_log && mysql_bin_log.append_state(&str)) ||
!(p= thd->strmake(str.ptr(), str.length())))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
return NULL;
}
return (uchar *)p;
}
static unsigned char opt_gtid_binlog_state_dummy;
static Sys_var_gtid_binlog_state Sys_gtid_binlog_state(
"gtid_binlog_state",
"The internal GTID state of the binlog, used to keep track of all "
"GTIDs ever logged to the binlog.",
GLOBAL_VAR(opt_gtid_binlog_state_dummy), NO_CMD_LINE);
static Sys_var_last_gtid Sys_last_gtid(
"last_gtid", "The GTID of the last commit (if binlogging was enabled), "
"or the empty string if none.",
READ_ONLY sys_var::ONLY_SESSION, NO_CMD_LINE);
export sys_var *Sys_last_gtid_ptr= &Sys_last_gtid; // for check changing
const uchar *
Sys_var_last_gtid::session_value_ptr(THD *thd, const LEX_CSTRING *base) const
{
char buf[10+1+10+1+20+1];
String str(buf, sizeof(buf), system_charset_info);
char *p;
bool first= true;
str.length(0);
rpl_gtid gtid= thd->get_last_commit_gtid();
if ((gtid.seq_no > 0 &&
rpl_slave_state_tostring_helper(&str, >id, &first)) ||
!(p= thd->strmake(str.ptr(), str.length())))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
return NULL;
}
return (uchar *)p;
}
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_CLEANUP_BATCH_SIZE>
Sys_gtid_cleanup_batch_size(
"gtid_cleanup_batch_size",
"Normally does not need tuning. How many old rows must accumulate in "
"the mysql.gtid_slave_pos table before a background job will be run to "
"delete them. Can be increased to reduce number of commits if "
"using many different engines with --gtid_pos_auto_engines, or to "
"reduce CPU overhead if using a huge number of different "
"gtid_domain_ids. Can be decreased to reduce number of old rows in the "
"table.",
GLOBAL_VAR(opt_gtid_cleanup_batch_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0,2147483647), DEFAULT(64), BLOCK_SIZE(1));
static bool
check_slave_parallel_threads(sys_var *self, THD *thd, set_var *var)
{
return give_error_if_slave_running(0);
}
static bool
fix_slave_parallel_threads(sys_var *self, THD *thd, enum_var_type type)
{
bool err;
mysql_mutex_unlock(&LOCK_global_system_variables);
err= give_error_if_slave_running(0);
mysql_mutex_lock(&LOCK_global_system_variables);
return err;
}
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_PARALLEL_THREADS>
Sys_slave_parallel_threads(
"slave_parallel_threads",
"If non-zero, number of threads to spawn to apply in parallel events "
"on the slave that were group-committed on the master or were logged "
"with GTID in different replication domains. Note that these threads "
"are in addition to the IO and SQL threads, which are always created "
"by a replication slave",
GLOBAL_VAR(opt_slave_parallel_threads), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0,16383), DEFAULT(0), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(check_slave_parallel_threads),
ON_UPDATE(fix_slave_parallel_threads));
/* Alias for @@slave_parallel_threads to match what MySQL 5.7 uses. */
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_PARALLEL_WORKERS>
Sys_slave_parallel_workers(
"slave_parallel_workers",
"Alias for slave_parallel_threads",
GLOBAL_VAR(opt_slave_parallel_threads), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0,16383), DEFAULT(0), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(check_slave_parallel_threads),
ON_UPDATE(fix_slave_parallel_threads));
static bool
check_slave_domain_parallel_threads(sys_var *self, THD *thd, set_var *var)
{
return give_error_if_slave_running(0);
}
static bool
fix_slave_domain_parallel_threads(sys_var *self, THD *thd, enum_var_type type)
{
bool running;
mysql_mutex_unlock(&LOCK_global_system_variables);
running= give_error_if_slave_running(0);
mysql_mutex_lock(&LOCK_global_system_variables);
return running;
}
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_DOMAIN_PARALLEL_THREADS>
Sys_slave_domain_parallel_threads(
"slave_domain_parallel_threads",
"Maximum number of parallel threads to use on slave for events in a "
"single replication domain. When using multiple domains, this can be "
"used to limit a single domain from grabbing all threads and thus "
"stalling other domains. The default of 0 means to allow a domain to "
"grab as many threads as it wants, up to the value of "
"slave_parallel_threads.",
GLOBAL_VAR(opt_slave_domain_parallel_threads), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0,16383), DEFAULT(0), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(check_slave_domain_parallel_threads),
ON_UPDATE(fix_slave_domain_parallel_threads));
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_PARALLEL_MAX_QUEUED>
Sys_slave_parallel_max_queued(
"slave_parallel_max_queued",
"Limit on how much memory SQL threads should use per parallel "
"replication thread when reading ahead in the relay log looking for "
"opportunities for parallel replication. Only used when "
"--slave-parallel-threads > 0.",
GLOBAL_VAR(opt_slave_parallel_max_queued), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0,2147483647), DEFAULT(131072), BLOCK_SIZE(1));
bool
Sys_var_slave_parallel_mode::global_update(THD *thd, set_var *var)
{
enum_slave_parallel_mode new_value=
(enum_slave_parallel_mode)var->save_result.ulonglong_value;
LEX_CSTRING *base_name= &var->base;
Master_info *mi;
bool res= false;
if (!base_name->length)
base_name= &thd->variables.default_master_connection;
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
mi= master_info_index->
get_master_info(base_name, !base_name->length ?
Sql_condition::WARN_LEVEL_ERROR :
Sql_condition::WARN_LEVEL_WARN);
if (mi)
{
if (mi->rli.slave_running)
{
my_error(ER_SLAVE_MUST_STOP, MYF(0),
(int) mi->connection_name.length, mi->connection_name.str);
res= true;
}
else
{
mi->parallel_mode= new_value;
if (!base_name->length)
{
/* Use as default value for new connections */
opt_slave_parallel_mode= new_value;
}
}
}
mysql_mutex_unlock(&LOCK_active_mi);
mysql_mutex_lock(&LOCK_global_system_variables);
return res;
}
const uchar *
Sys_var_slave_parallel_mode::global_value_ptr(THD *thd,
const
LEX_CSTRING *base_name) const
{
Master_info *mi;
enum_slave_parallel_mode val=
(enum_slave_parallel_mode)opt_slave_parallel_mode;
if (!base_name->length)
base_name= &thd->variables.default_master_connection;
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
mi= master_info_index->
get_master_info(base_name, !base_name->length ?
Sql_condition::WARN_LEVEL_ERROR :
Sql_condition::WARN_LEVEL_WARN);
if (mi)
val= mi->parallel_mode;
mysql_mutex_unlock(&LOCK_active_mi);
mysql_mutex_lock(&LOCK_global_system_variables);
if (!mi)
return 0;
return valptr(thd, val);
}
/* The order here must match enum_slave_parallel_mode in mysqld.h. */
static const char *slave_parallel_mode_names[] = {
"none", "minimal", "conservative", "optimistic", "aggressive", NULL
};
export TYPELIB slave_parallel_mode_typelib = {
array_elements(slave_parallel_mode_names)-1,
"",
slave_parallel_mode_names,
NULL
};
static Sys_var_on_access_global<Sys_var_slave_parallel_mode,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_PARALLEL_MODE>
Sys_slave_parallel_mode(
"slave_parallel_mode",
"Controls what transactions are applied in parallel when using "
"--slave-parallel-threads. Possible values: \"optimistic\" tries to "
"apply most transactional DML in parallel, and handles any conflicts "
"with rollback and retry. \"conservative\" limits parallelism in an "
"effort to avoid any conflicts. \"aggressive\" tries to maximise the "
"parallelism, possibly at the cost of increased conflict rate. "
"\"minimal\" only parallelizes the commit steps of transactions. "
"\"none\" disables parallel apply completely.",
GLOBAL_VAR(opt_slave_parallel_mode), NO_CMD_LINE,
slave_parallel_mode_names, DEFAULT(SLAVE_PARALLEL_OPTIMISTIC));
static Sys_var_bit Sys_skip_parallel_replication(
"skip_parallel_replication",
"If set when a transaction is written to the binlog, parallel apply of "
"that transaction will be avoided on a slave where slave_parallel_mode "
"is not \"aggressive\". Can be used to avoid unnecessary rollback and "
"retry for transactions that are likely to cause a conflict if "
"replicated in parallel.",
SESSION_ONLY(option_bits), NO_CMD_LINE, OPTION_RPL_SKIP_PARALLEL,
DEFAULT(FALSE));
static Sys_var_mybool Sys_binlog_alter_two_phase(
"binlog_alter_two_phase",
"When set, split ALTER at binary logging into 2 statements: "
"START ALTER and COMMIT/ROLLBACK ALTER",
SESSION_VAR(binlog_alter_two_phase), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static bool
check_gtid_ignore_duplicates(sys_var *self, THD *thd, set_var *var)
{
return give_error_if_slave_running(0);
}
static bool
fix_gtid_ignore_duplicates(sys_var *self, THD *thd, enum_var_type type)
{
bool running;
mysql_mutex_unlock(&LOCK_global_system_variables);
running= give_error_if_slave_running(0);
mysql_mutex_lock(&LOCK_global_system_variables);
return running;
}
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_IGNORE_DUPLICATES>
Sys_gtid_ignore_duplicates(
"gtid_ignore_duplicates",
"When set, different master connections in multi-source replication are "
"allowed to receive and process event groups with the same GTID (when "
"using GTID mode). Only one will be applied, any others will be "
"ignored. Within a given replication domain, just the sequence number "
"will be used to decide whether a given GTID has been already applied; "
"this means it is the responsibility of the user to ensure that GTID "
"sequence numbers are strictly increasing.",
GLOBAL_VAR(opt_gtid_ignore_duplicates), CMD_LINE(OPT_ARG),
DEFAULT(FALSE), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(check_gtid_ignore_duplicates),
ON_UPDATE(fix_gtid_ignore_duplicates));
static bool
update_slave_max_statement_time(sys_var *self, THD *thd, enum_var_type type)
{
slave_max_statement_time=
double2ulonglong(slave_max_statement_time_double * 1e6);
return false;
}
static Sys_var_on_access_global<
Sys_var_double, PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_MAX_STATEMENT_TIME>
Sys_slave_max_statement_time(
"slave_max_statement_time",
"A query that has taken more than slave_max_statement_time seconds to "
"run on the slave will be aborted. The argument will be treated as a "
"decimal value with microsecond precision. A value of 0 (default) "
"means no timeout",
GLOBAL_VAR(slave_max_statement_time_double), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, LONG_TIMEOUT), DEFAULT(0), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(update_slave_max_statement_time));
#endif
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_COMMIT_WAIT_COUNT>
Sys_binlog_commit_wait_count(
"binlog_commit_wait_count",
"If non-zero, binlog write will wait at most binlog_commit_wait_usec "
"microseconds for at least this many commits to queue up for group "
"commit to the binlog. This can reduce I/O on the binlog and provide "
"increased opportunity for parallel apply on the slave, but too high "
"a value will decrease commit throughput.",
GLOBAL_VAR(opt_binlog_commit_wait_count), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_COMMIT_WAIT_USEC>
Sys_binlog_commit_wait_usec(
"binlog_commit_wait_usec",
"Maximum time, in microseconds, to wait for more commits to queue up "
"for binlog group commit. Only takes effect if the value of "
"binlog_commit_wait_count is non-zero.",
GLOBAL_VAR(opt_binlog_commit_wait_usec), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, ULONG_MAX), DEFAULT(100000), BLOCK_SIZE(1));
static bool fix_max_join_size(sys_var *self, THD *thd, enum_var_type type)
{
SV *sv= type == OPT_GLOBAL ? &global_system_variables : &thd->variables;
if (sv->max_join_size == HA_POS_ERROR)
sv->option_bits|= OPTION_BIG_SELECTS;
else
sv->option_bits&= ~OPTION_BIG_SELECTS;
return false;
}
static Sys_var_harows Sys_max_join_size(
"max_join_size",
"Joins that are probably going to read more than max_join_size "
"records return an error",
SESSION_VAR(max_join_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_max_join_size));
static Sys_var_ulong Sys_max_seeks_for_key(
"max_seeks_for_key",
"Limit assumed max number of seeks when looking up rows based on a key",
SESSION_VAR(max_seeks_for_key), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, UINT_MAX), DEFAULT(UINT_MAX), BLOCK_SIZE(1));
static Sys_var_ulong Sys_max_length_for_sort_data(
"max_length_for_sort_data",
"Max number of bytes in sorted records",
SESSION_VAR(max_length_for_sort_data), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(4, 8192*1024L), DEFAULT(1024), BLOCK_SIZE(1));
static PolyLock_mutex PLock_prepared_stmt_count(&LOCK_prepared_stmt_count);
static Sys_var_uint Sys_max_prepared_stmt_count(
"max_prepared_stmt_count",
"Maximum number of prepared statements in the server",
GLOBAL_VAR(max_prepared_stmt_count), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX32), DEFAULT(16382), BLOCK_SIZE(1),
&PLock_prepared_stmt_count);
static Sys_var_ulong Sys_max_recursive_iterations(
"max_recursive_iterations",
"Maximum number of iterations when executing recursive queries",
SESSION_VAR(max_recursive_iterations), CMD_LINE(OPT_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(1000), BLOCK_SIZE(1));
static Sys_var_ulong Sys_max_sort_length(
"max_sort_length",
"The number of bytes to use when sorting BLOB or TEXT values (only "
"the first max_sort_length bytes of each value are used; the rest "
"are ignored)",
SESSION_VAR(max_sort_length), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(64, 8192*1024L), DEFAULT(1024), BLOCK_SIZE(1));
static Sys_var_ulong Sys_max_sp_recursion_depth(
"max_sp_recursion_depth",
"Maximum stored procedure recursion depth",
SESSION_VAR(max_sp_recursion_depth), CMD_LINE(OPT_ARG),
VALID_RANGE(0, 255), DEFAULT(0), BLOCK_SIZE(1));
static bool if_checking_enabled(sys_var *self, THD *thd, set_var *var)
{
if (session_readonly(self, thd, var))
return true;
if (!max_user_connections_checking)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--max-user-connections=0");
return true;
}
return false;
}
// non-standard session_value_ptr() here
static Sys_var_max_user_conn Sys_max_user_connections(
"max_user_connections",
"The maximum number of active connections for a single user "
"(0 = no limit)",
SESSION_VAR(max_user_connections), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(-1, INT_MAX), DEFAULT(0), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(if_checking_enabled));
static Sys_var_ulong Sys_max_tmp_tables(
"max_tmp_tables", "Unused, will be removed.",
SESSION_VAR(max_tmp_tables), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, UINT_MAX), DEFAULT(32), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
DEPRECATED("")); // since 10.1.2
static Sys_var_ulong Sys_max_write_lock_count(
"max_write_lock_count",
"After this many write locks, allow some read locks to run in between",
GLOBAL_VAR(max_write_lock_count), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, UINT_MAX), DEFAULT(UINT_MAX), BLOCK_SIZE(1));
static Sys_var_ulong Sys_min_examined_row_limit(
"min_examined_row_limit",
"Alias for log_slow_min_examined_row_limit. "
"Don't write queries to slow log that examine fewer rows "
"than that",
SESSION_VAR(min_examined_row_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_ulong Sys_log_slow_min_examined_row_limit(
"log_slow_min_examined_row_limit",
"Don't write queries to slow log that examine fewer rows "
"than that",
SESSION_VAR(min_examined_row_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
#ifdef _WIN32
static Sys_var_mybool Sys_named_pipe(
"named_pipe", "Enable the named pipe (NT)",
READ_ONLY GLOBAL_VAR(opt_enable_named_pipe), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
#endif
static bool check_net_buffer_length(sys_var *self, THD *thd, set_var *var)
{
longlong val;
if (session_readonly(self, thd, var))
return true;
val= var->save_result.ulonglong_value;
if (val > (longlong) global_system_variables.max_allowed_packet)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
WARN_OPTION_BELOW_LIMIT,
ER_THD(thd, WARN_OPTION_BELOW_LIMIT),
"max_allowed_packet", "net_buffer_length");
}
return false;
}
static Sys_var_ulong Sys_net_buffer_length(
"net_buffer_length",
"Buffer length for TCP/IP and socket communication",
SESSION_VAR(net_buffer_length), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, 1024*1024), DEFAULT(16384), BLOCK_SIZE(1024),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_net_buffer_length));
static bool fix_net_read_timeout(sys_var *self, THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
my_net_set_read_timeout(&thd->net, thd->variables.net_read_timeout);
return false;
}
static Sys_var_ulong Sys_net_read_timeout(
"net_read_timeout",
"Number of seconds to wait for more data from a connection before "
"aborting the read",
SESSION_VAR(net_read_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(NET_READ_TIMEOUT), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_net_read_timeout));
static bool fix_net_write_timeout(sys_var *self, THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
my_net_set_write_timeout(&thd->net, thd->variables.net_write_timeout);
return false;
}
static Sys_var_ulong Sys_net_write_timeout(
"net_write_timeout",
"Number of seconds to wait for a block to be written to a connection "
"before aborting the write",
SESSION_VAR(net_write_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(NET_WRITE_TIMEOUT), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_net_write_timeout));
static bool fix_net_retry_count(sys_var *self, THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
thd->net.retry_count=thd->variables.net_retry_count;
return false;
}
static Sys_var_ulong Sys_net_retry_count(
"net_retry_count",
"If a read on a communication port is interrupted, retry this "
"many times before giving up",
SESSION_VAR(net_retry_count), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, UINT_MAX), DEFAULT(MYSQLD_NET_RETRY_COUNT),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_net_retry_count));
static bool set_old_mode (sys_var *self, THD *thd, enum_var_type type)
{
if (thd->variables.old_mode)
{
thd->variables.old_behavior|= (OLD_MODE_NO_PROGRESS_INFO |
OLD_MODE_IGNORE_INDEX_ONLY_FOR_JOIN |
OLD_MODE_COMPAT_5_1_CHECKSUM);
}
else
{
thd->variables.old_behavior&= ~(OLD_MODE_NO_PROGRESS_INFO|
OLD_MODE_IGNORE_INDEX_ONLY_FOR_JOIN |
OLD_MODE_COMPAT_5_1_CHECKSUM);
}
return false;
}
static Sys_var_mybool Sys_old_mode(
"old", "Use compatible behavior from previous MariaDB version. See also --old-mode",
SESSION_VAR(old_mode), CMD_LINE(OPT_ARG), DEFAULT(FALSE), 0, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(set_old_mode), DEPRECATED("'@@old_mode'"));
static Sys_var_mybool Sys_opt_allow_suspicious_udfs(
"allow_suspicious_udfs",
"Allows use of user-defined functions (UDFs) consisting of only one symbol xxx() without corresponding xxx_init() or xxx_deinit(). That also means that one can load any function from any library, for example exit() from libc.so",
READ_ONLY GLOBAL_VAR(opt_allow_suspicious_udfs),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
#ifndef DISABLE_GRANT_OPTIONS
static Sys_var_mybool Sys_skip_grant_tables(
"skip_grant_tables",
"Start without grant tables. This gives all users FULL ACCESS to all tables.",
READ_ONLY GLOBAL_VAR(opt_noacl),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
#endif
static const char *alter_algorithm_modes[]= {"DEFAULT", "COPY", "INPLACE",
"NOCOPY", "INSTANT", NULL};
static Sys_var_enum Sys_alter_algorithm(
"alter_algorithm", "Specify the alter table algorithm",
SESSION_VAR(alter_algorithm), CMD_LINE(OPT_ARG),
alter_algorithm_modes, DEFAULT(0));
static Sys_var_enum Sys_old_alter_table(
"old_alter_table", "Alias for alter_algorithm. "
"Deprecated. Use --alter-algorithm instead.",
SESSION_VAR(alter_algorithm), CMD_LINE(OPT_ARG),
alter_algorithm_modes, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0), ON_UPDATE(0),
DEPRECATED("'@@alter_algorithm'")); // Since 10.5.1
static bool check_old_passwords(sys_var *self, THD *thd, set_var *var)
{
return mysql_user_table_is_in_short_password_format;
}
static Sys_var_mybool Sys_old_passwords(
"old_passwords",
"Use old password encryption method (needed for 4.0 and older clients)",
SESSION_VAR(old_passwords), CMD_LINE(OPT_ARG),
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_old_passwords));
export sys_var *Sys_old_passwords_ptr= &Sys_old_passwords; // for sql_acl.cc
static Sys_var_ulong Sys_open_files_limit(
"open_files_limit",
"If this is not 0, then mysqld will use this value to reserve file "
"descriptors to use with setrlimit(). If this value is 0 or autoset "
"then mysqld will reserve max_connections*5 or max_connections + "
"table_cache*2 (whichever is larger) number of file descriptors",
AUTO_SET READ_ONLY GLOBAL_VAR(open_files_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, OS_FILE_LIMIT), DEFAULT(0), BLOCK_SIZE(1));
/// @todo change to enum
static Sys_var_ulong Sys_optimizer_prune_level(
"optimizer_prune_level",
"Controls the heuristic(s) applied during query optimization to prune "
"less-promising partial plans from the optimizer search space. "
"Meaning: 0 - do not apply any heuristic, thus perform exhaustive "
"search: 1 - prune plans based on cost and number of retrieved rows "
"eq_ref: 2 - prune also if we find an eq_ref chain",
SESSION_VAR(optimizer_prune_level), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 2), DEFAULT(2), BLOCK_SIZE(1));
static Sys_var_ulong Sys_optimizer_selectivity_sampling_limit(
"optimizer_selectivity_sampling_limit",
"Controls number of record samples to check condition selectivity",
SESSION_VAR(optimizer_selectivity_sampling_limit),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(SELECTIVITY_SAMPLING_THRESHOLD, UINT_MAX),
DEFAULT(SELECTIVITY_SAMPLING_LIMIT), BLOCK_SIZE(1));
static Sys_var_ulong Sys_optimizer_use_condition_selectivity(
"optimizer_use_condition_selectivity",
"Controls selectivity of which conditions the optimizer takes into "
"account to calculate cardinality of a partial join when it searches "
"for the best execution plan "
"Meaning: "
"1 - use selectivity of index backed range conditions to calculate "
"the cardinality of a partial join if the last joined table is "
"accessed by full table scan or an index scan, "
"2 - use selectivity of index backed range conditions to calculate "
"the cardinality of a partial join in any case, "
"3 - additionally always use selectivity of range conditions that are "
"not backed by any index to calculate the cardinality of a partial join, "
"4 - use histograms to calculate selectivity of range conditions that "
"are not backed by any index to calculate the cardinality of "
"a partial join."
"5 - additionally use selectivity of certain non-range predicates "
"calculated on record samples",
SESSION_VAR(optimizer_use_condition_selectivity), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, 5), DEFAULT(4), BLOCK_SIZE(1));
static Sys_var_ulong Sys_optimizer_search_depth(
"optimizer_search_depth",
"Maximum depth of search performed by the query optimizer. Values "
"larger than the number of relations in a query result in better "
"query plans, but take longer to compile a query. Values smaller "
"than the number of tables in a relation result in faster "
"optimization, but may produce very bad query plans. If set to 0, "
"the system will automatically pick a reasonable value.",
SESSION_VAR(optimizer_search_depth), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, MAX_TABLES+1), DEFAULT(MAX_TABLES+1), BLOCK_SIZE(1));
static Sys_var_ulong Sys_optimizer_extra_pruning_depth(
"optimizer_extra_pruning_depth",
"If the optimizer needs to enumerate join prefix of this size or "
"larger, then it will try aggressively prune away the search space.",
SESSION_VAR(optimizer_extra_pruning_depth), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, MAX_TABLES+1), DEFAULT(8), BLOCK_SIZE(1));
/* this is used in the sigsegv handler */
export const char *optimizer_switch_names[]=
{
"index_merge","index_merge_union","index_merge_sort_union",
"index_merge_intersection","index_merge_sort_intersection",
"engine_condition_pushdown",
"index_condition_pushdown",
"derived_merge", "derived_with_keys",
"firstmatch","loosescan","materialization","in_to_exists","semijoin",
"partial_match_rowid_merge",
"partial_match_table_scan",
"subquery_cache",
"mrr",
"mrr_cost_based",
"mrr_sort_keys",
"outer_join_with_cache",
"semijoin_with_cache",
"join_cache_incremental",
"join_cache_hashed",
"join_cache_bka",
"optimize_join_buffer_size",
"table_elimination",
"extended_keys",
"exists_to_in",
"orderby_uses_equalities",
"condition_pushdown_for_derived",
"split_materialized",
"condition_pushdown_for_subquery",
"rowid_filter",
"condition_pushdown_from_having",
"not_null_range_scan",
"hash_join_cardinality",
"cset_narrowing",
"default",
NullS
};
static bool fix_optimizer_switch(sys_var *self, THD *thd,
enum_var_type type)
{
SV *sv= (type == OPT_GLOBAL) ? &global_system_variables : &thd->variables;
if (sv->optimizer_switch & deprecated_ENGINE_CONDITION_PUSHDOWN)
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT),
"engine_condition_pushdown=on"); // since 10.1.1
return false;
}
static bool check_legal_optimizer_switch(sys_var *self, THD *thd,
set_var *var)
{
if (var->save_result.ulonglong_value & (OPTIMIZER_SWITCH_MATERIALIZATION |
OPTIMIZER_SWITCH_IN_TO_EXISTS))
{
return false;
}
my_error(ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES, MYF(0));
return true;
}
static Sys_var_flagset Sys_optimizer_switch(
"optimizer_switch",
"Fine-tune the optimizer behavior",
SESSION_VAR(optimizer_switch), CMD_LINE(REQUIRED_ARG),
optimizer_switch_names, DEFAULT(OPTIMIZER_SWITCH_DEFAULT),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_legal_optimizer_switch),
ON_UPDATE(fix_optimizer_switch));
static Sys_var_flagset Sys_optimizer_trace(
"optimizer_trace",
"Controls tracing of the Optimizer:"
" optimizer_trace=option=val[,option=val...], where option is one of"
" {enabled}"
" and val is one of {on, off, default}",
SESSION_VAR(optimizer_trace), CMD_LINE(REQUIRED_ARG),
Opt_trace_context::flag_names, DEFAULT(Opt_trace_context::FLAG_DEFAULT));
// @see set_var::is_var_optimizer_trace()
export sys_var *Sys_optimizer_trace_ptr = &Sys_optimizer_trace;
static Sys_var_ulong Sys_optimizer_trace_max_mem_size(
"optimizer_trace_max_mem_size",
"Maximum allowed size of an optimizer trace",
SESSION_VAR(optimizer_trace_max_mem_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, ULONG_MAX), DEFAULT(1024 * 1024), BLOCK_SIZE(1));
static Sys_var_charptr_fscs Sys_pid_file(
"pid_file", "Pid file used by safe_mysqld",
READ_ONLY GLOBAL_VAR(pidfile_name_ptr), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_charptr_fscs Sys_plugin_dir(
"plugin_dir", "Directory for plugins",
READ_ONLY GLOBAL_VAR(opt_plugin_dir_ptr), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_uint Sys_port(
"port",
"Port number to use for connection or 0 to default to, "
"my.cnf, $MYSQL_TCP_PORT, "
#if MYSQL_PORT_DEFAULT == 0
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) "), whatever comes first",
READ_ONLY GLOBAL_VAR(mysqld_port), CMD_LINE(REQUIRED_ARG, 'P'),
VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_ulong Sys_preload_buff_size(
"preload_buffer_size",
"The size of the buffer that is allocated when preloading indexes",
SESSION_VAR(preload_buff_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, 1024*1024*1024), DEFAULT(32768), BLOCK_SIZE(1));
static Sys_var_uint Sys_protocol_version(
"protocol_version",
"The version of the client/server protocol used by the MariaDB server",
READ_ONLY GLOBAL_VAR(protocol_version), CMD_LINE_HELP_ONLY,
VALID_RANGE(0, ~0U), DEFAULT(PROTOCOL_VERSION), BLOCK_SIZE(1));
static Sys_var_proxy_user Sys_proxy_user(
"proxy_user", "The proxy user account name used when logging in");
static Sys_var_external_user Sys_exterenal_user(
"external_user", "The external user account used when logging in");
static Sys_var_ulong Sys_read_buff_size(
"read_buffer_size",
"Each thread that does a sequential scan allocates a buffer of "
"this size for each table it scans. If you do many sequential scans, "
"you may want to increase this value",
SESSION_VAR(read_buff_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE*2, INT_MAX32), DEFAULT(128*1024),
BLOCK_SIZE(IO_SIZE));
static bool check_read_only(sys_var *self, THD *thd, set_var *var)
{
/* Prevent self dead-lock */
if (thd->locked_tables_mode || thd->in_active_multi_stmt_transaction() ||
thd->current_backup_stage != BACKUP_FINISHED)
{
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
return true;
}
return false;
}
static bool fix_read_only(sys_var *self, THD *thd, enum_var_type type)
{
bool result= true;
my_bool new_read_only= read_only; // make a copy before releasing a mutex
DBUG_ENTER("sys_var_opt_readonly::update");
if (read_only == FALSE || read_only == opt_readonly)
{
opt_readonly= read_only;
DBUG_RETURN(false);
}
if (check_read_only(self, thd, 0)) // just in case
goto end;
if (thd->global_read_lock.is_acquired())
{
/*
This connection already holds the global read lock.
This can be the case with:
- FLUSH TABLES WITH READ LOCK
- SET GLOBAL READ_ONLY = 1
*/
opt_readonly= read_only;
DBUG_RETURN(false);
}
/*
READ_ONLY=1 prevents write locks from being taken on tables and
blocks transactions from committing. We therefore should make sure
that no such events occur while setting the read_only variable.
This is a 2 step process:
[1] lock_global_read_lock()
Prevents connections from obtaining new write locks on
tables. Note that we can still have active rw transactions.
[2] make_global_read_lock_block_commit()
Prevents transactions from committing.
*/
read_only= opt_readonly;
mysql_mutex_unlock(&LOCK_global_system_variables);
if (thd->global_read_lock.lock_global_read_lock(thd))
goto end_with_mutex_unlock;
if ((result= thd->global_read_lock.make_global_read_lock_block_commit(thd)))
goto end_with_read_lock;
/* Change the opt_readonly system variable, safe because the lock is held */
opt_readonly= new_read_only;
result= false;
end_with_read_lock:
/* Release the lock */
thd->global_read_lock.unlock_global_read_lock(thd);
end_with_mutex_unlock:
mysql_mutex_lock(&LOCK_global_system_variables);
end:
read_only= opt_readonly;
DBUG_RETURN(result);
}
/**
The read_only boolean is always equal to the opt_readonly boolean except
during fix_read_only(); when that function is entered, opt_readonly is
the pre-update value and read_only is the post-update value.
fix_read_only() compares them and runs needed operations for the
transition (especially when transitioning from false to true) and
synchronizes both booleans in the end.
*/
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_READ_ONLY>
Sys_readonly(
"read_only",
"Make all non-temporary tables read-only, with the exception for "
"replication (slave) threads and users with the 'READ ONLY ADMIN' "
"privilege",
GLOBAL_VAR(read_only), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_read_only), ON_UPDATE(fix_read_only));
// Small lower limit to be able to test MRR
static Sys_var_ulong Sys_read_rnd_buff_size(
"read_rnd_buffer_size",
"When reading rows in sorted order after a sort, the rows are read "
"through this buffer to avoid a disk seeks",
SESSION_VAR(read_rnd_buff_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, INT_MAX32), DEFAULT(256*1024), BLOCK_SIZE(1));
static Sys_var_ulong Sys_div_precincrement(
"div_precision_increment", "Precision of the result of '/' "
"operator will be increased on that value",
SESSION_VAR(div_precincrement), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, DECIMAL_MAX_SCALE), DEFAULT(4), BLOCK_SIZE(1));
static Sys_var_uint Sys_eq_range_index_dive_limit(
"eq_range_index_dive_limit",
"The optimizer will use existing index statistics instead of "
"doing index dives for equality ranges if the number of equality "
"ranges for the index is larger than or equal to this number. "
"If set to 0, index dives are always used.",
SESSION_VAR(eq_range_index_dive_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX32), DEFAULT(200),
BLOCK_SIZE(1));
static Sys_var_ulong Sys_range_alloc_block_size(
"range_alloc_block_size",
"Allocation block size for storing ranges during optimization",
SESSION_VAR(range_alloc_block_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(RANGE_ALLOC_BLOCK_SIZE, UINT_MAX),
DEFAULT(RANGE_ALLOC_BLOCK_SIZE), BLOCK_SIZE(1024));
static bool fix_thd_mem_root(sys_var *self, THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
reset_root_defaults(thd->mem_root,
thd->variables.query_alloc_block_size,
thd->variables.query_prealloc_size);
return false;
}
static Sys_var_ulong Sys_query_alloc_block_size(
"query_alloc_block_size",
"Allocation block size for query parsing and execution",
SESSION_VAR(query_alloc_block_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, UINT_MAX), DEFAULT(QUERY_ALLOC_BLOCK_SIZE),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_thd_mem_root));
static Sys_var_ulong Sys_query_prealloc_size(
"query_prealloc_size",
"Persistent buffer for query parsing and execution",
SESSION_VAR(query_prealloc_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, UINT_MAX),
DEFAULT(QUERY_ALLOC_PREALLOC_SIZE),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_thd_mem_root));
// this has to be NO_CMD_LINE as the command-line option has a different name
static Sys_var_mybool Sys_skip_external_locking(
"skip_external_locking", "Don't use system (external) locking",
READ_ONLY GLOBAL_VAR(my_disable_locking), NO_CMD_LINE, DEFAULT(TRUE));
static Sys_var_mybool Sys_skip_networking(
"skip_networking", "Don't allow connection with TCP/IP",
READ_ONLY GLOBAL_VAR(opt_disable_networking), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static Sys_var_mybool Sys_skip_name_resolve(
"skip_name_resolve",
"Don't resolve hostnames. All hostnames are IP's or 'localhost'.",
READ_ONLY GLOBAL_VAR(opt_skip_name_resolve),
CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static Sys_var_mybool Sys_skip_show_database(
"skip_show_database", "Don't allow 'SHOW DATABASE' commands",
READ_ONLY GLOBAL_VAR(opt_skip_show_db), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static Sys_var_charptr_fscs Sys_socket(
"socket", "Socket file to use for connection",
READ_ONLY GLOBAL_VAR(mysqld_unix_port), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_ulonglong Sys_thread_stack(
"thread_stack", "The stack size for each thread",
READ_ONLY GLOBAL_VAR(my_thread_stack_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(128*1024, ULONGLONG_MAX), DEFAULT(DEFAULT_THREAD_STACK),
BLOCK_SIZE(1024));
static Sys_var_charptr_fscs Sys_tmpdir(
"tmpdir", "Path for temporary files. Several paths may "
"be specified, separated by a "
#if defined(_WIN32)
"semicolon (;)"
#else
"colon (:)"
#endif
", in this case they are used in a round-robin fashion",
READ_ONLY GLOBAL_VAR(opt_mysql_tmpdir), CMD_LINE(REQUIRED_ARG, 't'),
DEFAULT(0));
static bool fix_trans_mem_root(sys_var *self, THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
reset_root_defaults(&thd->transaction->mem_root,
thd->variables.trans_alloc_block_size,
thd->variables.trans_prealloc_size);
return false;
}
static Sys_var_ulong Sys_trans_alloc_block_size(
"transaction_alloc_block_size",
"Allocation block size for transactions to be stored in binary log",
SESSION_VAR(trans_alloc_block_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, 128 * 1024 * 1024), DEFAULT(TRANS_ALLOC_BLOCK_SIZE),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_trans_mem_root));
static Sys_var_ulong Sys_trans_prealloc_size(
"transaction_prealloc_size",
"Persistent buffer for transactions to be stored in binary log",
SESSION_VAR(trans_prealloc_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, 128 * 1024 * 1024), DEFAULT(TRANS_ALLOC_PREALLOC_SIZE),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_trans_mem_root));
static const char *thread_handling_names[]=
{
"one-thread-per-connection", "no-threads",
#ifdef HAVE_POOL_OF_THREADS
"pool-of-threads",
#endif
0
};
#if defined (_WIN32) && defined (HAVE_POOL_OF_THREADS)
/* Windows is using OS threadpool, so we're pretty sure it works well */
#define DEFAULT_THREAD_HANDLING 2
#else
#define DEFAULT_THREAD_HANDLING 0
#endif
static Sys_var_enum Sys_thread_handling(
"thread_handling",
"Define threads usage for handling queries",
READ_ONLY GLOBAL_VAR(thread_handling), CMD_LINE(REQUIRED_ARG),
thread_handling_names,
DEFAULT(DEFAULT_THREAD_HANDLING)
);
#ifdef HAVE_QUERY_CACHE
static bool fix_query_cache_size(sys_var *self, THD *thd, enum_var_type type)
{
size_t new_cache_size= query_cache.resize((size_t)query_cache_size);
/*
Note: query_cache_size is a global variable reflecting the
requested cache size. See also query_cache_size_arg
*/
if (query_cache_size != new_cache_size)
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_QC_RESIZE, ER_THD(thd, ER_WARN_QC_RESIZE),
query_cache_size, (ulong)new_cache_size);
query_cache_size= new_cache_size;
return false;
}
static bool fix_query_cache_limit(sys_var *self, THD *thd, enum_var_type type)
{
query_cache.result_size_limit(query_cache_limit);
return false;
}
static Sys_var_ulonglong Sys_query_cache_size(
"query_cache_size",
"The memory allocated to store results from old queries",
GLOBAL_VAR(query_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, ULONG_MAX), DEFAULT(1024*1024), BLOCK_SIZE(1024),
NO_MUTEX_GUARD, NOT_IN_BINLOG, NULL,
ON_UPDATE(fix_query_cache_size));
static Sys_var_ulong Sys_query_cache_limit(
"query_cache_limit",
"Don't cache results that are bigger than this",
GLOBAL_VAR(query_cache_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(1024*1024), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_query_cache_limit));
static bool fix_qcache_min_res_unit(sys_var *self, THD *thd, enum_var_type type)
{
query_cache_min_res_unit=
(ulong)query_cache.set_min_res_unit(query_cache_min_res_unit);
return false;
}
static Sys_var_ulong Sys_query_cache_min_res_unit(
"query_cache_min_res_unit",
"The minimum size for blocks allocated by the query cache",
GLOBAL_VAR(query_cache_min_res_unit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(QUERY_CACHE_MIN_RESULT_DATA_SIZE),
BLOCK_SIZE(8), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_qcache_min_res_unit));
static const char *query_cache_type_names[]= { "OFF", "ON", "DEMAND", 0 };
static bool check_query_cache_type(sys_var *self, THD *thd, set_var *var)
{
if (query_cache.is_disable_in_progress())
{
my_error(ER_QUERY_CACHE_IS_DISABLED, MYF(0));
return true;
}
if (var->type != OPT_GLOBAL && global_system_variables.query_cache_type == 0)
{
if (var->value)
{
if (var->save_result.ulonglong_value != 0)
{
my_error(ER_QUERY_CACHE_IS_GLOBALY_DISABLED, MYF(0));
return true;
}
}
}
return false;
}
static bool fix_query_cache_type(sys_var *self, THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
return false;
if (global_system_variables.query_cache_type != 0 &&
query_cache.is_disabled())
{
/* if disabling in progress variable will not be set */
DBUG_ASSERT(!query_cache.is_disable_in_progress());
/* Enable query cache because it was disabled */
fix_query_cache_size(0, thd, type);
}
else if (global_system_variables.query_cache_type == 0)
query_cache.disable_query_cache(thd);
return false;
}
static Sys_var_enum Sys_query_cache_type(
"query_cache_type",
"OFF = Don't cache or retrieve results. ON = Cache all results "
"except SELECT SQL_NO_CACHE ... queries. DEMAND = Cache only "
"SELECT SQL_CACHE ... queries",
NO_SET_STMT SESSION_VAR(query_cache_type), CMD_LINE(REQUIRED_ARG),
query_cache_type_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_query_cache_type),
ON_UPDATE(fix_query_cache_type));
static Sys_var_mybool Sys_query_cache_wlock_invalidate(
"query_cache_wlock_invalidate",
"Invalidate queries in query cache on LOCK for write",
SESSION_VAR(query_cache_wlock_invalidate), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
#endif /* HAVE_QUERY_CACHE */
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_SECURE_AUTH>
Sys_secure_auth(
"secure_auth",
"Disallow authentication for accounts that have old (pre-4.1) "
"passwords",
GLOBAL_VAR(opt_secure_auth), CMD_LINE(OPT_ARG),
DEFAULT(TRUE));
static bool check_require_secure_transport(sys_var *self, THD *thd, set_var *var)
{
#ifndef _WIN32
/*
Always allow require_secure_transport to be enabled on
Linux, because it always has Unix domain sockets that are secure:
*/
return false;
#else
/*
Check SSL is enabled before turning require_secure_transport ON,
otherwise no connections will be allowed on Windows:
*/
if (!var->save_result.ulonglong_value)
return false;
if (opt_use_ssl || opt_enable_named_pipe)
return false;
/* reject if SSL is disabled: */
my_error(ER_NO_SECURE_TRANSPORTS_CONFIGURED, MYF(0));
return true;
#endif
}
static Sys_var_mybool Sys_require_secure_transport(
"require_secure_transport",
"When this option is enabled, connections attempted using insecure "
"transport will be rejected. Secure transports are SSL/TLS, "
"Unix sockets or named pipes.",
GLOBAL_VAR(opt_require_secure_transport),
CMD_LINE(OPT_ARG),
DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_require_secure_transport), ON_UPDATE(0));
static Sys_var_charptr_fscs Sys_secure_file_priv(
"secure_file_priv",
"Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
"within specified directory",
PREALLOCATED READ_ONLY GLOBAL_VAR(opt_secure_file_priv),
CMD_LINE(REQUIRED_ARG, OPT_SEQURE_FILE_PRIV), DEFAULT(0));
static bool check_server_id(sys_var *self, THD *thd, set_var *var)
{
#ifdef WITH_WSREP
if (WSREP_ON && WSREP_PROVIDER_EXISTS && !wsrep_new_cluster && wsrep_gtid_mode)
{
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"Can't change server_id because wsrep and wsrep_gtid_mode is set."
" You can set server_id only with wsrep_new_cluster. ");
return true;
}
#endif /* WITH_WSREP */
return false;
}
static bool fix_server_id(sys_var *self, THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
{
thd->variables.server_id= global_system_variables.server_id;
/*
Historically, server_id was a global variable that is exported to
plugins. Now it is a session variable, and lives in the
global_system_variables struct, but we still need to export the
value for reading to plugins for backwards compatibility reasons.
*/
::server_id= global_system_variables.server_id;
}
return false;
}
static Sys_var_on_access<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_SERVER_ID,
PRIV_SET_SYSTEM_SESSION_VAR_SERVER_ID>
Sys_server_id(
"server_id",
"Uniquely identifies the server instance in the community of "
"replication partners",
SESSION_VAR(server_id), CMD_LINE(REQUIRED_ARG, OPT_SERVER_ID),
VALID_RANGE(1, UINT_MAX32), DEFAULT(1), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(check_server_id), ON_UPDATE(fix_server_id));
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_COMPRESSED_PROTOCOL>
Sys_slave_compressed_protocol(
"slave_compressed_protocol",
"Use compression on master/slave protocol",
GLOBAL_VAR(opt_slave_compressed_protocol), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
#ifdef HAVE_REPLICATION
static const char *slave_exec_mode_names[]= {"STRICT", "IDEMPOTENT", 0};
static Sys_var_on_access_global<Sys_var_enum,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_EXEC_MODE>
Slave_exec_mode(
"slave_exec_mode",
"How replication events should be executed. Legal values "
"are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, "
"replication will not stop for operations that are idempotent. "
"For example, in row based replication attempts to delete rows that "
"doesn't exist will be ignored. "
"In STRICT mode, replication will stop on any unexpected difference "
"between the master and the slave.",
GLOBAL_VAR(slave_exec_mode_options), CMD_LINE(REQUIRED_ARG),
slave_exec_mode_names, DEFAULT(SLAVE_EXEC_MODE_STRICT));
static Sys_var_on_access_global<Sys_var_enum,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_DDL_EXEC_MODE>
Slave_ddl_exec_mode(
"slave_ddl_exec_mode",
"How replication events should be executed. Legal values "
"are STRICT and IDEMPOTENT (default). In IDEMPOTENT mode, "
"replication will not stop for DDL operations that are idempotent. "
"This means that CREATE TABLE is treated as CREATE TABLE OR REPLACE and "
"DROP TABLE is treated as DROP TABLE IF EXISTS.",
GLOBAL_VAR(slave_ddl_exec_mode_options), CMD_LINE(REQUIRED_ARG),
slave_exec_mode_names, DEFAULT(SLAVE_EXEC_MODE_IDEMPOTENT));
static const char *slave_run_triggers_for_rbr_names[]=
{"NO", "YES", "LOGGING", "ENFORCE", 0};
static Sys_var_on_access_global<Sys_var_enum,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_RUN_TRIGGERS_FOR_RBR>
Slave_run_triggers_for_rbr(
"slave_run_triggers_for_rbr",
"Modes for how triggers in row-base replication on slave side will be "
"executed. Legal values are NO (default), YES, LOGGING and ENFORCE. NO means "
"that trigger for RBR will not be running on slave. YES and LOGGING "
"means that triggers will be running on slave, if there was not "
"triggers running on the master for the statement. LOGGING also means "
"results of that the executed triggers work will be written to "
"the binlog. ENFORCE means that triggers will always be run on the slave, "
"even if there are triggers on the master. ENFORCE implies LOGGING.",
GLOBAL_VAR(slave_run_triggers_for_rbr), CMD_LINE(REQUIRED_ARG),
slave_run_triggers_for_rbr_names,
DEFAULT(SLAVE_RUN_TRIGGERS_FOR_RBR_NO));
static const char *slave_type_conversions_name[]= {"ALL_LOSSY", "ALL_NON_LOSSY", 0};
static Sys_var_on_access_global<Sys_var_set,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_TYPE_CONVERSIONS>
Slave_type_conversions(
"slave_type_conversions",
"Set of slave type conversions that are enabled."
" If the variable is empty, no conversions are"
" allowed and it is expected that the types match exactly",
GLOBAL_VAR(slave_type_conversions_options), CMD_LINE(REQUIRED_ARG),
slave_type_conversions_name,
DEFAULT(0));
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_SQL_VERIFY_CHECKSUM>
Sys_slave_sql_verify_checksum(
"slave_sql_verify_checksum",
"Force checksum verification of replication events after reading them "
"from relay log. Note: Events are always checksum-verified by slave on "
"receiving them from the network before writing them to the relay log",
GLOBAL_VAR(opt_slave_sql_verify_checksum), CMD_LINE(OPT_ARG),
DEFAULT(TRUE));
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_MASTER_VERIFY_CHECKSUM>
Sys_master_verify_checksum(
"master_verify_checksum",
"Force checksum verification of logged events in the binary log before "
"sending them to slaves or printing them in the output of "
"SHOW BINLOG EVENTS",
GLOBAL_VAR(opt_master_verify_checksum), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
/* These names must match RPL_SKIP_XXX #defines in slave.h. */
static const char *replicate_events_marked_for_skip_names[]= {
"REPLICATE", "FILTER_ON_SLAVE", "FILTER_ON_MASTER", 0
};
bool
Sys_var_replicate_events_marked_for_skip::global_update(THD *thd, set_var *var)
{
bool result= true; // Assume error
DBUG_ENTER("Sys_var_replicate_events_marked_for_skip::global_update");
mysql_mutex_unlock(&LOCK_global_system_variables);
if (!give_error_if_slave_running(0))
result= Sys_var_enum::global_update(thd, var);
mysql_mutex_lock(&LOCK_global_system_variables);
DBUG_RETURN(result);
}
static Sys_var_on_access_global<Sys_var_replicate_events_marked_for_skip,
PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_EVENTS_MARKED_FOR_SKIP>
Replicate_events_marked_for_skip
("replicate_events_marked_for_skip",
"Whether the slave should replicate events that were created with "
"@@skip_replication=1 on the master. Default REPLICATE (no events are "
"skipped). Other values are FILTER_ON_SLAVE (events will be sent by the "
"master but ignored by the slave) and FILTER_ON_MASTER (events marked with "
"@@skip_replication=1 will be filtered on the master and never be sent to "
"the slave).",
GLOBAL_VAR(opt_replicate_events_marked_for_skip), CMD_LINE(REQUIRED_ARG),
replicate_events_marked_for_skip_names, DEFAULT(RPL_SKIP_REPLICATE));
/* new options for semisync */
static bool fix_rpl_semi_sync_master_enabled(sys_var *self, THD *thd,
enum_var_type type)
{
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&repl_semisync_master.LOCK_rpl_semi_sync_master_enabled);
if (rpl_semi_sync_master_enabled)
{
if (repl_semisync_master.enable_master() != 0)
rpl_semi_sync_master_enabled= false;
else if (ack_receiver.start())
{
repl_semisync_master.disable_master();
rpl_semi_sync_master_enabled= false;
}
}
else
{
repl_semisync_master.disable_master();
ack_receiver.stop();
}
mysql_mutex_unlock(&repl_semisync_master.LOCK_rpl_semi_sync_master_enabled);
mysql_mutex_lock(&LOCK_global_system_variables);
return false;
}
static bool fix_rpl_semi_sync_master_timeout(sys_var *self, THD *thd,
enum_var_type type)
{
repl_semisync_master.set_wait_timeout(rpl_semi_sync_master_timeout);
return false;
}
static bool fix_rpl_semi_sync_master_trace_level(sys_var *self, THD *thd,
enum_var_type type)
{
repl_semisync_master.set_trace_level(rpl_semi_sync_master_trace_level);
ack_receiver.set_trace_level(rpl_semi_sync_master_trace_level);
return false;
}
static bool fix_rpl_semi_sync_master_wait_point(sys_var *self, THD *thd,
enum_var_type type)
{
repl_semisync_master.set_wait_point(rpl_semi_sync_master_wait_point);
return false;
}
static bool fix_rpl_semi_sync_master_wait_no_slave(sys_var *self, THD *thd,
enum_var_type type)
{
repl_semisync_master.check_and_switch();
return false;
}
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_MASTER_ENABLED>
Sys_semisync_master_enabled(
"rpl_semi_sync_master_enabled",
"Enable semi-synchronous replication master (disabled by default).",
GLOBAL_VAR(rpl_semi_sync_master_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_rpl_semi_sync_master_enabled));
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_MASTER_TIMEOUT>
Sys_semisync_master_timeout(
"rpl_semi_sync_master_timeout",
"The timeout value (in ms) for semi-synchronous replication in the "
"master",
GLOBAL_VAR(rpl_semi_sync_master_timeout),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0,~0L),DEFAULT(10000),BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_rpl_semi_sync_master_timeout));
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_MASTER_WAIT_NO_SLAVE>
Sys_semisync_master_wait_no_slave(
"rpl_semi_sync_master_wait_no_slave",
"Wait until timeout when no semi-synchronous replication slave "
"available (enabled by default).",
GLOBAL_VAR(rpl_semi_sync_master_wait_no_slave),
CMD_LINE(OPT_ARG), DEFAULT(TRUE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_rpl_semi_sync_master_wait_no_slave));
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_MASTER_TRACE_LEVEL>
Sys_semisync_master_trace_level(
"rpl_semi_sync_master_trace_level",
"The tracing level for semi-sync replication.",
GLOBAL_VAR(rpl_semi_sync_master_trace_level),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0,~0L),DEFAULT(32),BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_rpl_semi_sync_master_trace_level));
static const char *repl_semisync_wait_point[]=
{"AFTER_SYNC", "AFTER_COMMIT", NullS};
static Sys_var_on_access_global<Sys_var_enum,
PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_MASTER_WAIT_POINT>
Sys_semisync_master_wait_point(
"rpl_semi_sync_master_wait_point",
"Should transaction wait for semi-sync ack after having synced binlog, "
"or after having committed in storage engine.",
GLOBAL_VAR(rpl_semi_sync_master_wait_point), CMD_LINE(REQUIRED_ARG),
repl_semisync_wait_point, DEFAULT(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG,ON_CHECK(0),
ON_UPDATE(fix_rpl_semi_sync_master_wait_point));
static bool fix_rpl_semi_sync_slave_enabled(sys_var *self, THD *thd,
enum_var_type type)
{
repl_semisync_slave.set_slave_enabled(rpl_semi_sync_slave_enabled != 0);
return false;
}
static bool fix_rpl_semi_sync_slave_trace_level(sys_var *self, THD *thd,
enum_var_type type)
{
repl_semisync_slave.set_trace_level(rpl_semi_sync_slave_trace_level);
return false;
}
static bool fix_rpl_semi_sync_slave_delay_master(sys_var *self, THD *thd,
enum_var_type type)
{
repl_semisync_slave.set_delay_master(rpl_semi_sync_slave_delay_master);
return false;
}
static bool fix_rpl_semi_sync_slave_kill_conn_timeout(sys_var *self, THD *thd,
enum_var_type type)
{
repl_semisync_slave.
set_kill_conn_timeout(rpl_semi_sync_slave_kill_conn_timeout);
return false;
}
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_SLAVE_ENABLED>
Sys_semisync_slave_enabled(
"rpl_semi_sync_slave_enabled",
"Enable semi-synchronous replication slave (disabled by default).",
GLOBAL_VAR(rpl_semi_sync_slave_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_rpl_semi_sync_slave_enabled));
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_SLAVE_TRACE_LEVEL>
Sys_semisync_slave_trace_level(
"rpl_semi_sync_slave_trace_level",
"The tracing level for semi-sync replication.",
GLOBAL_VAR(rpl_semi_sync_slave_trace_level),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0,~0L),DEFAULT(32),BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_rpl_semi_sync_slave_trace_level));
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_SLAVE_DELAY_MASTER>
Sys_semisync_slave_delay_master(
"rpl_semi_sync_slave_delay_master",
"Only write master info file when ack is needed.",
GLOBAL_VAR(rpl_semi_sync_slave_delay_master),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_rpl_semi_sync_slave_delay_master));
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_RPL_SEMI_SYNC_SLAVE_KILL_CONN_TIMEOUT>
Sys_semisync_slave_kill_conn_timeout(
"rpl_semi_sync_slave_kill_conn_timeout",
"Timeout for the mysql connection used to kill the slave io_thread's "
"connection on master. This timeout comes into play when stop slave "
"is executed.",
GLOBAL_VAR(rpl_semi_sync_slave_kill_conn_timeout),
CMD_LINE(OPT_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(5), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_rpl_semi_sync_slave_kill_conn_timeout));
#endif /* HAVE_REPLICATION */
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLOW_LAUNCH_TIME>
Sys_slow_launch_time(
"slow_launch_time",
"If creating the thread takes longer than this value (in seconds), "
"the Slow_launch_threads counter will be incremented",
GLOBAL_VAR(slow_launch_time), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, LONG_TIMEOUT), DEFAULT(2), BLOCK_SIZE(1));
static Sys_var_ulonglong Sys_sort_buffer(
"sort_buffer_size",
"Each thread that needs to do a sort allocates a buffer of this size",
SESSION_VAR(sortbuff_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(MIN_SORT_MEMORY, SIZE_T_MAX), DEFAULT(MAX_SORT_MEMORY),
BLOCK_SIZE(1));
export sql_mode_t expand_sql_mode(sql_mode_t sql_mode)
{
if (sql_mode & MODE_ANSI)
{
/*
Note that we don't set
MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS | MODE_NO_FIELD_OPTIONS
to allow one to get full use of MySQL in this mode.
MODE_ONLY_FULL_GROUP_BY was removed from ANSI mode because it is
currently overly restrictive (see BUG#8510).
*/
sql_mode|= (MODE_REAL_AS_FLOAT | MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
MODE_IGNORE_SPACE);
}
if (sql_mode & MODE_ORACLE)
sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
MODE_IGNORE_SPACE |
MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
MODE_NO_FIELD_OPTIONS | MODE_NO_AUTO_CREATE_USER |
MODE_SIMULTANEOUS_ASSIGNMENT);
if (sql_mode & MODE_MSSQL)
sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
MODE_IGNORE_SPACE |
MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
MODE_NO_FIELD_OPTIONS);
if (sql_mode & MODE_POSTGRESQL)
sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
MODE_IGNORE_SPACE |
MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
MODE_NO_FIELD_OPTIONS);
if (sql_mode & MODE_DB2)
sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
MODE_IGNORE_SPACE |
MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
MODE_NO_FIELD_OPTIONS);
if (sql_mode & MODE_MAXDB)
sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
MODE_IGNORE_SPACE |
MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
MODE_NO_FIELD_OPTIONS | MODE_NO_AUTO_CREATE_USER);
if (sql_mode & MODE_MYSQL40)
sql_mode|= MODE_HIGH_NOT_PRECEDENCE;
if (sql_mode & MODE_MYSQL323)
sql_mode|= MODE_HIGH_NOT_PRECEDENCE;
if (sql_mode & MODE_TRADITIONAL)
sql_mode|= (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES |
MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
MODE_ERROR_FOR_DIVISION_BY_ZERO | MODE_NO_AUTO_CREATE_USER |
MODE_NO_ENGINE_SUBSTITUTION);
return sql_mode;
}
static bool check_sql_mode(sys_var *self, THD *thd, set_var *var)
{
var->save_result.ulonglong_value=
(ulonglong) expand_sql_mode(var->save_result.ulonglong_value);
return false;
}
static bool fix_sql_mode(sys_var *self, THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
{
/* Update thd->server_status */
if (thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES)
thd->server_status|= SERVER_STATUS_NO_BACKSLASH_ESCAPES;
else
thd->server_status&= ~SERVER_STATUS_NO_BACKSLASH_ESCAPES;
if (thd->variables.sql_mode & MODE_ANSI_QUOTES)
thd->server_status|= SERVER_STATUS_ANSI_QUOTES;
else
thd->server_status&= ~SERVER_STATUS_ANSI_QUOTES;
}
return false;
}
/*
WARNING: When adding new SQL modes don't forget to update the
tables definitions that stores it's value (ie: mysql.event, mysql.proc)
*/
static const char *sql_mode_names[]=
{
"REAL_AS_FLOAT", "PIPES_AS_CONCAT", "ANSI_QUOTES", "IGNORE_SPACE",
"IGNORE_BAD_TABLE_OPTIONS",
"ONLY_FULL_GROUP_BY", "NO_UNSIGNED_SUBTRACTION", "NO_DIR_IN_CREATE",
"POSTGRESQL", "ORACLE", "MSSQL", "DB2", "MAXDB", "NO_KEY_OPTIONS",
"NO_TABLE_OPTIONS", "NO_FIELD_OPTIONS", "MYSQL323", "MYSQL40", "ANSI",
"NO_AUTO_VALUE_ON_ZERO", "NO_BACKSLASH_ESCAPES", "STRICT_TRANS_TABLES",
"STRICT_ALL_TABLES", "NO_ZERO_IN_DATE", "NO_ZERO_DATE",
"ALLOW_INVALID_DATES", "ERROR_FOR_DIVISION_BY_ZERO", "TRADITIONAL",
"NO_AUTO_CREATE_USER", "HIGH_NOT_PRECEDENCE", "NO_ENGINE_SUBSTITUTION",
"PAD_CHAR_TO_FULL_LENGTH", "EMPTY_STRING_IS_NULL", "SIMULTANEOUS_ASSIGNMENT",
"TIME_ROUND_FRACTIONAL",
0
};
const char *sql_mode_string_representation(uint bit_number)
{
DBUG_ASSERT(bit_number < array_elements(sql_mode_names));
return sql_mode_names[bit_number];
}
export bool sql_mode_string_representation(THD *thd, sql_mode_t sql_mode,
LEX_CSTRING *ls)
{
set_to_string(thd, ls, sql_mode, sql_mode_names);
return ls->str == 0;
}
/*
sql_mode should *not* be IN_BINLOG: even though it is written to the binlog,
the slave ignores the MODE_NO_DIR_IN_CREATE variable, so slave's value
differs from master's (see log_event.cc: Query_log_event::do_apply_event()).
*/
static Sys_var_set Sys_sql_mode(
"sql_mode",
"Sets the sql mode",
SESSION_VAR(sql_mode), CMD_LINE(REQUIRED_ARG),
sql_mode_names,
DEFAULT(MODE_STRICT_TRANS_TABLES |
MODE_ERROR_FOR_DIVISION_BY_ZERO |
MODE_NO_ENGINE_SUBSTITUTION |
MODE_NO_AUTO_CREATE_USER),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_sql_mode), ON_UPDATE(fix_sql_mode));
static const char *old_mode_names[]=
{
"NO_DUP_KEY_WARNINGS_WITH_IGNORE",
"NO_PROGRESS_INFO",
"ZERO_DATE_TIME_CAST",
"UTF8_IS_UTF8MB3",
"IGNORE_INDEX_ONLY_FOR_JOIN",
"COMPAT_5_1_CHECKSUM",
0
};
/*
sql_mode should *not* be IN_BINLOG as the slave can't remember this
anyway on restart.
*/
static Sys_var_set Sys_old_behavior(
"old_mode",
"Used to emulate old behavior from earlier MariaDB or MySQL versions",
SESSION_VAR(old_behavior), CMD_LINE(REQUIRED_ARG),
old_mode_names, DEFAULT(OLD_MODE_UTF8_IS_UTF8MB3));
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
#define SSL_OPT(X) CMD_LINE(REQUIRED_ARG,X)
#else
#define SSL_OPT(X) NO_CMD_LINE
#endif
static Sys_var_charptr_fscs Sys_ssl_ca(
"ssl_ca",
"CA file in PEM format (check OpenSSL docs, implies --ssl)",
READ_ONLY GLOBAL_VAR(opt_ssl_ca), SSL_OPT(OPT_SSL_CA),
DEFAULT(0));
static Sys_var_charptr_fscs Sys_ssl_capath(
"ssl_capath",
"CA directory (check OpenSSL docs, implies --ssl)",
READ_ONLY GLOBAL_VAR(opt_ssl_capath), SSL_OPT(OPT_SSL_CAPATH),
DEFAULT(0));
static Sys_var_charptr_fscs Sys_ssl_cert(
"ssl_cert", "X509 cert in PEM format (implies --ssl)",
READ_ONLY GLOBAL_VAR(opt_ssl_cert), SSL_OPT(OPT_SSL_CERT),
DEFAULT(0));
static Sys_var_charptr_fscs Sys_ssl_cipher(
"ssl_cipher", "SSL cipher to use (implies --ssl)",
READ_ONLY GLOBAL_VAR(opt_ssl_cipher), SSL_OPT(OPT_SSL_CIPHER),
DEFAULT(0));
static Sys_var_charptr_fscs Sys_ssl_key(
"ssl_key", "X509 key in PEM format (implies --ssl)",
READ_ONLY GLOBAL_VAR(opt_ssl_key), SSL_OPT(OPT_SSL_KEY),
DEFAULT(0));
static Sys_var_charptr_fscs Sys_ssl_crl(
"ssl_crl",
"CRL file in PEM format (check OpenSSL docs, implies --ssl)",
READ_ONLY GLOBAL_VAR(opt_ssl_crl), SSL_OPT(OPT_SSL_CRL),
DEFAULT(0));
static Sys_var_charptr_fscs Sys_ssl_crlpath(
"ssl_crlpath",
"CRL directory (check OpenSSL docs, implies --ssl)",
READ_ONLY GLOBAL_VAR(opt_ssl_crlpath), SSL_OPT(OPT_SSL_CRLPATH),
DEFAULT(0));
static const char *tls_version_names[]=
{
"TLSv1.0",
"TLSv1.1",
"TLSv1.2",
"TLSv1.3",
0
};
export bool tls_version_string_representation(THD *thd, sql_mode_t sql_mode,
LEX_CSTRING *ls)
{
set_to_string(thd, ls, tls_version, tls_version_names);
return ls->str == 0;
}
static Sys_var_set Sys_tls_version(
"tls_version",
"TLS protocol version for secure connections.",
READ_ONLY GLOBAL_VAR(tls_version), CMD_LINE(REQUIRED_ARG),
tls_version_names,
DEFAULT(VIO_TLSv1_2 | VIO_TLSv1_3));
static Sys_var_mybool Sys_standard_compliant_cte(
"standard_compliant_cte",
"Allow only CTEs compliant to SQL standard",
SESSION_VAR(only_standard_compliant_cte), CMD_LINE(OPT_ARG),
DEFAULT(TRUE));
// why ENUM and not BOOL ?
static const char *updatable_views_with_limit_names[]= {"NO", "YES", 0};
static Sys_var_enum Sys_updatable_views_with_limit(
"updatable_views_with_limit",
"YES = Don't issue an error message (warning only) if a VIEW without "
"presence of a key of the underlying table is used in queries with a "
"LIMIT clause for updating. NO = Prohibit update of a VIEW, which "
"does not contain a key of the underlying table and the query uses "
"a LIMIT clause (usually get from GUI tools)",
SESSION_VAR(updatable_views_with_limit), CMD_LINE(REQUIRED_ARG),
updatable_views_with_limit_names, DEFAULT(TRUE));
static Sys_var_mybool Sys_sync_frm(
"sync_frm", "Sync .frm files to disk on creation",
GLOBAL_VAR(opt_sync_frm), CMD_LINE(OPT_ARG),
DEFAULT(TRUE));
static char *system_time_zone_ptr;
static Sys_var_charptr Sys_system_time_zone(
"system_time_zone", "The server system time zone",
READ_ONLY GLOBAL_VAR(system_time_zone_ptr),
CMD_LINE_HELP_ONLY,
DEFAULT(system_time_zone));
/*
If One use views with prepared statements this should be bigger than
table_open_cache (now we allow 2 times bigger value)
*/
static Sys_var_ulong Sys_table_def_size(
"table_definition_cache",
"The number of cached table definitions",
GLOBAL_VAR(tdc_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(TABLE_DEF_CACHE_MIN, 2*1024*1024),
DEFAULT(TABLE_DEF_CACHE_DEFAULT), BLOCK_SIZE(1));
static bool fix_table_open_cache(sys_var *, THD *, enum_var_type)
{
mysql_mutex_unlock(&LOCK_global_system_variables);
tc_purge();
mysql_mutex_lock(&LOCK_global_system_variables);
return false;
}
/* Check the table_definition_cache comment if makes changes */
static Sys_var_ulong Sys_table_cache_size(
"table_open_cache", "The number of cached open tables",
GLOBAL_VAR(tc_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(10, 1024*1024), DEFAULT(TABLE_OPEN_CACHE_DEFAULT),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_table_open_cache));
static Sys_var_uint Sys_table_cache_instances(
"table_open_cache_instances", "Maximum number of table cache instances",
READ_ONLY GLOBAL_VAR(tc_instances), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, 64), DEFAULT(8), BLOCK_SIZE(1));
static Sys_var_ulong Sys_thread_cache_size(
"thread_cache_size",
"How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time",
GLOBAL_VAR(thread_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 16384), DEFAULT(256), BLOCK_SIZE(1));
#ifdef HAVE_POOL_OF_THREADS
static bool fix_tp_max_threads(sys_var *, THD *, enum_var_type)
{
tp_set_max_threads(threadpool_max_threads);
return false;
}
#ifdef _WIN32
static bool fix_tp_min_threads(sys_var *, THD *, enum_var_type)
{
tp_set_min_threads(threadpool_min_threads);
return false;
}
#endif
static bool check_threadpool_size(sys_var *self, THD *thd, set_var *var)
{
#ifdef _WIN32
if (threadpool_mode != TP_MODE_GENERIC)
return false;
#endif
ulonglong v= var->save_result.ulonglong_value;
if (v > threadpool_max_size)
{
var->save_result.ulonglong_value= threadpool_max_size;
return throw_bounds_warning(thd, self->name.str, true, true, v);
}
return false;
}
static bool fix_threadpool_size(sys_var*, THD*, enum_var_type)
{
tp_set_threadpool_size(threadpool_size);
return false;
}
static bool fix_threadpool_stall_limit(sys_var*, THD*, enum_var_type)
{
tp_set_threadpool_stall_limit(threadpool_stall_limit);
return false;
}
#ifdef _WIN32
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL>
Sys_threadpool_min_threads(
"thread_pool_min_threads",
"Minimum number of threads in the thread pool.",
GLOBAL_VAR(threadpool_min_threads), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, 256), DEFAULT(1), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_tp_min_threads)
);
static const char *threadpool_mode_names[]={ "windows", "generic", 0 };
static Sys_var_on_access_global<Sys_var_enum,
PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL>
Sys_threadpool_mode(
"thread_pool_mode",
"Chose implementation of the threadpool",
READ_ONLY GLOBAL_VAR(threadpool_mode), CMD_LINE(REQUIRED_ARG),
threadpool_mode_names, DEFAULT(TP_MODE_WINDOWS)
);
#endif
static const char *threadpool_priority_names[]={ "high", "low", "auto", 0 };
static Sys_var_on_access_global<Sys_var_enum,
PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL>
Sys_thread_pool_priority(
"thread_pool_priority",
"Threadpool priority. High priority connections usually start executing earlier than low priority."
"If priority set to 'auto', the the actual priority(low or high) is determined based on whether or not connection is inside transaction.",
SESSION_VAR(threadpool_priority), CMD_LINE(REQUIRED_ARG),
threadpool_priority_names, DEFAULT(TP_PRIORITY_AUTO));
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL>
Sys_threadpool_idle_thread_timeout(
"thread_pool_idle_timeout",
"Timeout in seconds for an idle thread in the thread pool."
"Worker thread will be shut down after timeout",
GLOBAL_VAR(threadpool_idle_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, UINT_MAX), DEFAULT(60), BLOCK_SIZE(1)
);
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL>
Sys_threadpool_oversubscribe(
"thread_pool_oversubscribe",
"How many additional active worker threads in a group are allowed.",
GLOBAL_VAR(threadpool_oversubscribe), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, 1000), DEFAULT(3), BLOCK_SIZE(1)
);
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL>
Sys_threadpool_size(
"thread_pool_size",
"Number of thread groups in the pool. "
"This parameter is roughly equivalent to maximum number of concurrently "
"executing threads (threads in a waiting state do not count as executing).",
GLOBAL_VAR(threadpool_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, MAX_THREAD_GROUPS), DEFAULT(8), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_threadpool_size),
ON_UPDATE(fix_threadpool_size)
);
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL>
Sys_threadpool_stall_limit(
"thread_pool_stall_limit",
"Maximum query execution time in milliseconds,"
"before an executing non-yielding thread is considered stalled."
"If a worker thread is stalled, additional worker thread "
"may be created to handle remaining clients.",
GLOBAL_VAR(threadpool_stall_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, UINT_MAX), DEFAULT(DEFAULT_THREADPOOL_STALL_LIMIT), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_threadpool_stall_limit)
);
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL>
Sys_threadpool_max_threads(
"thread_pool_max_threads",
"Maximum allowed number of worker threads in the thread pool",
GLOBAL_VAR(threadpool_max_threads), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, 65536), DEFAULT(65536), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_tp_max_threads)
);
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL>
Sys_threadpool_threadpool_prio_kickup_timer(
"thread_pool_prio_kickup_timer",
"The number of milliseconds before a dequeued low-priority statement is moved to the high-priority queue",
GLOBAL_VAR(threadpool_prio_kickup_timer), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(1000), BLOCK_SIZE(1)
);
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL>
Sys_threadpool_exact_stats(
"thread_pool_exact_stats",
"If set to 1, provides better statistics in information_schema threadpool tables",
GLOBAL_VAR(threadpool_exact_stats), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG
);
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_THREAD_POOL>
Sys_threadpool_dedicated_listener(
"thread_pool_dedicated_listener",
"If set to 1,listener thread will not pick up queries",
GLOBAL_VAR(threadpool_dedicated_listener), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG
);
#endif /* HAVE_POOL_OF_THREADS */
/**
Can't change the 'next' tx_isolation if we are already in a
transaction.
*/
static bool check_tx_isolation(sys_var *self, THD *thd, set_var *var)
{
if (var->type == OPT_DEFAULT && thd->in_active_multi_stmt_transaction())
{
DBUG_ASSERT(thd->in_multi_stmt_transaction_mode());
my_error(ER_CANT_CHANGE_TX_CHARACTERISTICS, MYF(0));
return TRUE;
}
return FALSE;
}
// NO_CMD_LINE - different name of the option
static Sys_var_tx_isolation Sys_tx_isolation(
"tx_isolation", "Default transaction isolation level",
NO_SET_STMT SESSION_VAR(tx_isolation), NO_CMD_LINE,
tx_isolation_names, DEFAULT(ISO_REPEATABLE_READ),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_tx_isolation));
/**
Can't change the tx_read_only state if we are already in a
transaction.
*/
static bool check_tx_read_only(sys_var *self, THD *thd, set_var *var)
{
if (var->type == OPT_DEFAULT && thd->in_active_multi_stmt_transaction())
{
DBUG_ASSERT(thd->in_multi_stmt_transaction_mode());
my_error(ER_CANT_CHANGE_TX_CHARACTERISTICS, MYF(0));
return true;
}
return false;
}
bool Sys_var_tx_read_only::session_update(THD *thd, set_var *var)
{
if (var->type == OPT_SESSION && Sys_var_mybool::session_update(thd, var))
return true;
if (var->type == OPT_DEFAULT || !thd->in_active_multi_stmt_transaction())
{
// @see Sys_var_tx_isolation::session_update() above for the rules.
thd->tx_read_only= var->save_result.ulonglong_value;
#ifndef EMBEDDED_LIBRARY
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
{
if (var->type == OPT_DEFAULT)
thd->session_tracker.transaction_info.set_read_flags(thd,
thd->tx_read_only ? TX_READ_ONLY : TX_READ_WRITE);
else
thd->session_tracker.transaction_info.set_read_flags(thd,
TX_READ_INHERIT);
}
#endif //EMBEDDED_LIBRARY
}
return false;
}
static Sys_var_tx_read_only Sys_tx_read_only(
"tx_read_only", "Default transaction access mode. If set to OFF, "
"the default, access is read/write. If set to ON, access is read-only. "
"The SET TRANSACTION statement can also change the value of this variable. "
"See SET TRANSACTION and START TRANSACTION.",
SESSION_VAR(tx_read_only), NO_CMD_LINE, DEFAULT(0),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_tx_read_only));
static Sys_var_ulonglong Sys_tmp_table_size(
"tmp_table_size",
"Alias for tmp_memory_table_size. "
"If an internal in-memory temporary table exceeds this size, MariaDB "
"will automatically convert it to an on-disk MyISAM or Aria table.",
SESSION_VAR(tmp_memory_table_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024),
BLOCK_SIZE(1));
static Sys_var_ulonglong Sys_tmp_memory_table_size(
"tmp_memory_table_size",
"If an internal in-memory temporary table exceeds this size, MariaDB "
"will automatically convert it to an on-disk MyISAM or Aria table. "
"Same as tmp_table_size.",
SESSION_VAR(tmp_memory_table_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024),
BLOCK_SIZE(1));
static Sys_var_ulonglong Sys_tmp_disk_table_size(
"tmp_disk_table_size",
"Max size for data for an internal temporary on-disk MyISAM or Aria table.",
SESSION_VAR(tmp_disk_table_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, (ulonglong)~(intptr)0),
DEFAULT((ulonglong)~(intptr)0), BLOCK_SIZE(1));
static Sys_var_charptr Sys_version(
"version", "Server version number. It may also include a suffix "
"with configuration or build information. -debug indicates "
"debugging support was enabled on the server, and -log indicates "
"at least one of the binary log, general log or slow query log are "
"enabled, for example 10.1.1-MariaDB-mariadb1precise-log.",
READ_ONLY GLOBAL_VAR(server_version_ptr),
CMD_LINE_HELP_ONLY,
DEFAULT(server_version));
static char *server_version_comment_ptr;
static Sys_var_charptr Sys_version_comment(
"version_comment", "Value of the COMPILATION_COMMENT option "
"specified by CMake when building MariaDB, for example "
"mariadb.org binary distribution.",
READ_ONLY GLOBAL_VAR(server_version_comment_ptr),
CMD_LINE_HELP_ONLY,
DEFAULT(MYSQL_COMPILATION_COMMENT));
static char *server_version_compile_machine_ptr;
static Sys_var_charptr Sys_version_compile_machine(
"version_compile_machine", "The machine type or architecture "
"MariaDB was built on, for example i686.",
READ_ONLY GLOBAL_VAR(server_version_compile_machine_ptr),
CMD_LINE_HELP_ONLY, DEFAULT(DEFAULT_MACHINE));
static char *server_version_compile_os_ptr;
static Sys_var_charptr Sys_version_compile_os(
"version_compile_os", "Operating system that MariaDB was built "
"on, for example debian-linux-gnu.",
READ_ONLY GLOBAL_VAR(server_version_compile_os_ptr),
CMD_LINE_HELP_ONLY,
DEFAULT(SYSTEM_TYPE));
#include <source_revision.h>
static char *server_version_source_revision;
static Sys_var_charptr Sys_version_source_revision(
"version_source_revision", "Source control revision id for MariaDB source code",
READ_ONLY GLOBAL_VAR(server_version_source_revision),
CMD_LINE_HELP_ONLY,
DEFAULT(SOURCE_REVISION));
static char *malloc_library;
static Sys_var_charptr Sys_malloc_library(
"version_malloc_library", "Version of the used malloc library",
READ_ONLY GLOBAL_VAR(malloc_library), CMD_LINE_HELP_ONLY,
DEFAULT(guess_malloc_library()));
static char *ssl_library;
static Sys_var_charptr Sys_ssl_library(
"version_ssl_library", "Version of the used SSL library",
READ_ONLY GLOBAL_VAR(ssl_library), CMD_LINE_HELP_ONLY,
DEFAULT(SSL_LIBRARY));
static Sys_var_ulong Sys_net_wait_timeout(
"wait_timeout",
"The number of seconds the server waits for activity on a "
"connection before closing it",
NO_SET_STMT SESSION_VAR(net_wait_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)),
DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
static Sys_var_uint Sys_idle_transaction_timeout(
"idle_transaction_timeout",
"The number of seconds the server waits for idle transaction",
SESSION_VAR(idle_transaction_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)),
DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_uint Sys_idle_readonly_transaction_timeout(
"idle_readonly_transaction_timeout",
"The number of seconds the server waits for read-only idle transaction",
SESSION_VAR(idle_readonly_transaction_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)),
DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_uint Sys_idle_write_transaction_timeout(
"idle_write_transaction_timeout",
"The number of seconds the server waits for write idle transaction",
SESSION_VAR(idle_write_transaction_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)),
DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_plugin Sys_default_storage_engine(
"default_storage_engine", "The default storage engine for new tables",
SESSION_VAR(table_plugin), NO_CMD_LINE,
MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_storage_engine),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_not_null));
static Sys_var_plugin Sys_storage_engine(
"storage_engine", "Alias for @@default_storage_engine. Deprecated",
SESSION_VAR(table_plugin), NO_CMD_LINE,
MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_storage_engine),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_not_null), ON_UPDATE(0),
DEPRECATED("'@@default_storage_engine'")); // since 10.5.1
static Sys_var_plugin Sys_default_tmp_storage_engine(
"default_tmp_storage_engine", "The default storage engine for user-created temporary tables",
SESSION_VAR(tmp_table_plugin), NO_CMD_LINE,
MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_tmp_storage_engine),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_engine_supports_temporary));
static Sys_var_plugin Sys_enforce_storage_engine(
"enforce_storage_engine", "Force the use of a storage engine for new tables",
SESSION_VAR(enforced_table_plugin),
NO_CMD_LINE, MYSQL_STORAGE_ENGINE_PLUGIN,
DEFAULT(&enforced_storage_engine), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_has_super));
#ifdef HAVE_REPLICATION
/*
Check
1. Value for gtid_pos_auto_engines is not NULL.
2. No slave SQL thread is running.
*/
static bool
check_gtid_pos_auto_engines(sys_var *self, THD *thd, set_var *var)
{
bool running;
bool err= false;
DBUG_ASSERT(var->type == OPT_GLOBAL);
if (var->value && var->value->is_null())
err= true;
else
{
running= give_error_if_slave_running(false);
if (running)
err= true;
}
return err;
}
static Sys_var_on_access_global<Sys_var_pluginlist,
PRIV_SET_SYSTEM_GLOBAL_VAR_GTID_POS_AUTO_ENGINES>
Sys_gtid_pos_auto_engines(
"gtid_pos_auto_engines",
"List of engines for which to automatically create a "
"mysql.gtid_slave_pos_ENGINE table, if a transaction using that engine "
"is replicated. This can be used to avoid introducing cross-engine "
"transactions, if engines are used different from that used by table "
"mysql.gtid_slave_pos",
GLOBAL_VAR(opt_gtid_pos_auto_plugins), NO_CMD_LINE,
DEFAULT(>id_pos_auto_engines),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_gtid_pos_auto_engines));
#endif
#if defined(ENABLED_DEBUG_SYNC)
/*
Variable can be set for the session only.
This could be changed later. Then we need to have a global array of
actions in addition to the thread local ones. SET GLOBAL would
manage the global array, SET [SESSION] the local array. A sync point
would need to look for a local and a global action. Setting and
executing of global actions need to be protected by a mutex.
The purpose of global actions could be to allow synchronizing with
connectionless threads that cannot execute SET statements.
*/
static Sys_var_debug_sync Sys_debug_sync(
"debug_sync", "Debug Sync Facility",
NO_SET_STMT sys_var::ONLY_SESSION, NO_CMD_LINE,
DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super));
#endif /* defined(ENABLED_DEBUG_SYNC) */
/**
"time_format" "date_format" "datetime_format"
the following three variables are unused, and the source of confusion
(bug reports like "I've changed date_format, but date format hasn't changed.
I've made them read-only, to alleviate the situation somewhat.
@todo make them NO_CMD_LINE ?
*/
static Sys_var_charptr Sys_date_format(
"date_format", "The DATE format (ignored)",
READ_ONLY GLOBAL_VAR(global_date_format.format.str),
CMD_LINE(REQUIRED_ARG),
DEFAULT(known_date_time_formats[ISO_FORMAT].date_format),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
DEPRECATED("")); // since 10.1.2
static Sys_var_charptr Sys_datetime_format(
"datetime_format", "The DATETIME format (ignored)",
READ_ONLY GLOBAL_VAR(global_datetime_format.format.str),
CMD_LINE(REQUIRED_ARG),
DEFAULT(known_date_time_formats[ISO_FORMAT].datetime_format),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
DEPRECATED("")); // since 10.1.2
static Sys_var_charptr Sys_time_format(
"time_format", "The TIME format (ignored)",
READ_ONLY GLOBAL_VAR(global_time_format.format.str),
CMD_LINE(REQUIRED_ARG),
DEFAULT(known_date_time_formats[ISO_FORMAT].time_format),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
DEPRECATED("")); // since 10.1.2
static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
{
if (global_system_variables.option_bits & OPTION_AUTOCOMMIT)
global_system_variables.option_bits&= ~OPTION_NOT_AUTOCOMMIT;
else
global_system_variables.option_bits|= OPTION_NOT_AUTOCOMMIT;
return false;
}
if (test_all_bits(thd->variables.option_bits,
(OPTION_AUTOCOMMIT | OPTION_NOT_AUTOCOMMIT)))
{
// activating autocommit
if (trans_commit_stmt(thd) || trans_commit(thd))
{
thd->variables.option_bits&= ~OPTION_AUTOCOMMIT;
thd->release_transactional_locks();
WSREP_DEBUG("autocommit, MDL TRX lock released: %lld",
(longlong) thd->thread_id);
return true;
}
/*
Don't close thread tables or release metadata locks: if we do so, we
risk releasing locks/closing tables of expressions used to assign
other variables, as in:
set @var=my_stored_function1(), @@autocommit=1, @var2=(select MY_MAX(a)
from my_table), ...
The locks will be released at statement end anyway, as SET
statement that assigns autocommit is marked to commit
transaction implicitly at the end (@sa stmt_causes_implicitcommit()).
*/
thd->variables.option_bits&=
~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX | OPTION_NOT_AUTOCOMMIT |
OPTION_GTID_BEGIN);
thd->transaction->all.modified_non_trans_table= false;
thd->transaction->all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
return false;
}
if ((thd->variables.option_bits &
(OPTION_AUTOCOMMIT |OPTION_NOT_AUTOCOMMIT)) == 0)
{
// disabling autocommit
thd->transaction->all.modified_non_trans_table= false;
thd->transaction->all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
thd->variables.option_bits|= OPTION_NOT_AUTOCOMMIT;
return false;
}
return false; // autocommit value wasn't changed
}
static Sys_var_bit Sys_autocommit(
"autocommit", "If set to 1, the default, all queries are committed "
"immediately. If set to 0, they are only committed upon a COMMIT statement"
", or rolled back with a ROLLBACK statement. If autocommit is set to 0, "
"and then changed to 1, all open transactions are immediately committed.",
NO_SET_STMT SESSION_VAR(option_bits), NO_CMD_LINE,
OPTION_AUTOCOMMIT, DEFAULT(TRUE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_autocommit));
export sys_var *Sys_autocommit_ptr= &Sys_autocommit; // for sql_yacc.yy
static Sys_var_mybool Sys_big_tables(
"big_tables", "Old variable, which if set to 1, allows large result sets "
"by saving all temporary sets to disk, avoiding 'table full' errors. No "
"longer needed, as the server now handles this automatically.",
SESSION_VAR(big_tables), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
DEPRECATED("")); // since 10.5.0
static Sys_var_bit Sys_big_selects(
"sql_big_selects", "If set to 0, MariaDB will not perform large SELECTs."
" See max_join_size for details. If max_join_size is set to anything but "
"DEFAULT, sql_big_selects is automatically set to 0. If sql_big_selects "
"is again set, max_join_size will be ignored.",
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_BIG_SELECTS,
DEFAULT(FALSE));
static Sys_var_bit Sys_log_off(
"sql_log_off", "If set to 1 (0 is the default), no logging to the general "
"query log is done for the client. Only clients with the SUPER privilege "
"can update this variable.",
NO_SET_STMT SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_LOG_OFF,
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_has_super));
/**
This function sets the session variable thd->variables.sql_log_bin
to reflect changes to @@session.sql_log_bin.
@param[IN] self A pointer to the sys_var, i.e. Sys_log_binlog.
@param[IN] type The type either session or global.
@return @c FALSE.
*/
static bool fix_sql_log_bin_after_update(sys_var *self, THD *thd,
enum_var_type type)
{
DBUG_ASSERT(type == OPT_SESSION);
thd->set_binlog_bit();
return FALSE;
}
static bool check_session_only_variable(sys_var *self, THD *,set_var *var)
{
if (unlikely(var->type == OPT_GLOBAL))
{
my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0), self->name.str, "SESSION");
return true;
}
return false;
}
/**
This function checks if the sql_log_bin can be changed,
what is possible if:
- the user is a super user;
- the set is not called from within a function/trigger;
- there is no on-going transaction.
@param[IN] self A pointer to the sys_var, i.e. Sys_log_binlog.
@param[IN] var A pointer to the set_var created by the parser.
@return @c FALSE if the change is allowed, otherwise @c TRUE.
*/
static bool check_sql_log_bin(sys_var *self, THD *thd, set_var *var)
{
if (check_session_only_variable(self, thd, var))
return true;
if (unlikely(error_if_in_trans_or_substatement(thd,
ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN,
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN)))
return true;
return false;
}
static Sys_var_on_access<Sys_var_mybool,
PRIV_SET_SYSTEM_VAR_SQL_LOG_BIN,
PRIV_SET_SYSTEM_VAR_SQL_LOG_BIN>
Sys_sql_log_bin(
"sql_log_bin", "If set to 0 (1 is the default), no logging to the binary "
"log is done for the client. Only clients with the SUPER privilege can "
"update this variable. Can have unintended consequences if set globally, "
"see SET SQL_LOG_BIN. Starting MariaDB 10.1.7, this variable does not "
"affect the replication of events in a Galera cluster.",
SESSION_VAR(sql_log_bin), NO_CMD_LINE, DEFAULT(TRUE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_sql_log_bin),
ON_UPDATE(fix_sql_log_bin_after_update));
static Sys_var_bit Sys_sql_warnings(
"sql_warnings", "If set to 1, single-row INSERTs will produce a string "
"containing warning information if a warning occurs.",
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_WARNINGS,
DEFAULT(FALSE));
static Sys_var_bit Sys_sql_notes(
"sql_notes",
"If set to 1, the default, warning_count is incremented "
"each time a Note warning is encountered. If set to 0, Note warnings "
"are not recorded. mysqldump has outputs to set this variable to 0 so "
"that no unnecessary increments occur when data is reloaded. "
"See also note_verbosity, which allows one to define with notes are "
"sent.",
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_SQL_NOTES,
DEFAULT(TRUE));
static Sys_var_bit Sys_auto_is_null(
"sql_auto_is_null", "If set to 1, the query SELECT * FROM table_name WHERE "
"auto_increment_column IS NULL will return an auto-increment that has just "
"been successfully inserted, the same as the LAST_INSERT_ID() function. Some"
" ODBC programs make use of this IS NULL comparison.",
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_AUTO_IS_NULL,
DEFAULT(FALSE), NO_MUTEX_GUARD, IN_BINLOG);
static Sys_var_bit Sys_if_exists(
"sql_if_exists", "If set to 1 adds an implicate IF EXISTS to ALTER, RENAME and DROP of TABLES, VIEWS, FUNCTIONS and PACKAGES",
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_IF_EXISTS,
DEFAULT(FALSE), NO_MUTEX_GUARD, IN_BINLOG);
static Sys_var_bit Sys_safe_updates(
"sql_safe_updates", "If set to 1, UPDATEs and DELETEs need either a key in "
"the WHERE clause, or a LIMIT clause, or else they will aborted. Prevents "
"the common mistake of accidentally deleting or updating every row in a table.",
SESSION_VAR(option_bits), CMD_LINE(OPT_ARG), OPTION_SAFE_UPDATES,
DEFAULT(FALSE));
static Sys_var_bit Sys_buffer_results(
"sql_buffer_result", "If set to 1 (0 is default), results from SELECT "
"statements are always placed into temporary tables. This can help the "
"server when it takes a long time to send the results to the client by "
"allowing the table locks to be freed early.",
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_BUFFER_RESULT,
DEFAULT(FALSE));
static Sys_var_bit Sys_quote_show_create(
"sql_quote_show_create", "If set to 1, the default, the server will "
"quote identifiers for SHOW CREATE DATABASE, SHOW CREATE TABLE and "
"SHOW CREATE VIEW statements. Quoting is disabled if set to 0. Enable "
"to ensure replications works when identifiers require quoting.",
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_QUOTE_SHOW_CREATE,
DEFAULT(TRUE));
static Sys_var_bit Sys_foreign_key_checks(
"foreign_key_checks", "If set to 1 (the default) foreign key constraints"
" (including ON UPDATE and ON DELETE behavior) InnoDB tables are checked,"
" while if set to 0, they are not checked. 0 is not recommended for normal "
"use, though it can be useful in situations where you know the data is "
"consistent, but want to reload data in a different order from that that "
"specified by parent/child relationships. Setting this variable to 1 does "
"not retrospectively check for inconsistencies introduced while set to 0.",
SESSION_VAR(option_bits), NO_CMD_LINE,
REVERSE(OPTION_NO_FOREIGN_KEY_CHECKS),
DEFAULT(TRUE), NO_MUTEX_GUARD, IN_BINLOG);
static Sys_var_bit Sys_unique_checks(
"unique_checks", "If set to 1, the default, secondary indexes in InnoDB "
"tables are performed. If set to 0, storage engines can (but are not "
"required to) assume that duplicate keys are not present in input data. "
"Set to 0 to speed up imports of large tables to InnoDB. The storage "
"engine will still issue a duplicate key error if it detects one, even "
"if set to 0.",
SESSION_VAR(option_bits), NO_CMD_LINE,
REVERSE(OPTION_RELAXED_UNIQUE_CHECKS),
DEFAULT(TRUE), NO_MUTEX_GUARD, IN_BINLOG);
static Sys_var_bit Sys_no_check_constraint(
"check_constraint_checks", "check_constraint_checks",
SESSION_VAR(option_bits), NO_CMD_LINE,
REVERSE(OPTION_NO_CHECK_CONSTRAINT_CHECKS),
DEFAULT(TRUE), NO_MUTEX_GUARD, IN_BINLOG);
#ifdef ENABLED_PROFILING
static bool update_profiling(sys_var *self, THD *thd, enum_var_type type)
{
if (type == OPT_SESSION)
thd->profiling.reset();
return false;
}
static Sys_var_bit Sys_profiling(
"profiling", "If set to 1 (0 is default), statement profiling will be "
"enabled. See SHOW PROFILES and SHOW PROFILE.",
NO_SET_STMT SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_PROFILING,
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_profiling));
static Sys_var_ulong Sys_profiling_history_size(
"profiling_history_size", "Number of statements about which profiling "
"information is maintained. If set to 0, no profiles are stored. "
"See SHOW PROFILES.",
NO_SET_STMT SESSION_VAR(profiling_history_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 100), DEFAULT(15), BLOCK_SIZE(1));
#endif
/*
When this is set by a connection, binlogged events will be marked with a
corresponding flag. The slave can be configured to not replicate events
so marked.
In the binlog dump thread on the master, this variable is re-used for a
related purpose: The slave sets this flag when connecting to the master to
request that the master filter out (ie. not send) any events with the flag
set, thus saving network traffic on events that would be ignored by the
slave anyway.
*/
static bool check_skip_replication(sys_var *self, THD *thd, set_var *var)
{
/*
We must not change @@skip_replication in the middle of a transaction or
statement, as that could result in only part of the transaction / statement
being replicated.
(This would be particularly serious if we were to replicate eg.
Rows_log_event without Table_map_log_event or transactional updates without
the COMMIT).
*/
if (unlikely(error_if_in_trans_or_substatement(thd,
ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION,
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION)))
return 1;
return 0;
}
static Sys_var_bit Sys_skip_replication(
"skip_replication", "Changes are logged into the binary log with the "
"@@skip_replication flag set. Such events will not be replicated by "
"slaves that run with --replicate-events-marked-for-skip set different "
"from its default of REPLICATE. See Selectively skipping replication "
"of binlog events for more information.",
NO_SET_STMT SESSION_ONLY(option_bits),
NO_CMD_LINE, OPTION_SKIP_REPLICATION,
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_skip_replication));
static Sys_var_harows Sys_select_limit(
"sql_select_limit",
"The maximum number of rows to return from SELECT statements",
SESSION_VAR(select_limit), NO_CMD_LINE,
VALID_RANGE(0, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1));
static const char *secure_timestamp_levels[]= {"NO", "SUPER", "REPLICATION", "YES", 0};
bool is_set_timestamp_forbidden(THD *thd)
{
switch (opt_secure_timestamp) {
case SECTIME_NO:
return false;
case SECTIME_SUPER:
return check_global_access(thd, SUPER_ACL | BINLOG_REPLAY_ACL);
case SECTIME_REPL:
return check_global_access(thd, BINLOG_REPLAY_ACL);
case SECTIME_YES:
break;
}
char buf[1024];
strxnmov(buf, sizeof(buf), "--secure-timestamp=",
secure_timestamp_levels[opt_secure_timestamp], NULL);
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), buf);
return true;
}
bool Sys_var_timestamp::on_check_access_session(THD *thd) const
{
return is_set_timestamp_forbidden(thd);
}
static Sys_var_timestamp Sys_timestamp(
"timestamp", "Set the time for this client",
sys_var::ONLY_SESSION, NO_CMD_LINE,
VALID_RANGE(0, TIMESTAMP_MAX_VALUE),
NO_MUTEX_GUARD, IN_BINLOG);
static bool update_last_insert_id(THD *thd, set_var *var)
{
if (!var->value)
{
my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
return true;
}
thd->first_successful_insert_id_in_prev_stmt=
var->save_result.ulonglong_value;
return false;
}
static ulonglong read_last_insert_id(THD *thd)
{
return (ulonglong) thd->read_first_successful_insert_id_in_prev_stmt();
}
static Sys_var_session_special Sys_last_insert_id(
"last_insert_id", "The value to be returned from LAST_INSERT_ID()",
sys_var::ONLY_SESSION, NO_CMD_LINE,
VALID_RANGE(0, ULONGLONG_MAX), BLOCK_SIZE(1),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_last_insert_id), ON_READ(read_last_insert_id));
// alias for last_insert_id(), Sybase-style
static Sys_var_session_special Sys_identity(
"identity", "Synonym for the last_insert_id variable",
sys_var::ONLY_SESSION, NO_CMD_LINE,
VALID_RANGE(0, ULONGLONG_MAX), BLOCK_SIZE(1),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_last_insert_id), ON_READ(read_last_insert_id));
/*
insert_id should *not* be marked as written to the binlog (i.e., it
should *not* be IN_BINLOG), because we want any statement that
refers to insert_id explicitly to be unsafe. (By "explicitly", we
mean using @@session.insert_id, whereas insert_id is used
"implicitly" when NULL value is inserted into an auto_increment
column).
We want statements referring explicitly to @@session.insert_id to be
unsafe, because insert_id is modified internally by the slave sql
thread when NULL values are inserted in an AUTO_INCREMENT column.
This modification interfers with the value of the
@@session.insert_id variable if @@session.insert_id is referred
explicitly by an insert statement (as is seen by executing "SET
@@session.insert_id=0; CREATE TABLE t (a INT, b INT KEY
AUTO_INCREMENT); INSERT INTO t(a) VALUES (@@session.insert_id);" in
statement-based logging mode: t will be different on master and
slave).
*/
static bool update_insert_id(THD *thd, set_var *var)
{
/*
If we set the insert_id to the DEFAULT or 0
it means we 'reset' it so it's value doesn't
affect the INSERT.
*/
if (!var->value ||
var->save_result.ulonglong_value == 0)
thd->auto_inc_intervals_forced.empty();
else
thd->force_one_auto_inc_interval(var->save_result.ulonglong_value);
return false;
}
static ulonglong read_insert_id(THD *thd)
{
return thd->auto_inc_intervals_forced.minimum();
}
static Sys_var_session_special Sys_insert_id(
"insert_id", "The value to be used by the following INSERT "
"or ALTER TABLE statement when inserting an AUTO_INCREMENT value",
sys_var::ONLY_SESSION, NO_CMD_LINE,
VALID_RANGE(0, ULONGLONG_MAX), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_insert_id), ON_READ(read_insert_id));
static bool update_rand_seed1(THD *thd, set_var *var)
{
if (!var->value)
{
my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
return true;
}
thd->rand.seed1= (ulong) var->save_result.ulonglong_value;
return false;
}
static ulonglong read_rand_seed1(THD *thd)
{
return thd->rand.seed1;
}
static Sys_var_session_special Sys_rand_seed1(
"rand_seed1", "Sets the internal state of the RAND() "
"generator for replication purposes",
sys_var::ONLY_SESSION, NO_CMD_LINE,
VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_rand_seed1), ON_READ(read_rand_seed1));
static bool update_rand_seed2(THD *thd, set_var *var)
{
if (!var->value)
{
my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
return true;
}
thd->rand.seed2= (ulong) var->save_result.ulonglong_value;
return false;
}
static ulonglong read_rand_seed2(THD *thd)
{
return thd->rand.seed2;
}
static Sys_var_session_special Sys_rand_seed2(
"rand_seed2", "Sets the internal state of the RAND() "
"generator for replication purposes",
sys_var::ONLY_SESSION, NO_CMD_LINE,
VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_rand_seed2), ON_READ(read_rand_seed2));
static ulonglong read_error_count(THD *thd)
{
return thd->get_stmt_da()->error_count();
}
// this really belongs to the SHOW STATUS
static Sys_var_session_special Sys_error_count(
"error_count", "The number of errors that resulted from the "
"last statement that generated messages",
READ_ONLY sys_var::ONLY_SESSION, NO_CMD_LINE,
VALID_RANGE(0, ULONGLONG_MAX), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), ON_READ(read_error_count));
static ulonglong read_warning_count(THD *thd)
{
return thd->get_stmt_da()->warn_count();
}
// this really belongs to the SHOW STATUS
static Sys_var_session_special Sys_warning_count(
"warning_count", "The number of errors, warnings, and notes "
"that resulted from the last statement that generated messages",
READ_ONLY sys_var::ONLY_SESSION, NO_CMD_LINE,
VALID_RANGE(0, ULONGLONG_MAX), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), ON_READ(read_warning_count));
static Sys_var_ulong Sys_default_week_format(
"default_week_format",
"The default week format used by WEEK() functions",
SESSION_VAR(default_week_format), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 7), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_uint Sys_group_concat_max_len(
"group_concat_max_len",
"The maximum length of the result of function GROUP_CONCAT()",
SESSION_VAR(group_concat_max_len), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(4, UINT_MAX32), DEFAULT(1024*1024), BLOCK_SIZE(1));
static char *glob_hostname_ptr;
static Sys_var_charptr Sys_hostname(
"hostname", "Server host name",
READ_ONLY GLOBAL_VAR(glob_hostname_ptr), NO_CMD_LINE,
DEFAULT(glob_hostname));
#ifndef EMBEDDED_LIBRARY
static Sys_var_charptr Sys_repl_report_host(
"report_host",
"Hostname or IP of the slave to be reported to the master during "
"slave registration. Will appear in the output of SHOW SLAVE HOSTS. "
"Leave unset if you do not want the slave to register itself with the "
"master. Note that it is not sufficient for the master to simply read "
"the IP of the slave off the socket once the slave connects. Due to "
"NAT and other routing issues, that IP may not be valid for connecting "
"to the slave from the master or other hosts",
READ_ONLY GLOBAL_VAR(report_host), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_charptr Sys_repl_report_user(
"report_user",
"The account user name of the slave to be reported to the master "
"during slave registration",
READ_ONLY GLOBAL_VAR(report_user), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_charptr Sys_repl_report_password(
"report_password",
"The account password of the slave to be reported to the master "
"during slave registration",
READ_ONLY GLOBAL_VAR(report_password), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_uint Sys_repl_report_port(
"report_port",
"Port for connecting to slave reported to the master during slave "
"registration. Set it only if the slave is listening on a non-default "
"port or if you have a special tunnel from the master or other clients "
"to the slave. If not sure, leave this option unset",
READ_ONLY GLOBAL_VAR(report_port), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
#endif
static Sys_var_mybool Sys_keep_files_on_create(
"keep_files_on_create",
"Don't overwrite stale .MYD and .MYI even if no directory is specified",
SESSION_VAR(keep_files_on_create), CMD_LINE(OPT_ARG),
DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
DEPRECATED("")); // since 10.8.0
static char *license;
static Sys_var_charptr Sys_license(
"license", "The type of license the server has",
READ_ONLY GLOBAL_VAR(license), NO_CMD_LINE,
DEFAULT(STRINGIFY_ARG(LICENSE)));
#include <proxy_protocol.h>
char *my_proxy_protocol_networks;
static bool check_proxy_protocol_networks(sys_var *, THD *, set_var *var)
{
if (!var->value)
return false;
return !proxy_protocol_networks_valid(var->save_result.string_value.str);
}
static bool fix_proxy_protocol_networks(sys_var *, THD *, enum_var_type)
{
return (bool)set_proxy_protocol_networks(my_proxy_protocol_networks);
}
static Sys_var_on_access_global<Sys_var_charptr_fscs,
PRIV_SET_SYSTEM_GLOBAL_VAR_PROXY_PROTOCOL_NETWORKS>
Sys_proxy_protocol_networks(
"proxy_protocol_networks", "Enable proxy protocol for these source "
"networks. The syntax is a comma separated list of IPv4 and IPv6 "
"networks. If the network doesn't contain mask, it is considered to be "
"a single host. \"*\" represents all networks and must the only "
"directive on the line. String \"localhost\" represents non-TCP "
"local connections (Unix domain socket, Windows named pipe or shared memory).",
GLOBAL_VAR(my_proxy_protocol_networks), CMD_LINE(REQUIRED_ARG),
DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_proxy_protocol_networks), ON_UPDATE(fix_proxy_protocol_networks));
static bool check_log_path(sys_var *self, THD *thd, set_var *var)
{
if (!var->value)
return false; // DEFAULT is ok
if (!var->save_result.string_value.str)
return true;
LEX_STRING *val= &var->save_result.string_value;
if (val->length > FN_REFLEN)
{ // path is too long
my_error(ER_PATH_LENGTH, MYF(0), self->name.str);
return true;
}
char path[FN_REFLEN];
size_t path_length= unpack_filename(path, val->str);
if (!path_length)
return true;
if (!is_filename_allowed(var->save_result.string_value.str,
var->save_result.string_value.length, TRUE))
{
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0),
self->name.str, var->save_result.string_value.str);
return true;
}
static const LEX_CSTRING my_cnf= { STRING_WITH_LEN("my.cnf") };
static const LEX_CSTRING my_ini= { STRING_WITH_LEN("my.ini") };
if (path_length >= my_cnf.length)
{
if (strcasecmp(path + path_length - my_cnf.length, my_cnf.str) == 0)
return true; // log file name ends with "my.cnf"
DBUG_ASSERT(my_cnf.length == my_ini.length);
if (strcasecmp(path + path_length - my_ini.length, my_ini.str) == 0)
return true; // log file name ends with "my.ini"
}
MY_STAT f_stat;
if (my_stat(path, &f_stat, MYF(0)))
{
if (!MY_S_ISREG(f_stat.st_mode) || !(f_stat.st_mode & MY_S_IWRITE))
return true; // not a regular writable file
return false;
}
(void) dirname_part(path, val->str, &path_length);
if (val->length - path_length >= FN_LEN)
{ // filename is too long
my_error(ER_PATH_LENGTH, MYF(0), self->name.str);
return true;
}
if (!path_length) // no path is good path (remember, relative to datadir)
return false;
if (my_access(path, (F_OK|W_OK)))
return true; // directory is not writable
return false;
}
static bool fix_log(char** logname, const char* default_logname,
const char*ext, bool enabled, void (*reopen)(char*))
{
if (!*logname) // SET ... = DEFAULT
{
make_default_log_name(logname, ext, false);
if (!*logname)
return true;
}
logger.lock_exclusive();
mysql_mutex_unlock(&LOCK_global_system_variables);
if (enabled)
reopen(*logname);
logger.unlock();
mysql_mutex_lock(&LOCK_global_system_variables);
return false;
}
static void reopen_general_log(char* name)
{
logger.get_log_file_handler()->close(0);
logger.get_log_file_handler()->open_query_log(name);
}
static bool fix_general_log_file(sys_var *self, THD *thd, enum_var_type type)
{
return fix_log(&opt_logname, opt_log_basename, ".log", opt_log,
reopen_general_log);
}
static Sys_var_charptr_fscs Sys_general_log_path(
"general_log_file", "Log connections and queries to given file",
PREALLOCATED GLOBAL_VAR(opt_logname), CMD_LINE(REQUIRED_ARG),
DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_log_path), ON_UPDATE(fix_general_log_file));
static void reopen_slow_log(char* name)
{
logger.get_slow_log_file_handler()->close(0);
logger.get_slow_log_file_handler()->open_slow_log(name);
}
static bool fix_slow_log_file(sys_var *self, THD *thd, enum_var_type type)
{
return fix_log(&opt_slow_logname, opt_log_basename, "-slow.log",
global_system_variables.sql_log_slow, reopen_slow_log);
}
static Sys_var_charptr_fscs Sys_slow_log_path(
"slow_query_log_file",
"Alias for log_slow_query_file. "
"Log slow queries to given log file. "
"Defaults logging to 'hostname'-slow.log. Must be enabled to activate "
"other slow log options",
PREALLOCATED GLOBAL_VAR(opt_slow_logname), CMD_LINE(REQUIRED_ARG),
DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_log_path), ON_UPDATE(fix_slow_log_file));
static Sys_var_charptr_fscs Sys_log_slow_query_file_name(
"log_slow_query_file", "Log slow queries to given log file. "
"Defaults logging to 'hostname'-slow.log. Must be enabled to activate "
"other slow log options",
PREALLOCATED GLOBAL_VAR(opt_slow_logname), CMD_LINE(REQUIRED_ARG),
DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_log_path), ON_UPDATE(fix_slow_log_file));
static Sys_var_have Sys_have_compress(
"have_compress", "If the zlib compression library is accessible to the "
"server, this will be set to YES, otherwise it will be NO. The COMPRESS() "
"and UNCOMPRESS() functions will only be available if set to YES.",
READ_ONLY GLOBAL_VAR(have_compress), NO_CMD_LINE);
static Sys_var_have Sys_have_crypt(
"have_crypt", "If the crypt() system call is available this variable will "
"be set to YES, otherwise it will be set to NO. If set to NO, the "
"ENCRYPT() function cannot be used.",
READ_ONLY GLOBAL_VAR(have_crypt), NO_CMD_LINE);
static Sys_var_have Sys_have_dlopen(
"have_dynamic_loading", "If the server supports dynamic loading of plugins, "
"will be set to YES, otherwise will be set to NO.",
READ_ONLY GLOBAL_VAR(have_dlopen), NO_CMD_LINE);
static Sys_var_have Sys_have_geometry(
"have_geometry", "If the server supports spatial data types, will be set to "
"YES, otherwise will be set to NO.",
READ_ONLY GLOBAL_VAR(have_geometry), NO_CMD_LINE);
static Sys_var_have Sys_have_openssl(
"have_openssl", "Comparing have_openssl with have_ssl will indicate whether "
"YaSSL or openssl was used. If YaSSL, have_ssl will be YES, but have_openssl "
"will be NO.",
READ_ONLY GLOBAL_VAR(have_openssl), NO_CMD_LINE);
static Sys_var_have Sys_have_profiling(
"have_profiling", "If statement profiling is available, will be set to YES, "
"otherwise will be set to NO. See SHOW PROFILES and SHOW PROFILE.",
READ_ONLY GLOBAL_VAR(have_profiling), NO_CMD_LINE);
static Sys_var_have Sys_have_query_cache(
"have_query_cache", "If the server supports the query cache, will be set to "
"YES, otherwise will be set to NO.",
READ_ONLY GLOBAL_VAR(have_query_cache), NO_CMD_LINE);
static Sys_var_have Sys_have_rtree_keys(
"have_rtree_keys", "If RTREE indexes (used for spatial indexes) "
"are available, will be set to YES, otherwise will be set to NO.",
READ_ONLY GLOBAL_VAR(have_rtree_keys), NO_CMD_LINE);
static Sys_var_have Sys_have_ssl(
"have_ssl", "If the server supports secure connections, will be set to YES, "
"otherwise will be set to NO. If set to DISABLED, the server was compiled with "
"TLS support, but was not started with TLS support (see the mysqld options). "
"See also have_openssl.",
READ_ONLY GLOBAL_VAR(have_ssl), NO_CMD_LINE);
static Sys_var_have Sys_have_symlink(
"have_symlink", "If symbolic link support is enabled, will be set to YES, "
"otherwise will be set to NO. Required for the INDEX DIRECTORY and DATA "
"DIRECTORY table options (see CREATE TABLE) and Windows symlink support. "
"Will be set to DISABLED if the server is started with the "
"--skip-symbolic-links option.",
READ_ONLY GLOBAL_VAR(have_symlink), NO_CMD_LINE);
#if defined __SANITIZE_ADDRESS__ || defined WITH_UBSAN || __has_feature(memory_sanitizer)
# ifdef __SANITIZE_ADDRESS__
# ifdef WITH_UBSAN
# define SANITIZER_MODE "ASAN,UBSAN"
# else
# define SANITIZER_MODE "ASAN"
# endif
# elif defined WITH_UBSAN
# define SANITIZER_MODE "UBSAN"
# else
# define SANITIZER_MODE "MSAN"
# endif
static char *have_sanitizer;
static Sys_var_charptr Sys_have_santitizer(
"have_sanitizer",
"If the server is compiled with sanitize (compiler option), this "
"variable is set to the sanitizer mode used. Possible values are "
"ASAN (Address sanitizer) or UBSAN (The Undefined Behavior Sanitizer).",
READ_ONLY GLOBAL_VAR(have_sanitizer), NO_CMD_LINE,
DEFAULT(SANITIZER_MODE));
#endif /* defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN) */
static bool fix_log_state(sys_var *self, THD *thd, enum_var_type type);
static Sys_var_mybool Sys_general_log(
"general_log", "Log connections and queries to a table or log file. "
"Defaults logging to a file 'hostname'.log or a table mysql.general_log"
"if --log-output=TABLE is used.",
GLOBAL_VAR(opt_log), CMD_LINE(OPT_ARG),
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_log_state));
static Sys_var_mybool Sys_slow_query_log(
"slow_query_log",
"Alias for log_slow_query. "
"Log slow queries to a table or log file. Defaults logging to a file "
"'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is "
"used. Must be enabled to activate other slow log options.",
SESSION_VAR(sql_log_slow), CMD_LINE(OPT_ARG),
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0), ON_UPDATE(fix_log_state));
static Sys_var_mybool Sys_log_slow_query(
"log_slow_query",
"Log slow queries to a table or log file. Defaults logging to a file "
"'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is "
"used. Must be enabled to activate other slow log options.",
SESSION_VAR(sql_log_slow), CMD_LINE(OPT_ARG),
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0), ON_UPDATE(fix_log_state));
static bool fix_log_state(sys_var *self, THD *thd, enum_var_type type)
{
bool res;
my_bool *UNINIT_VAR(newvalptr), newval, UNINIT_VAR(oldval);
uint UNINIT_VAR(log_type);
if (type != OPT_GLOBAL)
return 0;
if (self == &Sys_general_log)
{
newvalptr= &opt_log;
oldval= logger.get_log_file_handler()->is_open();
log_type= QUERY_LOG_GENERAL;
}
else
{
DBUG_ASSERT(self == &Sys_slow_query_log || self == &Sys_log_slow_query);
newvalptr= &global_system_variables.sql_log_slow;
oldval= logger.get_slow_log_file_handler()->is_open();
log_type= QUERY_LOG_SLOW;
}
newval= *newvalptr;
if (oldval == newval)
return false;
*newvalptr= oldval; // [de]activate_log_handler works that way (sigh)
mysql_mutex_unlock(&LOCK_global_system_variables);
if (!newval)
{
logger.deactivate_log_handler(thd, log_type);
res= false;
}
else
res= logger.activate_log_handler(thd, log_type);
mysql_mutex_lock(&LOCK_global_system_variables);
return res;
}
static bool check_not_empty_set(sys_var *self, THD *thd, set_var *var)
{
return var->save_result.ulonglong_value == 0;
}
static bool fix_log_output(sys_var *self, THD *thd, enum_var_type type)
{
logger.lock_exclusive();
logger.init_slow_log(log_output_options);
logger.init_general_log(log_output_options);
logger.unlock();
return false;
}
static const char *log_output_names[] = { "NONE", "FILE", "TABLE", NULL};
static Sys_var_set Sys_log_output(
"log_output", "How logs should be written",
GLOBAL_VAR(log_output_options), CMD_LINE(REQUIRED_ARG),
log_output_names, DEFAULT(LOG_FILE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_not_empty_set), ON_UPDATE(fix_log_output));
#ifdef HAVE_REPLICATION
static Sys_var_mybool Sys_log_slave_updates(
"log_slave_updates", "Tells the slave to log the updates from "
"the slave thread to the binary log. You will need to turn it on if "
"you plan to daisy-chain the slaves.",
READ_ONLY GLOBAL_VAR(opt_log_slave_updates), CMD_LINE(OPT_ARG),
DEFAULT(0));
static Sys_var_charptr_fscs Sys_relay_log(
"relay_log", "The location and name to use for relay logs.",
READ_ONLY GLOBAL_VAR(opt_relay_logname), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
/*
Uses NO_CMD_LINE since the --relay-log-index option set
opt_relaylog_index_name variable and computes a value for the
relay_log_index variable.
*/
static Sys_var_charptr_fscs Sys_relay_log_index(
"relay_log_index", "The location and name to use for the file "
"that keeps a list of the last relay logs.",
READ_ONLY GLOBAL_VAR(relay_log_index), NO_CMD_LINE,
DEFAULT(0));
/*
Uses NO_CMD_LINE since the --log-bin-index option set
opt_binlog_index_name variable and computes a value for the
log_bin_index variable.
*/
static Sys_var_charptr_fscs Sys_binlog_index(
"log_bin_index", "File that holds the names for last binary log files.",
READ_ONLY GLOBAL_VAR(log_bin_index), NO_CMD_LINE,
DEFAULT(0));
static Sys_var_charptr_fscs Sys_relay_log_basename(
"relay_log_basename",
"The full path of the relay log file names, excluding the extension.",
READ_ONLY GLOBAL_VAR(relay_log_basename), NO_CMD_LINE,
DEFAULT(0));
static Sys_var_charptr_fscs Sys_log_bin_basename(
"log_bin_basename",
"The full path of the binary log file names, excluding the extension.",
READ_ONLY GLOBAL_VAR(log_bin_basename), NO_CMD_LINE,
DEFAULT(0));
static Sys_var_charptr_fscs Sys_relay_log_info_file(
"relay_log_info_file", "The location and name of the file that "
"remembers where the SQL replication thread is in the relay logs.",
READ_ONLY GLOBAL_VAR(relay_log_info_file), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_RELAY_LOG_PURGE>
Sys_relay_log_purge(
"relay_log_purge", "if disabled - do not purge relay logs. "
"if enabled - purge them as soon as they are no more needed.",
GLOBAL_VAR(relay_log_purge), CMD_LINE(OPT_ARG), DEFAULT(TRUE));
static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_RELAY_LOG_RECOVERY>
Sys_relay_log_recovery(
"relay_log_recovery", "Enables automatic relay log recovery "
"right after the database startup, which means that the IO Thread "
"starts re-fetching from the master right after the last transaction "
"processed.",
GLOBAL_VAR(relay_log_recovery), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
bool Sys_var_rpl_filter::global_update(THD *thd, set_var *var)
{
bool result= true; // Assume error
LEX_CSTRING *base_name= &var->base;
if (!base_name->length)
base_name= &thd->variables.default_master_connection;
mysql_mutex_unlock(&LOCK_global_system_variables);
if (Master_info *mi= get_master_info(base_name, !var->base.length ?
Sql_condition::WARN_LEVEL_ERROR :
Sql_condition::WARN_LEVEL_WARN))
{
if (mi->rli.slave_running)
{
my_error(ER_SLAVE_MUST_STOP, MYF(0),
(int) mi->connection_name.length,
mi->connection_name.str);
result= true;
}
else
{
result= set_filter_value(var->save_result.string_value.str, mi);
}
mi->release();
}
mysql_mutex_lock(&LOCK_global_system_variables);
return result;
}
bool Sys_var_rpl_filter::set_filter_value(const char *value, Master_info *mi)
{
bool status= true;
Rpl_filter* rpl_filter= mi->rpl_filter;
/* Proctect against other threads */
mysql_mutex_lock(&LOCK_active_mi);
switch (opt_id) {
case OPT_REPLICATE_REWRITE_DB:
status= rpl_filter->set_rewrite_db(value);
break;
case OPT_REPLICATE_DO_DB:
status= rpl_filter->set_do_db(value);
break;
case OPT_REPLICATE_DO_TABLE:
status= rpl_filter->set_do_table(value);
break;
case OPT_REPLICATE_IGNORE_DB:
status= rpl_filter->set_ignore_db(value);
break;
case OPT_REPLICATE_IGNORE_TABLE:
status= rpl_filter->set_ignore_table(value);
break;
case OPT_REPLICATE_WILD_DO_TABLE:
status= rpl_filter->set_wild_do_table(value);
break;
case OPT_REPLICATE_WILD_IGNORE_TABLE:
status= rpl_filter->set_wild_ignore_table(value);
break;
}
mysql_mutex_unlock(&LOCK_active_mi);
return status;
}
const uchar *
Sys_var_rpl_filter::global_value_ptr(THD *thd,
const LEX_CSTRING *base_name) const
{
char buf[256];
String tmp(buf, sizeof(buf), &my_charset_bin);
uchar *ret;
Master_info *mi;
Rpl_filter *rpl_filter;
mysql_mutex_unlock(&LOCK_global_system_variables);
mi= get_master_info(base_name, !base_name->length ?
Sql_condition::WARN_LEVEL_ERROR :
Sql_condition::WARN_LEVEL_WARN);
if (!mi)
{
mysql_mutex_lock(&LOCK_global_system_variables);
return 0;
}
rpl_filter= mi->rpl_filter;
mysql_mutex_lock(&LOCK_active_mi);
switch (opt_id) {
case OPT_REPLICATE_REWRITE_DB:
rpl_filter->get_rewrite_db(&tmp);
break;
case OPT_REPLICATE_DO_DB:
rpl_filter->get_do_db(&tmp);
break;
case OPT_REPLICATE_DO_TABLE:
rpl_filter->get_do_table(&tmp);
break;
case OPT_REPLICATE_IGNORE_DB:
rpl_filter->get_ignore_db(&tmp);
break;
case OPT_REPLICATE_IGNORE_TABLE:
rpl_filter->get_ignore_table(&tmp);
break;
case OPT_REPLICATE_WILD_DO_TABLE:
rpl_filter->get_wild_do_table(&tmp);
break;
case OPT_REPLICATE_WILD_IGNORE_TABLE:
rpl_filter->get_wild_ignore_table(&tmp);
break;
}
mysql_mutex_unlock(&LOCK_active_mi);
mysql_mutex_lock(&LOCK_global_system_variables);
mi->release();
ret= (uchar *) thd->strmake(tmp.ptr(), tmp.length());
return ret;
}
static Sys_var_rpl_filter Sys_replicate_do_db(
"replicate_do_db", OPT_REPLICATE_DO_DB,
"Tell the slave to restrict replication to updates of tables "
"whose names appear in the comma-separated list. For "
"statement-based replication, only the default database (that "
"is, the one selected by USE) is considered, not any explicitly "
"mentioned tables in the query. For row-based replication, the "
"actual names of table(s) being updated are checked.",
PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_DO_DB);
static Sys_var_rpl_filter Sys_replicate_rewrite_db(
"replicate_rewrite_db", OPT_REPLICATE_REWRITE_DB,
"Tells the slave to replicate binlog events "
"into a different database than their original target on the master."
"Example: replicate-rewrite-db=master_db_name->slave_db_name.",
PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_REWRITE_DB);
static Sys_var_rpl_filter Sys_replicate_do_table(
"replicate_do_table", OPT_REPLICATE_DO_TABLE,
"Tells the slave to restrict replication to tables in the "
"comma-separated list.",
PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_DO_TABLE);
static Sys_var_rpl_filter Sys_replicate_ignore_db(
"replicate_ignore_db", OPT_REPLICATE_IGNORE_DB,
"Tell the slave to restrict replication to updates of tables "
"whose names do not appear in the comma-separated list. For "
"statement-based replication, only the default database (that "
"is, the one selected by USE) is considered, not any explicitly "
"mentioned tables in the query. For row-based replication, the "
"actual names of table(s) being updated are checked.",
PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_IGNORE_DB);
static Sys_var_rpl_filter Sys_replicate_ignore_table(
"replicate_ignore_table", OPT_REPLICATE_IGNORE_TABLE,
"Tells the slave thread not to replicate any statement that "
"updates the specified table, even if any other tables might be "
"updated by the same statement.",
PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_IGNORE_TABLE);
static Sys_var_rpl_filter Sys_replicate_wild_do_table(
"replicate_wild_do_table", OPT_REPLICATE_WILD_DO_TABLE,
"Tells the slave thread to restrict replication to statements "
"where any of the updated tables match the specified database "
"and table name patterns.",
PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_WILD_DO_TABLE);
static Sys_var_rpl_filter Sys_replicate_wild_ignore_table(
"replicate_wild_ignore_table", OPT_REPLICATE_WILD_IGNORE_TABLE,
"Tells the slave thread to not replicate to the tables that "
"match the given wildcard pattern.",
PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_WILD_IGNORE_TABLE);
static Sys_var_charptr_fscs Sys_slave_load_tmpdir(
"slave_load_tmpdir", "The location where the slave should put "
"its temporary files when replicating a LOAD DATA INFILE command",
READ_ONLY GLOBAL_VAR(slave_load_tmpdir), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_NET_TIMEOUT>
Sys_slave_net_timeout(
"slave_net_timeout", "Number of seconds to wait for more data "
"from any master/slave connection before aborting the read",
GLOBAL_VAR(slave_net_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(SLAVE_NET_TIMEOUT), BLOCK_SIZE(1));
/*
Access a multi_source variable
Return 0 + warning if it doesn't exist
*/
ulonglong Sys_var_multi_source_ulonglong::
get_master_info_ulonglong_value(THD *thd, ptrdiff_t offset) const
{
Master_info *mi;
ulonglong res= 0; // Default value
mysql_mutex_unlock(&LOCK_global_system_variables);
if ((mi= get_master_info(&thd->variables.default_master_connection,
Sql_condition::WARN_LEVEL_WARN)))
{
res= *((ulonglong*) (((uchar*) mi) + master_info_offset));
mi->release();
}
mysql_mutex_lock(&LOCK_global_system_variables);
return res;
}
bool update_multi_source_variable(sys_var *self_var, THD *thd,
enum_var_type type)
{
Sys_var_multi_source_ulonglong *self= (Sys_var_multi_source_ulonglong*) self_var;
bool result= true;
Master_info *mi;
if (type == OPT_GLOBAL)
mysql_mutex_unlock(&LOCK_global_system_variables);
if ((mi= (get_master_info(&thd->variables.default_master_connection,
Sql_condition::WARN_LEVEL_ERROR))))
{
mysql_mutex_lock(&mi->rli.run_lock);
mysql_mutex_lock(&mi->rli.data_lock);
result= self->update_variable(thd, mi);
mysql_mutex_unlock(&mi->rli.data_lock);
mysql_mutex_unlock(&mi->rli.run_lock);
mi->release();
}
if (type == OPT_GLOBAL)
mysql_mutex_lock(&LOCK_global_system_variables);
return result;
}
static bool update_slave_skip_counter(sys_var *self, THD *thd, Master_info *mi)
{
if (mi->rli.slave_running)
{
my_error(ER_SLAVE_MUST_STOP, MYF(0), (int) mi->connection_name.length,
mi->connection_name.str);
return true;
}
if (mi->using_gtid != Master_info::USE_GTID_NO && mi->using_parallel())
{
ulong domain_count;
mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state);
domain_count= rpl_global_gtid_slave_state->count();
mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state);
if (domain_count > 1)
{
/*
With domain-based parallel replication, the slave position is
multi-dimensional, so the relay log position is not very meaningful.
It might not even correspond to the next GTID to execute in _any_
domain (the case after error stop). So slave_skip_counter will most
likely not do what the user intends. Instead give an error, with a
suggestion to instead set @@gtid_slave_pos past the point of error;
this works reliably also in the case of multiple domains.
*/
my_error(ER_SLAVE_SKIP_NOT_IN_GTID, MYF(0));
return true;
}
}
/* The value was stored temporarily in thd */
mi->rli.slave_skip_counter= thd->variables.slave_skip_counter;
return false;
}
static Sys_var_multi_source_ulonglong Sys_slave_skip_counter(
"sql_slave_skip_counter", "Skip the next N events from the master log",
SESSION_VAR(slave_skip_counter), NO_CMD_LINE,
MASTER_INFO_VAR(rli.slave_skip_counter),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1),
ON_UPDATE(update_slave_skip_counter));
static bool update_max_relay_log_size(sys_var *self, THD *thd, Master_info *mi)
{
mi->rli.max_relay_log_size= thd->variables.max_relay_log_size;
mi->rli.relay_log.set_max_size((ulong)mi->rli.max_relay_log_size);
return false;
}
static Sys_var_multi_source_ulonglong Sys_max_relay_log_size(
"max_relay_log_size",
"relay log will be rotated automatically when the size exceeds this "
"value. If 0 at startup, it's set to max_binlog_size",
SESSION_VAR(max_relay_log_size), CMD_LINE(REQUIRED_ARG),
MASTER_INFO_VAR(rli.max_relay_log_size),
VALID_RANGE(0, 1024L*1024*1024), DEFAULT(0), BLOCK_SIZE(IO_SIZE),
ON_UPDATE(update_max_relay_log_size));
static Sys_var_charptr Sys_slave_skip_errors(
"slave_skip_errors", "Tells the slave thread to continue "
"replication when a query event returns an error from the "
"provided list",
READ_ONLY GLOBAL_VAR(opt_slave_skip_errors), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_on_access_global<Sys_var_ulonglong,
PRIV_SET_SYSTEM_GLOBAL_VAR_READ_BINLOG_SPEED_LIMIT>
Sys_read_binlog_speed_limit(
"read_binlog_speed_limit", "Maximum speed(KB/s) to read binlog from"
" master (0 = no limit)",
GLOBAL_VAR(opt_read_binlog_speed_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_charptr Sys_slave_transaction_retry_errors(
"slave_transaction_retry_errors", "Tells the slave thread to retry "
"transaction for replication when a query event returns an error from "
"the provided list. Deadlock error, elapsed lock wait timeout, "
"net read error, net read timeout, net write error, net write timeout, "
"connect error and 2 types of lost connection error are automatically "
"added to this list",
READ_ONLY GLOBAL_VAR(opt_slave_transaction_retry_errors), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
static Sys_var_ulonglong Sys_relay_log_space_limit(
"relay_log_space_limit", "Maximum space to use for all relay logs",
READ_ONLY GLOBAL_VAR(relay_log_space_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, ULONGLONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_SYNC_RELAY_LOG>
Sys_sync_relaylog_period(
"sync_relay_log", "Synchronously flush relay log to disk after "
"every #th event. Use 0 to disable synchronous flushing",
GLOBAL_VAR(sync_relaylog_period), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(10000), BLOCK_SIZE(1));
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_SYNC_RELAY_LOG_INFO>
Sys_sync_relayloginfo_period(
"sync_relay_log_info", "Synchronously flush relay log info "
"to disk after every #th transaction. Use 0 to disable "
"synchronous flushing",
GLOBAL_VAR(sync_relayloginfo_period), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(10000), BLOCK_SIZE(1));
#endif
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_SYNC_BINLOG>
Sys_sync_binlog_period(
"sync_binlog", "Synchronously flush binary log to disk after "
"every #th event. Use 0 (default) to disable synchronous flushing",
GLOBAL_VAR(sync_binlog_period), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_on_access_global<Sys_var_uint,
PRIV_SET_SYSTEM_GLOBAL_VAR_SYNC_MASTER_INFO>
Sys_sync_masterinfo_period(
"sync_master_info", "Synchronously flush master info to disk "
"after every #th event. Use 0 to disable synchronous flushing",
GLOBAL_VAR(sync_masterinfo_period), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(10000), BLOCK_SIZE(1));
#ifdef HAVE_REPLICATION
static Sys_var_ulong Sys_slave_trans_retries(
"slave_transaction_retries", "Number of times the slave SQL "
"thread will retry a transaction in case it failed with a deadlock, "
"elapsed lock wait timeout or listed in "
"slave_transaction_retry_errors, before giving up and stopping",
GLOBAL_VAR(slave_trans_retries), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(10), BLOCK_SIZE(1));
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_TRANSACTION_RETRY_INTERVAL>
Sys_slave_trans_retry_interval(
"slave_transaction_retry_interval", "Interval of the slave SQL "
"thread will retry a transaction in case it failed with a deadlock "
"or elapsed lock wait timeout or listed in "
"slave_transaction_retry_errors",
GLOBAL_VAR(slave_trans_retry_interval), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 3600), DEFAULT(0), BLOCK_SIZE(1));
#endif
static bool check_locale(sys_var *self, THD *thd, set_var *var)
{
if (!var->value)
return false;
MY_LOCALE *locale;
char buff[STRING_BUFFER_USUAL_SIZE];
if (var->value->result_type() == INT_RESULT)
{
int lcno= (int)var->value->val_int();
if (!(locale= my_locale_by_number(lcno)))
{
my_error(ER_UNKNOWN_LOCALE, MYF(0), llstr(lcno, buff));
return true;
}
if (check_not_null(self, thd, var))
return true;
}
else // STRING_RESULT
{
String str(buff, sizeof(buff), system_charset_info), *res;
if (!(res=var->value->val_str(&str)))
return true;
else if (!(locale= my_locale_by_name(res->c_ptr_safe())))
{
ErrConvString err(res);
my_error(ER_UNKNOWN_LOCALE, MYF(0), err.ptr());
return true;
}
}
var->save_result.ptr= locale;
if (!locale->errmsgs->errmsgs)
{
bool res;
mysql_mutex_lock(&LOCK_error_messages);
res= (!locale->errmsgs->errmsgs &&
read_texts(ERRMSG_FILE, locale->errmsgs->language,
&locale->errmsgs->errmsgs));
mysql_mutex_unlock(&LOCK_error_messages);
if (res)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Can't process error message file for locale '%s'",
locale->name);
return true;
}
}
status_var_increment(thd->status_var.feature_locale);
return false;
}
static bool update_locale(sys_var *self, THD* thd, enum_var_type type)
{
/* Cache pointer to error messages */
if (type == OPT_SESSION)
thd->variables.errmsgs= thd->variables.lc_messages->errmsgs->errmsgs;
else
global_system_variables.errmsgs=
global_system_variables.lc_messages->errmsgs->errmsgs;
return false;
}
static Sys_var_struct Sys_lc_messages(
"lc_messages", "Set the language used for the error messages",
SESSION_VAR(lc_messages), NO_CMD_LINE,
offsetof(MY_LOCALE, name), DEFAULT(&my_default_lc_messages),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_locale), ON_UPDATE(update_locale));
static Sys_var_struct Sys_lc_time_names(
"lc_time_names", "Set the language used for the month "
"names and the days of the week",
SESSION_VAR(lc_time_names), NO_CMD_LINE,
offsetof(MY_LOCALE, name), DEFAULT(&my_default_lc_time_names),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_locale));
static Sys_var_tz Sys_time_zone(
"time_zone", "The current time zone, used to initialize the time "
"zone for a client when it connects. Set to SYSTEM by default, in "
"which the client uses the system time zone value.",
SESSION_VAR(time_zone), NO_CMD_LINE,
DEFAULT(&default_tz), NO_MUTEX_GUARD, IN_BINLOG);
#ifdef WITH_WSREP
#include "wsrep_var.h"
#include "wsrep_sst.h"
#include "wsrep_binlog.h"
static Sys_var_charptr_fscs Sys_wsrep_provider(
"wsrep_provider", "Path to replication provider library",
PREALLOCATED READ_ONLY GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG),
DEFAULT(WSREP_NONE),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_provider_check), ON_UPDATE(wsrep_provider_update));
static Sys_var_charptr Sys_wsrep_provider_options(
"wsrep_provider_options", "Semicolon (;) separated list of wsrep "
"options (see wsrep_provider_options documentation).",
PREALLOCATED GLOBAL_VAR(wsrep_provider_options),
CMD_LINE(REQUIRED_ARG),
DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_provider_options_check),
ON_UPDATE(wsrep_provider_options_update));
static Sys_var_charptr_fscs Sys_wsrep_data_home_dir(
"wsrep_data_home_dir", "home directory for wsrep provider",
READ_ONLY GLOBAL_VAR(wsrep_data_home_dir), CMD_LINE(REQUIRED_ARG),
DEFAULT(mysql_real_data_home));
static Sys_var_charptr Sys_wsrep_cluster_name(
"wsrep_cluster_name", "Name for the cluster",
PREALLOCATED GLOBAL_VAR(wsrep_cluster_name), CMD_LINE(REQUIRED_ARG),
DEFAULT(WSREP_CLUSTER_NAME),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_cluster_name_check),
ON_UPDATE(wsrep_cluster_name_update));
static Sys_var_charptr Sys_wsrep_cluster_address (
"wsrep_cluster_address", "Address to initially connect to cluster",
PREALLOCATED GLOBAL_VAR(wsrep_cluster_address),
CMD_LINE(REQUIRED_ARG),
DEFAULT(""),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_cluster_address_check),
ON_UPDATE(wsrep_cluster_address_update));
static Sys_var_charptr Sys_wsrep_node_name (
"wsrep_node_name", "Name of this node. This name can be used in "
"wsrep_sst_donor as a preferred donor. Note that multiple nodes "
"in a cluster can have the same name.",
PREALLOCATED GLOBAL_VAR(wsrep_node_name), CMD_LINE(REQUIRED_ARG),
DEFAULT(glob_hostname), NO_MUTEX_GUARD, NOT_IN_BINLOG,
wsrep_node_name_check, wsrep_node_name_update);
static Sys_var_charptr Sys_wsrep_node_address (
"wsrep_node_address", "Specifies the node's network address, in "
"the format ip address[:port]. Used in situations where autoguessing "
"is not reliable. As of MariaDB 10.1.8, supports IPv6.",
PREALLOCATED GLOBAL_VAR(wsrep_node_address), CMD_LINE(REQUIRED_ARG),
DEFAULT(""),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_node_address_check),
ON_UPDATE(wsrep_node_address_update));
static Sys_var_charptr Sys_wsrep_node_incoming_address(
"wsrep_node_incoming_address", "Client connection address",
PREALLOCATED GLOBAL_VAR(wsrep_node_incoming_address),CMD_LINE(REQUIRED_ARG),
DEFAULT(WSREP_NODE_INCOMING_AUTO));
static Sys_var_ulong Sys_wsrep_slave_threads(
"wsrep_slave_threads", "Number of slave appliers to launch",
GLOBAL_VAR(wsrep_slave_threads), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, 512), DEFAULT(1), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0),
ON_UPDATE(wsrep_slave_threads_update));
static Sys_var_charptr Sys_wsrep_dbug_option(
"wsrep_dbug_option", "DBUG options to provider library",
GLOBAL_VAR(wsrep_dbug_option),CMD_LINE(REQUIRED_ARG),
DEFAULT(""));
static const char *wsrep_debug_names[]=
{ "NONE", "SERVER", "TRANSACTION", "STREAMING", "CLIENT", NullS };
static Sys_var_enum Sys_wsrep_debug(
"wsrep_debug", "WSREP debug level logging",
GLOBAL_VAR(wsrep_debug), CMD_LINE(REQUIRED_ARG),
wsrep_debug_names, DEFAULT(0),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0), ON_UPDATE(wsrep_debug_update));
static Sys_var_mybool Sys_wsrep_convert_LOCK_to_trx(
"wsrep_convert_LOCK_to_trx", "To convert locking sessions "
"into transactions",
GLOBAL_VAR(wsrep_convert_LOCK_to_trx),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_ulong Sys_wsrep_retry_autocommit(
"wsrep_retry_autocommit", "Max number of times to retry "
"a failed autocommit statement",
SESSION_VAR(wsrep_retry_autocommit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 10000), DEFAULT(1), BLOCK_SIZE(1));
static bool update_wsrep_auto_increment_control (sys_var *self, THD *thd, enum_var_type type)
{
if (wsrep_auto_increment_control)
{
/*
The variables that control auto increment shall be calculated
automatically based on the size of the cluster. This usually done
within the wsrep_view_handler_cb callback. However, if the user
manually sets the value of wsrep_auto_increment_control to 'ON',
then we should to re-calculate these variables again (because
these values may be required before wsrep_view_handler_cb will
be re-invoked, which is rarely invoked if the cluster stays in
the stable state):
*/
global_system_variables.auto_increment_increment=
wsrep_cluster_size ? wsrep_cluster_size : 1;
global_system_variables.auto_increment_offset=
wsrep_local_index >= 0 ? wsrep_local_index + 1 : 1;
thd->variables.auto_increment_increment=
global_system_variables.auto_increment_increment;
thd->variables.auto_increment_offset=
global_system_variables.auto_increment_offset;
}
else
{
/*
We must restore the last values of the variables that
are explicitly specified by the user:
*/
global_system_variables.auto_increment_increment=
global_system_variables.saved_auto_increment_increment;
global_system_variables.auto_increment_offset=
global_system_variables.saved_auto_increment_offset;
thd->variables.auto_increment_increment=
thd->variables.saved_auto_increment_increment;
thd->variables.auto_increment_offset=
thd->variables.saved_auto_increment_offset;
}
return false;
}
static Sys_var_mybool Sys_wsrep_auto_increment_control(
"wsrep_auto_increment_control", "To automatically control the "
"assignment of autoincrement variables",
GLOBAL_VAR(wsrep_auto_increment_control),
CMD_LINE(OPT_ARG), DEFAULT(TRUE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_wsrep_auto_increment_control));
static Sys_var_mybool Sys_wsrep_drupal_282555_workaround(
"wsrep_drupal_282555_workaround", "Enable a workaround to handle the "
"cases where inserting a DEFAULT value into an auto-increment column "
"could fail with duplicate key error",
GLOBAL_VAR(wsrep_drupal_282555_workaround),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_charptr sys_wsrep_sst_method(
"wsrep_sst_method", "State snapshot transfer method",
GLOBAL_VAR(wsrep_sst_method),CMD_LINE(REQUIRED_ARG),
DEFAULT(WSREP_SST_DEFAULT), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_sst_method_check));
static Sys_var_charptr Sys_wsrep_sst_receive_address(
"wsrep_sst_receive_address", "Address where node is waiting for "
"SST contact",
GLOBAL_VAR(wsrep_sst_receive_address),CMD_LINE(REQUIRED_ARG),
DEFAULT(WSREP_SST_ADDRESS_AUTO), NO_MUTEX_GUARD,
NOT_IN_BINLOG,
ON_CHECK(wsrep_sst_receive_address_check),
ON_UPDATE(wsrep_sst_receive_address_update));
static Sys_var_charptr Sys_wsrep_sst_auth(
"wsrep_sst_auth", "Authentication for SST connection",
PREALLOCATED GLOBAL_VAR(wsrep_sst_auth), CMD_LINE(REQUIRED_ARG),
DEFAULT(NULL), NO_MUTEX_GUARD,
NOT_IN_BINLOG,
ON_CHECK(wsrep_sst_auth_check),
ON_UPDATE(wsrep_sst_auth_update));
static Sys_var_charptr Sys_wsrep_sst_donor(
"wsrep_sst_donor", "preferred donor node for the SST",
GLOBAL_VAR(wsrep_sst_donor),CMD_LINE(REQUIRED_ARG),
DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_sst_donor_check),
ON_UPDATE(wsrep_sst_donor_update));
static Sys_var_mybool Sys_wsrep_sst_donor_rejects_queries(
"wsrep_sst_donor_rejects_queries", "Reject client queries "
"when donating state snapshot transfer",
GLOBAL_VAR(wsrep_sst_donor_rejects_queries),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_mybool Sys_wsrep_on (
"wsrep_on", "To enable wsrep replication ",
SESSION_VAR(wsrep_on),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_on_check),
ON_UPDATE(wsrep_on_update));
static Sys_var_charptr Sys_wsrep_start_position (
"wsrep_start_position", "global transaction position to start from ",
PREALLOCATED GLOBAL_VAR(wsrep_start_position),
CMD_LINE(REQUIRED_ARG),
DEFAULT(WSREP_START_POSITION_ZERO),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_start_position_check),
ON_UPDATE(wsrep_start_position_update));
static Sys_var_ulong Sys_wsrep_max_ws_size (
"wsrep_max_ws_size", "Max write set size (bytes)",
GLOBAL_VAR(wsrep_max_ws_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, WSREP_MAX_WS_SIZE), DEFAULT(WSREP_MAX_WS_SIZE),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_max_ws_size_check), ON_UPDATE(wsrep_max_ws_size_update));
static Sys_var_ulong Sys_wsrep_max_ws_rows (
"wsrep_max_ws_rows", "Max number of rows in write set",
GLOBAL_VAR(wsrep_max_ws_rows), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 1048576), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_charptr Sys_wsrep_notify_cmd(
"wsrep_notify_cmd", "",
READ_ONLY GLOBAL_VAR(wsrep_notify_cmd), CMD_LINE(REQUIRED_ARG),
DEFAULT(""));
static Sys_var_charptr_fscs Sys_wsrep_status_file(
"wsrep_status_file", "wsrep status output filename",
READ_ONLY GLOBAL_VAR(wsrep_status_file), CMD_LINE(REQUIRED_ARG),
DEFAULT(""));
static Sys_var_mybool Sys_wsrep_certify_nonPK(
"wsrep_certify_nonPK", "Certify tables with no primary key",
GLOBAL_VAR(wsrep_certify_nonPK),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
static const char *wsrep_certification_rules_names[]= { "strict", "optimized", NullS };
static Sys_var_enum Sys_wsrep_certification_rules(
"wsrep_certification_rules",
"Certification rules to use in the cluster. Possible values are: "
"\"strict\": stricter rules that could result in more certification "
"failures. "
"\"optimized\": relaxed rules that allow more concurrency and "
"cause less certification failures.",
GLOBAL_VAR(wsrep_certification_rules), CMD_LINE(REQUIRED_ARG),
wsrep_certification_rules_names, DEFAULT(WSREP_CERTIFICATION_RULES_STRICT),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(0));
static Sys_var_mybool Sys_wsrep_causal_reads(
"wsrep_causal_reads", "Setting this variable is equivalent "
"to setting wsrep_sync_wait READ flag",
SESSION_VAR(wsrep_causal_reads),
CMD_LINE(OPT_ARG, OPT_WSREP_CAUSAL_READS), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(wsrep_causal_reads_update),
DEPRECATED("'@@wsrep_sync_wait=1'")); // since 10.1.3
static Sys_var_uint Sys_wsrep_sync_wait(
"wsrep_sync_wait", "Ensure \"synchronous\" read view before executing "
"an operation of the type specified by bitmask: 1 - READ(includes "
"SELECT, SHOW and BEGIN/START TRANSACTION); 2 - UPDATE and DELETE; 4 - "
"INSERT and REPLACE",
SESSION_VAR(wsrep_sync_wait), CMD_LINE(OPT_ARG, OPT_WSREP_SYNC_WAIT),
VALID_RANGE(WSREP_SYNC_WAIT_NONE, WSREP_SYNC_WAIT_MAX),
DEFAULT(WSREP_SYNC_WAIT_NONE), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(wsrep_sync_wait_update));
static const char *wsrep_mode_names[]=
{
"STRICT_REPLICATION",
"BINLOG_ROW_FORMAT_ONLY",
"REQUIRED_PRIMARY_KEY",
"REPLICATE_MYISAM",
"REPLICATE_ARIA",
"DISALLOW_LOCAL_GTID",
"BF_ABORT_MARIABACKUP",
NullS
};
static Sys_var_set Sys_wsrep_mode(
"wsrep_mode",
"Set of WSREP features that are enabled.",
GLOBAL_VAR(wsrep_mode), CMD_LINE(REQUIRED_ARG),
wsrep_mode_names,
DEFAULT(0),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_mode_check));
static const char *wsrep_OSU_method_names[]= { "TOI", "RSU", NullS };
static Sys_var_enum Sys_wsrep_OSU_method(
"wsrep_OSU_method", "Method for Online Schema Upgrade",
SESSION_VAR(wsrep_OSU_method), CMD_LINE(OPT_ARG),
wsrep_OSU_method_names, DEFAULT(WSREP_OSU_TOI));
static PolyLock_mutex PLock_wsrep_desync(&LOCK_wsrep_desync);
static Sys_var_mybool Sys_wsrep_desync (
"wsrep_desync", "To desynchronize the node from the cluster",
GLOBAL_VAR(wsrep_desync),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
&PLock_wsrep_desync, NOT_IN_BINLOG,
ON_CHECK(wsrep_desync_check),
ON_UPDATE(wsrep_desync_update));
static const char *wsrep_reject_queries_names[]= { "NONE", "ALL", "ALL_KILL", NullS };
static Sys_var_enum Sys_wsrep_reject_queries(
"wsrep_reject_queries", "Variable to set to reject queries",
GLOBAL_VAR(wsrep_reject_queries), CMD_LINE(OPT_ARG),
wsrep_reject_queries_names, DEFAULT(WSREP_REJECT_NONE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(wsrep_reject_queries_update));
static const char *wsrep_binlog_format_names[]=
{"MIXED", "STATEMENT", "ROW", "NONE", NullS};
static Sys_var_enum Sys_wsrep_forced_binlog_format(
"wsrep_forced_binlog_format", "binlog format to take effect over user's choice",
GLOBAL_VAR(wsrep_forced_binlog_format), CMD_LINE(REQUIRED_ARG),
wsrep_binlog_format_names, DEFAULT(BINLOG_FORMAT_UNSPEC));
static Sys_var_mybool Sys_wsrep_recover_datadir(
"wsrep_recover", "Recover database state after crash and exit",
READ_ONLY GLOBAL_VAR(wsrep_recovery),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_mybool Sys_wsrep_log_conflicts(
"wsrep_log_conflicts", "To log multi-master conflicts",
GLOBAL_VAR(wsrep_log_conflicts), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_ulong Sys_wsrep_mysql_replication_bundle(
"wsrep_mysql_replication_bundle", "mysql replication group commit ",
GLOBAL_VAR(wsrep_mysql_replication_bundle), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 1000), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_mybool Sys_wsrep_load_data_splitting(
"wsrep_load_data_splitting", "To commit LOAD DATA "
"transaction after every 10K rows inserted (deprecated)",
GLOBAL_VAR(wsrep_load_data_splitting),
CMD_LINE(OPT_ARG), DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0), ON_UPDATE(0), DEPRECATED("")); // since 10.4.3
static Sys_var_mybool Sys_wsrep_slave_FK_checks(
"wsrep_slave_FK_checks", "Should slave thread do "
"foreign key constraint checks",
GLOBAL_VAR(wsrep_slave_FK_checks),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
static Sys_var_mybool Sys_wsrep_slave_UK_checks(
"wsrep_slave_UK_checks", "Should slave thread do "
"secondary index uniqueness checks",
GLOBAL_VAR(wsrep_slave_UK_checks),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_mybool Sys_wsrep_restart_slave(
"wsrep_restart_slave", "Should MariaDB slave be restarted automatically, when node joins back to cluster",
GLOBAL_VAR(wsrep_restart_slave), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_ulonglong Sys_wsrep_trx_fragment_size(
"wsrep_trx_fragment_size",
"Size of transaction fragments for streaming replication (measured in "
"units of 'wsrep_trx_fragment_unit')",
SESSION_VAR(wsrep_trx_fragment_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, WSREP_MAX_WS_SIZE), DEFAULT(0), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_trx_fragment_size_check),
ON_UPDATE(wsrep_trx_fragment_size_update));
extern const char *wsrep_fragment_units[];
static Sys_var_enum Sys_wsrep_trx_fragment_unit(
"wsrep_trx_fragment_unit",
"Unit for streaming replication transaction fragments' size: bytes, "
"rows, statements",
SESSION_VAR(wsrep_trx_fragment_unit), CMD_LINE(REQUIRED_ARG),
wsrep_fragment_units,
DEFAULT(WSREP_FRAG_BYTES),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0),
ON_UPDATE(wsrep_trx_fragment_unit_update));
extern const char *wsrep_SR_store_types[];
static Sys_var_enum Sys_wsrep_SR_store(
"wsrep_SR_store", "Storage for streaming replication fragments",
READ_ONLY GLOBAL_VAR(wsrep_SR_store_type), CMD_LINE(REQUIRED_ARG),
wsrep_SR_store_types, DEFAULT(WSREP_SR_STORE_TABLE));
static Sys_var_mybool Sys_wsrep_dirty_reads(
"wsrep_dirty_reads",
"Allow reads even when the node is not in the primary component.",
SESSION_VAR(wsrep_dirty_reads), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static Sys_var_uint Sys_wsrep_ignore_apply_errors (
"wsrep_ignore_apply_errors", "Ignore replication errors",
GLOBAL_VAR(wsrep_ignore_apply_errors), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(WSREP_IGNORE_ERRORS_NONE, WSREP_IGNORE_ERRORS_MAX),
DEFAULT(7), BLOCK_SIZE(1));
static Sys_var_uint Sys_wsrep_gtid_domain_id(
"wsrep_gtid_domain_id", "When wsrep_gtid_mode is set, this value is "
"used as gtid_domain_id for galera transactions and also copied to the "
"joiner nodes during state transfer. It is ignored, otherwise.",
GLOBAL_VAR(wsrep_gtid_domain_id), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(wsrep_gtid_domain_id_update));
static Sys_var_ulonglong Sys_wsrep_gtid_seq_no(
"wsrep_gtid_seq_no",
"Internal server usage, manually set WSREP GTID seqno.",
SESSION_ONLY(wsrep_gtid_seq_no),
NO_CMD_LINE, VALID_RANGE(0, ULONGLONG_MAX), DEFAULT(0),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_gtid_seq_no_check));
static Sys_var_mybool Sys_wsrep_gtid_mode(
"wsrep_gtid_mode", "Automatically update the (joiner) node's "
"wsrep_gtid_domain_id value with that of donor's (received during "
"state transfer) and use it in place of gtid_domain_id for all galera "
"transactions. When OFF (default), wsrep_gtid_domain_id is simply "
"ignored (backward compatibility).",
GLOBAL_VAR(wsrep_gtid_mode), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static char *wsrep_patch_version_ptr;
static Sys_var_charptr Sys_wsrep_patch_version(
"wsrep_patch_version", "Wsrep patch version, for example wsrep_25.10.",
READ_ONLY GLOBAL_VAR(wsrep_patch_version_ptr), CMD_LINE_HELP_ONLY,
DEFAULT(WSREP_PATCH_VERSION));
static Sys_var_charptr Sys_wsrep_allowlist(
"wsrep_allowlist", "Allowed IP addresses split by comma delimiter",
READ_ONLY GLOBAL_VAR(wsrep_allowlist), CMD_LINE(REQUIRED_ARG),
DEFAULT(""));
#endif /* WITH_WSREP */
static bool fix_host_cache_size(sys_var *, THD *, enum_var_type)
{
hostname_cache_resize((uint) host_cache_size);
return false;
}
static Sys_var_ulong Sys_host_cache_size(
"host_cache_size",
"How many host names should be cached to avoid resolving.",
AUTO_SET GLOBAL_VAR(host_cache_size),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 65536),
DEFAULT(HOST_CACHE_SIZE), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_host_cache_size));
vio_keepalive_opts opt_vio_keepalive;
static Sys_var_int Sys_keepalive_time(
"tcp_keepalive_time",
"Timeout, in seconds, with no activity until the first TCP keep-alive packet is sent."
"If set to 0, system dependent default is used.",
AUTO_SET GLOBAL_VAR(opt_vio_keepalive.idle),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, INT_MAX32/1000), DEFAULT(0),
BLOCK_SIZE(1));
static Sys_var_int Sys_keepalive_interval(
"tcp_keepalive_interval",
"The interval, in seconds, between when successive keep-alive packets are sent if no acknowledgement is received."
"If set to 0, system dependent default is used.",
AUTO_SET GLOBAL_VAR(opt_vio_keepalive.interval),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, INT_MAX32/1000), DEFAULT(0),
BLOCK_SIZE(1));
static Sys_var_int Sys_keepalive_probes(
"tcp_keepalive_probes",
"The number of unacknowledged probes to send before considering the connection dead and notifying the application layer."
"If set to 0, system dependent default is used.",
AUTO_SET GLOBAL_VAR(opt_vio_keepalive.probes),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, INT_MAX32/1000), DEFAULT(0),
BLOCK_SIZE(1));
static bool update_tcp_nodelay(sys_var *self, THD *thd,
enum_var_type type)
{
DBUG_ASSERT(thd);
Vio *vio = thd->net.vio;
if (vio)
return (MY_TEST(vio_nodelay(vio, thd->variables.tcp_nodelay)));
return false;
}
static Sys_var_mybool Sys_tcp_nodelay(
"tcp_nodelay",
"Set option TCP_NODELAY (disable Nagle's algorithm) on socket",
SESSION_VAR(tcp_nodelay), CMD_LINE(OPT_ARG),
DEFAULT(TRUE),NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_session_only_variable),
ON_UPDATE(update_tcp_nodelay));
static Sys_var_charptr_fscs Sys_ignore_db_dirs(
"ignore_db_dirs",
"Specifies a directory to add to the ignore list when collecting "
"database names from the datadir. Put a blank argument to reset "
"the list accumulated so far.",
READ_ONLY GLOBAL_VAR(opt_ignore_db_dirs),
CMD_LINE(REQUIRED_ARG, OPT_IGNORE_DB_DIRECTORY),
DEFAULT(0));
static Sys_var_ulong Sys_sp_cache_size(
"stored_program_cache",
"The soft upper limit for number of cached stored routines for "
"one connection.",
GLOBAL_VAR(stored_program_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 512 * 1024), DEFAULT(256), BLOCK_SIZE(1));
export const char *plugin_maturity_names[]=
{ "unknown", "experimental", "alpha", "beta", "gamma", "stable", 0 };
static Sys_var_enum Sys_plugin_maturity(
"plugin_maturity",
"The lowest desirable plugin maturity. "
"Plugins less mature than that will not be installed or loaded",
READ_ONLY GLOBAL_VAR(plugin_maturity), CMD_LINE(REQUIRED_ARG),
plugin_maturity_names,
DEFAULT(SERVER_MATURITY_LEVEL > 0 ?
SERVER_MATURITY_LEVEL - 1 : SERVER_MATURITY_LEVEL));
static Sys_var_ulong Sys_deadlock_search_depth_short(
"deadlock_search_depth_short",
"Short search depth for the two-step deadlock detection",
SESSION_VAR(wt_deadlock_search_depth_short), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 32), DEFAULT(4), BLOCK_SIZE(1));
static Sys_var_ulong Sys_deadlock_search_depth_long(
"deadlock_search_depth_long",
"Long search depth for the two-step deadlock detection",
SESSION_VAR(wt_deadlock_search_depth_long), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 33), DEFAULT(15), BLOCK_SIZE(1));
static Sys_var_ulong Sys_deadlock_timeout_depth_short(
"deadlock_timeout_short",
"Short timeout for the two-step deadlock detection (in microseconds)",
SESSION_VAR(wt_timeout_short), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(10000), BLOCK_SIZE(1));
static Sys_var_ulong Sys_deadlock_timeout_depth_long(
"deadlock_timeout_long",
"Long timeout for the two-step deadlock detection (in microseconds)",
SESSION_VAR(wt_timeout_long), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(50000000), BLOCK_SIZE(1));
static Sys_var_uint Sys_extra_port(
"extra_port",
"Extra port number to use for tcp connections in a "
"one-thread-per-connection manner. 0 means don't use another port",
READ_ONLY GLOBAL_VAR(mysqld_extra_port), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_on_access_global<Sys_var_ulong,
PRIV_SET_SYSTEM_GLOBAL_VAR_EXTRA_MAX_CONNECTIONS>
Sys_extra_max_connections(
"extra_max_connections", "The number of connections on extra-port",
GLOBAL_VAR(extra_max_connections), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, 100000), DEFAULT(1), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_max_connections));
#ifdef SAFE_MUTEX
static Sys_var_mybool Sys_mutex_deadlock_detector(
"debug_mutex_deadlock_detector", "Enable checking of wrong mutex usage",
READ_ONLY GLOBAL_VAR(safe_mutex_deadlock_detector),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
#endif
static Sys_var_keycache Sys_key_cache_segments(
"key_cache_segments", "The number of segments in a key cache",
KEYCACHE_VAR(param_partitions),
CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_PARTITIONS),
VALID_RANGE(0, MAX_KEY_CACHE_PARTITIONS),
DEFAULT(DEFAULT_KEY_CACHE_PARTITIONS),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(repartition_keycache));
static const char *log_slow_filter_names[]=
{
"admin", "filesort", "filesort_on_disk", "filesort_priority_queue",
"full_join", "full_scan", "not_using_index", "query_cache",
"query_cache_miss", "tmp_table", "tmp_table_on_disk", 0
};
static Sys_var_set Sys_log_slow_filter(
"log_slow_filter",
"Log only certain types of queries to the slow log. If variable empty all kind of queries are logged. All types are bound by slow_query_time, except 'not_using_index' which is always logged if enabled",
SESSION_VAR(log_slow_filter), CMD_LINE(REQUIRED_ARG),
log_slow_filter_names,
/* by default we log all queries except 'not_using_index' */
DEFAULT(my_set_bits(array_elements(log_slow_filter_names)-1) &
~QPLAN_NOT_USING_INDEX));
static const char *log_slow_disabled_statements_names[]=
{ "admin", "call", "slave", "sp", 0 };
static const char *log_disabled_statements_names[]=
{ "slave", "sp", 0 };
static Sys_var_set Sys_log_slow_disabled_statements(
"log_slow_disabled_statements",
"Don't log certain types of statements to slow log",
SESSION_VAR(log_slow_disabled_statements), CMD_LINE(REQUIRED_ARG),
log_slow_disabled_statements_names,
DEFAULT(LOG_SLOW_DISABLE_SP));
static Sys_var_set Sys_log_disabled_statements(
"log_disabled_statements",
"Don't log certain types of statements to general log",
SESSION_VAR(log_disabled_statements), CMD_LINE(REQUIRED_ARG),
log_disabled_statements_names,
DEFAULT(LOG_DISABLE_SP),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super));
#define NOT_SUPPORTED_YET -2
#ifndef PCRE2_EXTENDED_MORE
#define PCRE2_EXTENDED_MORE NOT_SUPPORTED_YET
#endif
static const char *default_regex_flags_names[]=
{
"DOTALL", // (?s) . matches anything including NL
"DUPNAMES", // (?J) Allow duplicate names for subpatterns
"EXTENDED", // (?x) Ignore white space and # comments
"EXTENDED_MORE",//(?xx) Ignore white space and # comments inside cheracter
"EXTRA", // means nothing since PCRE2
"MULTILINE", // (?m) ^ and $ match newlines within data
"UNGREEDY", // (?U) Invert greediness of quantifiers
0
};
static const int default_regex_flags_to_pcre[]=
{
PCRE2_DOTALL,
PCRE2_DUPNAMES,
PCRE2_EXTENDED,
PCRE2_EXTENDED_MORE,
-1, /* EXTRA flag not available since PCRE2 */
PCRE2_MULTILINE,
PCRE2_UNGREEDY,
0
};
int default_regex_flags_pcre(THD *thd)
{
ulonglong src= thd->variables.default_regex_flags;
int i, res;
for (i= res= 0; default_regex_flags_to_pcre[i]; i++)
{
if (src & (1ULL << i))
{
if (default_regex_flags_to_pcre[i] < 0)
{
const char *msg= default_regex_flags_to_pcre[i] == NOT_SUPPORTED_YET
? "Your version of PCRE2 does not support the %s flag. Ignored."
: "PCRE2 doesn't support the %s flag. Ignored.";
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_UNKNOWN_ERROR, msg, default_regex_flags_names[i]);
continue;
}
res|= default_regex_flags_to_pcre[i];
}
}
return res;
}
static Sys_var_set Sys_default_regex_flags(
"default_regex_flags",
"Default flags for the regex library",
SESSION_VAR(default_regex_flags), CMD_LINE(REQUIRED_ARG),
default_regex_flags_names,
DEFAULT(0));
static Sys_var_ulong Sys_log_slow_rate_limit(
"log_slow_rate_limit",
"Write to slow log every #th slow query. Set to 1 to log everything. "
"Increase it to reduce the size of the slow or the performance impact "
"of slow logging",
SESSION_VAR(log_slow_rate_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, UINT_MAX), DEFAULT(1), BLOCK_SIZE(1));
/*
Full is not needed below anymore as one can set all bits with '= ALL', but
we need it for compatiblity with earlier versions.
*/
static const char *log_slow_verbosity_names[]=
{ "innodb", "query_plan", "explain", "engine", "warnings", "full", 0};
static Sys_var_set Sys_log_slow_verbosity(
"log_slow_verbosity",
"Verbosity level for the slow log",
SESSION_VAR(log_slow_verbosity), CMD_LINE(REQUIRED_ARG),
log_slow_verbosity_names, DEFAULT(LOG_SLOW_VERBOSITY_INIT));
static Sys_var_ulong Sys_log_slow_max_warnings(
"log_slow_max_warnings",
"Max numbers of warnings printed to slow query log per statement",
SESSION_VAR(log_slow_max_warnings), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 1000), DEFAULT(10), BLOCK_SIZE(1));
static const char *note_verbosity_names[]=
{ "basic", "unusable_keys", "explain", 0};
static Sys_var_set Sys_note_verbosity(
"note_verbosity",
"Verbosity level for note-warnings given to the user. "
"See also @@sql_notes.",
SESSION_VAR(note_verbosity), CMD_LINE(REQUIRED_ARG),
note_verbosity_names, DEFAULT(NOTE_VERBOSITY_NORMAL |
NOTE_VERBOSITY_EXPLAIN));
static Sys_var_ulong Sys_join_cache_level(
"join_cache_level",
"Controls what join operations can be executed with join buffers. Odd "
"numbers are used for plain join buffers while even numbers are used "
"for linked buffers",
SESSION_VAR(join_cache_level), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 8), DEFAULT(2), BLOCK_SIZE(1));
static Sys_var_ulong Sys_mrr_buffer_size(
"mrr_buffer_size",
"Size of buffer to use when using MRR with range access",
SESSION_VAR(mrr_buff_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE*2, INT_MAX32), DEFAULT(256*1024), BLOCK_SIZE(1));
static Sys_var_ulong Sys_rowid_merge_buff_size(
"rowid_merge_buff_size",
"The size of the buffers used [NOT] IN evaluation via partial matching",
SESSION_VAR(rowid_merge_buff_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, LONG_MAX), DEFAULT(8*1024*1024),
BLOCK_SIZE(1));
static Sys_var_mybool Sys_userstat(
"userstat",
"Enables statistics gathering for USER_STATISTICS, CLIENT_STATISTICS, "
"INDEX_STATISTICS and TABLE_STATISTICS tables in the INFORMATION_SCHEMA",
GLOBAL_VAR(opt_userstat_running),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_on_access<Sys_var_mybool,
PRIV_SET_SYSTEM_VAR_BINLOG_ANNOTATE_ROW_EVENTS,
PRIV_SET_SYSTEM_VAR_BINLOG_ANNOTATE_ROW_EVENTS>
Sys_binlog_annotate_row_events(
"binlog_annotate_row_events",
"Tells the master to annotate RBR events with the statement that "
"caused these events",
SESSION_VAR(binlog_annotate_row_events), CMD_LINE(OPT_ARG),
DEFAULT(TRUE));
#ifdef HAVE_REPLICATION
static Sys_var_mybool Sys_replicate_annotate_row_events(
"replicate_annotate_row_events",
"Tells the slave to write annotate rows events received from the master "
"to its own binary log. Ignored if log_slave_updates is not set",
READ_ONLY GLOBAL_VAR(opt_replicate_annotate_row_events),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
#endif
static Sys_var_ulonglong Sys_join_buffer_space_limit(
"join_buffer_space_limit",
"The limit of the space for all join buffers used by a query",
SESSION_VAR(join_buff_space_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(2048, ULONGLONG_MAX), DEFAULT(16*128*1024),
BLOCK_SIZE(2048));
static Sys_var_ulong Sys_progress_report_time(
"progress_report_time",
"Seconds between sending progress reports to the client for "
"time-consuming statements. Set to 0 to disable progress reporting.",
SESSION_VAR(progress_report_time), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(5), BLOCK_SIZE(1));
const char *use_stat_tables_modes[] =
{"NEVER", "COMPLEMENTARY", "PREFERABLY",
"COMPLEMENTARY_FOR_QUERIES", "PREFERABLY_FOR_QUERIES", 0};
static Sys_var_enum Sys_optimizer_use_stat_tables(
"use_stat_tables",
"Specifies how to use system statistics tables",
SESSION_VAR(use_stat_tables), CMD_LINE(REQUIRED_ARG),
use_stat_tables_modes, DEFAULT(4));
static Sys_var_ulong Sys_histogram_size(
"histogram_size",
"Number of bytes used for a histogram. "
"If set to 0, no histograms are created by ANALYZE.",
SESSION_VAR(histogram_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 255), DEFAULT(254), BLOCK_SIZE(1));
extern const char *histogram_types[];
static Sys_var_enum Sys_histogram_type(
"histogram_type",
"Specifies type of the histograms created by ANALYZE. "
"Possible values are: "
"SINGLE_PREC_HB - single precision height-balanced, "
"DOUBLE_PREC_HB - double precision height-balanced, "
"JSON_HB - height-balanced, stored as JSON.",
SESSION_VAR(histogram_type), CMD_LINE(REQUIRED_ARG),
histogram_types, DEFAULT(1));
static Sys_var_mybool Sys_no_thread_alarm(
"debug_no_thread_alarm",
"Disable system thread alarm calls. Disabling it may be useful "
"in debugging or testing, never do it in production",
READ_ONLY GLOBAL_VAR(my_disable_thr_alarm), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static Sys_var_mybool Sys_query_cache_strip_comments(
"query_cache_strip_comments",
"Strip all comments from a query before storing it "
"in the query cache",
SESSION_VAR(query_cache_strip_comments), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static ulonglong in_transaction(THD *thd)
{
return MY_TEST(thd->in_active_multi_stmt_transaction());
}
static Sys_var_session_special Sys_in_transaction(
"in_transaction", "Whether there is an active transaction",
READ_ONLY sys_var::ONLY_SESSION, NO_CMD_LINE,
VALID_RANGE(0, 1), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), ON_READ(in_transaction));
#ifndef DBUG_OFF
static Sys_var_ulong Sys_debug_binlog_fsync_sleep(
"debug_binlog_fsync_sleep",
"Extra sleep (in microseconds) to add to binlog fsync(), for debugging",
GLOBAL_VAR(opt_binlog_dbug_fsync_sleep),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
#endif
static Sys_var_harows Sys_expensive_subquery_limit(
"expensive_subquery_limit",
"The maximum number of rows a subquery may examine in order to be "
"executed during optimization and used for constant optimization",
SESSION_VAR(expensive_subquery_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, HA_POS_ERROR), DEFAULT(100), BLOCK_SIZE(1));
static Sys_var_mybool Sys_encrypt_tmp_disk_tables(
"encrypt_tmp_disk_tables",
"Encrypt temporary on-disk tables (created as part of query execution)",
GLOBAL_VAR(encrypt_tmp_disk_tables),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_mybool Sys_encrypt_tmp_files(
"encrypt_tmp_files",
"Encrypt temporary files (created for filesort, binary log cache, etc)",
READ_ONLY GLOBAL_VAR(encrypt_tmp_files),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_mybool Sys_binlog_encryption(
"encrypt_binlog", "Encrypt binary logs (including relay logs)",
READ_ONLY GLOBAL_VAR(encrypt_binlog), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static const char *binlog_row_image_names[]= {"MINIMAL", "NOBLOB", "FULL", NullS};
static Sys_var_on_access<Sys_var_enum,
PRIV_SET_SYSTEM_VAR_BINLOG_ROW_IMAGE,
PRIV_SET_SYSTEM_VAR_BINLOG_ROW_IMAGE>
Sys_binlog_row_image(
"binlog_row_image",
"Controls whether rows should be logged in 'FULL', 'NOBLOB' or "
"'MINIMAL' formats. 'FULL', means that all columns in the before "
"and after image are logged. 'NOBLOB', means that mysqld avoids logging "
"blob columns whenever possible (eg, blob column was not changed or "
"is not part of primary key). 'MINIMAL', means that a PK equivalent (PK "
"columns or full row if there is no PK in the table) is logged in the "
"before image, and only changed columns are logged in the after image. "
"(Default: FULL).",
SESSION_VAR(binlog_row_image), CMD_LINE(REQUIRED_ARG),
binlog_row_image_names, DEFAULT(BINLOG_ROW_IMAGE_FULL));
static const char *binlog_row_metadata_names[]= {"NO_LOG", "MINIMAL", "FULL", NullS};
static Sys_var_on_access_global<Sys_var_enum,
PRIV_SET_SYSTEM_GLOBAL_VAR_BINLOG_ROW_METADATA>
Sys_binlog_row_metadata(
"binlog_row_metadata",
"Controls whether metadata is logged using FULL , MINIMAL format and NO_LOG."
"FULL causes all metadata to be logged; MINIMAL means that only "
"metadata actually required by slave is logged; NO_LOG NO metadata will be logged."
"Default: NO_LOG.",
GLOBAL_VAR(binlog_row_metadata), CMD_LINE(REQUIRED_ARG),
binlog_row_metadata_names, DEFAULT(Table_map_log_event::BINLOG_ROW_METADATA_NO_LOG),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
ON_UPDATE(NULL));
static bool check_pseudo_slave_mode(sys_var *self, THD *thd, set_var *var)
{
longlong previous_val= thd->variables.pseudo_slave_mode;
longlong val= (longlong) var->save_result.ulonglong_value;
bool rli_fake= false;
#ifndef EMBEDDED_LIBRARY
rli_fake= thd->rli_fake ? true : false;
#endif
if (rli_fake)
{
if (!val)
{
#ifndef EMBEDDED_LIBRARY
delete thd->rli_fake;
thd->rli_fake= NULL;
delete thd->rgi_fake;
thd->rgi_fake= NULL;
#endif
}
else if (previous_val && val)
goto ineffective;
else if (!previous_val && val)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"'pseudo_slave_mode' is already ON.");
}
else
{
if (!previous_val && !val)
goto ineffective;
else if (previous_val && !val)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"Slave applier execution mode not active, "
"statement ineffective.");
}
goto end;
ineffective:
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"'pseudo_slave_mode' change was ineffective.");
end:
return FALSE;
}
static Sys_var_mybool Sys_pseudo_slave_mode(
"pseudo_slave_mode",
"SET pseudo_slave_mode= 0,1 are commands that mysqlbinlog "
"adds to beginning and end of binary log dumps. While zero "
"value indeed disables, the actual enabling of the slave "
"applier execution mode is done implicitly when a "
"Format_description_event is sent through the session.",
SESSION_ONLY(pseudo_slave_mode), NO_CMD_LINE, DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_pseudo_slave_mode));
static Sys_var_mybool Sys_mysql56_temporal_format(
"mysql56_temporal_format",
"Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, DATETIME, TIMESTAMP columns.",
GLOBAL_VAR(opt_mysql56_temporal_format),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
static Sys_var_mybool Sys_strict_password_validation(
"strict_password_validation",
"When password validation plugins are enabled, reject passwords "
"that cannot be validated (passwords specified as a hash)",
GLOBAL_VAR(strict_password_validation),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
#ifdef HAVE_MMAP
static Sys_var_ulong Sys_log_tc_size(
"log_tc_size",
"Size of transaction coordinator log.",
READ_ONLY GLOBAL_VAR(opt_tc_log_size),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(my_getpagesize() * 3, ULONG_MAX),
DEFAULT(my_getpagesize() * 6), BLOCK_SIZE(my_getpagesize()));
#endif
static Sys_var_ulonglong Sys_max_session_mem_used(
"max_session_mem_used", "Amount of memory a single user session "
"is allowed to allocate. This limits the value of the "
"session variable MEM_USED", SESSION_VAR(max_mem_used),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(8192, ULONGLONG_MAX),
DEFAULT(LONGLONG_MAX), BLOCK_SIZE(1));
#ifndef EMBEDDED_LIBRARY
static Sys_var_sesvartrack Sys_track_session_sys_vars(
"session_track_system_variables",
"Track changes in registered system variables. ",
CMD_LINE(REQUIRED_ARG),
DEFAULT("autocommit,character_set_client,character_set_connection,"
"character_set_results,time_zone"));
static bool update_session_track_schema(sys_var *self, THD *thd,
enum_var_type type)
{
DBUG_ENTER("update_session_track_schema");
DBUG_RETURN(thd->session_tracker.current_schema.update(thd, NULL));
}
static Sys_var_mybool Sys_session_track_schema(
"session_track_schema",
"Track changes to the default schema.",
SESSION_VAR(session_track_schema),
CMD_LINE(OPT_ARG), DEFAULT(TRUE),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0),
ON_UPDATE(update_session_track_schema));
static bool update_session_track_tx_info(sys_var *self, THD *thd,
enum_var_type type)
{
DBUG_ENTER("update_session_track_tx_info");
DBUG_RETURN(thd->session_tracker.transaction_info.update(thd, NULL));
}
static const char *session_track_transaction_info_names[]=
{ "OFF", "STATE", "CHARACTERISTICS", NullS };
static Sys_var_enum Sys_session_track_transaction_info(
"session_track_transaction_info",
"Track changes to the transaction attributes. OFF to disable; "
"STATE to track just transaction state (Is there an active transaction? "
"Does it have any data? etc.); CHARACTERISTICS to track transaction "
"state and report all statements needed to start a transaction with "
"the same characteristics (isolation level, read only/read write,"
"snapshot - but not any work done / data modified within the "
"transaction).",
SESSION_VAR(session_track_transaction_info),
CMD_LINE(REQUIRED_ARG), session_track_transaction_info_names,
DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_session_track_tx_info));
static bool update_session_track_state_change(sys_var *self, THD *thd,
enum_var_type type)
{
DBUG_ENTER("update_session_track_state_change");
DBUG_RETURN(thd->session_tracker.state_change.update(thd, NULL));
}
static Sys_var_mybool Sys_session_track_state_change(
"session_track_state_change",
"Track changes to the session state.",
SESSION_VAR(session_track_state_change),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0),
ON_UPDATE(update_session_track_state_change));
#ifdef USER_VAR_TRACKING
static bool update_session_track_user_variables(sys_var *self, THD *thd,
enum_var_type type)
{
return thd->session_tracker.user_variables.update(thd, 0);
}
static Sys_var_mybool Sys_session_track_user_variables(
"session_track_user_variables",
"Track changes to user variables.",
SESSION_VAR(session_track_user_variables),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0),
ON_UPDATE(update_session_track_user_variables));
#endif // USER_VAR_TRACKING
#endif //EMBEDDED_LIBRARY
static Sys_var_uint Sys_in_subquery_conversion_threshold(
"in_predicate_conversion_threshold",
"The minimum number of scalar elements in the value list of "
"IN predicate that triggers its conversion to IN subquery. Set to "
"0 to disable the conversion.",
SESSION_VAR(in_subquery_conversion_threshold), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(IN_SUBQUERY_CONVERSION_THRESHOLD), BLOCK_SIZE(1));
static Sys_var_ulong Sys_optimizer_max_sel_arg_weight(
"optimizer_max_sel_arg_weight",
"The maximum weight of the SEL_ARG graph. Set to 0 for no limit",
SESSION_VAR(optimizer_max_sel_arg_weight), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(SEL_ARG::MAX_WEIGHT), BLOCK_SIZE(1));
static Sys_var_ulong Sys_optimizer_max_sel_args(
"optimizer_max_sel_args",
"The maximum number of SEL_ARG objects created when optimizing a range. "
"If more objects would be needed, the range will not be used by the "
"optimizer.",
SESSION_VAR(optimizer_max_sel_args), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(SEL_ARG::DEFAULT_MAX_SEL_ARGS), BLOCK_SIZE(1));
static Sys_var_enum Sys_secure_timestamp(
"secure_timestamp", "Restricts direct setting of a session "
"timestamp. Possible levels are: YES - timestamp cannot deviate from "
"the system clock, REPLICATION - replication thread can adjust "
"timestamp to match the master's, SUPER - a user with this "
"privilege and a replication thread can adjust timestamp, NO - "
"historical behavior, anyone can modify session timestamp",
READ_ONLY GLOBAL_VAR(opt_secure_timestamp), CMD_LINE(REQUIRED_ARG),
secure_timestamp_levels, DEFAULT(SECTIME_NO));
static Sys_var_ulonglong Sys_max_rowid_filter_size(
"max_rowid_filter_size",
"The maximum size of the container of a rowid filter",
SESSION_VAR(max_rowid_filter_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, (ulonglong)~(intptr)0), DEFAULT(128*1024),
BLOCK_SIZE(1));
static Sys_var_bit Sys_system_versioning_insert_history(
"system_versioning_insert_history",
"Allows direct inserts into ROW_START and ROW_END columns if "
"secure_timestamp allows changing @@timestamp",
SESSION_VAR(option_bits), CMD_LINE(OPT_ARG),
OPTION_INSERT_HISTORY, DEFAULT(FALSE),
NO_MUTEX_GUARD, IN_BINLOG);
|