diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-03-19 23:06:59 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-03-23 00:55:19 +0100 |
commit | ccd5c9c64e17f33bec73f8dbee8f17cbc8a8f09d (patch) | |
tree | 9946797cfa30dae68c335c4f4b34581816d329b5 /client | |
parent | a15ab358fc1ea75634de266fa8150b3e89ac5593 (diff) | |
download | mariadb-git-ccd5c9c64e17f33bec73f8dbee8f17cbc8a8f09d.tar.gz |
mysql: don't prepare strings if they won't be used
in particular, don't call server_version_string() unnecessary,
because it runs 'SELECT @@version_comment' and this might block
under certain galera settings (wsrep_sync_wait).
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 0b8be00c542..2cbb6ae25dd 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1225,15 +1225,17 @@ int main(int argc,char *argv[]) window_resize(0); #endif - put_info("Welcome to the MariaDB monitor. Commands end with ; or \\g.", - INFO_INFO); - my_snprintf((char*) glob_buffer.ptr(), glob_buffer.alloced_length(), - "Your %s connection id is %lu\nServer version: %s\n", - mysql_get_server_name(&mysql), - mysql_thread_id(&mysql), server_version_string(&mysql)); - put_info((char*) glob_buffer.ptr(),INFO_INFO); - - put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO); + if (!status.batch) + { + put_info("Welcome to the MariaDB monitor. Commands end with ; or \\g.", + INFO_INFO); + my_snprintf((char*) glob_buffer.ptr(), glob_buffer.alloced_length(), + "Your %s connection id is %lu\nServer version: %s\n", + mysql_get_server_name(&mysql), + mysql_thread_id(&mysql), server_version_string(&mysql)); + put_info((char*) glob_buffer.ptr(),INFO_INFO); + put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO); + } #ifdef HAVE_READLINE initialize_readline((char*) my_progname); |