Skip to content
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

Optimized the active judgment command #2378

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hackersean
Copy link

@hackersean hackersean commented Feb 27, 2024

What problem does this PR solve?

when use GNU bash, version 5.2.21(1)-release (x86_64-redhat-linux-gnu) scale-out will be failed

- Reload prometheus -> 172.17.0.17:9090 ... Error
  - Reload grafana -> 172.17.0.17:3000 ... Done
Error: stdout: , stderr:Failed to connect to bus: No such file or directory
bash: -c: line 1: conditional binary operator expected
bash: -c: line 1: syntax error near `active'
bash: -c: line 1: `systemctl daemon-reload && if [[  == active ]]; then systemctl reload prometheus-9090.service; fi'
: executor.ssh.execute_failed: Failed to execute command over SSH for 'tidb@172.17.0.17:22' {ssh_stderr: Failed to connect to bus: No such file or directory
bash: -c: line 1: conditional binary operator expected
bash: -c: line 1: syntax error near `active'
bash: -c: line 1: `systemctl daemon-reload && if [[  == active ]]; then systemctl reload prometheus-9090.service; fi'
, ssh_stdout: , ssh_command: export LANG=C; PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin /usr/bin/sudo -H bash -c "systemctl daemon-reload && if [[ $(systemctl is-active prometheus-9090.service) == "active" ]]; then systemctl reload prometheus-9090.service; fi"}, cause: Process exited with status 2

Manual execution also generates an error

[tidb@d86d4890486f ~]$ sudo -H bash -c "systemctl daemon-reload && if [[ $(systemctl is-active prometheus-9090.service) == "active" ]]; then systemctl reload prometheus-9090.service; fi"
Failed to connect to bus: No such file or directory
bash: -c: line 1: conditional binary operator expected
bash: -c: line 1: syntax error near `active'
bash: -c: line 1: `systemctl daemon-reload && if [[  == active ]]; then systemctl reload prometheus-9090.service; fi'

What is changed and how it works?

Optimized shell statement

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release notes:

NONE

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

ti-chi-bot bot commented Feb 27, 2024

Welcome @hackersean! It looks like this is your first PR to pingcap/tiup 🎉

@ti-chi-bot ti-chi-bot bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 27, 2024
@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.60%. Comparing base (6f01692) to head (26915c6).
Report is 5 commits behind head on master.

❗ Current head 26915c6 differs from pull request most recent head 01de734. Consider uploading reports for the commit 01de734 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2378      +/-   ##
==========================================
- Coverage   55.96%   55.60%   -0.36%     
==========================================
  Files         329      329              
  Lines       35221    35025     -196     
==========================================
- Hits        19709    19474     -235     
- Misses      13141    13215      +74     
+ Partials     2371     2336      -35     
Flag Coverage Δ
cluster 45.09% <100.00%> (-0.15%) ⬇️
dm 25.51% <100.00%> (-<0.01%) ⬇️
playground 15.16% <0.00%> (-1.37%) ⬇️
tiup 33.60% <ø> (-0.04%) ⬇️
unittest 22.23% <ø> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AstroProfundis
Copy link
Contributor

This looks like an issue of systemd on the target server, maybe your systemd service is not in a normal state or maybe you are using a --user scope?

Copy link
Contributor

ti-chi-bot bot commented Apr 11, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kaaaaaaang for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants