-
Notifications
You must be signed in to change notification settings - Fork 590
/
Makefile.toml
1439 lines (1216 loc) · 39.5 KB
/
Makefile.toml
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
extend = [
{ path = "src/risedevtool/grafana.toml" },
{ path = "src/risedevtool/prometheus.toml" },
{ path = "src/risedevtool/minio.toml" },
{ path = "src/risedevtool/tempo.toml" },
{ path = "src/risedevtool/gcloud-pubsub.toml" },
{ path = "src/risedevtool/redis.toml" },
{ path = "src/risedevtool/connector.toml" },
{ path = "src/risedevtool/risedev-components.toml" },
{ path = "src/sqlparser/sqlparser_test.toml" },
{ path = "src/frontend/planner_test/planner_test.toml" },
{ path = "src/tests/compaction_test/Makefile.toml" },
{ path = "src/storage/backup/integration_tests/Makefile.toml" },
{ path = "src/java_binding/make-java-binding.toml" },
{ path = "src/stream/tests/integration_tests/integration_test.toml" },
{ path = "e2e_test/source_inline/commands.toml" },
]
env_files = ["./risedev-components.user.env"]
env_scripts = [
'''
#!@duckscript
# only duckscript can modify env variables in cargo-make
# duckscript doc: https://github.com/sagiegurari/duckscript/blob/master/docs/sdk.md
set_env ENABLE_TELEMETRY "false"
set_env RW_TELEMETRY_TYPE "test"
set_env RW_SECRET_STORE_PRIVATE_KEY_HEX "0123456789abcdef"
set_env RW_TEMP_SECRET_FILE_DIR "${PREFIX_SECRET}"
is_sanitizer_enabled = get_env ENABLE_SANITIZER
is_hdfs_backend = get_env ENABLE_HDFS
is_release = get_env ENABLE_RELEASE_PROFILE
is_not_release = not ${is_release}
is_dynamic_linking = get_env ENABLE_DYNAMIC_LINKING
is_hummock_trace = get_env ENABLE_HUMMOCK_TRACE
is_external_udf_enabled = get_env ENABLE_EXTERNAL_UDF
is_wasm_udf_enabled = get_env ENABLE_WASM_UDF
is_js_udf_enabled = get_env ENABLE_JS_UDF
is_python_udf_enabled = get_env ENABLE_PYTHON_UDF
if ${is_sanitizer_enabled}
set_env RISEDEV_CARGO_BUILD_EXTRA_ARGS "--timings -Zbuild-std --target ${CARGO_MAKE_RUST_TARGET_TRIPLE}"
set_env RISEDEV_BUILD_TARGET_DIR "${CARGO_MAKE_RUST_TARGET_TRIPLE}/"
set_env RISEDEV_RUSTFLAGS "-Ctarget-cpu=native --cfg tokio_unstable -Zsanitizer=thread"
else
set_env RISEDEV_CARGO_BUILD_EXTRA_ARGS "--timings"
set_env RISEDEV_BUILD_TARGET_DIR ""
end
if ${is_hdfs_backend}
set_env BUILD_HDFS_BACKEND_CMD "-p risingwave_object_store --features hdfs-backend"
else
set_env BUILD_HDFS_BACKEND_CMD ""
end
if ${is_not_release} and ${is_dynamic_linking}
set_env RISINGWAVE_FEATURE_FLAGS "--features rw-dynamic-link --no-default-features"
else
set_env RISINGWAVE_FEATURE_FLAGS "--features rw-static-link"
end
if ${is_external_udf_enabled}
flags = get_env RISINGWAVE_FEATURE_FLAGS
set_env RISINGWAVE_FEATURE_FLAGS "${flags} --features external-udf"
end
if ${is_wasm_udf_enabled}
flags = get_env RISINGWAVE_FEATURE_FLAGS
set_env RISINGWAVE_FEATURE_FLAGS "${flags} --features wasm-udf"
end
if ${is_js_udf_enabled}
flags = get_env RISINGWAVE_FEATURE_FLAGS
set_env RISINGWAVE_FEATURE_FLAGS "${flags} --features js-udf"
end
if ${is_python_udf_enabled}
flags = get_env RISINGWAVE_FEATURE_FLAGS
set_env RISINGWAVE_FEATURE_FLAGS "${flags} --features python-udf"
end
if ${is_hummock_trace}
set_env BUILD_HUMMOCK_TRACE_CMD "-p risingwave_storage --features hm-trace"
else
set_env BUILD_HUMMOCK_TRACE_CMD ""
end
is_ci = get_env RISINGWAVE_CI
is_not_ci = not ${is_ci}
if ${is_not_ci}
query_log_path = get_env RW_QUERY_LOG_PATH
no_query_log_path = not ${query_log_path}
if ${no_query_log_path}
set_env RW_QUERY_LOG_PATH "${PREFIX_LOG}"
fi
rust_log = get_env RUST_LOG
no_rust_log = not ${rust_log}
if ${no_rust_log}
set_env RUST_LOG "pgwire_query_log=info"
else
set_env RUST_LOG "pgwire_query_log=info,${rust_log}"
end
end
set_env TMUX "tmux -L risedev"
''',
]
[config]
default_to_workspace = false
skip_core_tasks = true
skip_git_env_info = true
skip_rust_env_info = false
skip_crate_env_info = true
min_version = "0.37.1"
[tasks.clean-full]
category = "Misc"
description = "Clean all downloaded binaries and all data, config and logs by deleting .risingwave folder"
script = '''
#!@duckscript
rm -rf "${PREFIX}"
'''
[tasks.clean-data]
category = "RiseDev - Start/Stop"
description = "Clean all data, config and logs"
script = '''
#!@duckscript
rm -rf "${PREFIX_DATA}"
rm -rf "${PREFIX_LOG}"
rm -rf "${PREFIX_CONFIG}"
rm -rf "${PREFIX_PROFILING}"
rm -rf "${PREFIX_SECRET}"
'''
[tasks.reset-rw]
category = "RiseDev - Start/Stop"
description = "Clean all data in the default database dev of the running RisingWave"
dependencies = ["check-and-load-risedev-env-file"]
script = '''
#!/usr/bin/env bash
psql -h $RISEDEV_RW_FRONTEND_LISTEN_ADDRESS -p $RISEDEV_RW_FRONTEND_PORT -U root -d dev -c "CREATE DATABASE risedev_tmp;"
psql -h $RISEDEV_RW_FRONTEND_LISTEN_ADDRESS -p $RISEDEV_RW_FRONTEND_PORT -U root -d risedev_tmp -c "DROP DATABASE dev; CREATE DATABASE dev;"
psql -h $RISEDEV_RW_FRONTEND_LISTEN_ADDRESS -p $RISEDEV_RW_FRONTEND_PORT -U root -d dev -c "DROP DATABASE risedev_tmp;"
'''
[tasks.l]
alias = "logs"
[tasks.logs]
category = "RiseDev - Start/Stop"
description = "Open logs with VSCode or dump in console"
script = '''
#!/usr/bin/env bash
code "${PREFIX_LOG}" 2> /dev/null
if [[ $? -eq 0 ]]; then
exit 0
fi
for out_file in ${PREFIX_LOG}/*.log
do
echo "~~~ Dump log file $out_file"
echo ""
cat "$out_file" | tail -n 300
done
echo ""
echo ""
echo ""
'''
[tasks.ls]
category = "Misc"
description = "List all nodes in the cluster"
script = '''
#!/usr/bin/env bash
${TMUX} list-windows -t risedev | grep -v active | cut -d'(' -f1
'''
[tasks.lsw]
category = "Misc"
description = "List --watch all nodes in the cluster"
script = '''
#!/usr/bin/env bash
watch -n 1 "${TMUX} list-windows -t risedev | grep -v active | cut -d'(' -f1"
'''
[tasks.del]
alias = "delete"
[tasks.delete]
category = "RiseDev - Start/Stop"
description = "Delete a node in the cluster"
script = '''
#!/usr/bin/env bash
risedev_ls () {
${TMUX} list-windows -t risedev | grep -v active | cut -d'(' -f1
}
err () {
echo "Available nodes are"
risedev_ls
exit 1
}
if [[ -z "$1" ]]; then
echo "Please pass a parameter to this script, defining which node you want to delete"
err
fi
if [[ -z $(risedev_ls | grep "$1" ) ]]; then
echo "Please select a node that is currently running"
err
fi
${TMUX} kill-window -t $1
'''
[tasks.f]
alias = "follow"
[tasks.follow]
category = "Misc"
description = "Follows the end of the logs of a specific component"
script = '''
#!/usr/bin/env bash
set -e
if [[ -z "$1" ]]; then
echo "Please pass a parameter to this script, defining which logs you want to follow"
echo "Available logs are..."
ls ${PREFIX_LOG}
exit 1
fi
if [[ ! -f ${PREFIX_LOG}/$1 ]]; then
echo "selected file does not exist"
echo "Available logs are..."
ls ${PREFIX_LOG}
exit 1
fi
tail -f -n 5 ${PREFIX_LOG}/$1
'''
[tasks.check-logs]
private = true
category = "RiseDev - CI"
description = "Check if there is panic in log or significant log size issue"
script = '''
#!/usr/bin/env bash
set -e
echo "~~~ Check logs"
du -ah ${PREFIX_LOG}
for out_file in ${PREFIX_LOG}/*.log
do
if grep "panicked at" "$out_file" -C 100; then
echo "$(tput setaf 1)\"panicked at\" found in $out_file$(tput sgr0), please check if there's any bugs in this PR."
echo "You may find \"risedev-logs\" artifacts and download logs after all workflows finish."
exit 1
fi
done
if (( "$(du -sk ${PREFIX_LOG} | cut -f1)" > 4000 )) ; then
echo "$(tput setaf 1)ERROR: log size is significantly large ($(du -sh ${PREFIX_LOG} | cut -f1)).$(tput sgr0) Please disable unnecessary logs."
exit 1
fi
'''
[tasks.doc]
category = "Misc"
description = "Open rustdoc for risingwave"
dependencies = ["build-docs"]
script = '''
#!/usr/bin/env bash
set -e
python -mwebbrowser file://$(pwd)/target/doc/index.html
'''
[tasks.link-all-in-one-binaries]
private = true
category = "RiseDev - Build"
description = "Link all-in-one cmds to RiseDev bin"
script = '''
#!/usr/bin/env bash
set -e
rm -rf "${PREFIX_BIN}/risingwave"
mkdir -p "${PREFIX_BIN}/risingwave"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/meta-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/compute-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/frontend-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/compactor"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/risectl"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/playground"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/standalone"
'''
[tasks.codesign-playground]
private = true
category = "RiseDev - Build"
description = "Codesign playground binary to support coredump"
# If core dump is enabled by RiseDev and we're on an Apple Silicon platform,
# codesign the binary before running.
# https://developer.apple.com/forums/thread/694233?answerId=695943022#695943022
condition = { env_set = [
"ENABLE_COREDUMP",
], env = { "SYSTEM" = "darwin-arm64" } }
script = '''
#!/usr/bin/env bash
set -ex
codesign -s - -f --entitlements scripts/coredump/coredump.entitlements "target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave"
'''
[tasks.codesign-binaries]
private = true
category = "RiseDev - Build"
description = "Codesign all binaries to support coredump"
# If core dump is enabled by RiseDev and we're on an Apple Silicon platform,
# codesign the binary before running.
# https://developer.apple.com/forums/thread/694233?answerId=695943022#695943022
condition = { env_set = [
"ENABLE_COREDUMP",
], env = { "SYSTEM" = "darwin-arm64" } }
script = '''
#!/usr/bin/env bash
set -e
binaries=("risingwave")
set -ex
echo -n "${binaries[*]}" | parallel -d ' ' \
"codesign -s - -f --entitlements scripts/coredump/coredump.entitlements \"target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/{}\""
'''
[tasks.link-user-bin]
private = true
category = "RiseDev - Build"
description = "Link all binaries to .bin"
script = '''
#!/usr/bin/env bash
set -e
rm -rf "${PREFIX_USR_BIN}"
mkdir -p "${PREFIX_USR_BIN}"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_USR_BIN}/meta-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_USR_BIN}/compute-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_USR_BIN}/frontend-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_USR_BIN}/risectl"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_USR_BIN}/playground"
'''
[tasks.post-build-risingwave]
category = "RiseDev - Build"
description = "Copy RisingWave binaries to bin"
condition = { env_set = ["ENABLE_BUILD_RUST"] }
dependencies = [
"link-all-in-one-binaries",
"link-user-bin",
"codesign-binaries",
]
[tasks.b]
alias = "build-risingwave"
[tasks.build]
alias = "build-risingwave"
[tasks.build-risingwave]
category = "RiseDev - Build"
description = "Build Rust components"
condition = { env_true = ["ENABLE_BUILD_RUST"] }
script = '''
#!/usr/bin/env bash
set -e
echo "$(tput setaf 4)$(tput bold)[Reminder]$(tput sgr0) risedev will only build $(tput setaf 4)risingwave_cmd(_all) and risedev$(tput sgr0) crates."
[[ -z "${RISEDEV_RUSTFLAGS}" ]] || export RUSTFLAGS="${RISEDEV_RUSTFLAGS}"
echo + RUSTFLAGS="${RUSTFLAGS:-<not set>}"
set -xe
cargo build -p risedev
cargo build -p risingwave_cmd_all ${BUILD_HDFS_BACKEND_CMD}\
${BUILD_HUMMOCK_TRACE_CMD}\
--profile "${RISINGWAVE_BUILD_PROFILE}" \
${RISINGWAVE_FEATURE_FLAGS} \
${RISEDEV_CARGO_BUILD_EXTRA_ARGS}
'''
[tasks.build-risingwave-playground]
category = "RiseDev - Build"
description = "Build RisingWave playground"
condition = { env_true = ["ENABLE_BUILD_RUST"] }
script = '''
#!/usr/bin/env bash
set -e
[[ -z "${RISEDEV_RUSTFLAGS}" ]] || export RUSTFLAGS="${RISEDEV_RUSTFLAGS}"
echo + RUSTFLAGS="${RUSTFLAGS:-<not set>}"
set -xe
cargo build -p risingwave_cmd_all \
--profile "${RISINGWAVE_BUILD_PROFILE}" \
${RISINGWAVE_FEATURE_FLAGS} \
${RISEDEV_CARGO_BUILD_EXTRA_ARGS}
'''
[tasks.clean]
private = true
category = "RiseDev - Build"
description = "Clean all build targets"
dependencies = ["clean-rust", "clean-java"]
[tasks.clean-rust]
private = true
category = "RiseDev - Build"
description = "Clean Rust targets"
condition = { env_set = ["ENABLE_BUILD_RUST"] }
script = '''
#!/usr/bin/env bash
set -e
cargo clean
'''
[tasks.clean-java]
private = true
category = "RiseDev - Build"
description = "Clean Rust targets"
condition = { env_set = ["ENABLE_RW_CONNECTOR", "ENABLE_BUILD_RW_CONNECTOR"] }
script = '''
#!/usr/bin/env bash
set -e
if command -v mvn &> /dev/null; then
MAVEN_PATH="$(command -v mvn)"
else
MAVEN_PATH="${PREFIX_BIN}/maven/bin/mvn"
fi
cd "${JAVA_DIR}"
"${MAVEN_PATH}" clean
'''
[tasks.build-docs]
private = true
category = "RiseDev - Build"
description = "Build Rust docs"
condition = { env_set = ["ENABLE_BUILD_RUST"] }
env = { RUSTDOCFLAGS = "--markdown-css ../../docs/rustdoc/rust.css --markdown-no-toc --index-page docs/rustdoc/index.md -Zunstable-options" }
script = '''
#!/usr/bin/env bash
set -e
cargo doc --workspace --no-deps --document-private-items
'''
[tasks.prepare-config]
private = true
category = "RiseDev - Prepare"
description = "Copy necessary configuration files to RiseDev"
script = '''
#!/usr/bin/env bash
set -e
echo > "${PREFIX_CONFIG}/risingwave.toml"
cp "src/risedevtool/run_command.sh" "${PREFIX_BIN}/run_command.sh"
cp "src/risedevtool/welcome.sh" "${PREFIX_BIN}/welcome.sh"
'''
[tasks.download-all]
private = true
category = "Misc"
description = "Download all available components at once"
dependencies = [
"download-maven",
"download-grafana",
"download-tempo",
"download-mcli",
"download-minio",
"download-prometheus",
"download-pubsub",
"download-redis",
]
[tasks.create-user-profiles-file]
private = true
category = "RiseDev - Prepare"
description = "Create user profiles file if not exists"
condition = { files_not_exist = [
"${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/risedev-profiles.user.yml",
] }
script = '''
#!/usr/bin/env bash
set -e
cat <<\EOF > "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/risedev-profiles.user.yml"
# This file is used to store extra profiles besides the ones defined in `risedev.yml`.
# It is automatically created by RiseDev.
#
# To use this:
# - add new profiles just like the ones defined under the `profile` section in `risedev.yml`
# - develop the cluster with the new profiles by `./risedev dev <new-profile-name>`
my-default-example:
config-path: src/config/my_config.toml
steps:
- use: meta-node
- use: compute-node
- use: frontend
EOF
'''
[tasks.pre-start-dev]
category = "RiseDev - Prepare"
description = "Prepare dev cluster by downloading necessary tools and build required components"
dependencies = [
"create-user-profiles-file",
"download-all",
"build-risingwave",
"build-connector-node",
"post-build-risingwave",
"prepare-config",
]
[tasks.pre-start-benchmark]
category = "RiseDev - Prepare"
description = "Download necessary tools to deploy a benchmark env"
dependencies = [
"download-minio",
"download-mcli",
"download-grafana",
"download-prometheus",
"download-tempo",
"download-redis",
]
[tasks.pre-start-playground]
category = "RiseDev - Prepare"
description = "Preparation steps for playground"
dependencies = [
"build-risingwave-playground",
"codesign-playground",
"build-connector-node",
]
[tasks.check-risedev-env-file]
private = true
category = "RiseDev - Prepare"
description = "Check if risedev-env file exists"
script = '''
#!/usr/bin/env bash
set -euo pipefail
RC_ENV_FILE="${PREFIX_CONFIG}/risedev-env"
if [ ! -f "${RC_ENV_FILE}" ]; then
echo "risedev-env file not found at ${RC_ENV_FILE}. Did you start cluster using $(tput setaf 4)\`./risedev d\`$(tput sgr0) or $(tput setaf 4)\`./risedev p\`$(tput sgr0)?"
exit 1
fi
'''
[tasks.check-and-load-risedev-env-file]
private = true
category = "RiseDev - Prepare"
dependencies = ["check-risedev-env-file"]
env_files = ["${PREFIX_CONFIG}/risedev-env"]
[tasks.psql-env]
category = "RiseDev - Start/Stop"
description = "Dump env configuration for psql"
dependencies = ["check-and-load-risedev-env-file"]
script = '''
#!/usr/bin/env bash
cat <<EOF > "${PREFIX_CONFIG}/psql-env"
export PGHOST=$RISEDEV_RW_FRONTEND_LISTEN_ADDRESS
export PGPORT=$RISEDEV_RW_FRONTEND_PORT
export PGUSER=root
export PGDATABASE=dev
EOF
echo "psql environment file is created at ${PREFIX_CONFIG}/psql-env"
echo "You can source this file to use psql with default connection parameters."
echo " $(tput setaf 4)source ${PREFIX_CONFIG}/psql-env$(tput sgr0)"
'''
[tasks.psql]
category = "RiseDev - Start/Stop"
description = "Run local psql client with default connection parameters. You can pass extra arguments to psql."
dependencies = ["check-and-load-risedev-env-file"]
script = '''
#!/usr/bin/env bash
psql -h $RISEDEV_RW_FRONTEND_LISTEN_ADDRESS -p $RISEDEV_RW_FRONTEND_PORT -U root -d dev "$@"
'''
[tasks.ctl]
category = "RiseDev - Start/Stop"
description = "Start RiseCtl"
dependencies = ["check-and-load-risedev-env-file"]
script = '''
#!/usr/bin/env bash
cargo run -p risingwave_cmd_all --profile "${RISINGWAVE_BUILD_PROFILE}" -- ctl "$@"
test $? -eq 0 || exit 1
'''
[tasks.p]
alias = "playground"
[tasks.playground]
category = "RiseDev - Start/Stop"
description = "🌟 Start a lite RisingWave playground using risingwave all-in-one binary"
dependencies = ["pre-start-playground"]
script = '''
#!/usr/bin/env bash
set -e
if [[ $ENABLE_COREDUMP == "true" ]]; then
echo "+ ulimit -c unlimited"
ulimit -c unlimited
fi
set -x
target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave playground $@
'''
[tasks.standalone]
category = "RiseDev - Start/Stop"
description = "🌟 Start a RisingWave standalone instance"
dependencies = ["pre-start-playground"]
script = '''
#!/usr/bin/env bash
set -e
if [[ $ENABLE_COREDUMP == "true" ]]; then
echo "+ ulimit -c unlimited"
ulimit -c unlimited
fi
set -x
target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave standalone $@
'''
# TODO(kwannoel): Support `tasks.standalone-dev` as well.
# Then we can reuse risedev to start peripheral services, e.g. compactor, kafka, etc...
[tasks.standalone-demo-dev]
category = "RiseDev - Start/Stop"
description = "🌟 Start a RisingWave standalone demo."
dependencies = ["build"]
script = "./src/cmd_all/scripts/standalone-demo-dev.sh"
[tasks.standalone-demo-full]
category = "RiseDev - Start/Stop"
description = "🌟 Start a RisingWave standalone demo."
dependencies = ["build"]
script = "./src/cmd_all/scripts/standalone-demo-full.sh"
[tasks.d]
alias = "dev"
[tasks.dev]
category = "RiseDev - Start/Stop"
dependencies = ["pre-start-dev"]
description = "🌟 Start a full RisingWave dev cluster using risedev-dev"
script = '''
#!/usr/bin/env bash
set -e
if [[ $ENABLE_COREDUMP == "true" ]]; then
echo "+ ulimit -c unlimited"
ulimit -c unlimited
fi
set -x
target/debug/risedev-dev ${@}
'''
[tasks.kill-risedev]
category = "RiseDev - Start/Stop"
description = "Kill RisingWave dev cluster"
script = '''
#!/usr/bin/env bash
set -euo pipefail
if ! ${TMUX} ls &>/dev/null ; then
echo "No risedev cluster to kill. Exiting..."
exit 0
fi
# Kill tmux components with Ctrl+C
${TMUX} list-windows -F "#{window_name} #{pane_id}" \
| awk '{ print $2 }' \
| xargs -I {} ${TMUX} send-keys -t {} C-c
# Stop docker components
containers=$(docker ps -q -f name='risedev|risingwave'- 2>/dev/null) || true
if [[ -n ${containers} ]]; then
echo "Stopping docker components..."
docker stop ${containers}
fi
${TMUX} kill-server
test $? -eq 0 || { echo "Failed to stop all RiseDev components."; exit 1; }
'''
[tasks.kill]
alias = "kill-risedev"
[tasks.k]
alias = "kill-risedev"
[tasks.down]
category = "RiseDev - Start/Stop"
description = "Kill RisingWave dev cluster and clean the data"
dependencies = ["k", "clean-data"]
[tasks.install-nextest]
private = true
category = "RiseDev - Check"
install_crate = { min_version = "0.9.51", crate_name = "cargo-nextest", binary = "cargo", test_arg = [
"nextest",
"--help",
], install_command = "binstall" }
[tasks.install-llvm-cov]
private = true
category = "RiseDev - Check"
install_crate = { min_version = "0.5.17", crate_name = "cargo-llvm-cov", binary = "cargo", test_arg = [
"llvm-cov",
"--help",
], install_command = "binstall" }
[tasks.install-tools]
category = "RiseDev - Check"
script = """
#!/usr/bin/env bash
set -e
for tool in cargo-llvm-cov cargo-nextest cargo-hakari cargo-sort cargo-make cargo-udeps
do
echo "install: $(tput setaf 4)$tool$(tput sgr0)"
cargo binstall -y --locked --no-symlinks $tool
echo
done
# Tools that fallback to `cargo install` when using `cargo binstall`.
# We directly use `cargo install` here to be faster.
for tool in typos-cli sqllogictest-bin
do
echo "install: $(tput setaf 4)$tool$(tput sgr0)"
cargo install $tool --locked
echo
done
echo "check: $(tput setaf 4)${TMUX} >= v3.2a$(tput sgr0)"
${TMUX} -V || echo "$(tput setaf 3)tmux$(tput sgr0) not found."
echo
echo "check: $(tput setaf 4)psql >= 14$(tput sgr0)"
psql -V || echo "$(tput setaf 3)psql$(tput sgr0) not found."
echo
echo "check: $(tput setaf 4)cmake$(tput sgr0)"
cmake --version || echo "$(tput setaf 3)cmake$(tput sgr0) not found."
echo
echo "check: $(tput setaf 4)protoc >= 3.12.0$(tput sgr0)"
protoc --version || echo "$(tput setaf 3)protoc$(tput sgr0) not found."
echo
echo "check: $(tput setaf 4)parallel >= 2022XXXX$(tput sgr0)"
parallel --version || echo "$(tput setaf 3)parallel$(tput sgr0) not found."
echo
"""
description = "Install (or upgrade) required tools to do pre-CI check and run e2e tests"
[tasks.warn-on-missing-tools]
private = true
script = """
echo "If any command is not found, run $(tput setaf 4)./risedev install-tools$(tput sgr0) to install required tools."
"""
[tasks.test-cov]
category = "RiseDev - Test"
dependencies = ["install-llvm-cov", "install-nextest"]
script = """
#!/usr/bin/env bash
set -e
export CARGO_TARGET_DIR=target/coverage
cargo llvm-cov nextest --html --workspace --exclude risingwave_simulation
"""
description = "Run unit tests and report coverage"
[tasks.test]
category = "RiseDev - Test"
dependencies = ["install-nextest"]
script = """
#!/usr/bin/env bash
set -e
cargo nextest run --workspace --exclude risingwave_simulation "$@"
"""
description = "🌟 Run unit tests"
[tasks.build-connector-node]
category = "RiseDev - Build"
dependencies = ["prepare"]
condition = { env_set = [
"ENABLE_BUILD_RW_CONNECTOR",
], files_modified = { input = [
"./java/connector-node/**/*",
], output = [
"./java/connector-node/assembly/target/**/*",
] } }
description = "Build RisingWave Connector from source"
script = '''
#!/usr/bin/env bash
set -e
if command -v mvn &> /dev/null; then
MAVEN_PATH="$(command -v mvn)"
else
MAVEN_PATH="${PREFIX_BIN}/maven/bin/mvn"
fi
ARTIFACT="risingwave-connector-1.0.0.tar.gz"
TARGET_PATH="${JAVA_DIR}/connector-node/assembly/target/${ARTIFACT}"
echo "Building connector node..."
cd "${JAVA_DIR}"
"${MAVEN_PATH}" --batch-mode --update-snapshots package -Dmaven.test.skip -Dno-build-rust
rm -rf ${PREFIX_BIN}/connector-node
mkdir -p "${PREFIX_BIN}/connector-node"
tar xf ${TARGET_PATH} -C "${PREFIX_BIN}/connector-node"
'''
[tasks.sbuild]
category = "RiseDev - Build"
description = "Build in simulation mode"
dependencies = ["warn-on-missing-tools"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo build \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-p risingwave_batch \
-p risingwave_common \
-p risingwave_compute \
-p risingwave_connector \
-p risingwave_dml \
-p risingwave_frontend \
-p risingwave_meta \
-p risingwave_object_store \
-p risingwave_storage \
-p risingwave_stream \
-p pgwire \
"$@"
"""
[tasks.stest]
category = "RiseDev - Test - Deterministic Simulation"
description = "Run unit tests in deterministic simulation mode"
dependencies = ["install-nextest"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo nextest run \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-p risingwave_batch \
-p risingwave_common \
-p risingwave_compute \
-p risingwave_connector \
-p risingwave_dml \
-p risingwave_frontend \
-p risingwave_meta \
-p risingwave_object_store \
-p risingwave_storage \
-p risingwave_stream \
-p pgwire \
"$@"
"""
[tasks.sit-test]
category = "RiseDev - Test - Deterministic Simulation"
description = "Run integration tests in deterministic simulation mode"
dependencies = ["install-nextest"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo nextest run \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-p risingwave_simulation \
"$@"
"""
[tasks.sarchive-it-test]
category = "RiseDev - Test - Deterministic Simulation"
description = "Archive integration tests in deterministic simulation mode"
dependencies = ["install-nextest"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo nextest archive \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-p risingwave_simulation \
--archive-file simulation-it-test.tar.zst \
"$@"
"""
[tasks.scheck]
category = "RiseDev - Test - Deterministic Simulation"
description = "Run cargo check in deterministic simulation mode"
dependencies = ["warn-on-missing-tools"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo check \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-p risingwave_batch \
-p risingwave_common \
-p risingwave_compute \
-p risingwave_connector \
-p risingwave_dml \
-p risingwave_frontend \
-p risingwave_meta \
-p risingwave_object_store \
-p risingwave_storage \
-p risingwave_stream \
-p pgwire \
-p risingwave_simulation --tests "$@"
"""
[tasks.sslt]
category = "RiseDev - Test - Deterministic Simulation"
description = "Run e2e tests in deterministic simulation mode"
dependencies = ["warn-on-missing-tools"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo run \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-p risingwave_simulation "$@"
"""
[tasks.sslt-build-all]
category = "RiseDev - Test - Deterministic Simulation"
description = "Build deterministic simulation runner and tests"
dependencies = ["warn-on-missing-tools"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo build \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-p risingwave_simulation \
--tests "$@"
"""
[tasks.sslt-cov]
category = "RiseDev - Test - Deterministic Simulation"
description = "Run e2e tests in deterministic simulation mode and report code coverage"
dependencies = ["install-llvm-cov"]
env = { CARGO_TARGET_DIR = "target/sim-cov" }
script = """
#!/usr/bin/env bash
set -e