-
Notifications
You must be signed in to change notification settings - Fork 500
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
set the SLOW_LOG_FILE in the startup script #307
set the SLOW_LOG_FILE in the startup script #307
Conversation
#295 set this in go code. |
Thank you for your guidance @gregwebs ! |
/run-e2e-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-e2e-tests |
@@ -34,6 +34,7 @@ then | |||
ARGS="${ARGS} --enable-binlog=true" | |||
fi | |||
|
|||
SLOW_LOG_FILE=${SLOW_LOG_FILE:-""} | |||
if [[ ! -z "${SLOW_LOG_FILE}" ]] | |||
then | |||
ARGS="${ARGS} --log-slow-query=${SLOW_LOG_FILE:-}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to have ${SLOW_LOG_FILE:-}
after setting it on line 37 and checking it on line 38?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On line 38 it will be undefined. The purpose of line 37 is just to define it and set a default value if it is not defined. It is a little verbose and obscure as bash is, but I think this idiom is easy to get used to and understand whereas the other ones are trickier. And overall it is much safer to use these techniques and have undefined variables be an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, so I think you are more directly asking about :-
. That allows for the variable to be unset and not throw an undefined variable error.
${parameter:-word}
If parameter is unset or null, the expansion of word is substituted.
Otherwise, the value of parameter is substituted.
* .github: add workflow to auto assign to projects * Update assign-to-project.yml
Relying on go code to set an env variable is brittle, at least brittle enough that I ran into this. We can make sure it is set in the script itself.
Bash is painful, this is my standard technique for making sure variables are set to a default.
@aylei
I tested this as fixing the issue.