-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[MDEV-14978] Client programs to use $MARIADB_HOST consistently #2556
Open
oceanli-hub
wants to merge
1
commit into
MariaDB:11.5
Choose a base branch
from
oceanli-hub:11.0
base: 11.5
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
[MDEV-14978] Client programs to use $MARIADB_HOST consistently
Only `mysql` client program was using $MYSQL_HOST as the default host. Add the same feature in most other client programs but using $MARIADB_HOST instead. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
- Loading branch information
commit c607c9ddcd4617fcbc5a6dc5eaf2abde2fe6d8d2
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
!include include/default_my.cnf | ||
|
||
[ENV] | ||
MARIADB_HOST=localhost | ||
MYSQL_HOST=some_server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
USE test; | ||
CREATE TABLE pet (name VARCHAR(20)); | ||
localhost | ||
**************** | ||
nonexistent-server | ||
Done | ||
DROP TABLE pet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
-- source include/have_log_bin.inc | ||
|
||
# Set up environment varibles for client programs | ||
# The environment variables for client programs have default options file | ||
# They interfere with the MTR test so I am creating new variables for them | ||
|
||
--let MARIADB = $MYSQL_BINDIR/client//mariadb | ||
--let MARIADBADMIN = $MYSQL_BINDIR/client//mariadb-admin | ||
--let MARIADBBINLOG = $MYSQL_BINDIR/client//mariadb-binlog | ||
--let MARIADBCHECK = $MYSQL_BINDIR/client//mariadb-check | ||
--let MARIADBDUMP = $MYSQL_BINDIR/client//mariadb-dump | ||
--let MARIADBIMPORT = $MYSQL_BINDIR/client//mariadb-import | ||
--let MARIADBSHOW = $MYSQL_BINDIR/client//mariadb-show | ||
--let MARIADBSLAP = $MYSQL_BINDIR/client//mariadb-slap | ||
|
||
# Creating a table for the client programs | ||
USE test; | ||
CREATE TABLE pet (name VARCHAR(20)); | ||
|
||
# Creating a data file for mysqlimport | ||
write_file $MYSQL_TMP_DIR/pet; | ||
buster | ||
bob | ||
EOF | ||
|
||
# Options for client program | ||
--let $options = --user=root --port=$MASTER_MYPORT --disable-ssl-verify-server-cert | ||
|
||
# Check to see if environment variable is defined | ||
# MARIADB_HOST is defined in client-env-variable.cnf | ||
--echo $MARIADB_HOST | ||
|
||
# Positive test for client program with MARIADB_HOST | ||
--exec $MARIADB $options -e "SHOW DATABASES;" > /dev/null 2>&1 | ||
--exec $MARIADBADMIN $options processlist > /dev/null 2>&1 | ||
--exec $MARIADBBINLOG $options --read-from-remote-server master-bin.000001 > /dev/null 2>&1 | ||
--exec $MARIADBCHECK $options -c --databases test > /dev/null 2>&1 | ||
--exec $MARIADBDUMP $options test > $MYSQL_TMP_DIR/tmp.sql > /dev/null 2>&1 | ||
--exec $MARIADBIMPORT $options test --local $MYSQL_TMP_DIR/pet > /dev/null 2>&1 | ||
--exec $MARIADBSHOW $options test > /dev/null 2>&1 | ||
--exec $MARIADBSLAP $options > /dev/null 2>&1 | ||
|
||
#Set up negative test with invalid server | ||
--echo **************** | ||
--let MARIADB_HOST=nonexistent-server | ||
--echo $MARIADB_HOST | ||
|
||
# Now run the same command as in the postive test case | ||
# Client programs are expected to fail since the server does not exist | ||
# Some client program fails with error 1 and some fails wtih error 2 | ||
|
||
--error 1 | ||
--exec $MARIADB $options -e "SHOW DATABASES;" > /dev/null 2>&1 | ||
|
||
--error 1 | ||
--exec $MARIADBADMIN $options processlist > /dev/null 2>&1 | ||
|
||
--error 1 | ||
--exec $MARIADBBINLOG $options --read-from-remote-server master-bin.000001 > /dev/null 2>&1 | ||
|
||
--error 2 | ||
--exec $MARIADBCHECK $options -c --databases test > /dev/null 2>&1 | ||
|
||
--error 2 | ||
--exec $MARIADBDUMP $options test > $MYSQL_TMP_DIR/tmp.sql > /dev/null 2>&1 | ||
|
||
--error 1 | ||
--exec $MARIADBIMPORT $options test $MYSQL_TMP_DIR/pet > /dev/null 2>&1 | ||
|
||
--error 1 | ||
--exec $MARIADBSLAP $options > /dev/null 2>&1 | ||
|
||
# Run the same command but with '--host' to verify command line input overrides env variable | ||
--exec $MARIADB $options --host localhost -e "SHOW DATABASES;" > /dev/null 2>&1 | ||
--exec $MARIADBADMIN $options --host localhost processlist > /dev/null 2>&1 | ||
--exec $MARIADBBINLOG $options --host localhost --read-from-remote-server master-bin.000001 > /dev/null 2>&1 | ||
--exec $MARIADBCHECK $options --host localhost -c --databases test > /dev/null 2>&1 | ||
--exec $MARIADBDUMP $options --host localhost test > $MYSQL_TMP_DIR/tmp.sql > /dev/null 2>&1 | ||
--exec $MARIADBIMPORT $options --host localhost test --local $MYSQL_TMP_DIR/pet > /dev/null 2>&1 | ||
--exec $MARIADBSHOW $options --host localhost test > /dev/null 2>&1 | ||
--exec $MARIADBSLAP $options --host localhost > /dev/null 2>&1 | ||
|
||
# Clean up | ||
--echo Done | ||
grooverdan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
DROP TABLE pet; | ||
--remove_file $MYSQL_TMP_DIR/tmp.sql | ||
--remove_file $MYSQL_TMP_DIR/pet |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Are there positive test examples using
MYSQL_HOSTMARIADB_HOST
maybe with--protocol tcp
?