-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix:CI #3199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix:CI #3199
Changes from all commits
e5bab9f
07e43d6
fa09ec8
192207f
592eb8d
c245ae7
8d24ea0
fb85736
7a18d22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,10 +1,25 @@ | ||||||
| #!/bin/bash | ||||||
|
|
||||||
| #pkill -9 pika | ||||||
| #pkill -9 codis | ||||||
| #rm -rf /tmp/codis | ||||||
| #rm -rf codis_data_1 | ||||||
| #rm -rf codis_data_2 | ||||||
| # Clean up processes and temporary files | ||||||
| pkill -9 pika || true | ||||||
| pkill -9 codis || true | ||||||
| # Wait for processes to fully terminate and release resources | ||||||
| sleep 5 | ||||||
| rm -rf /tmp/codis || true | ||||||
| rm -rf codis_data_1 || true | ||||||
| rm -rf codis_data_2 || true | ||||||
|
|
||||||
| # Clean up log directory in codis to free space, but keep bin directory | ||||||
| # to preserve existing codis binaries | ||||||
| rm -rf ../codis/log || true | ||||||
| mkdir -p ../codis/bin | ||||||
| mkdir -p ../codis/log | ||||||
|
|
||||||
| # Display memory usage for monitoring | ||||||
| free -h || true | ||||||
|
|
||||||
| # Display available disk space | ||||||
| df -h | ||||||
|
|
||||||
| CODIS_DASHBOARD_ADDR=127.0.0.1:18080 | ||||||
|
|
||||||
|
|
@@ -21,15 +36,47 @@ mkdir codis_data_1 | |||||
| mkdir codis_data_2 | ||||||
|
|
||||||
| # Example Change the location for storing data on primary and secondary nodes in the configuration file | ||||||
| sed -i '' -e 's|databases : 1|databases : 2|' -e 's|port : 9221|port : 8000|' -e 's|log-path : ./log/|log-path : ./codis_data_1/log/|' -e 's|db-path : ./db/|db-path : ./codis_data_1/db/|' -e 's|dump-path : ./dump/|dump-path : ./codis_data_1/dump/|' -e 's|pidfile : ./pika.pid|pidfile : ./codis_data_1/pika.pid|' -e 's|db-sync-path : ./dbsync/|db-sync-path : ./codis_data_1/dbsync/|' -e 's|#daemonize : yes|daemonize : yes|' ./pika_8000.conf | ||||||
| sed -i '' -e 's|databases : 1|databases : 2|' -e 's|port : 9221|port : 8001|' -e 's|log-path : ./log/|log-path : ./codis_data_2/log/|' -e 's|db-path : ./db/|db-path : ./codis_data_2/db/|' -e 's|dump-path : ./dump/|dump-path : ./codis_data_2/dump/|' -e 's|pidfile : ./pika.pid|pidfile : ./codis_data_2/pika.pid|' -e 's|db-sync-path : ./dbsync/|db-sync-path : ./codis_data_2/dbsync/|' -e 's|#daemonize : yes|daemonize : yes|' ./pika_8001.conf | ||||||
| # Start three nodes | ||||||
| # Reduce memory usage for CI environment | ||||||
| sed -i.bak \ | ||||||
| -e 's|databases : 1|databases : 2|' \ | ||||||
| -e 's|port : 9221|port : 8000|' \ | ||||||
| -e 's|log-path : ./log/|log-path : ./codis_data_1/log/|' \ | ||||||
| -e 's|db-path : ./db/|db-path : ./codis_data_1/db/|' \ | ||||||
| -e 's|dump-path : ./dump/|dump-path : ./codis_data_1/dump/|' \ | ||||||
| -e 's|pidfile : ./pika.pid|pidfile : ./codis_data_1/pika.pid|' \ | ||||||
| -e 's|db-sync-path : ./dbsync/|db-sync-path : ./codis_data_1/dbsync/|' \ | ||||||
| -e 's|#daemonize : yes|daemonize : yes|' \ | ||||||
| -e 's|cache-maxmemory : 10737418240|cache-maxmemory : 268435456|' \ | ||||||
| -e 's|max-write-buffer-size : 10737418240|max-write-buffer-size : 268435456|' \ | ||||||
| -e 's|write-buffer-size : 256M|write-buffer-size : 64M|' \ | ||||||
| ./pika_8000.conf | ||||||
|
Comment on lines
+40
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clean up sed backup files to prevent CI disk waste. Both sed commands use sed -i.bak \
-e 's|databases : 1|databases : 2|' \
-e 's|port : 9221|port : 8000|' \
-e 's|log-path : ./log/|log-path : ./codis_data_1/log/|' \
-e 's|db-path : ./db/|db-path : ./codis_data_1/db/|' \
-e 's|dump-path : ./dump/|dump-path : ./codis_data_1/dump/|' \
-e 's|pidfile : ./pika.pid|pidfile : ./codis_data_1/pika.pid|' \
-e 's|db-sync-path : ./dbsync/|db-sync-path : ./codis_data_1/dbsync/|' \
-e 's|#daemonize : yes|daemonize : yes|' \
-e 's|cache-maxmemory : 10737418240|cache-maxmemory : 268435456|' \
-e 's|max-write-buffer-size : 10737418240|max-write-buffer-size : 268435456|' \
-e 's|write-buffer-size : 256M|write-buffer-size : 64M|' \
./pika_8000.conf
+rm -f ./pika_8000.conf.bak
sed -i.bak \
-e 's|databases : 1|databases : 2|' \
-e 's|port : 9221|port : 8001|' \
-e 's|log-path : ./log/|log-path : ./codis_data_2/log/|' \
-e 's|db-path : ./db/|db-path : ./codis_data_2/db/|' \
-e 's|dump-path : ./dump/|dump-path : ./codis_data_2/dump/|' \
-e 's|pidfile : ./pika.pid|pidfile : ./codis_data_2/pika.pid|' \
-e 's|db-sync-path : ./dbsync/|db-sync-path : ./codis_data_2/dbsync/|' \
-e 's|#daemonize : yes|daemonize : yes|' \
-e 's|cache-maxmemory : 10737418240|cache-maxmemory : 268435456|' \
-e 's|max-write-buffer-size : 10737418240|max-write-buffer-size : 268435456|' \
-e 's|write-buffer-size : 256M|write-buffer-size : 64M|' \
./pika_8001.conf
+rm -f ./pika_8001.conf.bakAlternatively, if the original config files do not need to be preserved, use Also applies to: 54-66 🤖 Prompt for AI Agents |
||||||
|
|
||||||
| sed -i.bak \ | ||||||
| -e 's|databases : 1|databases : 2|' \ | ||||||
| -e 's|port : 9221|port : 8001|' \ | ||||||
| -e 's|log-path : ./log/|log-path : ./codis_data_2/log/|' \ | ||||||
| -e 's|db-path : ./db/|db-path : ./codis_data_2/db/|' \ | ||||||
| -e 's|dump-path : ./dump/|dump-path : ./codis_data_2/dump/|' \ | ||||||
| -e 's|pidfile : ./pika.pid|pidfile : ./codis_data_2/pika.pid|' \ | ||||||
| -e 's|db-sync-path : ./dbsync/|db-sync-path : ./codis_data_2/dbsync/|' \ | ||||||
| -e 's|#daemonize : yes|daemonize : yes|' \ | ||||||
| -e 's|cache-maxmemory : 10737418240|cache-maxmemory : 268435456|' \ | ||||||
| -e 's|max-write-buffer-size : 10737418240|max-write-buffer-size : 268435456|' \ | ||||||
| -e 's|write-buffer-size : 256M|write-buffer-size : 64M|' \ | ||||||
| ./pika_8001.conf | ||||||
|
|
||||||
| # Start instances one by one with time to initialize | ||||||
| ./pika -c ./pika_8000.conf | ||||||
| sleep 5 | ||||||
| ./pika -c ./pika_8001.conf | ||||||
| #ensure both master and slave are ready | ||||||
| sleep 10 | ||||||
|
|
||||||
| # Display memory usage after starting pika instances | ||||||
| free -h || true | ||||||
|
|
||||||
| cd ../codis | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling to If the directory change fails, subsequent commands will execute in the wrong location, causing silent failures. Add error handling to exit or return on failure. -cd ../codis
+cd ../codis || exit 1📝 Committable suggestion
Suggested change
🧰 Tools🪛 Shellcheck (0.11.0)[warning] 56-56: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. (SC2164) 🤖 Prompt for AI Agents |
||||||
| echo "Building codis..." | ||||||
| make | ||||||
|
|
||||||
| echo 'startup codis dashboard and codis proxy' | ||||||
|
|
@@ -55,6 +102,3 @@ echo 'resync all groups' | |||||
|
|
||||||
| #ensure codis are ready | ||||||
| sleep 10 | ||||||
|
|
||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.