forked from polardb/polardbx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
886 lines (830 loc) · 31.7 KB
/
Makefile
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
BUILD_DIR = $(shell pwd)/build
CN_CONF = $(BUILD_DIR)/run/polardbx-sql/conf/server.properties
DN_BASE_DIR = $(BUILD_DIR)/run/polardbx-engine
DN_DATA_DIR = $(DN_BASE_DIR)/data
DN_CONF = $(DN_DATA_DIR)/my.cnf
CDC_CONF = $(BUILD_DIR)/run/polardbx-cdc/polardbx-binlog.standalone/conf/config.properties
CN_STARTUP = $(BUILD_DIR)/run/polardbx-sql/bin/startup.sh
CDC_STARTUP = $(BUILD_DIR)/run/polardbx-cdc/polardbx-binlog.standalone/bin/start.sh
UNAME_S = $(shell uname -s)
OS = $(shell lsb_release -si)
V = $(shell lsb_release -r | awk '{print $$2}'|awk -F"." '{print $$1}')
CPU_CORES = $(shell cat /proc/cpuinfo | grep processor| wc -l)
CFLAGS = -O3 -g -fexceptions -static-libgcc -static-libstdc++ -fno-omit-frame-pointer -fno-strict-aliasing
CXXFLAGS = -O3 -g -fexceptions -static-libgcc -static-libstdc++ -fno-omit-frame-pointer -fno-strict-aliasing
WITH_JEMALLOC = yes
ARCH := $(shell uname -m)
ifeq ($(ARCH), aarch64)
CFLAGS = -O3 -g -fexceptions -fno-strict-aliasing -Wl,-Bsymbolic
CXXFLAGS = -O3 -g -fexceptions -fno-strict-aliasing -Wl,-Bsymbolic
WITH_JEMALLOC = no
endif
CC=gcc
CXX=g++
export CFLAGS
export CXXFLAGS
export CC
export CXX
.PHONY: polardb-x
polardb-x: gms dn cn cdc configs
cd $(BUILD_DIR)/run ; \
if [ -d "bin" ]; then \
rm -rf bin; \
fi; \
mkdir bin; \
echo "$$START_SCRIPT" > bin/polardb-x.sh; \
chmod +x bin/polardb-x.sh
chmod +x $(BUILD_DIR)/run/polardbx-sql/bin/startup.sh
chmod +x $(BUILD_DIR)/run/polardbx-cdc/polardbx-binlog.standalone/bin/daemon.sh
.PHONY: gms
gms: sources deps
. /etc/profile; \
cd $(BUILD_DIR)/polardbx-engine && cat extra/boost/boost_1_77_0.tar.bz2.* > extra/boost/boost_1_77_0.tar.bz2; \
cmake . \
-DFORCE_INSOURCE_BUILD=ON \
-DSYSCONFDIR:PATH="$(BUILD_DIR)/run/polardbx-engine/u01/mysql" \
-DCMAKE_INSTALL_PREFIX:PATH="$(BUILD_DIR)/run/polardbx-engine/u01/mysql" \
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
-DWITH_JEMALLOC="$(WITH_JEMALLOC)" \
-DWITH_PROTOBUF:STRING=bundled \
-DINSTALL_LAYOUT=STANDALONE \
-DMYSQL_MAINTAINER_MODE=0 \
-DWITH_SSL=openssl \
-DWITH_ZLIB=bundled \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_CSV_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_EXAMPLE_STORAGE_ENGINE=0 \
-DWITH_TEMPTABLE_STORAGE_ENGINE=1 \
-DUSE_CTAGS=0 \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_DEBUG=0 \
-DENABLE_DEBUG_SYNC=0 \
-DENABLE_DTRACE=0 \
-DENABLED_PROFILING=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_BOOST="./extra/boost/boost_1_77_0.tar.bz2" \
-DPOLARDBX_RELEASE_DATE="20241111" \
-DPOLARDBX_ENGINE_VERSION="8.4.19" \
-DPOLARDBX_VERSION_EXTRA="X-Cluster" \
-DWITH_TESTS=0 \
-DWITH_UNIT_TESTS=0; \
make -j $(CPU_CORES) install
rm -rf $(BUILD_DIR)/run/polardbx-engine/u01/mysql/mysql-test
.PHONY: dn
dn: gms
.PHONY: cdc
cdc: sources deps cn
. /etc/profile; \
cd $(BUILD_DIR)/polardbx-cdc; \
mvn clean; \
mvn -U clean install -Dmaven.test.skip=true -DfailIfNoTests=false -e -P release; \
mkdir $(BUILD_DIR)/run/polardbx-cdc; \
cp polardbx-cdc-assemble/target/polardbx-binlog.tar.gz $(BUILD_DIR)/run/polardbx-cdc/; \
cd $(BUILD_DIR)/run/polardbx-cdc/; \
tar xzvf polardbx-binlog.tar.gz; \
rm -f polardbx-binlog.tar.gz
.PHONY: cn
cn: sources deps
. /etc/profile; \
cd $(BUILD_DIR)/polardbx-sql; \
mvn install -DskipTests -D env=release; \
mkdir $(BUILD_DIR)/run/polardbx-sql; \
cp target/polardbx-server-*.tar.gz $(BUILD_DIR)/run/polardbx-sql/; \
cd $(BUILD_DIR)/run/polardbx-sql; \
tar xzvf polardbx-server-*.tar.gz; \
rm -f xzvf polardbx-server-*.tar.gz
.PHONY: configs
configs: gms dn cdc cn
# config gms & dn
mkdir -p $(DN_DATA_DIR)
echo "$$MY_CNF" > $(DN_CONF)
mkdir -p $(DN_DATA_DIR)/data
mkdir -p $(DN_DATA_DIR)/log
touch $(DN_DATA_DIR)/log/mysqld_safe.err
mkdir -p $(DN_DATA_DIR)/run
mkdir -p $(DN_DATA_DIR)/tmp
mkdir -p $(DN_DATA_DIR)/mysql
# start gms
if [ -e "$(DN_DATA_DIR)/data/auto.cnf" ]; then \
echo "gms root account already initialized."; \
else \
$(BUILD_DIR)/run/polardbx-engine/u01/mysql/bin/mysqld --defaults-file=$(DN_CONF) --initialize-insecure; \
fi ; \
$(BUILD_DIR)/run/polardbx-engine/u01/mysql/bin/mysqld --defaults-file=$(DN_CONF) -D
# config cn
awk -F"=" '/^serverPort/{$$2="=8527";print;next}1' $(CN_CONF) > tmp && mv tmp $(CN_CONF)
awk -F"=" '/^metaDbAddr/{$$2="=127.0.0.1:4886";print;next}1' $(CN_CONF) > tmp && mv tmp $(CN_CONF)
awk -F"=" '/^metaDbXprotoPort/{$$2="=34886";print;next}1' $(CN_CONF) > tmp && mv tmp $(CN_CONF)
awk -F"=" '/^galaxyXProtocol/{$$2="=2";print;next}1' $(CN_CONF) > tmp && mv tmp $(CN_CONF)
cd $(BUILD_DIR)/run/polardbx-sql/; \
META=`bin/startup.sh -I -P asdf1234ghjk5678 -d 127.0.0.1:4886:34886 -u polardbx_root -S "123456" 2>&1`; \
echo "meta: $${META}"; \
echo "$${META}" | grep "metaDbPass" >> meta.tmp; \
META_DB_PASS=`cat meta.tmp | grep "metaDbPass"`; \
echo "metadb password: $${META_DB_PASS}"; \
ps aux|grep "$(BUILD_DIR)/run/polardbx-engine/u01/mysql/bin/mysqld" | grep -v "grep" | awk '{print $$2}' |xargs kill -9; \
if [ "" = "$${META_DB_PASS}" ]; then \
echo "meta db init failed."; \
exit 1; \
fi; \
cat meta.tmp >> $(CN_CONF)
# config cdc
cd $(BUILD_DIR)/run/polardbx-sql/; \
META_DB_PASS=`cat meta.tmp | awk -F"=" '{print $$2}'`; \
awk -F"=" '/^useEncryptedPassword/{$$2="=true";print;next}1' $(CDC_CONF) > tmp && mv tmp $(CDC_CONF); \
awk -F"=" '/^polardbx.instance.id/{$$2="=polardbx-polardbx";print;next}1' $(CDC_CONF) > tmp && mv tmp $(CDC_CONF); \
awk -F"=" '/^metaDb_url/{$$2="=jdbc:mysql://127.0.0.1:4886/polardbx_meta_db_polardbx?useSSL=false";print;next}1' $(CDC_CONF) > tmp && mv tmp $(CDC_CONF); \
awk -F"=" '/^metaDb_username/{$$2="=my_polarx";print;next}1' $(CDC_CONF) > tmp && mv tmp $(CDC_CONF); \
sed 's/metaDb_password.*//g' $(CDC_CONF) > tmp && mv tmp $(CDC_CONF); \
cat meta.tmp >> $(CDC_CONF); \
sed 's/metaDbPasswd/metaDb_password/g' $(CDC_CONF) > tmp && mv tmp $(CDC_CONF); \
awk -F"=" '/^polarx_url/{$$2="=jdbc:mysql://127.0.0.1:8527/__cdc__";print;next}1' $(CDC_CONF) > tmp && mv tmp $(CDC_CONF); \
awk -F"=" '/^polarx_username/{$$2="=polardbx_root";print;next}1' $(CDC_CONF) > tmp && mv tmp $(CDC_CONF); \
awk -F"=" '/^polarx_password/{$$2="=UY1tQsgNvP8GJGGP8vHKKA==";print;next}1' $(CDC_CONF) > tmp && mv tmp $(CDC_CONF); \
sed -i 's/admin/polarx/g' $(CDC_CONF); \
echo dnPasswordKey=asdf1234ghjk5678 >> $(CDC_CONF); \
echo cluster_id=cluster_1 >> $(CDC_CONF); \
echo ins_id=1001 >> $(CDC_CONF); \
echo ins_ip=127.0.0.1 >> $(CDC_CONF); \
echo daemon_port=3007 >> $(CDC_CONF); \
echo ssh_port=3008 >> $(CDC_CONF); \
echo common_ports='{"cdc1_port":"3009","cdc3_port":"3011","cdc2_port":"3010","cdc6_port":"3014","cdc5_port":"3013","cdc4_port":"3012"}' >> $(CDC_CONF); \
echo t-polardbx-cdc-5.4.19-20241111_1234567.noarch.rpm > $(BUILD_DIR)/../../releaseNote; \
rm meta.tmp
.PHONY: sources
sources: deps
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR); \
if [ -d "polardbx-sql" ]; then \
echo "polardbx-sql exsits."; \
else \
git clone https://github.com/polardb/polardbx-sql.git; \
cd polardbx-sql; \
git submodule update --init; \
fi
cd $(BUILD_DIR); \
if [ -d "polardbx-engine" ]; then \
echo "polardbx-engine exists."; \
else \
git clone https://github.com/polardb/polardbx-engine.git; \
cd polardbx-engine; \
wget https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.gz; \
mkdir -p extra/boost; \
cp boost_1_70_0.tar.gz extra/boost/; \
if [ "$(UNAME_S)" = "Darwin" ]; then \
echo "$${VERSION_PATCH}" >> macos.patch; \
git apply macos.patch; \
rm macos.patch; \
fi ; \
fi
cd $(BUILD_DIR); \
if [ -d "polardbx-cdc" ]; then \
echo "polardbx-cdc exists."; \
else \
git clone https://github.com/polardb/polardbx-cdc.git; \
fi
.PHONY: deps
deps:
ifeq ($(UNAME_S), Darwin)
@echo "Install the following tools and libraries before your building.\n"
@echo "tools : cmake3, make, automake, gcc, g++, bison, git, jdk11+, maven3"
@echo "libraries : openssl1.1 \n\n"
@echo "Press any key to continue..."
@read -n 1
else
ifeq ($(OS), CentOS)
# sudo yum remove -y cmake
# sudo yum install -y epel-release
# sudo yum install -y wget java-11-openjdk-devel cmake3 automake bison openssl-devel ncurses-devel libaio-devel mysql snappy-devel lz4-devel bzip2-devel autoconf libstdc++-static libarchive
ifeq ($(V), 8)
sudo yum install -y libtirpc-devel dnf-plugins-core
sudo yum config-manager --set-enabled PowerTools
sudo yum install -y rpcgen
sudo yum groupinstall -y "Development Tools"
sudo yum install -y gcc gcc-c++
endif
ifeq ($(V), 7)
if [ -e "/usr/bin/cmake" ]; then \
sudo rm /usr/bin/cmake -f ; \
fi
sudo ln -s /usr/bin/cmake3 /usr/bin/cmake
# sudo yum install -y centos-release-scl
# sudo yum install -y devtoolset-10
if ! grep "source /opt/rh/devtoolset-10/enable" /etc/profile; then \
echo "source /opt/rh/devtoolset-10/enable" | sudo tee -a /etc/profile ; \
fi
endif
endif
ifneq ($(filter $(OS), Ubuntu CentOS),)
if [ ! -d /opt/apache-maven-3.9.5 ]; then \
sudo wget https://mirrors.aliyun.com/apache/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz -P /tmp && \
sudo tar xf /tmp/apache-maven-3.9.5-bin.tar.gz -C /opt && \
sudo rm -f /tmp/apache-maven-3.9.5-bin.tar.gz && \
sudo ln -fs /opt/apache-maven-3.9.5 /opt/maven && \
echo 'export M2_HOME=/opt/maven' | sudo tee /etc/profile.d/maven.sh && \
echo 'export PATH=$${M2_HOME}/bin:$${PATH}' | sudo tee -a /etc/profile.d/maven.sh && \
sudo chmod +x /etc/profile.d/maven.sh && \
echo '<mirror>' | sudo tee /opt/maven/conf/settings.xml && \
echo '<id>aliyunmaven</id>' | sudo tee -a /opt/maven/conf/settings.xml && \
echo '<mirrorOf>*</mirrorOf>' | sudo tee -a /opt/maven/conf/settings.xml && \
echo '<name>aliyun public</name>' | sudo tee -a /opt/maven/conf/settings.xml && \
echo '<url>https://maven.aliyun.com/repository/public</url>' | sudo tee -a /opt/maven/conf/settings.xml && \
echo '</mirror>' | sudo tee -a /opt/maven/conf/settings.xml; \
fi
if ! grep "source /etc/profile.d/maven.sh" /etc/profile; then \
echo "source /etc/profile.d/maven.sh" | sudo tee -a /etc/profile ; \
fi
endif
ifeq ($(OS), Ubuntu)
sudo apt-get update
sudo apt-get install -y git openjdk-8-jdk make automake cmake bison pkg-config libaio-dev libncurses5-dev \
libsasl2-dev libldap2-dev libssl-dev gcc-7 g++-7 mysql-client
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives --config gcc
endif
endif
clean:
rm -rf $(BUILD_DIR)/run
cleanAll:
rm -rf $(BUILD_DIR)
# long variables
define START_SCRIPT
#!/bin/bash
PROG_NAME=$$0
ACTION=$$1
usage() {
echo "Usage: $${PROG_NAME} [start | restart | stop]"
exit 1;
}
if [ $$# -lt 1 ]; then
usage
fi
if [ x"$$mem_size" = "x" ]; then
export mem_size=4096
fi
if [ x"$$disk_size" = "x" ]; then
export disk_size=10240
fi
buffer_pool_size_byte=$$(echo "scale=0; $$mem_size*1024*1024*0.3/1" | bc)
awk -v size=$$buffer_pool_size_byte -F"=" '/^innodb_buffer_pool_size/{$$2="="size;print;next}1' $(DN_CONF) > tmp && mv tmp $(DN_CONF)
cpu_cores=`cat /proc/cpuinfo | grep processor| wc -l`
echo cpu_cores=$$cpu_cores >> $(CDC_CONF)
echo mem_size=$$mem_size >> $(CDC_CONF)
echo disk_size=$$disk_size >> $(CDC_CONF)
retry() {
retry_interval=5
retry_cnt=0
retry_limit=100
succeed=0
while [ $${retry_cnt} -lt $${retry_limit} ]; do
if [[ $$1 ]]; then
succeed=1
return 0
fi
echo "Fail to $$1, retry..."
((retry_cnt++))
sleep "$${retry_interval}"
done
if [ $${succeed} -eq 0 ]; then
echo "$$1 failed."
return 1
fi
return 0
}
start() {
start_dn
sleep 30
start_cn
echo "start cdc..."
$(BUILD_DIR)/run/polardbx-cdc/polardbx-binlog.standalone/bin/daemon.sh start
echo "cdc starts."
if ! retry "mysql -h127.1 -P8527 -upolardbx_root -e 'SELECT 1'"; then
echo "cn starts failed."
exit 1
fi
echo "try polardb-x by:"
echo "mysql -h127.1 -P8527 -upolardbx_root"
}
start_dn() {
echo "start gms & dn..."
($(BUILD_DIR)/run/polardbx-engine/u01/mysql/bin/mysqld_safe --defaults-file=$(DN_CONF) --log-error=$(DN_DATA_DIR)/log/mysqld_safe.err &)
if ! retry "mysql -h127.1 -P4886 -uroot -e 'create table if not exists polardbx_meta_db_polardbx.__test_avaliable__(id int)'"; then
echo "gms and dn start failed."
exit 1
fi
echo "gms and dn are running."
mysql -h127.1 -P4886 -uroot -e 'drop table if exists polardbx_meta_db_polardbx.__test_avaliable__'
}
start_cn() {
echo "start cn..."
$(BUILD_DIR)/run/polardbx-sql/bin/startup.sh -P asdf1234ghjk5678
echo "cn starts."
}
stop() {
echo "stop cdc..."
ps aux | grep "DaemonBootStrap" | grep -v "grep" | awk '{print $$2}'| xargs kill -9 > /dev/null 2>&1
ps aux | grep "TaskBootStrap" | grep -v "grep" | awk '{print $$2}'| xargs kill -9 > /dev/null 2>&1
ps aux | grep "DumperBootStrap" | grep -v "grep" | awk '{print $$2}'| xargs kill -9 > /dev/null 2>&1
echo "cdc is stopped."
echo "stop cn..."
ps aux | grep "TddlLauncher" | grep -v "grep" | awk '{print $$2}' | xargs kill -9 > /dev/null 2>&1
if [ -f "$(BUILD_DIR)/run/polardbx-sql/bin/tddl.pid" ]; then
rm $(BUILD_DIR)/run/polardbx-sql/bin/tddl.pid
fi
echo "cn is stopped."
echo "stop dn & gms..."
ps aux | grep "$(BUILD_DIR)/run/polardbx-engine/u01/mysql/bin/mysqld_safe" | grep -v "grep" | awk '{print $$2}'| xargs kill -15
ps aux | grep "$(BUILD_DIR)/run/polardbx-engine/u01/mysql/bin/mysqld" | grep -v "grep" | awk '{print $$2}'| xargs kill -15
sleep 10
ps aux | grep "$(BUILD_DIR)/run/polardbx-engine/u01/mysql/bin/mysqld_safe" | grep -v "grep" | awk '{print $$2}'| xargs kill -9
ps aux | grep "$(BUILD_DIR)/run/polardbx-engine/u01/mysql/bin/mysqld" | grep -v "grep" | awk '{print $$2}'| xargs kill -9
echo "dn & gms are stopped."
}
case "$${ACTION}" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 1
start
;;
start_dn)
start_dn
;;
*)
usage
;;
esac
endef
export START_SCRIPT
define MY_CNF
[mysqld]
auto_increment_increment = 1
auto_increment_offset = 1
autocommit = ON
automatic_sp_privileges = ON
avoid_temporal_upgrade = OFF
back_log = 3000
binlog_cache_size = 1048576
binlog_checksum = CRC32
binlog_order_commits = OFF
binlog_row_image = full
binlog_rows_query_log_events = ON
binlog_stmt_cache_size = 32768
binlog_transaction_dependency_tracking = WRITESET
block_encryption_mode = "aes-128-ecb"
bulk_insert_buffer_size = 4194304
character_set_server = utf8
concurrent_insert = 2
connect_timeout = 10
datadir = $(DN_DATA_DIR)/data
default_authentication_plugin = mysql_native_password
default_storage_engine = InnoDB
default_time_zone = +8:00
default_week_format = 0
delay_key_write = ON
delayed_insert_limit = 100
delayed_insert_timeout = 300
delayed_queue_size = 1000
disconnect_on_expired_password = ON
div_precision_increment = 4
end_markers_in_json = OFF
enforce_gtid_consistency = ON
eq_range_index_dive_limit = 200
event_scheduler = OFF
expire_logs_days = 0
explicit_defaults_for_timestamp = OFF
flush_time = 0
ft_max_word_len = 84
ft_min_word_len = 4
ft_query_expansion_limit = 20
general_log = OFF
general_log_file = $(DN_DATA_DIR)/log/general.log
group_concat_max_len = 1024
gtid_mode = ON
host_cache_size = 644
init_connect = ''
innodb_adaptive_flushing = ON
innodb_adaptive_flushing_lwm = 10
innodb_adaptive_hash_index = OFF
innodb_adaptive_max_sleep_delay = 150000
innodb_autoextend_increment = 64
innodb_autoinc_lock_mode = 2
innodb_buffer_pool_chunk_size = 33554432
innodb_buffer_pool_dump_at_shutdown = ON
innodb_buffer_pool_dump_pct = 25
innodb_buffer_pool_instances = 8
innodb_buffer_pool_load_at_startup = ON
innodb_change_buffer_max_size = 25
innodb_change_buffering = none
innodb_checksum_algorithm = crc32
innodb_cmp_per_index_enabled = OFF
innodb_commit_concurrency = 0
innodb_compression_failure_threshold_pct = 5
innodb_compression_level = 6
innodb_compression_pad_pct_max = 50
innodb_concurrency_tickets = 5000
innodb_data_file_purge = ON
innodb_data_file_purge_interval = 100
innodb_data_file_purge_max_size = 128
innodb_data_home_dir = $(DN_DATA_DIR)/mysql
innodb_deadlock_detect = ON
innodb_disable_sort_file_cache = ON
innodb_flush_log_at_trx_commit = 1
innodb_flush_method = O_DIRECT
innodb_flush_neighbors = 0
innodb_flush_sync = ON
innodb_ft_cache_size = 8000000
innodb_ft_enable_diag_print = OFF
innodb_ft_enable_stopword = ON
innodb_ft_max_token_size = 84
innodb_ft_min_token_size = 3
innodb_ft_num_word_optimize = 2000
innodb_ft_result_cache_limit = 2000000000
innodb_ft_sort_pll_degree = 2
innodb_ft_total_cache_size = 640000000
innodb_io_capacity = 20000
innodb_io_capacity_max = 40000
innodb_lock_wait_timeout = 50
innodb_log_buffer_size = 16777216
innodb_log_checksums = ON
innodb_log_file_size = 134217728
innodb_log_group_home_dir = $(DN_DATA_DIR)/mysql
innodb_lru_scan_depth = 8192
innodb_max_dirty_pages_pct = 75
innodb_max_dirty_pages_pct_lwm = 0
innodb_max_purge_lag = 0
innodb_max_purge_lag_delay = 0
innodb_max_undo_log_size = 1073741824
innodb_monitor_disable =
innodb_monitor_enable =
innodb_old_blocks_pct = 37
innodb_old_blocks_time = 1000
innodb_online_alter_log_max_size = 134217728
innodb_open_files = 20000
innodb_optimize_fulltext_only = OFF
innodb_page_cleaners = 4
innodb_print_all_deadlocks = ON
innodb_purge_batch_size = 300
innodb_purge_rseg_truncate_frequency = 128
innodb_purge_threads = 4
innodb_random_read_ahead = OFF
innodb_read_ahead_threshold = 0
innodb_read_io_threads = 4
innodb_rollback_on_timeout = OFF
innodb_rollback_segments = 128
innodb_sort_buffer_size = 1048576
innodb_spin_wait_delay = 6
innodb_stats_auto_recalc = ON
innodb_stats_method = nulls_equal
innodb_stats_on_metadata = OFF
innodb_stats_persistent = ON
innodb_stats_persistent_sample_pages = 20
innodb_stats_transient_sample_pages = 8
innodb_status_output = OFF
innodb_status_output_locks = OFF
innodb_strict_mode = ON
innodb_sync_array_size = 16
innodb_sync_spin_loops = 30
innodb_table_locks = ON
innodb_tcn_cache_level = block
innodb_thread_concurrency = 0
innodb_thread_sleep_delay = 0
innodb_write_io_threads = 4
interactive_timeout = 7200
key_buffer_size = 16777216
key_cache_age_threshold = 300
key_cache_block_size = 1024
key_cache_division_limit = 100
lc_time_names = en_US
local_infile = OFF
lock_wait_timeout = 1800
log-bin-index = $(DN_DATA_DIR)/mysql/mysql-bin.index
log_bin = $(DN_DATA_DIR)/mysql/mysql-bin.log
log_bin_trust_function_creators = ON
log_bin_use_v1_row_events = 0
log_error = $(DN_DATA_DIR)/log/alert.log
log_error_verbosity = 2
log_queries_not_using_indexes = OFF
log_slave_updates = 0
log_slow_admin_statements = ON
log_slow_slave_statements = ON
log_throttle_queries_not_using_indexes = 0
long_query_time = 1
loose_ccl_max_waiting_count = 0
loose_ccl_queue_bucket_count = 4
loose_ccl_queue_bucket_size = 64
loose_ccl_wait_timeout = 86400
loose_cluster-id = 1234
loose_cluster-info = 127.0.0.1:14886@1
loose_consensus_auto_leader_transfer = ON
loose_consensus_auto_reset_match_index = ON
loose_consensus_election_timeout = 10000
loose_consensus_io_thread_cnt = 8
loose_consensus_large_trx = ON
loose_consensus_log_cache_size = 536870912
loose_consensus_max_delay_index = 10000
loose_consensus_max_log_size = 20971520
loose_consensus_max_packet_size = 131072
loose_consensus_prefetch_cache_size = 268435456
loose_consensus_worker_thread_cnt = 8
loose_implicit_primary_key = 1
loose_information_schema_stats_expiry = 86400
loose_innodb_buffer_pool_in_core_file = OFF
loose_innodb_commit_cleanout_max_rows = 9999999999
loose_innodb_doublewrite_pages = 64
loose_innodb_lizard_stat_enabled = OFF
loose_innodb_log_compressed_pages = ON
loose_innodb_log_write_ahead_size = 4096
loose_innodb_parallel_read_threads = 1
loose_innodb_undo_retention = 1800
loose_innodb_undo_space_reserved_size = 1024
loose_innodb_undo_space_supremum_size = 102400
loose_internal_tmp_mem_storage_engine = TempTable
loose_new_rpc = ON
loose_optimizer_switch = index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
loose_optimizer_trace = enabled=off,one_line=off
loose_optimizer_trace_features = greedy_search=on,range_optimizer=on,dynamic_range=on,repeated_subselect=on
loose_performance-schema_instrument = 'wait/lock/metadata/sql/mdl=ON'
loose_performance_point_lock_rwlock_enabled = ON
loose_performance_schema-instrument = 'memory/%%=COUNTED'
loose_performance_schema_accounts_size = 10000
loose_performance_schema_consumer_events_stages_current = ON
loose_performance_schema_consumer_events_stages_history = ON
loose_performance_schema_consumer_events_stages_history_long = ON
loose_performance_schema_consumer_events_statements_current = OFF
loose_performance_schema_consumer_events_statements_history = OFF
loose_performance_schema_consumer_events_statements_history_long = OFF
loose_performance_schema_consumer_events_transactions_current = OFF
loose_performance_schema_consumer_events_transactions_history = OFF
loose_performance_schema_consumer_events_transactions_history_long = OFF
loose_performance_schema_consumer_events_waits_current = OFF
loose_performance_schema_consumer_events_waits_history = OFF
loose_performance_schema_consumer_events_waits_history_long = OFF
loose_performance_schema_consumer_global_instrumentation = OFF
loose_performance_schema_consumer_statements_digest = OFF
loose_performance_schema_consumer_thread_instrumentation = OFF
loose_performance_schema_digests_size = 10000
loose_performance_schema_error_size = 0
loose_performance_schema_events_stages_history_long_size = 0
loose_performance_schema_events_stages_history_size = 0
loose_performance_schema_events_statements_history_long_size = 0
loose_performance_schema_events_statements_history_size = 0
loose_performance_schema_events_transactions_history_long_size = 0
loose_performance_schema_events_transactions_history_size = 0
loose_performance_schema_events_waits_history_long_size = 0
loose_performance_schema_events_waits_history_size = 0
loose_performance_schema_hosts_size = 10000
loose_performance_schema_instrument = '%%=OFF'
loose_performance_schema_max_cond_classes = 0
loose_performance_schema_max_cond_instances = 10000
loose_performance_schema_max_digest_length = 0
loose_performance_schema_max_digest_sample_age = 0
loose_performance_schema_max_file_classes = 0
loose_performance_schema_max_file_handles = 0
loose_performance_schema_max_file_instances = 1000
loose_performance_schema_max_index_stat = 10000
loose_performance_schema_max_memory_classes = 0
loose_performance_schema_max_metadata_locks = 10000
loose_performance_schema_max_mutex_classes = 0
loose_performance_schema_max_mutex_instances = 10000
loose_performance_schema_max_prepared_statements_instances = 1000
loose_performance_schema_max_program_instances = 10000
loose_performance_schema_max_rwlock_classes = 0
loose_performance_schema_max_rwlock_instances = 10000
loose_performance_schema_max_socket_classes = 0
loose_performance_schema_max_socket_instances = 1000
loose_performance_schema_max_sql_text_length = 0
loose_performance_schema_max_stage_classes = 0
loose_performance_schema_max_statement_classes = 0
loose_performance_schema_max_statement_stack = 1
loose_performance_schema_max_table_handles = 10000
loose_performance_schema_max_table_instances = 1000
loose_performance_schema_max_table_lock_stat = 10000
loose_performance_schema_max_thread_classes = 0
loose_performance_schema_max_thread_instances = 10000
loose_performance_schema_session_connect_attrs_size = 0
loose_performance_schema_setup_actors_size = 10000
loose_performance_schema_setup_objects_size = 10000
loose_performance_schema_users_size = 10000
loose_rds_audit_log_buffer_size = 16777216
loose_rds_audit_log_enabled = OFF
loose_rds_audit_log_event_buffer_size = 8192
loose_rds_audit_log_row_limit = 100000
loose_rds_audit_log_version = MYSQL_V1
loose_replica_read_timeout = 3000
loose_rpc_port = 34886
loose_session_track_system_variables = "*"
loose_session_track_transaction_info = OFF
loose_slave_parallel_workers = 32
low_priority_updates = 0
lower_case_table_names = 1
master_info_file = $(DN_DATA_DIR)/mysql/master.info
master_info_repository = TABLE
master_verify_checksum = OFF
max_allowed_packet = 1073741824
max_binlog_cache_size = 18446744073709551615
max_binlog_stmt_cache_size = 18446744073709551615
max_connect_errors = 65536
max_connections = 5532
max_error_count = 1024
max_execution_time = 0
max_heap_table_size = 67108864
max_join_size = 18446744073709551615
max_length_for_sort_data = 4096
max_points_in_geometry = 65536
max_prepared_stmt_count = 16382
max_seeks_for_key = 18446744073709551615
max_sort_length = 1024
max_sp_recursion_depth = 0
max_user_connections = 5000
max_write_lock_count = 102400
min_examined_row_limit = 0
myisam_sort_buffer_size = 262144
mysql_native_password_proxy_users = OFF
net_buffer_length = 16384
net_read_timeout = 30
net_retry_count = 10
net_write_timeout = 60
ngram_token_size = 2
open_files_limit = 65535
opt_indexstat = ON
opt_tablestat = ON
optimizer_prune_level = 1
optimizer_search_depth = 62
optimizer_trace_limit = 1
optimizer_trace_max_mem_size = 1048576
optimizer_trace_offset = -1
performance_schema = ON
port = 4886
preload_buffer_size = 32768
query_alloc_block_size = 8192
query_prealloc_size = 8192
range_alloc_block_size = 4096
range_optimizer_max_mem_size = 8388608
read_rnd_buffer_size = 442368
relay_log = $(DN_DATA_DIR)/mysql/slave-relay.log
relay_log_index = $(DN_DATA_DIR)/mysql/slave-relay-log.index
relay_log_info_file = $(DN_DATA_DIR)/mysql/slave-relay-log.info
relay_log_info_repository = TABLE
relay_log_purge = OFF
relay_log_recovery = OFF
replicate_same_server_id = OFF
loose_rotate_log_table_last_name =
server_id = 1234
session_track_gtids = OFF
session_track_schema = ON
session_track_state_change = OFF
sha256_password_proxy_users = OFF
show_old_temporals = OFF
skip_slave_start = OFF
slave_exec_mode = strict
slave_load_tmpdir = $(DN_DATA_DIR)/tmp
slave_net_timeout = 4
slave_parallel_type = LOGICAL_CLOCK
slave_pending_jobs_size_max = 1073741824
slave_sql_verify_checksum = OFF
slave_type_conversions =
slow_launch_time = 2
slow_query_log = OFF
slow_query_log_file = $(DN_DATA_DIR)/mysql/slow_query.log
socket = $(DN_DATA_DIR)/run/mysql.sock
sort_buffer_size = 868352
sql_mode = NO_ENGINE_SUBSTITUTION
stored_program_cache = 256
sync_binlog = 1
sync_master_info = 10000
sync_relay_log = 1
sync_relay_log_info = 10000
table_open_cache_instances = 16
temptable_max_ram = 1073741824
thread_cache_size = 100
thread_stack = 262144
tls_version = TLSv1.2,TLSv1.3
tmp_table_size = 2097152
tmpdir = $(DN_DATA_DIR)/tmp
transaction_alloc_block_size = 8192
transaction_isolation = REPEATABLE-READ
transaction_prealloc_size = 4096
transaction_write_set_extraction = XXHASH64
updatable_views_with_limit = YES
wait_timeout = 28800
innodb_buffer_pool_size = 644245094
loose_optimizer_switch=index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on,skip_scan=off
xa_detach_on_prepare = OFF
[mysqld_safe]
pid_file = $(DN_DATA_DIR)/run/mysql.pid
endef
export MY_CNF
define VERSION_PATCH
diff --git a/VERSION b/MYSQL_VERSION
similarity index 100%
rename from VERSION
rename to MYSQL_VERSION
diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake
index bed6e9f0..b76b7ba4 100644
--- a/cmake/mysql_version.cmake
+++ b/cmake/mysql_version.cmake
@@ -28,17 +28,17 @@ SET(SHARED_LIB_MAJOR_VERSION "21")
SET(SHARED_LIB_MINOR_VERSION "1")
SET(PROTOCOL_VERSION "10")
-# Generate "something" to trigger cmake rerun when VERSION changes
+# Generate "something" to trigger cmake rerun when MYSQL_VERSION changes
CONFIGURE_FILE(
- $${CMAKE_SOURCE_DIR}/VERSION
+ $${CMAKE_SOURCE_DIR}/MYSQL_VERSION
$${CMAKE_BINARY_DIR}/VERSION.dep
)
-# Read value for a variable from VERSION.
+# Read value for a variable from MYSQL_VERSION.
MACRO(MYSQL_GET_CONFIG_VALUE keyword var)
IF(NOT $${var})
- FILE (STRINGS $${CMAKE_SOURCE_DIR}/VERSION str REGEX "^[ ]*$${keyword}=")
+ FILE (STRINGS $${CMAKE_SOURCE_DIR}/MYSQL_VERSION str REGEX "^[ ]*$${keyword}=")
IF(str)
STRING(REPLACE "$${keyword}=" "" str $${str})
STRING(REGEX REPLACE "[ ].*" "" str "$${str}")
@@ -59,7 +59,7 @@ MACRO(GET_MYSQL_VERSION)
IF(NOT DEFINED MAJOR_VERSION OR
NOT DEFINED MINOR_VERSION OR
NOT DEFINED PATCH_VERSION)
- MESSAGE(FATAL_ERROR "VERSION file cannot be parsed.")
+ MESSAGE(FATAL_ERROR "MYSQL_VERSION file cannot be parsed.")
ENDIF()
SET(VERSION
@@ -80,7 +80,7 @@ MACRO(GET_MYSQL_VERSION)
SET(CPACK_PACKAGE_VERSION_PATCH $${PATCH_VERSION})
IF(WITH_NDBCLUSTER)
- # Read MySQL Cluster version values from VERSION, these are optional
+ # Read MySQL Cluster version values from MYSQL_VERSION, these are optional
# as by default MySQL Cluster is using the MySQL Server version
MYSQL_GET_CONFIG_VALUE("MYSQL_CLUSTER_VERSION_MAJOR" CLUSTER_MAJOR_VERSION)
MYSQL_GET_CONFIG_VALUE("MYSQL_CLUSTER_VERSION_MINOR" CLUSTER_MINOR_VERSION)
@@ -89,12 +89,12 @@ MACRO(GET_MYSQL_VERSION)
# Set MySQL Cluster version same as the MySQL Server version
# unless a specific MySQL Cluster version has been specified
- # in the VERSION file. This is the version used when creating
+ # in the MYSQL_VERSION file. This is the version used when creating
# the cluster package names as well as by all the NDB binaries.
IF(DEFINED CLUSTER_MAJOR_VERSION AND
DEFINED CLUSTER_MINOR_VERSION AND
DEFINED CLUSTER_PATCH_VERSION)
- # Set MySQL Cluster version to the specific version defined in VERSION
+ # Set MySQL Cluster version to the specific version defined in MYSQL_VERSION
SET(MYSQL_CLUSTER_VERSION "$${CLUSTER_MAJOR_VERSION}")
SET(MYSQL_CLUSTER_VERSION
"$${MYSQL_CLUSTER_VERSION}.$${CLUSTER_MINOR_VERSION}")
@@ -106,7 +106,7 @@ MACRO(GET_MYSQL_VERSION)
ENDIF()
ELSE()
# Set MySQL Cluster version to the same as MySQL Server, possibly
- # overriding the extra version with value specified in VERSION
+ # overriding the extra version with value specified in MYSQL_VERSION
# This might be used when MySQL Cluster is still released as DMR
# while MySQL Server is already GA.
SET(MYSQL_CLUSTER_VERSION
diff --git a/plugin/galaxy/CMakeLists.txt b/plugin/galaxy/CMakeLists.txt.bak
similarity index 100%
rename from plugin/galaxy/CMakeLists.txt
rename to plugin/galaxy/CMakeLists.txt.bak
diff --git a/plugin/performance_point/CMakeLists.txt b/plugin/performance_point/CMakeLists.txt.bak
similarity index 100%
rename from plugin/performance_point/CMakeLists.txt
rename to plugin/performance_point/CMakeLists.txt.bak
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 9fe6d12d..eea38fa7 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -869,6 +869,8 @@ bool opt_large_files = sizeof(my_off_t) > 4;
static bool opt_autocommit; ///< for --autocommit command-line option
static get_opt_arg_source source_autocommit;
+
+bool opt_performance_point_enabled = false;
/*
Used with --help for detailed option
*/
diff --git a/sql/package/package_cache.cc b/sql/package/package_cache.cc
index 8a81734e..30ec6a08 100644
--- a/sql/package/package_cache.cc
+++ b/sql/package/package_cache.cc
@@ -76,7 +76,7 @@ static const T *find_package_element(const std::string &schema_name,
return Package::instance()->lookup_element<T>(schema_name, element_name);
}
/* Template instantiation */
-template static const Proc *find_package_element(
+template const Proc *find_package_element(
const std::string &schema_name, const std::string &element_name);
/**
endef
export VERSION_PATCH