-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
1 parent
d20a96f
commit 645b308
Showing
9 changed files
with
121 additions
and
15 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
USE test; | ||
CREATE TABLE pet (name VARCHAR(20)); | ||
**************** | ||
# Setting MARIADB_HOST environment variable | ||
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,76 @@ | ||
-- 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 MYSQLADMIN = $MYSQL_BINDIR/client//mariadb-admin | ||
--let MYSQLBINLOG = $MYSQL_BINDIR/client//mariadb-binlog | ||
--let MYSQLCHECK = $MYSQL_BINDIR/client//mariadb-check | ||
--let MYSQLDUMP = $MYSQL_BINDIR/client//mariadb-dump | ||
--let MYSQLIMPORT = $MYSQL_BINDIR/client//mariadb-import | ||
--let MYSQLSHOW = $MYSQL_BINDIR/client//mariadb-show | ||
--let MYSQLSLAP = $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=16000 --socket=$MYSQL_TMP_DIR/mysqld.1.sock | ||
|
||
# Run client programs using the default `localhost` | ||
--exec $MYSQLADMIN $options processlist > /dev/null 2>&1 | ||
--exec $MYSQLBINLOG $options --read-from-remote-server master-bin.000001 > /dev/null 2>&1 | ||
--exec $MYSQLCHECK $options -c --databases test > /dev/null 2>&1 | ||
--exec $MYSQLDUMP $options test > $MYSQL_TMP_DIR/tmp.sql > /dev/null 2>&1 | ||
--exec $MYSQLIMPORT $options test --local $MYSQL_TMP_DIR/pet > /dev/null 2>&1 | ||
--exec $MYSQLSHOW $options test > /dev/null 2>&1 | ||
--exec $MYSQLSLAP $options > /dev/null 2>&1 | ||
|
||
--echo **************** | ||
--echo # Setting MARIADB_HOST environment variable | ||
--let MARIADB_HOST=nonexistent-server | ||
|
||
# Now run the same command as before with MARIADB_HOST environment variable | ||
# 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 $MYSQLADMIN $options processlist > /dev/null 2>&1 | ||
|
||
--error 1 | ||
--exec $MYSQLBINLOG $options --read-from-remote-server master-bin.000001 > /dev/null 2>&1 | ||
|
||
--error 2 | ||
--exec $MYSQLCHECK $options -c --databases test > /dev/null 2>&1 | ||
|
||
--error 2 | ||
--exec $MYSQLDUMP $options test > $MYSQL_TMP_DIR/tmp.sql > /dev/null 2>&1 | ||
|
||
--error 1 | ||
--exec $MYSQLIMPORT $options test $MYSQL_TMP_DIR/pet > /dev/null 2>&1 | ||
|
||
--error 1 | ||
--exec $MYSQLSLAP $options > /dev/null 2>&1 | ||
|
||
# Run the same command but with '--host' to verify command line input overrides env variable | ||
--exec $MYSQLADMIN $options --host localhost processlist > /dev/null 2>&1 | ||
--exec $MYSQLBINLOG $options --host localhost --read-from-remote-server master-bin.000001 > /dev/null 2>&1 | ||
--exec $MYSQLCHECK $options --host localhost -c --databases test > /dev/null 2>&1 | ||
--exec $MYSQLDUMP $options --host localhost test > $MYSQL_TMP_DIR/tmp.sql > /dev/null 2>&1 | ||
--exec $MYSQLIMPORT $options --host localhost test --local $MYSQL_TMP_DIR/pet > /dev/null 2>&1 | ||
--exec $MYSQLSHOW $options --host localhost test > /dev/null 2>&1 | ||
--exec $MYSQLSLAP $options --host localhost > /dev/null 2>&1 | ||
|
||
# Clean up | ||
--echo Done | ||
DROP TABLE pet; | ||
--exec rm $MYSQL_TMP_DIR/tmp.sql | ||
--exec rm $MYSQL_TMP_DIR/pet |